mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 09:00: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.
36 lines
736 B
Go
36 lines
736 B
Go
package main
|
|
|
|
import (
|
|
"io/fs"
|
|
"log"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
const binaryType = "external"
|
|
|
|
var localFS fs.FS
|
|
var langFS fs.FS
|
|
|
|
// When using os.DirFS, even on Windows the separator seems to be '/'.
|
|
// func FSJoin(elem ...string) string { return filepath.Join(elem...) }
|
|
func FSJoin(elem ...string) string {
|
|
sep := "/"
|
|
if strings.Contains(elem[0], "\\") {
|
|
sep = "\\"
|
|
}
|
|
path := ""
|
|
for _, el := range elem {
|
|
path += el + sep
|
|
}
|
|
return strings.TrimSuffix(path, sep)
|
|
}
|
|
|
|
func loadFilesystems() {
|
|
log.Println("Using external storage")
|
|
executable, _ := os.Executable()
|
|
localFS = os.DirFS(filepath.Join(filepath.Dir(executable), "data"))
|
|
langFS = os.DirFS(filepath.Join(filepath.Dir(executable), "data", "lang"))
|
|
}
|