From 48e1d427aa14937b08b4e6a9232822fd36c9c3b1 Mon Sep 17 00:00:00 2001 From: Augustin Godiscal Date: Wed, 26 Mar 2025 15:40:57 +0100 Subject: [PATCH 01/10] Serve static files from public directory --- cmd/run_server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/run_server.go b/cmd/run_server.go index a26cd32..d45e55d 100644 --- a/cmd/run_server.go +++ b/cmd/run_server.go @@ -50,6 +50,10 @@ func RunServer(configBackend string) error { services.OauthService.RegisterRoutes(router, "/v1/oauth") webRoutes := mux.NewRouter() + + // Serve static files under ../public + webRoutes.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("../public/")))) + services.WebService.RegisterRoutes(webRoutes, "/web") CSRF := csrf.Protect( From 199893a0afb0c4aba707191a9222547d8517f04d Mon Sep 17 00:00:00 2001 From: Augustin Godiscal Date: Wed, 26 Mar 2025 15:41:44 +0100 Subject: [PATCH 02/10] Add version key to config file --- config.sample.json | 1 + config/config.go | 1 + 2 files changed, 2 insertions(+) diff --git a/config.sample.json b/config.sample.json index 7b316c9..1d515f1 100644 --- a/config.sample.json +++ b/config.sample.json @@ -1,5 +1,6 @@ { "Hostname": "id.resonate.localhost", + "Version":"1.2.0-0", "Clients": [ { "ConnectUrl": "https://stream.resonate.localhost/api/v3/user/connect/resonate", diff --git a/config/config.go b/config/config.go index 352e433..3f821b7 100644 --- a/config/config.go +++ b/config/config.go @@ -80,6 +80,7 @@ type UserAPIConfig struct { // Config stores all configuration options type Config struct { Hostname string + Version string // versioning for static assets CSRF CSRFConfig Mailgun MailgunConfig Database DatabaseConfig From 5812d7fa332924b48159f5ff8087698a8f151c11 Mon Sep 17 00:00:00 2001 From: Augustin Godiscal Date: Wed, 26 Mar 2025 15:42:19 +0100 Subject: [PATCH 03/10] Disable css minification --- postcss.config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/postcss.config.js b/postcss.config.js index d04430a..938f922 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -10,7 +10,6 @@ module.exports = { }, 'nesting-rules': true } - }), - require('postcss-minify')() + }) ] } From 42628d616c7bdea3436cb36fecbf67f59acf5f8c Mon Sep 17 00:00:00 2001 From: Augustin Godiscal Date: Wed, 26 Mar 2025 15:54:53 +0100 Subject: [PATCH 04/10] Minor layout fixes and restore css files with @resonate/tachyons import --- assets/css/main.css | 249 ++++++++++++++++++++++++++++++++++++++++++++ package-lock.json | 44 ++++++-- package.json | 5 +- web/header.pug | 16 +-- web/join.pug | 7 +- web/layout.pug | 9 +- web/login.pug | 2 +- 7 files changed, 308 insertions(+), 24 deletions(-) create mode 100644 assets/css/main.css diff --git a/assets/css/main.css b/assets/css/main.css new file mode 100644 index 0000000..5ddb9d2 --- /dev/null +++ b/assets/css/main.css @@ -0,0 +1,249 @@ +@import '@resonate/tachyons'; + +.search-component .search-label { + top: 50%; + transform: translateY(-50%); +} + +.search-component input[type="search"] { + appearance: none; + text-indent: 1rem; + font-family: inherit; + height: calc(3rem - 1px); +} + +.search-component input[type="search"]::-webkit-search-cancel-button { + appearance: none; +} + +.typeahead { + visibility: hidden; + opacity: 0; + display: none; +} + +.search-component form:focus-within input[type="search"] { + height: 3rem; + outline-style: solid; + outline-width: 1px; + outline-color: var(--dark-gray); + outline-offset: -1px; +} + +@media (prefers-color-scheme: dark) { + .search-component form:focus-within input[type="search"] { + outline-color: var(--near-black); + } +} + +.color-scheme--dark .search-component form:focus-within input[type="search"] { + outline-color: var(--near-black); +} + +.search-component form:focus-within > div.typeahead { + visibility: visible; + z-index: 1; + opacity: 1; + display: block; +} + +/** + * styling for radio + checkbox + */ + +input[type="radio"] { + opacity: 0; + width: 0; + height: 0; +} + +input[type="radio"]:active ~ label { + opacity: 1; +} + +input[type="radio"]:checked ~ label { + opacity: 1; +} + +input[type="radio"]:checked ~ label .icon { + fill: var(--black); +} + +input[type="checkbox"] ~ label .icon { + fill: transparent; +} + +input[type="checkbox"]:checked ~ label .icon { + fill: var(--black); +} + +/** + * Offset margin + */ + +.ml-3 { + margin-left: -1rem; +} + +.mr-3 { + margin-right: -1rem; +} + +/** + * Custom html styling for radio + checkbox + */ + +input[type="radio"] { + opacity: 0; + width: 0; + height: 0; +} + +input[type="radio"]:active ~ label { + opacity: 1; +} + +input[type="radio"]:checked ~ label { + opacity: 1; +} + +input[type="radio"]:checked ~ label .icon { + fill: hsl(210, 4%, 10%); + fill: var(--black); +} + +input[type="checkbox"] ~ label .icon { + fill: transparent; +} + +input[type="checkbox"]:checked ~ label .icon { + fill: hsl(210, 4%, 10%); + fill: var(--black); +} + +/** + * Offset margin + */ + +.ml-3 { + margin-left: -1rem; +} + +.mr-3 { + margin-right: -1rem; +} + +/** + * Custom html