Skip to content

Commit

Permalink
client: Use the app build version as Version in UI in hamburger menu. (
Browse files Browse the repository at this point in the history
…#3121)

* client: Use the app build version as Version in UI in hamburger menu #2.

	- This is a rework of #3096 and keeps the Build ID in the
	  settings dialog.

	- Webpack Build ID for caching site/dist build will be
	  addressed in another PR if required.

* client: Re-work profile dropdown to show simplified, user-facing app version

* client,webserver: re-work to modify config per JoeGruff suggestions #2

* client,app,webserver: Remove un-needed configuration variables.

---------

Co-authored-by: dev-warrior777 <>
  • Loading branch information
dev-warrior777 authored Feb 3, 2025
1 parent 05d7092 commit 553d2d0
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 2 deletions.
10 changes: 10 additions & 0 deletions client/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ func (cfg *Config) Web(c *core.Core, mm *mm.MarketMaker, log dex.Logger, utc boo
UTC: utc,
CertFile: certFile,
KeyFile: keyFile,
NoEmbed: cfg.NoEmbedSite,
HttpProf: cfg.HTTPProfile,
AppVersion: userAppVersion(Version),
Language: cfg.Language,
Tor: cfg.Tor,
}
Expand Down Expand Up @@ -349,9 +352,16 @@ func ResolveConfig(appData string, cfg *Config) error {
if cfg.MMConfig.EventLogDBPath == "" {
cfg.MMConfig.EventLogDBPath = defaultMMEventLogDBPath
}

return nil
}

// userAppVersion returns a simple user-facing version: maj.min.patch.
func userAppVersion(fullVersion string) string {
parts := strings.Split(fullVersion, "-")
return parts[0]
}

// setNet sets the filepath for the network directory and some network specific
// files. It returns a suggested path for the database file and a log file. If
// using a file rotator, the directory of the log filepath as parsed by
Expand Down
2 changes: 2 additions & 0 deletions client/webserver/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type CommonArguments struct {
UserInfo *userInfo
Title string
UseDEXBranding bool
Version string
}

// Create the CommonArguments for the request.
Expand All @@ -66,6 +67,7 @@ func (s *WebServer) commonArgs(r *http.Request, title string) *CommonArguments {
UserInfo: extractUserInfo(r),
Title: title,
UseDEXBranding: s.useDEXBranding,
Version: s.appVersion,
}
}

Expand Down
1 change: 1 addition & 0 deletions client/webserver/locales/ar.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ var Ar = map[string]*intl.Translation{
"Export Account": {T: "تصدير الحساب"},
"simultaneous_servers_msg": {T: "يدعم عميل منصة المبادلات اللامركزية لديكريد الاستخدام المتزامن لأي عدد من خوادم منصة المبادلات اللامركزية DEX."},
"Change App Password": {T: "تغيير كلمة مرور التطبيق"},
"Version": {T: "إصدار"},
"Build ID": {T: "معرف البنية"},
"Connect": {T: "اتصل"},
"Send": {T: "ارسال"},
Expand Down
1 change: 1 addition & 0 deletions client/webserver/locales/de-de.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ var DeDE = map[string]*intl.Translation{
"browser_ntfn_blocked": {T: "Browser-Benachrichtigungen sind derzeit blockiert. Heben die Blockierung dieser Seite in Ihrem Browser auf, um Benachrichtigungen zu erhalten."},
"enable_browser_ntfn_info": {T: "Benachrichtigungen auf dem Desktop erscheinen auch dann, wenn dieses Fenster nicht aktiv ist. Dies kann nützlich sein, wenn Sie andere Anwendungen aktiviert haben, da Sie dann Benachrichtigungen über Aktivitäten auf Bison Wallet erhalten. Sie können die Arten von Benachrichtigungen, die Sie erhalten möchten, unten anpassen."},
"Save Notifications": {T: "Benachrichtigungen Speichern"},
"Version": {T: "Version"},
"Build ID": {T: "Build ID"},
"Connect": {T: "Verbinden"},
"Send": {T: "Senden"},
Expand Down
1 change: 1 addition & 0 deletions client/webserver/locales/en-us.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ var EnUS = map[string]*intl.Translation{
"companion_app_tor_needed": {T: "Tor must be enabled for this."},
"Pair companion app": {T: "Pair companion app"},
"Download APK": {T: "Download APK"},
"Version": {T: "Version"},
"Build ID": {T: "Build ID"},
"Connect": {T: "Connect"},
"Send": {T: "Send"},
Expand Down
1 change: 1 addition & 0 deletions client/webserver/locales/pl-pl.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +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"},
"Version": {T: "Wersja"},
"Build ID": {T: "ID builda"},
"Connect": {T: "Połącz"},
"Withdraw": {T: "Wypłać"},
Expand Down
1 change: 1 addition & 0 deletions client/webserver/locales/pt-br.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +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"},
"Version": {T: "Versão"},
"Build ID": {T: "ID da Build"},
"Connect": {T: "Conectar"},
"Withdraw": {T: "Retirar"},
Expand Down
1 change: 1 addition & 0 deletions client/webserver/locales/zh-cn.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ var ZhCN = map[string]*intl.Translation{
"browser_ntfn_blocked": {T: "浏览器通知目前被阻止。请在浏览器中解除对该站点的阻止,以接收通知。"},
"enable_browser_ntfn_info": {T: "即使此窗口不活跃,桌面通知仍会出现。当您打开其他应用程序时,这会很有帮助,因为您将收到 DCRDEX 事件的通知。您可以在下方自定义您希望接收的通知类型。"},
"Save Notifications": {T: "保存通知"},
"Version": {T: "版本"},
"Build ID": {T: "构建 ID"},
"Connect": {T: "连接"},
"Send": {T: "发送"},
Expand Down
9 changes: 8 additions & 1 deletion client/webserver/site/src/html/bodybuilder.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<span class="ico-barchart fs16 me-2"></span>
[[[Market Making]]]
</a>
<a href="/settings" class="demi hoverbright plainlink d-flex align-items-center py-1">
<a href="/settings" class="demi hoverbright plainlink d-flex align-items-center py-1 authed-only">
<span class="ico-settings fs16 me-2"></span>
[[[Settings]]]
</a>
Expand All @@ -123,8 +123,15 @@
<span class="ico-profile fs16 me-2"></span>
[[[Sign Out]]]
</div>
<div class="border-bottom py-2"></div>
<div class="demi-sans d-flex align-items-center py-1" id="version">
<div class="flex-center">
[[[Version]]] {{.Version}}
</div>
</div>
</div>


</header>
{{end}}

Expand Down
6 changes: 5 additions & 1 deletion client/webserver/webserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ type Config struct {
CustomSiteDir string
Language string
Logger dex.Logger
UTC bool // for stdout http request logging
UTC bool // for stdout http request logging
AppVersion string // user app version for UI
CertFile string
KeyFile string
// NoEmbed indicates to serve files from the system disk rather than the
Expand Down Expand Up @@ -276,6 +277,8 @@ type WebServer struct {
bondBufMtx sync.Mutex
bondBuf map[uint32]valStamp

appVersion string

useDEXBranding bool
}

Expand Down Expand Up @@ -402,6 +405,7 @@ func New(cfg *Config) (*WebServer, error) {
cachedPasswords: make(map[string]*cachedPassword),
tor: cfg.Tor,
bondBuf: map[uint32]valStamp{},
appVersion: cfg.AppVersion,
useDEXBranding: useDEXBranding,
}
s.lang.Store(lang)
Expand Down

0 comments on commit 553d2d0

Please sign in to comment.