1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-09-19 19:00:11 +00:00

Compare commits

..

No commits in common. "f1b7ef303d2bb1cfadf81aa6dc8b900483439ea9" and "7caa5c5d572e50b7f45d3af23b99e4721e8de383" have entirely different histories.

12 changed files with 38 additions and 82 deletions

View File

@ -18,8 +18,6 @@ steps:
from_secret: BUILDRONE_KEY from_secret: BUILDRONE_KEY
GITHUB_TOKEN: GITHUB_TOKEN:
from_secret: github_token from_secret: github_token
JFA_GO_BUILT_BY:
from_secret: BUILT_BY
commands: commands:
- curl -sL https://git.io/goreleaser > ../goreleaser - curl -sL https://git.io/goreleaser > ../goreleaser
- chmod +x ../goreleaser - chmod +x ../goreleaser
@ -28,7 +26,6 @@ steps:
- pip3 install requests - pip3 install requests
- bash -c 'sftp -P 2022 -i /id_rsa -o StrictHostKeyChecking=no root@161.97.102.153:/repo/incoming <<< $"put dist/*.deb"' - bash -c 'sftp -P 2022 -i /id_rsa -o StrictHostKeyChecking=no root@161.97.102.153:/repo/incoming <<< $"put dist/*.deb"'
- bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "repo-process-deb trusty"' - bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "repo-process-deb trusty"'
bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "rm /repo/incoming/*.deb"'
- bash -c 'python3 ../upload.py https://builds.hrfee.pw hrfee jfa-go --tag internal=true' - bash -c 'python3 ../upload.py https://builds.hrfee.pw hrfee jfa-go --tag internal=true'
volumes: volumes:
- name: ssh_key - name: ssh_key
@ -96,13 +93,10 @@ steps:
# - bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "reprepro -Vb /repo remove trusty-unstable jfa-go"' # - bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "reprepro -Vb /repo remove trusty-unstable jfa-go"'
# - bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "reprepro -Vb /repo remove trusty-unstable jfa-go-tray"' # - bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "reprepro -Vb /repo remove trusty-unstable jfa-go-tray"'
- bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "repo-process-deb trusty"' - bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "repo-process-deb trusty"'
bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "rm /repo/incoming/*.deb"'
- bash -c 'python3 upload.py https://builds.hrfee.pw hrfee jfa-go --upload ./dist/*.zip ./dist/*.rpm ./dist/*.apk --tag internal-git=true' - bash -c 'python3 upload.py https://builds.hrfee.pw hrfee jfa-go --upload ./dist/*.zip ./dist/*.rpm ./dist/*.apk --tag internal-git=true'
environment: environment:
BUILDRONE_KEY: BUILDRONE_KEY:
from_secret: BUILDRONE_KEY from_secret: BUILDRONE_KEY
JFA_GO_BUILT_BY:
from_secret: BUILT_BY
volumes: volumes:
- name: ssh_key - name: ssh_key

View File

