1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 00:50:12 +00:00

admin: add build tags to "About"

build tags like e2ee and external are now included in the about page.
This commit is contained in:
Harvey Tindall 2024-08-11 17:55:12 +01:00
parent d2c7bf06f7
commit ab3989f233
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
10 changed files with 28 additions and 0 deletions

View File

@ -1,3 +1,4 @@
//go:build external
// +build external // +build external
package main package main
@ -12,6 +13,8 @@ import (
const binaryType = "external" const binaryType = "external"
func BuildTagsExternal() { buildTags = append(buildTags, "external") }
var localFS dirFS var localFS dirFS
var langFS dirFS var langFS dirFS

View File

@ -51,6 +51,7 @@
<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.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> <p>{{ .strings.builtBy }} <span class="text-black dark:text-white font-mono bg-inherit">{{ .builtBy }}</span></p>
<p>{{ .strings.buildTags }} <span class="text-black dark:text-white font-mono bg-inherit">{{ .buildTags }}</span></p>
<div class="flex flex-row flex-wrap gap-2 my-2"> <div class="flex flex-row flex-wrap gap-2 my-2">
<a class="button ~neutral lang-link" href="https://github.com/hrfee/jfa-go"><i class="ri-github-line mr-2"></i>github</a> <a class="button ~neutral lang-link" href="https://github.com/hrfee/jfa-go"><i class="ri-github-line mr-2"></i>github</a>
<a class="button ~urge lang-link" href="https://wiki.jfa-go.com">wiki/docs</a> <a class="button ~urge lang-link" href="https://wiki.jfa-go.com">wiki/docs</a>

View File

@ -1,3 +1,4 @@
//go:build !external
// +build !external // +build !external
package main package main
@ -10,6 +11,8 @@ import (
const binaryType = "internal" const binaryType = "internal"
func BuildTagsExternal() {}
//go:embed data data/html data/web data/web/css data/web/js //go:embed data data/html data/web data/web/css data/web/js
var loFS embed.FS var loFS embed.FS

View File

@ -146,6 +146,7 @@
"postSignupCardDescription": "Card shown to user after signing up. Overrides \"Success Message\". Overriden by \"Auto redirect on success\" setting.", "postSignupCardDescription": "Card shown to user after signing up. Overrides \"Success Message\". Overriden by \"Auto redirect on success\" setting.",
"buildTime": "Build Time", "buildTime": "Build Time",
"builtBy": "Built By", "builtBy": "Built By",
"buildTags": "Build Tags",
"loginNotAdmin": "Not an Admin?", "loginNotAdmin": "Not an Admin?",
"referrer": "Referrer", "referrer": "Referrer",
"accountLinked": "{contactMethod} linked: {user}", "accountLinked": "{contactMethod} linked: {user}",

View File

@ -60,6 +60,7 @@ var (
commit string commit string
buildTimeUnix string buildTimeUnix string
builtBy string builtBy string
buildTags []string
_LOADBAK *string _LOADBAK *string
LOADBAK = "" LOADBAK = ""
) )
@ -740,6 +741,11 @@ func printVersion() {
const SYSTEMD_SERVICE = "jfa-go.service" const SYSTEMD_SERVICE = "jfa-go.service"
func main() { func main() {
// Generate list of "-tags" for about page.
BuildTagsE2EE()
BuildTagsTray()
BuildTagsExternal()
f, err := logOutput() f, err := logOutput()
if err != nil { if err != nil {
fmt.Printf(lm.FailedLogging, err) fmt.Printf(lm.FailedLogging, err)

View File

@ -16,6 +16,10 @@ type Crypto struct {
helper *cryptohelper.CryptoHelper helper *cryptohelper.CryptoHelper
} }
func BuildTagsE2EE() {
buildTags = append(buildTags, "e2ee")
}
func MatrixE2EE() bool { return true } func MatrixE2EE() bool { return true }
func InitMatrixCrypto(d *MatrixDaemon) error { func InitMatrixCrypto(d *MatrixDaemon) error {

View File

@ -7,6 +7,8 @@ import "maunium.net/go/mautrix/id"
type Crypto struct{} type Crypto struct{}
func BuildTagsE2EE() {}
func MatrixE2EE() bool { return false } func MatrixE2EE() bool { return false }
func InitMatrixCrypto(d *MatrixDaemon) (err error) { func InitMatrixCrypto(d *MatrixDaemon) (err error) {

View File

@ -1,9 +1,12 @@
//go:build !tray
// +build !tray // +build !tray
package main package main
var TRAY = false var TRAY = false
func BuildTagsTray() {}
func RunTray() {} func RunTray() {}
func QuitTray() {} func QuitTray() {}

View File

@ -15,6 +15,10 @@ import (
var TRAY = true var TRAY = true
func BuildTagsTray() {
buildTags = append(buildTags, "tray")
}
func RunTray() { func RunTray() {
systray.Run(onReady, onExit) systray.Run(onReady, onExit)
} }

View File

@ -174,6 +174,7 @@ func (app *appContext) AdminPage(gc *gin.Context) {
"commit": commit, "commit": commit,
"buildTime": buildTime, "buildTime": buildTime,
"builtBy": builtBy, "builtBy": builtBy,
"buildTags": buildTags,
"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,