Compare commits

...

2 Commits

Author SHA1 Message Date
jordi fita mas 18b38f593c Add the application’s version on the footer
This is mostly to reassure people that we are running the same version
as published on numerus.cat.  Or at least, try.

Go 1.18 adds the info from git if the package is build from a git
repository, but this is not the case in OBS, so i instead relay on a
constant for the version number.  This constant is “updated” by Debian’s
rules, mostly due to the discussion in [0].

[0]: https://github.com/golang/go/issues/22706
2024-01-19 20:03:04 +01:00
jordi fita mas 22ee6343e2 Use errors.Is to compare ErrServerClosed in main 2024-01-19 19:44:11 +01:00
8 changed files with 96 additions and 83 deletions

View File

@ -2,6 +2,7 @@ package main
import ( import (
"context" "context"
"errors"
"log" "log"
"net/http" "net/http"
"os" "os"
@ -29,7 +30,7 @@ func main() {
go func() { go func() {
log.Printf("INFO - listening on %s\n", srv.Addr) log.Printf("INFO - listening on %s\n", srv.Addr)
if err := srv.ListenAndServe(); err != http.ErrServerClosed { if err := srv.ListenAndServe(); !errors.Is(err, http.ErrServerClosed) {
log.Fatalf("http server: %v", err) log.Fatalf("http server: %v", err)
} }
}() }()

1
debian/rules vendored
View File

@ -4,6 +4,7 @@
dh $@ --builddirectory=_build --buildsystem=golang --with=golang dh $@ --builddirectory=_build --buildsystem=golang --with=golang
execute_before_dh_auto_build: execute_before_dh_auto_build:
printf 'package pkg; const Version = "%s"' "$(DEB_UPSTREAM_VERSION)" > pkg/build.go
make make
execute_after_dh_auto_test: execute_after_dh_auto_test:

3
pkg/build.go Normal file
View File

@ -0,0 +1,3 @@
package pkg
const Version = "1.1~git"

View File

@ -96,6 +96,9 @@ func mustRenderTemplate(wr io.Writer, r *http.Request, layout string, filename s
"slugify": func(s string) string { "slugify": func(s string) string {
return slugify(s) return slugify(s)
}, },
"numerusVersion": func() string {
return Version
},
}) })
if _, err := t.ParseFiles(templateFile(filename), templateFile(layout), templateFile("form.gohtml")); err != nil { if _, err := t.ParseFiles(templateFile(filename), templateFile(layout), templateFile("form.gohtml")); err != nil {
panic(err) panic(err)

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: numerus\n" "Project-Id-Version: numerus\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2023-11-06 13:50+0100\n" "POT-Creation-Date: 2024-01-19 19:57+0100\n"
"PO-Revision-Date: 2023-01-18 17:08+0100\n" "PO-Revision-Date: 2023-01-18 17:08+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n" "Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Catalan <ca@dodds.net>\n" "Language-Team: Catalan <ca@dodds.net>\n"
@ -288,26 +288,6 @@ msgctxt "title"
msgid "Edit Invoice “%s”" msgid "Edit Invoice “%s”"
msgstr "Edició de la factura «%s»" msgstr "Edició de la factura «%s»"
#: web/template/home.gohtml:9
msgid "If you want to sign in, just head to %sthe login page%s and enter your credentials in the form."
msgstr "Si vols accedir al teu usuari només has d'anar a %sla pàgina dentrada%s i apuntar les teves credencials al seu lloc."
#: web/template/home.gohtml:12
msgid "manager"
msgstr "gestor"
#: web/template/home.gohtml:16
msgid "Tool to simplify management for small business and freelancers"
msgstr "Eina per simplificar la gestió dautònoms i petites empreses."
#: web/template/home.gohtml:19
msgid "Reduce management time, take control of your balance."
msgstr "Redueix el temps de gestió, tingues controlats els teus números."
#: web/template/home.gohtml:20
msgid "application"
msgstr "aplicació"
#: web/template/form.gohtml:36 #: web/template/form.gohtml:36
msgctxt "input" msgctxt "input"
msgid "(Max. %s)" msgid "(Max. %s)"
@ -334,32 +314,27 @@ msgctxt "title"
msgid "Dashboard" msgid "Dashboard"
msgstr "Tauler" msgstr "Tauler"
#: web/template/dashboard.gohtml:29 #: web/template/dashboard.gohtml:31
msgctxt "term"
msgid "Sales"
msgstr "Vendes"
#: web/template/dashboard.gohtml:33
msgctxt "term" msgctxt "term"
msgid "Income" msgid "Income"
msgstr "Ingressos" msgstr "Ingressos"
#: web/template/dashboard.gohtml:37 #: web/template/dashboard.gohtml:35
msgctxt "term" msgctxt "term"
msgid "Expenses" msgid "Expenses"
msgstr "Despeses" msgstr "Despeses"
#: web/template/dashboard.gohtml:41 #: web/template/dashboard.gohtml:39
msgctxt "term" msgctxt "term"
msgid "VAT" msgid "VAT"
msgstr "IVA" msgstr "IVA"
#: web/template/dashboard.gohtml:45 #: web/template/dashboard.gohtml:43
msgctxt "term" msgctxt "term"
msgid "IRPF" msgid "IRPF"
msgstr "IRPF" msgstr "IRPF"
#: web/template/dashboard.gohtml:49 #: web/template/dashboard.gohtml:47
msgctxt "term" msgctxt "term"
msgid "Net Income" msgid "Net Income"
msgstr "Ingressos nets" msgstr "Ingressos nets"
@ -439,56 +414,60 @@ msgctxt "title"
msgid "Edit Quotation “%s”" msgid "Edit Quotation “%s”"
msgstr "Edició del pressupost «%s»" msgstr "Edició del pressupost «%s»"
#: web/template/app.gohtml:23 #: web/template/app.gohtml:24
msgctxt "menu" msgctxt "menu"
msgid "Account" msgid "Account"
msgstr "Compte" msgstr "Compte"
#: web/template/app.gohtml:29 #: web/template/app.gohtml:30
msgctxt "menu" msgctxt "menu"
msgid "Tax Details" msgid "Tax Details"
msgstr "Configuració fiscal" msgstr "Configuració fiscal"
#: web/template/app.gohtml:35 #: web/template/app.gohtml:36
msgctxt "menu" msgctxt "menu"
msgid "Switch Company" msgid "Switch Company"
msgstr "Canvi dempresa" msgstr "Canvi dempresa"
#: web/template/app.gohtml:43 #: web/template/app.gohtml:44
msgctxt "action" msgctxt "action"
msgid "Logout" msgid "Logout"
msgstr "Surt" msgstr "Surt"
#: web/template/app.gohtml:52 #: web/template/app.gohtml:53
msgctxt "nav" msgctxt "nav"
msgid "Dashboard" msgid "Dashboard"
msgstr "Tauler" msgstr "Tauler"
#: web/template/app.gohtml:53 #: web/template/app.gohtml:54
msgctxt "nav" msgctxt "nav"
msgid "Quotations" msgid "Quotations"
msgstr "Pressuposts" msgstr "Pressuposts"
#: web/template/app.gohtml:54 #: web/template/app.gohtml:55
msgctxt "nav" msgctxt "nav"
msgid "Invoices" msgid "Invoices"
msgstr "Factures" msgstr "Factures"
#: web/template/app.gohtml:55 #: web/template/app.gohtml:56
msgctxt "nav" msgctxt "nav"
msgid "Expenses" msgid "Expenses"
msgstr "Despeses" msgstr "Despeses"
#: web/template/app.gohtml:56 #: web/template/app.gohtml:57
msgctxt "nav" msgctxt "nav"
msgid "Products" msgid "Products"
msgstr "Productes" msgstr "Productes"
#: web/template/app.gohtml:57 #: web/template/app.gohtml:58
msgctxt "nav" msgctxt "nav"
msgid "Contacts" msgid "Contacts"
msgstr "Contactes" msgstr "Contactes"
#: web/template/app.gohtml:66
msgid "<a href=\"https://numerus.cat/\">Numerus</a> Version: %s"
msgstr "<a href=\"https://numerus.cat/\">Numerus</a> versió: %s"
#: web/template/contacts/new.gohtml:2 web/template/contacts/new.gohtml:11 #: web/template/contacts/new.gohtml:2 web/template/contacts/new.gohtml:11
#: web/template/contacts/new.gohtml:19 #: web/template/contacts/new.gohtml:19
msgctxt "title" msgctxt "title"
@ -1374,6 +1353,25 @@ msgctxt "input"
msgid "Holded Excel file" msgid "Holded Excel file"
msgstr "Fitxer Excel del Holded" msgstr "Fitxer Excel del Holded"
#~ msgid "If you want to sign in, just head to %sthe login page%s and enter your credentials in the form."
#~ msgstr "Si vols accedir al teu usuari només has d'anar a %sla pàgina dentrada%s i apuntar les teves credencials al seu lloc."
#~ msgid "manager"
#~ msgstr "gestor"
#~ msgid "Tool to simplify management for small business and freelancers"
#~ msgstr "Eina per simplificar la gestió dautònoms i petites empreses."
#~ msgid "Reduce management time, take control of your balance."
#~ msgstr "Redueix el temps de gestió, tingues controlats els teus números."
#~ msgid "application"
#~ msgstr "aplicació"
#~ msgctxt "term"
#~ msgid "Sales"
#~ msgstr "Vendes"
#~ msgctxt "title" #~ msgctxt "title"
#~ msgid "Switch Company" #~ msgid "Switch Company"
#~ msgstr "Canvi dempresa" #~ msgstr "Canvi dempresa"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: numerus\n" "Project-Id-Version: numerus\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2023-11-06 13:50+0100\n" "POT-Creation-Date: 2024-01-19 19:57+0100\n"
"PO-Revision-Date: 2023-01-18 17:45+0100\n" "PO-Revision-Date: 2023-01-18 17:45+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n" "Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Spanish <es@tp.org.es>\n" "Language-Team: Spanish <es@tp.org.es>\n"
@ -288,26 +288,6 @@ msgctxt "title"
msgid "Edit Invoice “%s”" msgid "Edit Invoice “%s”"
msgstr "Edición de la factura «%s»" msgstr "Edición de la factura «%s»"
#: web/template/home.gohtml:9
msgid "If you want to sign in, just head to %sthe login page%s and enter your credentials in the form."
msgstr "Si quieres acceder a tu usuario solo tienes que ir a %sla página de entrada% y anotar tus credenciales a su sitio."
#: web/template/home.gohtml:12
msgid "manager"
msgstr "gestor"
#: web/template/home.gohtml:16
msgid "Tool to simplify management for small business and freelancers"
msgstr "Herramienta para simplificar la gestión de autónomos y pequeñas empresas."
#: web/template/home.gohtml:19
msgid "Reduce management time, take control of your balance."
msgstr "Reduce el tiempo de gestión, ten controlados tus números."
#: web/template/home.gohtml:20
msgid "application"
msgstr "aplicación"
#: web/template/form.gohtml:36 #: web/template/form.gohtml:36
msgctxt "input" msgctxt "input"
msgid "(Max. %s)" msgid "(Max. %s)"
@ -334,32 +314,27 @@ msgctxt "title"
msgid "Dashboard" msgid "Dashboard"
msgstr "Panel" msgstr "Panel"
#: web/template/dashboard.gohtml:29 #: web/template/dashboard.gohtml:31
msgctxt "term"
msgid "Sales"
msgstr "Ventas"
#: web/template/dashboard.gohtml:33
msgctxt "term" msgctxt "term"
msgid "Income" msgid "Income"
msgstr "Ingresos" msgstr "Ingresos"
#: web/template/dashboard.gohtml:37 #: web/template/dashboard.gohtml:35
msgctxt "term" msgctxt "term"
msgid "Expenses" msgid "Expenses"
msgstr "Gastos" msgstr "Gastos"
#: web/template/dashboard.gohtml:41 #: web/template/dashboard.gohtml:39
msgctxt "term" msgctxt "term"
msgid "VAT" msgid "VAT"
msgstr "IVA" msgstr "IVA"
#: web/template/dashboard.gohtml:45 #: web/template/dashboard.gohtml:43
msgctxt "term" msgctxt "term"
msgid "IRPF" msgid "IRPF"
msgstr "IRPF" msgstr "IRPF"
#: web/template/dashboard.gohtml:49 #: web/template/dashboard.gohtml:47
msgctxt "term" msgctxt "term"
msgid "Net Income" msgid "Net Income"
msgstr "Ingresos netos" msgstr "Ingresos netos"
@ -439,56 +414,60 @@ msgctxt "title"
msgid "Edit Quotation “%s”" msgid "Edit Quotation “%s”"
msgstr "Edición del presupuesto «%s»" msgstr "Edición del presupuesto «%s»"
#: web/template/app.gohtml:23 #: web/template/app.gohtml:24
msgctxt "menu" msgctxt "menu"
msgid "Account" msgid "Account"
msgstr "Cuenta" msgstr "Cuenta"
#: web/template/app.gohtml:29 #: web/template/app.gohtml:30
msgctxt "menu" msgctxt "menu"
msgid "Tax Details" msgid "Tax Details"
msgstr "Configuración fiscal" msgstr "Configuración fiscal"
#: web/template/app.gohtml:35 #: web/template/app.gohtml:36
msgctxt "menu" msgctxt "menu"
msgid "Switch Company" msgid "Switch Company"
msgstr "Cambio de empresa" msgstr "Cambio de empresa"
#: web/template/app.gohtml:43 #: web/template/app.gohtml:44
msgctxt "action" msgctxt "action"
msgid "Logout" msgid "Logout"
msgstr "Salir" msgstr "Salir"
#: web/template/app.gohtml:52 #: web/template/app.gohtml:53
msgctxt "nav" msgctxt "nav"
msgid "Dashboard" msgid "Dashboard"
msgstr "Panel" msgstr "Panel"
#: web/template/app.gohtml:53 #: web/template/app.gohtml:54
msgctxt "nav" msgctxt "nav"
msgid "Quotations" msgid "Quotations"
msgstr "Presupuestos" msgstr "Presupuestos"
#: web/template/app.gohtml:54 #: web/template/app.gohtml:55
msgctxt "nav" msgctxt "nav"
msgid "Invoices" msgid "Invoices"
msgstr "Facturas" msgstr "Facturas"
#: web/template/app.gohtml:55 #: web/template/app.gohtml:56
msgctxt "nav" msgctxt "nav"
msgid "Expenses" msgid "Expenses"
msgstr "Gastos" msgstr "Gastos"
#: web/template/app.gohtml:56 #: web/template/app.gohtml:57
msgctxt "nav" msgctxt "nav"
msgid "Products" msgid "Products"
msgstr "Productos" msgstr "Productos"
#: web/template/app.gohtml:57 #: web/template/app.gohtml:58
msgctxt "nav" msgctxt "nav"
msgid "Contacts" msgid "Contacts"
msgstr "Contactos" msgstr "Contactos"
#: web/template/app.gohtml:66
msgid "<a href=\"https://numerus.cat/\">Numerus</a> Version: %s"
msgstr "<a href=\"https://numerus.cat/\">Numerus</a> versión: %s"
#: web/template/contacts/new.gohtml:2 web/template/contacts/new.gohtml:11 #: web/template/contacts/new.gohtml:2 web/template/contacts/new.gohtml:11
#: web/template/contacts/new.gohtml:19 #: web/template/contacts/new.gohtml:19
msgctxt "title" msgctxt "title"
@ -1374,6 +1353,25 @@ msgctxt "input"
msgid "Holded Excel file" msgid "Holded Excel file"
msgstr "Archivo Excel de Holded" msgstr "Archivo Excel de Holded"
#~ msgid "If you want to sign in, just head to %sthe login page%s and enter your credentials in the form."
#~ msgstr "Si quieres acceder a tu usuario solo tienes que ir a %sla página de entrada% y anotar tus credenciales a su sitio."
#~ msgid "manager"
#~ msgstr "gestor"
#~ msgid "Tool to simplify management for small business and freelancers"
#~ msgstr "Herramienta para simplificar la gestión de autónomos y pequeñas empresas."
#~ msgid "Reduce management time, take control of your balance."
#~ msgstr "Reduce el tiempo de gestión, ten controlados tus números."
#~ msgid "application"
#~ msgstr "aplicación"
#~ msgctxt "term"
#~ msgid "Sales"
#~ msgstr "Ventas"
#~ msgctxt "title" #~ msgctxt "title"
#~ msgid "Switch Company" #~ msgid "Switch Company"
#~ msgstr "Cambio de empresa" #~ msgstr "Cambio de empresa"

View File

@ -314,6 +314,12 @@ main {
padding: 2rem 3rem; padding: 2rem 3rem;
} }
body > footer {
border-top: 1px solid var(--numerus--color--light-gray);
font-size: 75%;
padding: .25em 3rem;
}
.input { .input {
margin-top: 2rem; margin-top: 2rem;
flex: 1; flex: 1;

View File

@ -62,6 +62,9 @@
{{- template "breadcrumbs" . }} {{- template "breadcrumbs" . }}
{{- template "content" . }} {{- template "content" . }}
</main> </main>
<footer>
<p>{{printf ( gettext "<a href=\"https://numerus.cat/\">Numerus</a> Version: %s") numerusVersion | unsafe}}</p>
</footer>
</body> </body>
<div x-data="snackbar"> <div x-data="snackbar">
<div x-show="show" <div x-show="show"