@ -33,7 +33,7 @@ before:
- npx esbuild --target=es6 --bundle tempts/setup.ts --outfile=./data/web/js/setup.js --minify - npx esbuild --target=es6 --bundle tempts/setup.ts --outfile=./data/web/js/setup.js --minify
- npx esbuild --target=es6 --bundle tempts/crash.ts --outfile=./data/crash.js --minify - npx esbuild --target=es6 --bundle tempts/crash.ts --outfile=./data/crash.js --minify
- rm -r tempts - rm -r tempts
- npx esbuild --bundle css/base.css --outfile=./data/web/css/bundle.css --external:remixicon.css --external:../fonts/hanken* --minify - npx esbuild --bundle css/base.css --outfile=./data/web/css/bundle.css --external:remixicon.css --minify
- cp html/crash.html data/ - cp html/crash.html data/
- npx tailwindcss -i data/web/css/bundle.css -o data/bundle.css --content "html/crash.html" - npx tailwindcss -i data/web/css/bundle.css -o data/bundle.css --content "html/crash.html"
- node scripts/inline.js root data data/crash.html data/crash.html - node scripts/inline.js root data data/crash.html data/crash.html
@ -49,7 +49,7 @@ builds:
env: env:
- CGO_ENABLED=0 - CGO_ENABLED=0
ldflags: ldflags:
- -s -w -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}} -X main.buildTimeUnix={{.Env.JFA_GO_BUILD_TIME}} -X main.builtBy="{{.Env.JFA_GO_BUILT_BY}}" - -s -w -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}}
goos: goos:
- linux - linux
- darwin - darwin
@ -66,7 +66,7 @@ builds:
flags: flags:
- -tags=tray - -tags=tray
ldflags: ldflags:
- -s -w -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}} -X main.buildTimeUnix={{.Env.JFA_GO_BUILD_TIME}} -X main.builtBy="{{.Env.JFA_GO_BUILT_BY}}" -H=windowsgui - -s -w -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}} -H=windowsgui
goos: goos:
- windows - windows
goarch: goarch:
@ -78,7 +78,7 @@ builds:
flags: flags:
- -tags=tray - -tags=tray
ldflags: ldflags:
- -s -w -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}} -X main.buildTimeUnix={{.Env.JFA_GO_BUILD_TIME}} -X main.builtBy="{{.Env.JFA_GO_BUILT_BY}}" - -s -w -X main.version={{.Env.JFA_GO_VERSION}} -X main.commit={{.ShortCommit}} -X main.updater=binary -X main.cssVersion={{.Env.JFA_GO_CSS_VERSION}}
goos: goos:
- linux - linux
goarch: goarch:

View File

@ -11,10 +11,9 @@ CSSVERSION ?= v3
VERSION ?= $(shell git describe --exact-match HEAD 2> /dev/null || echo vgit) VERSION ?= $(shell git describe --exact-match HEAD 2> /dev/null || echo vgit)
VERSION := $(shell echo $(VERSION) | sed 's/v//g') VERSION := $(shell echo $(VERSION) | sed 's/v//g')
COMMIT ?= $(shell git rev-parse --short HEAD || echo unknown) COMMIT ?= $(shell git rev-parse --short HEAD || echo unknown)
BUILDTIME ?= $(shell date +%s)
UPDATER ?= off UPDATER ?= off
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.cssVersion=$(CSSVERSION) -X main.buildTimeUnix=$(BUILDTIME) $(if $(BUILTBY),-X 'main.builtBy=$(BUILTBY)',) LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.cssVersion=$(CSSVERSION)
ifeq ($(UPDATER), on) ifeq ($(UPDATER), on)
LDFLAGS := $(LDFLAGS) -X main.updater=binary LDFLAGS := $(LDFLAGS) -X main.updater=binary
else ifneq ($(UPDATER), off) else ifneq ($(UPDATER), off)
@ -75,23 +74,14 @@ else
RACEDETECTOR := RACEDETECTOR :=
endif endif
ifeq (, $(shell which esbuild))
ESBUILDINSTALL := go install github.com/evanw/esbuild/cmd/esbuild@latest
else
ESBUILDINSTALL :=
endif
ifeq ($(GOESBUILD), on)
NPMIGNOREOPTIONAL := --no-optional
NPMOPTS := $(NPMIGNOREOPTIONAL); $(ESBUILDINSTALL)
else
NPMOPTS :=
endif
npm: npm:
$(info installing npm dependencies) $(info installing npm dependencies)
npm install $(NPMOPTS) npm install
@if [ "$(GOESBUILD)" = "off" ]; then\
npm install esbuild;\
else\
go install github.com/evanw/esbuild/cmd/esbuild@latest;\
fi
configuration: configuration:
$(info Fixing config-base) $(info Fixing config-base)

View File

