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.WebappChartJSIntegrity, values.WebappChartJSIntegrity, usage.WebappChartJSIntegrity)
cmd.PersistentFlags().String(config.Keys.WebappFontAwesomeCSSURI, values.WebappFontAwesomeCSSURI, usage.WebappFontAwesomeCSSURI) 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.WebappFontAwesomeCSSIntegrity, values.WebappFontAwesomeCSSIntegrity, usage.WebappFontAwesomeCSSIntegrity)
cmd.PersistentFlags().String(config.Keys.WebappLogoSrcDark, values.WebappLogoSrcDark, usage.WebappLogoSrcDark) cmd.PersistentFlags().String(config.Keys.WebappLogoMascot, values.WebappLogoMascot, usage.WebappLogoMascot)
cmd.PersistentFlags().String(config.Keys.WebappLogoSrcLight, values.WebappLogoSrcLight, usage.WebappLogoSrcLight) cmd.PersistentFlags().String(config.Keys.WebappLogoHorizontal, values.WebappLogoHorizontal, usage.WebappLogoHorizontal)
// metrics // metrics
cmd.PersistentFlags().String(config.Keys.MetricsHTTPBind, values.MetricsHTTPBind, usage.MetricsHTTPBind) cmd.PersistentFlags().String(config.Keys.MetricsHTTPBind, values.MetricsHTTPBind, usage.MetricsHTTPBind)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,8 +44,6 @@ type Module struct {
tracerAttrs []trace.SpanStartOption tracerAttrs []trace.SpanStartOption
domain string domain string
logoSrcDark string
logoSrcLight string
headLinks []libtemplate.HeadLink headLinks []libtemplate.HeadLink
footerScripts []libtemplate.Script footerScripts []libtemplate.Script
footerScriptChartJS libtemplate.Script footerScriptChartJS libtemplate.Script
@ -146,8 +144,6 @@ func New(
}, },
domain: viper.GetString(config.Keys.ServerExternalHostname), domain: viper.GetString(config.Keys.ServerExternalHostname),
logoSrcDark: viper.GetString(config.Keys.WebappLogoSrcDark),
logoSrcLight: viper.GetString(config.Keys.WebappLogoSrcLight),
headLinks: hl, headLinks: hl,
footerScripts: fs, footerScripts: fs,
footerScriptChartJS: fsCanvasJS, 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"> <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> <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"> <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> </div>
<ul class="nav col-md-4 justify-content-end"> <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> <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 }}"> <nav class="navbar navbar-expand-lg {{ if .NavBarDark }}navbar-dark bg-primary{{ else }}bg-light{{ end }}">
<div class="container-fluid"> <div class="container-fluid">
<div class="navbar-brand"> <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> <span lang="{{ $textRelay.Language }}">{{ $textRelay }}</span>
</div> </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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">