logo updates (#186)

Reviewed-on: https://git.ptzo.gdn/feditools/relay/pulls/186
Co-authored-by: Tyr Mactire <tyr@pettingzoo.co>
Co-committed-by: Tyr Mactire <tyr@pettingzoo.co>
This commit is contained in:
Tyr Mactire 2023-03-12 01:23:01 +00:00 committed by PettingZoo Gitea
parent cdaec9b3e0
commit 83b3d41008
No known key found for this signature in database
GPG Key ID: 39788A4390A1372F
10 changed files with 75 additions and 20 deletions

View File

@ -26,8 +26,8 @@ func Server(cmd *cobra.Command, values config.Values) {
cmd.PersistentFlags().String(config.Keys.WebappChartJSIntegrity, values.WebappChartJSIntegrity, usage.WebappChartJSIntegrity)
cmd.PersistentFlags().String(config.Keys.WebappFontAwesomeCSSURI, values.WebappFontAwesomeCSSURI, usage.WebappFontAwesomeCSSURI)
cmd.PersistentFlags().String(config.Keys.WebappFontAwesomeCSSIntegrity, values.WebappFontAwesomeCSSIntegrity, usage.WebappFontAwesomeCSSIntegrity)
cmd.PersistentFlags().String(config.Keys.WebappLogoSrcDark, values.WebappLogoSrcDark, usage.WebappLogoSrcDark)
cmd.PersistentFlags().String(config.Keys.WebappLogoSrcLight, values.WebappLogoSrcLight, usage.WebappLogoSrcLight)
cmd.PersistentFlags().String(config.Keys.WebappLogoMascot, values.WebappLogoMascot, usage.WebappLogoMascot)
cmd.PersistentFlags().String(config.Keys.WebappLogoHorizontal, values.WebappLogoHorizontal, usage.WebappLogoHorizontal)
// metrics
cmd.PersistentFlags().String(config.Keys.MetricsHTTPBind, values.MetricsHTTPBind, usage.MetricsHTTPBind)

View File

@ -56,8 +56,8 @@ type KeyNames struct {
WebappChartJSIntegrity string
WebappFontAwesomeCSSURI string
WebappFontAwesomeCSSIntegrity string
WebappLogoSrcDark string
WebappLogoSrcLight string
WebappLogoMascot string
WebappLogoHorizontal string
// account
Account string
@ -123,8 +123,8 @@ var Keys = KeyNames{
WebappChartJSIntegrity: "webapp-chart-js-integrity",
WebappFontAwesomeCSSURI: "webapp-fontawesome-css-uri",
WebappFontAwesomeCSSIntegrity: "webapp-fontawesome-css-integrity",
WebappLogoSrcDark: "webapp-logo-src-dark",
WebappLogoSrcLight: "webapp-logo-src-light",
WebappLogoMascot: "webapp-logo-mascot",
WebappLogoHorizontal: "webapp-logo-horizontal",
// account
Account: "account",

View File

@ -56,8 +56,8 @@ type Values struct {
WebappChartJSIntegrity string
WebappFontAwesomeCSSURI string
WebappFontAwesomeCSSIntegrity string
WebappLogoSrcDark string
WebappLogoSrcLight string
WebappLogoMascot string
WebappLogoHorizontal string
// account
Account string
@ -120,8 +120,8 @@ var Defaults = Values{
WebappChartJSIntegrity: "sha384-9MhbyIRcBVQiiC7FSd7T38oJNj2Zh+EfxS7/vjhBi4OOT78NlHSnzM31EZRWR1LZ",
WebappFontAwesomeCSSURI: "https://assets.fedi.tools/vendor/fontawesome-free-6.1.1/css/all.min.css",
WebappFontAwesomeCSSIntegrity: "sha384-/frq1SRXYH/bSyou/HUp/hib7RVN1TawQYja658FEOodR/FQBKVqT9Ol+Oz3Olq5",
WebappLogoSrcDark: "https://assets.fedi.tools/img/feditools-logo-dark.svg",
WebappLogoSrcLight: "https://assets.fedi.tools/img/feditools-logo-light.svg",
WebappLogoMascot: "https://assets.fedi.tools/img/feditools-logo-dark.svg",
WebappLogoHorizontal: "https://assets.fedi.tools/img/feditools-logo-dark.svg",
// metrics
MetricsHTTPBind: ":9218",

View File

@ -42,8 +42,8 @@ func New(tokz *token.Tokenizer) (*template.Template, error) {
"formatDateTimeUTC": formatDateTimeUTC,
"olderThan24Hours": genOlderThan(hours24),
"olderThan7Days": genOlderThan(days7),
"logoSrcDark": genString(viper.GetString(config.Keys.WebappLogoSrcDark)),
"logoSrcLight": genString(viper.GetString(config.Keys.WebappLogoSrcLight)),
"logoMascot": genString(viper.GetString(config.Keys.WebappLogoMascot)),
"logoHorizontal": genString(viper.GetString(config.Keys.WebappLogoHorizontal)),
"pathAppAdminBlockExport": path.GenAppAdminBlockExport,
"pathAppAdminBlockExportCSV": path.GenAppAdminBlockExportCSV,
"pathAppAdminBlockExportJSON": path.GenAppAdminBlockExportJSON,

View File

@ -2,8 +2,10 @@ package webapp
import (
"fmt"
"git.ptzo.gdn/feditools/relay/internal/config"
"git.ptzo.gdn/feditools/relay/internal/http/template"
"git.ptzo.gdn/feditools/relay/internal/path"
"github.com/spf13/viper"
"net/http"
)
@ -14,7 +16,7 @@ func (m *Module) returnErrorPage(w http.ResponseWriter, r *http.Request, code in
tmplVars := &template.Error{}
// set image
tmplVars.Image = m.logoSrcDark
tmplVars.Image = viper.GetString(config.Keys.WebappLogoMascot)
// set text
tmplVars.Header = fmt.Sprintf("%d", code)

View File

@ -3,9 +3,11 @@ package webapp
import (
"errors"
libtemplate "git.ptzo.gdn/feditools/go-lib/template"
"git.ptzo.gdn/feditools/relay/internal/config"
"git.ptzo.gdn/feditools/relay/internal/db"
"git.ptzo.gdn/feditools/relay/internal/http/template"
"git.ptzo.gdn/feditools/relay/internal/language"
"github.com/spf13/viper"
"net/http"
)
@ -87,7 +89,7 @@ func (m *Module) displayLoginPage(w http.ResponseWriter, r *http.Request, instan
Value: instance,
Required: true,
},
LogoHRef: m.logoSrcDark,
LogoHRef: viper.GetString(config.Keys.WebappLogoMascot),
},
}

View File

@ -44,8 +44,6 @@ type Module struct {
tracerAttrs []trace.SpanStartOption
domain string
logoSrcDark string
logoSrcLight string
headLinks []libtemplate.HeadLink
footerScripts []libtemplate.Script
footerScriptChartJS libtemplate.Script
@ -146,8 +144,6 @@ func New(
},
domain: viper.GetString(config.Keys.ServerExternalHostname),
logoSrcDark: viper.GetString(config.Keys.WebappLogoSrcDark),
logoSrcLight: viper.GetString(config.Keys.WebappLogoSrcLight),
headLinks: hl,
footerScripts: fs,
footerScriptChartJS: fsCanvasJS,

View File

@ -6,7 +6,7 @@
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
<p class="col-md-4 mb-0 text-muted">{{ applicationName }} {{ softwareVersion }}</p>
<div class="col-md-4 d-flex align-items-center justify-content-center mb-3 mb-md-0 me-md-auto link-dark text-decoration-none">
<img src="{{ logoSrcDark }}" class="bi me-2" alt="robot" height="32">
<img src="{{ logoHorizontal }}" class="bi me-2" alt="robot" height="32">
</div>
<ul class="nav col-md-4 justify-content-end">
<li class="nav-item" lang="{{ $textHome.Language }}"><a href="{{ pathAppHome }}" class="nav-link px-2 text-muted">{{ $textHome }}</a></li>

55
web/template/login.gohtml Normal file
View File

@ -0,0 +1,55 @@
{{ define "login" -}}
<!doctype html>
<html lang="{{ .Language }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title lang="{{ .TextLogin.Language }}">{{ .TextLogin }}</title>
{{ range $link := .HeadLinks }}
{{template "head_link" $link -}}
{{- end }}
<style>
html,
body {
height: 100%;
}
body {
display: -ms-flexbox;
display: flex;
-ms-flex-align: center;
align-items: center;
padding-top: 40px;
padding-bottom: 40px;
}
.centerbox {
width: 100%;
padding: 15px;
margin: auto;
}
.centerbox .form-control {
margin-bottom: 20px;
}
</style>
</head>
<body class="text-center bg-light">
<div class="centerbox" style="max-width: 330px">
<form method="post">
<img class="mb-4" src="{{ .LogoHRef }}" alt="Logo" height="100">
<h1 class="h3 mb-3 font-weight-normal" lang="{{ .TextLogin.Language }}">{{ .TextLogin }}</h1>
{{- if .FormError }}
{{ template "alert" .FormError}}
{{- end }}
{{ template "form_input" .FormInstance}}
<button type="submit" class="btn btn-lg btn-primary btn-block" lang="{{ .TextLogin.Language }}">{{ .TextLogin }}</button>
</form>
</div>
{{- range $link := .FooterScripts}}
{{template "script" $link }}
{{- end}}
</body>
</html>
{{ end }}

View File

@ -6,7 +6,7 @@
<nav class="navbar navbar-expand-lg {{ if .NavBarDark }}navbar-dark bg-primary{{ else }}bg-light{{ end }}">
<div class="container-fluid">
<div class="navbar-brand">
<img src="{{ if .NavBarDark }}{{ logoSrcLight }}{{ else }}{{ logoSrcDark }}{{ end }}" alt="robot" height="25" class="d-inline-block align-top">
<img src="{{ logoMascot }}" alt="logo" height="25" class="d-inline-block align-top">
<span lang="{{ $textRelay.Language }}">{{ $textRelay }}</span>
</div>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">