@ -41,8 +41,6 @@
<span class="heading"><span class="modal-close">&times;</span></span> <span class="heading"><span class="modal-close">&times;</span></span>
<p>{{ .strings.version }} <span class="text-black dark:text-white font-mono bg-inherit">{{ .version }}</span></p> <p>{{ .strings.version }} <span class="text-black dark:text-white font-mono bg-inherit">{{ .version }}</span></p>
<p>{{ .strings.commitNoun }} <span class="text-black dark:text-white font-mono bg-inherit">{{ .commit }}</span></p> <p>{{ .strings.commitNoun }} <span class="text-black dark:text-white font-mono bg-inherit">{{ .commit }}</span></p>
<p>{{ .strings.buildTime }} <span class="text-black dark:text-white font-mono bg-inherit">{{ .buildTime }}</span></p>
<p>{{ .strings.builtBy }} <span class="text-black dark:text-white font-mono bg-inherit">{{ .builtBy }}</span></p>
<div class="row col flex"> <div class="row col flex">
<a class="button ~neutral mr-2 mt-4 mb-4 lang-link" href="https://github.com/hrfee/jfa-go"><i class="ri-github-line mr-2"></i>github</a> <a class="button ~neutral mr-2 mt-4 mb-4 lang-link" href="https://github.com/hrfee/jfa-go"><i class="ri-github-line mr-2"></i>github</a>
<a class="button ~urge mt-4 mb-4 mr-2 lang-link" href="https://wiki.jfa-go.com">wiki/docs</a> <a class="button ~urge mt-4 mb-4 mr-2 lang-link" href="https://wiki.jfa-go.com">wiki/docs</a>

View File

@ -115,9 +115,7 @@
"matchText": "Match Text", "matchText": "Match Text",
"jellyfinID": "Jellyfin ID", "jellyfinID": "Jellyfin ID",
"userPageLogin": "User Page: Login", "userPageLogin": "User Page: Login",
"userPagePage": "User Page: Page", "userPagePage": "User Page: Page"
"buildTime": "Build Time",
"builtBy": "Built By"
}, },
"notifications": { "notifications": {
"changedEmailAddress": "Changed email address of {n}.", "changedEmailAddress": "Changed email address of {n}.",

View File

@ -53,8 +53,6 @@ var (
white = color.New(color.FgWhite).SprintfFunc() white = color.New(color.FgWhite).SprintfFunc()
version string version string
commit string commit string
buildTimeUnix string
builtBy string
) )
var temp = func() string { var temp = func() string {

6
package-lock.json generated
View File

@ -15,6 +15,7 @@
"any-date-parser": "^1.5.4", "any-date-parser": "^1.5.4",
"browserslist": "^4.21.7", "browserslist": "^4.21.7",
"cheerio": "^1.0.0-rc.12", "cheerio": "^1.0.0-rc.12",
"esbuild": "^0.18.6",
"fs-cheerio": "^3.0.0", "fs-cheerio": "^3.0.0",
"inline-source": "^8.0.2", "inline-source": "^8.0.2",
"jsdom": "^22.1.0", "jsdom": "^22.1.0",
@ -31,9 +32,6 @@
}, },
"devDependencies": { "devDependencies": {
"live-server": "^1.2.2" "live-server": "^1.2.2"
},
"optionalDependencies": {
"esbuild": "^0.18.6"
} }
}, },
"node_modules/@alloc/quick-lru": { "node_modules/@alloc/quick-lru": {
@ -1653,7 +1651,6 @@
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.6.tgz", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.6.tgz",
"integrity": "sha512-5QgxWaAhU/tPBpvkxUmnFv2YINHuZzjbk0LeUUnC2i3aJHjfi5yR49lgKgF7cb98bclOp/kans8M5TGbGFfJlQ==", "integrity": "sha512-5QgxWaAhU/tPBpvkxUmnFv2YINHuZzjbk0LeUUnC2i3aJHjfi5yR49lgKgF7cb98bclOp/kans8M5TGbGFfJlQ==",
"hasInstallScript": true, "hasInstallScript": true,
"optional": true,
"bin": { "bin": {
"esbuild": "bin/esbuild" "esbuild": "bin/esbuild"
}, },
@ -7902,7 +7899,6 @@
"version": "0.18.6", "version": "0.18.6",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.6.tgz", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.6.tgz",
"integrity": "sha512-5QgxWaAhU/tPBpvkxUmnFv2YINHuZzjbk0LeUUnC2i3aJHjfi5yR49lgKgF7cb98bclOp/kans8M5TGbGFfJlQ==", "integrity": "sha512-5QgxWaAhU/tPBpvkxUmnFv2YINHuZzjbk0LeUUnC2i3aJHjfi5yR49lgKgF7cb98bclOp/kans8M5TGbGFfJlQ==",
"optional": true,
"requires": { "requires": {
"@esbuild/android-arm": "0.18.6", "@esbuild/android-arm": "0.18.6",
"@esbuild/android-arm64": "0.18.6", "@esbuild/android-arm64": "0.18.6",

View File

@ -23,6 +23,7 @@
"any-date-parser": "^1.5.4", "any-date-parser": "^1.5.4",
"browserslist": "^4.21.7", "browserslist": "^4.21.7",
"cheerio": "^1.0.0-rc.12", "cheerio": "^1.0.0-rc.12",
"esbuild": "^0.18.6",
"fs-cheerio": "^3.0.0", "fs-cheerio": "^3.0.0",
"inline-source": "^8.0.2", "inline-source": "^8.0.2",
"jsdom": "^22.1.0", "jsdom": "^22.1.0",
@ -39,8 +40,5 @@
}, },
"devDependencies": { "devDependencies": {
"live-server": "^1.2.2" "live-server": "^1.2.2"
},
"optionalDependencies": {
"esbuild": "^0.18.6"
} }
} }

