From 546fd8aedb77657ecda4b902aa860d70a4fb7055 Mon Sep 17 00:00:00 2001 From: dev-warrior777 <> Date: Sun, 24 Nov 2024 18:44:22 +0800 Subject: [PATCH 1/8] client,webserver: Use the app build version as Version in UI. - Use the value from client/app/version.go - Place at the foot of Settings dialog - Re-purpose 'BUILD ID' as "Version for translations and find relevant translations --- client/app/config.go | 2 ++ client/cmd/bisonw/config.go | 1 + client/cmd/bisonw/main.go | 2 +- client/webserver/http.go | 2 ++ client/webserver/locales/de-de.go | 2 +- client/webserver/locales/en-us.go | 2 +- client/webserver/locales/pl-pl.go | 2 +- client/webserver/locales/pt-br.go | 2 +- client/webserver/locales/zh-cn.go | 2 +- .../webserver/site/src/html/bodybuilder.tmpl | 4 +-- client/webserver/site/src/html/settings.tmpl | 3 +- client/webserver/site/src/js/app.ts | 10 +++--- client/webserver/site/src/js/locales.ts | 9 ++++-- client/webserver/site/src/js/registry.ts | 2 +- client/webserver/site/src/js/settings.ts | 11 ++++--- client/webserver/site/webpack/common.js | 14 ++++---- client/webserver/template.go | 32 +++++++++---------- client/webserver/webserver.go | 4 ++- 18 files changed, 60 insertions(+), 46 deletions(-) diff --git a/client/app/config.go b/client/app/config.go index f2aadbc687..36e145b049 100644 --- a/client/app/config.go +++ b/client/app/config.go @@ -143,6 +143,7 @@ type Config struct { WebConfig LogConfig MMConfig + AppVersion string // AppData and ConfigPath should be parsed from the command-line, // as it makes no sense to set these in the config file itself. If no values // are assigned, defaults will be used. @@ -348,6 +349,7 @@ func ResolveConfig(appData string, cfg *Config) error { if cfg.MMConfig.EventLogDBPath == "" { cfg.MMConfig.EventLogDBPath = defaultMMEventLogDBPath } + return nil } diff --git a/client/cmd/bisonw/config.go b/client/cmd/bisonw/config.go index e102adf12e..467c16b264 100644 --- a/client/cmd/bisonw/config.go +++ b/client/cmd/bisonw/config.go @@ -13,6 +13,7 @@ func configure() (*app.Config, error) { // or the version flag was specified. Override any environment variables // with parsed command line flags. iniCfg := app.DefaultConfig + iniCfg.AppVersion = app.Version preCfg := iniCfg if err := app.ParseCLIConfig(&preCfg); err != nil { return nil, err diff --git a/client/cmd/bisonw/main.go b/client/cmd/bisonw/main.go index 01e7c94065..eb11e5c0d6 100644 --- a/client/cmd/bisonw/main.go +++ b/client/cmd/bisonw/main.go @@ -154,7 +154,7 @@ func runCore(cfg *app.Config) error { } if !cfg.NoWeb { - webSrv, err := webserver.New(cfg.Web(clientCore, marketMaker, logMaker.Logger("WEB"), utc)) + webSrv, err := webserver.New(cfg.Web(clientCore, marketMaker, logMaker.Logger("WEB"), utc), cfg.AppVersion) if err != nil { return fmt.Errorf("failed creating web server: %w", err) } diff --git a/client/webserver/http.go b/client/webserver/http.go index 45ca372e66..56f533fed0 100644 --- a/client/webserver/http.go +++ b/client/webserver/http.go @@ -260,6 +260,7 @@ func (s *WebServer) handleSettings(w http.ResponseWriter, r *http.Request) { FiatCurrency string Exchanges map[string]*core.Exchange IsInitialized bool + AppVersion string }{ CommonArguments: *common, KnownExchanges: s.knownUnregisteredExchanges(xcs), @@ -267,6 +268,7 @@ func (s *WebServer) handleSettings(w http.ResponseWriter, r *http.Request) { FiatRateSources: s.core.FiatRateSources(), Exchanges: xcs, IsInitialized: s.core.IsInitialized(), + AppVersion: s.appVersion, } s.sendTemplate(w, "settings", data) } diff --git a/client/webserver/locales/de-de.go b/client/webserver/locales/de-de.go index ecd2becfea..497f316522 100644 --- a/client/webserver/locales/de-de.go +++ b/client/webserver/locales/de-de.go @@ -135,7 +135,7 @@ var DeDE = map[string]*intl.Translation{ "Export Account": {T: "Account exportieren"}, "simultaneous_servers_msg": {T: "Der unterstützt die gleichzeitige Nutzung einer beliebigen Anzahl von DEX-Servern."}, "Change App Password": {T: "App-Passwort ändern"}, - "Build ID": {T: "Build ID"}, + "Build ID": {T: "Version"}, "Connect": {T: "Verbinden"}, "Send": {T: "Senden"}, "Deposit": {T: "Einzahlen"}, diff --git a/client/webserver/locales/en-us.go b/client/webserver/locales/en-us.go index 8d15eef0cc..2f8daa2291 100644 --- a/client/webserver/locales/en-us.go +++ b/client/webserver/locales/en-us.go @@ -167,7 +167,7 @@ var EnUS = map[string]*intl.Translation{ "browser_ntfn_blocked": {T: "Browser notifications are currently blocked. Please unblock this site in your browser to receive notifications."}, "enable_browser_ntfn_info": {T: "Desktop notifications appear even when this window is not active. When you have other applications open this can be helpful as you will be notified on DCRDEX events. Customize below the types of notifications you would like to receive."}, "Save Notifications": {T: "Save Notifications"}, - "Build ID": {T: "Build ID"}, + "Build ID": {T: "Version"}, "Connect": {T: "Connect"}, "Send": {T: "Send"}, "Deposit": {T: "Deposit"}, // unused diff --git a/client/webserver/locales/pl-pl.go b/client/webserver/locales/pl-pl.go index c1f7be9a99..d47cf94cb6 100644 --- a/client/webserver/locales/pl-pl.go +++ b/client/webserver/locales/pl-pl.go @@ -133,7 +133,7 @@ var PlPL = map[string]*intl.Translation{ "Export Account": {T: "Eksportuj konto"}, "simultaneous_servers_msg": {T: "Klient Decred DEX wspiera jednoczesne korzystanie z wielu serwerów DEX."}, "Change App Password": {T: "Zmień hasło aplikacji"}, - "Build ID": {T: "ID builda"}, + "Build ID": {T: "Wersja"}, "Connect": {T: "Połącz"}, "Withdraw": {T: "Wypłać"}, "Deposit": {T: "Zdeponuj"}, diff --git a/client/webserver/locales/pt-br.go b/client/webserver/locales/pt-br.go index 38187ed0b2..db2ccbcc89 100644 --- a/client/webserver/locales/pt-br.go +++ b/client/webserver/locales/pt-br.go @@ -133,7 +133,7 @@ var PtBr = map[string]*intl.Translation{ "Export Account": {T: "Exportar Conta"}, "simultaneous_servers_msg": {T: "O cliente da DEX suporta simultâneos números de servidores DEX."}, "Change App Password": {T: "Trocar Senha do aplicativo"}, - "Build ID": {T: "ID da Build"}, + "Build ID": {T: "Versão"}, "Connect": {T: "Conectar"}, "Withdraw": {T: "Retirar"}, "Deposit": {T: "Depositar"}, diff --git a/client/webserver/locales/zh-cn.go b/client/webserver/locales/zh-cn.go index 0b68f012b7..4adc2fe42d 100644 --- a/client/webserver/locales/zh-cn.go +++ b/client/webserver/locales/zh-cn.go @@ -135,7 +135,7 @@ var ZhCN = map[string]*intl.Translation{ "Export Account": {T: "退出账户"}, "simultaneous_servers_msg": {T: "Decred DEX 客户端支持同时使用任意数量的 DEX 服务器。"}, "Change App Password": {T: "更改应用程序密码"}, - "Build ID": {T: "构建 ID"}, + "Build ID": {T: "版本"}, "Connect": {T: "连接"}, "Send": {T: "发送"}, "Deposit": {T: "存款"}, diff --git a/client/webserver/site/src/html/bodybuilder.tmpl b/client/webserver/site/src/html/bodybuilder.tmpl index fb0fca5e3d..2bd698057a 100644 --- a/client/webserver/site/src/html/bodybuilder.tmpl +++ b/client/webserver/site/src/html/bodybuilder.tmpl @@ -9,7 +9,7 @@