2 Commits

Author SHA1 Message Date
92ad202bfe Add version to docker build (#301)
* add version to build.

* update docs.
2023-04-29 00:12:56 +02:00
cd4acb5eec lang url parameter (#296)
* lang url parameter

* add ?lang to readme.

---------

Co-authored-by: Miroslav Šedivý <sedivy.miro@gmail.com>
2023-04-22 01:24:23 +02:00
10 changed files with 47 additions and 26 deletions

View File

@ -27,7 +27,7 @@ RUN set -eux; apt-get update; \
# #
# build server # build server
COPY server/ . COPY server/ .
RUN go get -v -t -d . && go build -o bin/neko cmd/neko/main.go RUN ./build
# #
# STAGE 2: CLIENT # STAGE 2: CLIENT

View File

@ -27,7 +27,7 @@ RUN set -eux; apt-get update; \
# #
# build server # build server
COPY server/ . COPY server/ .
RUN go get -v -t -d . && go build -o bin/neko cmd/neko/main.go RUN ./build
# #
# STAGE 2: CLIENT # STAGE 2: CLIENT

View File

@ -27,7 +27,7 @@ RUN set -eux; apt-get update; \
# #
# build server # build server
COPY server/ . COPY server/ .
RUN go get -v -t -d . && go build -o bin/neko cmd/neko/main.go RUN ./build
# #
# STAGE 2: CLIENT # STAGE 2: CLIENT

View File

@ -82,7 +82,7 @@ RUN set -eux; apt-get update; \
# #
# build server # build server
COPY server/ . COPY server/ .
RUN go get -v -t -d . && go build -o bin/neko cmd/neko/main.go RUN ./build
# #
# STAGE 2: CLIENT # STAGE 2: CLIENT

View File

@ -76,5 +76,12 @@
about() { about() {
this.$accessor.client.toggleAbout() this.$accessor.client.toggleAbout()
} }
mounted() {
const default_lang = new URL(location.href).searchParams.get('lang')
if (default_lang && this.langs.includes(default_lang)) {
this.$i18n.locale = default_lang
}
}
} }
</script> </script>

View File

@ -6,5 +6,6 @@ Vue.use(VueI18n)
export const i18n = new VueI18n({ export const i18n = new VueI18n({
locale: 'en', locale: 'en',
fallbackLocale: 'en',
messages, messages,
}) })

View File

@ -4,6 +4,10 @@
### New Features ### New Features
- Added nvidia support for firefox. - Added nvidia support for firefox.
- Added `?lang=<lang>` parameter to the URL, which will set the language of the interface (by @mbattista).
### Misc
- Git commit and tag are now included in the build when creating a docker image.
## [n.eko v2.8.0](https://github.com/m1k1o/neko/releases/tag/v2.8.0) ## [n.eko v2.8.0](https://github.com/m1k1o/neko/releases/tag/v2.8.0)

View File

@ -255,6 +255,7 @@ NEKO_BROADCAST_PIPELINE: "flvmux name=mux ! rtmpsink location={url} pulsesrc dev
- Adding `?cast=1` will hide all control and show only video. - Adding `?cast=1` will hide all control and show only video.
- Adding `?embed=1` will hide most additional components and show only video. - Adding `?embed=1` will hide most additional components and show only video.
- Adding `?volume=<0-1>` will set volume to given value. - Adding `?volume=<0-1>` will set volume to given value.
- Adding `?lang=<language>` will set language to given value.
- e.g. `http(s)://<URL:Port>/?pwd=neko&usr=guest&cast=1` - e.g. `http(s)://<URL:Port>/?pwd=neko&usr=guest&cast=1`
### Screen size ### Screen size

View File