View File

@ -13,8 +13,8 @@ args = parser.parse_args()
def runcmd(cmd): def runcmd(cmd):
if os.name == "nt": if os.name == "nt":
return subprocess.check_output(cmd, shell=True) return subprocess.check_output(cmd, shell=True)
with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as proc: proc = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
return proc.communicate() return proc.communicate()
def compile(mjml: Path): def compile(mjml: Path):
fname = mjml.with_suffix(".html") fname = mjml.with_suffix(".html")

View File

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# sets version environment variable for goreleaser to use # sets version environment variable for goreleaser to use
# scripts/version.sh goreleaser ... # scripts/version.sh goreleaser ...
JFA_GO_VERSION=$(git describe --exact-match HEAD 2> /dev/null || echo 'vgit') JFA_GO_VERSION=$(git describe --exact-match HEAD 2> /dev/null || echo 'vgit')
JFA_GO_CSS_VERSION="v3" JFA_GO_NFPM_EPOCH=$(git rev-list --all --count) JFA_GO_BUILD_TIME=$(date +%s) JFA_GO_BUILT_BY=${JFA_GO_BUILT_BY:-"???"} JFA_GO_VERSION="$(echo $JFA_GO_VERSION | sed 's/v//g')" $@ JFA_GO_CSS_VERSION="v3" JFA_GO_NFPM_EPOCH=$(git rev-list --all --count) JFA_GO_VERSION="$(echo $JFA_GO_VERSION | sed 's/v//g')" $@

View File

