mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-11-14 22:30:10 +00:00
Harvey Tindall
92332206f0
If enabled, jfa-go pings buildrone (hosted at builds.hrfee.pw) every 30 min for new updates. If there is one, it gets information (and if applicable, a binary) from the appropriate source (buildrone, github, or dockerhub) and displays it on the admin page. You can switch update channels between stable and unstable. For binary releases, updates are downloaded automatically and installed when the user presses update. Since this obviously introduces some "phone-home" functionality into jfa-go, I just want to say IPs are not and will not be logged by buildrone, although I may later introduce functionality to give a rough idea of the number of users (again, no IPs stored). The whole thing can also be turned off in settings.
41 lines
918 B
Go
41 lines
918 B
Go
package main
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
"log"
|
|
)
|
|
|
|
const binaryType = "internal"
|
|
|
|
//go:embed data data/html data/web data/web/css data/web/js
|
|
var loFS embed.FS
|
|
|
|
//go:embed lang/common lang/admin lang/email lang/form lang/setup
|
|
var laFS embed.FS
|
|
|
|
var langFS rewriteFS
|
|
var localFS rewriteFS
|
|
|
|
type rewriteFS struct {
|
|
fs embed.FS
|
|
prefix string
|
|
}
|
|
|
|
func (l rewriteFS) Open(name string) (fs.File, error) { return l.fs.Open(l.prefix + name) }
|
|
func (l rewriteFS) ReadDir(name string) ([]fs.DirEntry, error) { return l.fs.ReadDir(l.prefix + name) }
|
|
func (l rewriteFS) ReadFile(name string) ([]byte, error) { return l.fs.ReadFile(l.prefix + name) }
|
|
func FSJoin(elem ...string) string {
|
|
out := ""
|
|
for _, v := range elem {
|
|
out += v + "/"
|
|
}
|
|
return out[:len(out)-1]
|
|
}
|
|
|
|
func loadFilesystems() {
|
|
langFS = rewriteFS{laFS, "lang/"}
|
|
localFS = rewriteFS{loFS, "data/"}
|
|
log.Println("Using internal storage")
|
|
}
|