@ -1,24 +1,35 @@
#!/bin/bash #!/bin/bash
set -ex #
# aborting if any command returns a non-zero value
set -e
BUILD_TIME=`date -u +'%Y-%m-%dT%H:%M:%SZ'` BUILD_TIME=`date -u +'%Y-%m-%dT%H:%M:%SZ'`
# #
# set git build variables if git exists # set git build variables if git exists
if git status > /dev/null 2>&1 && [ -z $GIT_COMMIT ] && [ -z $GIT_BRANCH ] && [ -z $GIT_DIRTY ]; if git status > /dev/null 2>&1 && [ -z $GIT_COMMIT ] && [ -z $GIT_BRANCH ] && [ -z $GIT_TAG ];
then then
GIT_COMMIT=`git rev-parse --short HEAD` GIT_COMMIT=`git rev-parse --short HEAD`
GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD` GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
GIT_TAG=`git tag --points-at $GIT_COMMIT | head -n 1`
GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "✗-"` GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "✗-"`
GIT_COMMIT="${GIT_DIRTY}${GIT_COMMIT}"
fi fi
#
# load dependencies
go get -v -t -d .
#
# build server
go build \ go build \
-o bin/neko \ -o bin/neko \
-ldflags " -ldflags "
-s -w -s -w
-X 'm1k1o/neko.buildDate=${BUILD_TIME}' -X 'm1k1o/neko.buildDate=${BUILD_TIME}'
-X 'm1k1o/neko.gitCommit=${GIT_DIRTY}${GIT_COMMIT}' -X 'm1k1o/neko.gitCommit=${GIT_COMMIT}'
-X 'm1k1o/neko.gitBranch=${GIT_BRANCH}' -X 'm1k1o/neko.gitBranch=${GIT_BRANCH}'
-X 'm1k1o/neko.gitTag=${GIT_TAG}'
" \ " \
cmd/neko/main.go; cmd/neko/main.go;

View File

@ -5,6 +5,7 @@ import (
"os" "os"
"os/signal" "os/signal"
"runtime" "runtime"
"strings"
"m1k1o/neko/internal/capture" "m1k1o/neko/internal/capture"
"m1k1o/neko/internal/config" "m1k1o/neko/internal/config"
@ -25,7 +26,7 @@ const Header = `&34
/ |/ / _ \/ //_/ __ \ ) ( ') / |/ / _ \/ //_/ __ \ ) ( ')
/ /| / __/ ,< / /_/ / ( / ) / /| / __/ ,< / /_/ / ( / )
/_/ |_/\___/_/|_|\____/ \(__)| /_/ |_/\___/_/|_|\____/ \(__)|
&1&37 nurdism/m1k1o &33%s v%s&0 &1&37 nurdism/m1k1o &33%s %s&0
` `
var ( var (
@ -35,13 +36,8 @@ var (
gitCommit = "dev" gitCommit = "dev"
// //
gitBranch = "dev" gitBranch = "dev"
//
// Major version when you make incompatible API changes, gitTag = "dev"
major = "2"
// Minor version when you add functionality in a backwards-compatible manner, and
minor = "8"
// Patch version when you make backwards-compatible bug fixes.
patch = "0"
) )
var Service *Neko var Service *Neko
@ -49,11 +45,9 @@ var Service *Neko
func init() { func init() {
Service = &Neko{ Service = &Neko{
Version: &Version{ Version: &Version{
Major: major,
Minor: minor,
Patch: patch,
GitCommit: gitCommit, GitCommit: gitCommit,
GitBranch: gitBranch, GitBranch: gitBranch,
GitTag: gitTag,
BuildDate: buildDate, BuildDate: buildDate,
GoVersion: runtime.Version(), GoVersion: runtime.Version(),
Compiler: runtime.Compiler, Compiler: runtime.Compiler,
@ -69,11 +63,9 @@ func init() {
} }
type Version struct { type Version struct {
Major string
Minor string
Patch string
GitCommit string GitCommit string
GitBranch string GitBranch string
GitTag string
BuildDate string BuildDate string
GoVersion string GoVersion string
Compiler string Compiler string
@ -81,20 +73,25 @@ type Version struct {
} }
func (i *Version) String() string { func (i *Version) String() string {
return fmt.Sprintf("%s.%s.%s %s", i.Major, i.Minor, i.Patch, i.GitCommit) version := i.GitTag
if version == "" || version == "dev" {
version = i.GitBranch
}
return fmt.Sprintf("%s@%s", version, i.GitCommit)
} }
func (i *Version) Details() string { func (i *Version) Details() string {
return fmt.Sprintf( return "\n" + strings.Join([]string{
"%s\n%s\n%s\n%s\n%s\n%s\n%s\n", fmt.Sprintf("Version %s", i.String()),
fmt.Sprintf("Version %s.%s.%s", i.Major, i.Minor, i.Patch),
fmt.Sprintf("GitCommit %s", i.GitCommit), fmt.Sprintf("GitCommit %s", i.GitCommit),
fmt.Sprintf("GitBranch %s", i.GitBranch), fmt.Sprintf("GitBranch %s", i.GitBranch),
fmt.Sprintf("GitTag %s", i.GitTag),
fmt.Sprintf("BuildDate %s", i.BuildDate), fmt.Sprintf("BuildDate %s", i.BuildDate),
fmt.Sprintf("GoVersion %s", i.GoVersion), fmt.Sprintf("GoVersion %s", i.GoVersion),
fmt.Sprintf("Compiler %s", i.Compiler), fmt.Sprintf("Compiler %s", i.Compiler),
fmt.Sprintf("Platform %s", i.Platform), fmt.Sprintf("Platform %s", i.Platform),
) }, "\n") + "\n"
} }
type Neko struct { type Neko struct {