Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions client/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ type Config struct {
WebConfig
LogConfig
MMConfig
AppVersion string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add this.

// 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.
Expand Down Expand Up @@ -195,6 +196,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: cfg.AppVersion,
Comment on lines +199 to +201
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NoEmbed: cfg.NoEmbedSite,
HttpProf: cfg.HTTPProfile,
AppVersion: cfg.AppVersion,
AppVersion: userAppVersion(Version),

Language: cfg.Language,
Tor: cfg.Tor,
}
Expand Down Expand Up @@ -349,9 +353,17 @@ func ResolveConfig(appData string, cfg *Config) error {
if cfg.MMConfig.EventLogDBPath == "" {
cfg.MMConfig.EventLogDBPath = defaultMMEventLogDBPath
}

cfg.AppVersion = userAppVersion(Version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add to this config I think.

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
4 changes: 4 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 Expand Up @@ -292,13 +294,15 @@ func (s *WebServer) handleSettings(w http.ResponseWriter, r *http.Request) {
FiatCurrency string
Exchanges map[string]*core.Exchange
IsInitialized bool
AppVersion string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is currently unused, can remove.

}{
CommonArguments: *common,
KnownExchanges: s.knownUnregisteredExchanges(xcs),
FiatCurrency: core.DefaultFiatCurrency,
FiatRateSources: s.core.FiatRateSources(),
Exchanges: xcs,
IsInitialized: s.core.IsInitialized(),
AppVersion: s.appVersion,
}
s.sendTemplate(w, "settings", data)
}
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
Loading