@ -25,11 +25,6 @@ const (
repo = "jfa-go" repo = "jfa-go"
) )
var buildTime time.Time = func() time.Time {
i, _ := strconv.ParseInt(buildTimeUnix, 10, 64)
return time.Unix(i, 0)
}()
type GHRelease struct { type GHRelease struct {
HTMLURL string `json:"html_url"` HTMLURL string `json:"html_url"`
ID int `json:"id"` ID int `json:"id"`
@ -111,14 +106,14 @@ var goarch = map[string]string{
"arm": "armv6", "arm": "armv6",
} }
// func newDockerBuild() Update { // func newDockerBuild() Update {
// var tag string // var tag string
// if version == "git" { // if version == "git" {
// tag = "docker-unstable" // tag = "docker-unstable"
// } else { // } else {
// tag = "docker-latest" // tag = "docker-latest"
// } // }
// } // }
type Updater struct { type Updater struct {
version, commit, tag, url, namespace, name string version, commit, tag, url, namespace, name string
stable bool stable bool
@ -129,7 +124,6 @@ type Updater struct {
} }
func newUpdater(buildroneURL, namespace, repo, version, commit, buildType string) *Updater { func newUpdater(buildroneURL, namespace, repo, version, commit, buildType string) *Updater {
// fmt.Printf(`Updater intializing with "%s", "%s", "%s", "%s", "%s", "%s"\n`, buildroneURL, namespace, repo, version, commit, buildType)
bType := off bType := off
tag := "" tag := ""
switch buildType { switch buildType {
@ -190,7 +184,6 @@ func (ud *Updater) GetTag() (Tag, int, error) {
return Tag{}, -1, nil return Tag{}, -1, nil
} }
url := fmt.Sprintf("%s/repo/%s/%s/tag/latest/%s", ud.url, ud.namespace, ud.name, ud.tag) url := fmt.Sprintf("%s/repo/%s/%s/tag/latest/%s", ud.url, ud.namespace, ud.name, ud.tag)
// fmt.Printf("Pinging URL \"%s\" for updates\n", url)
req, _ := http.NewRequest("GET", url, nil) req, _ := http.NewRequest("GET", url, nil)
resp, err := ud.httpClient.Do(req) resp, err := ud.httpClient.Do(req)
defer ud.timeoutHandler() defer ud.timeoutHandler()
@ -212,8 +205,7 @@ func (ud *Updater) GetTag() (Tag, int, error) {
} }
func (t *Tag) IsNew() bool { func (t *Tag) IsNew() bool {
// fmt.Printf("Build Time: %+v, Release Date: %+v", buildTime, t.ReleaseDate) return t.Version[:7] != commit && t.Ready
return t.Version[:7] != commit && t.Ready && t.ReleaseDate.After(buildTime)
} }
func (ud *Updater) getRelease() (release GHRelease, status int, err error) { func (ud *Updater) getRelease() (release GHRelease, status int, err error) {
@ -534,18 +526,18 @@ func (ud *Updater) pullInternal(url string) (applyUpdate ApplyUpdate, status int
// func newInternalBuild() Update { // func newInternalBuild() Update {
// tag := "internal" // tag := "internal"
// func update(path string) err { // func update(path string) err {
// if // if
// fp, err := os.Executable() // fp, err := os.Executable()
// if err != nil { // if err != nil {
// return err // return err
// } // }
// fullPath, err := filepath.EvalSymlinks(fp) // fullPath, err := filepath.EvalSymlinks(fp)
// if err != nil { // if err != nil {
// return err // return err
// } // }
// newBinary, // newBinary,
// } // }
func (app *appContext) checkForUpdates() { func (app *appContext) checkForUpdates() {
for { for {
go func() { go func() {

View File

@ -143,10 +143,6 @@ func (app *appContext) AdminPage(gc *gin.Context) {
license += "---Hanken Grotesk---\n\n" license += "---Hanken Grotesk---\n\n"
license += string(fontLicense) license += string(fontLicense)
if builtBy == "" {
builtBy = "???"
}
gcHTML(gc, http.StatusOK, "admin.html", gin.H{ gcHTML(gc, http.StatusOK, "admin.html", gin.H{
"urlBase": app.getURLBase(gc), "urlBase": app.getURLBase(gc),
"cssClass": app.cssClass, "cssClass": app.cssClass,
@ -161,8 +157,6 @@ func (app *appContext) AdminPage(gc *gin.Context) {
"notifications": notificationsEnabled, "notifications": notificationsEnabled,
"version": version, "version": version,
"commit": commit, "commit": commit,
"buildTime": buildTime,
"builtBy": builtBy,
"username": !app.config.Section("email").Key("no_username").MustBool(false), "username": !app.config.Section("email").Key("no_username").MustBool(false),
"strings": app.storage.lang.Admin[lang].Strings, "strings": app.storage.lang.Admin[lang].Strings,
"quantityStrings": app.storage.lang.Admin[lang].QuantityStrings, "quantityStrings": app.storage.lang.Admin[lang].QuantityStrings,