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
10 changes: 10 additions & 0 deletions client/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -195,6 +196,7 @@ func (cfg *Config) Web(c *core.Core, mm *mm.MarketMaker, log dex.Logger, utc boo
KeyFile: keyFile,
NoEmbed: cfg.NoEmbedSite,
HttpProf: cfg.HTTPProfile,
AppVersion: cfg.AppVersion,
Language: cfg.Language,
}
}
Expand Down Expand Up @@ -348,9 +350,17 @@ func ResolveConfig(appData string, cfg *Config) error {
if cfg.MMConfig.EventLogDBPath == "" {
cfg.MMConfig.EventLogDBPath = defaultMMEventLogDBPath
}

cfg.AppVersion = userAppVersion(Version)
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 @@ -260,13 +262,15 @@ 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),
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 @@ -135,6 +135,7 @@ var DeDE = map[string]*intl.Translation{
"Export Account": {T: "Account exportieren"},
"simultaneous_servers_msg": {T: "Der <span class=brand></span> unterstützt die gleichzeitige Nutzung einer beliebigen Anzahl von DEX-Servern."},
"Change App Password": {T: "App-Passwort ändern"},
"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 @@ -167,6 +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"},
"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 @@ -135,6 +135,7 @@ var ZhCN = map[string]*intl.Translation{
"Export Account": {T: "退出账户"},
"simultaneous_servers_msg": {T: "Decred DEX 客户端支持同时使用任意数量的 DEX 服务器。"},
"Change App Password": {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 @@ -97,7 +97,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 @@ -118,8 +118,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 @@ -229,7 +229,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 @@ -270,6 +271,8 @@ type WebServer struct {
bondBufMtx sync.Mutex
bondBuf map[uint32]valStamp

appVersion string

useDEXBranding bool
}

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