Rename htmlpage to html
Because it's going to get more tools.
4
.gitignore
vendored
|
|
@ -1,5 +1,5 @@
|
|||
nidus-sync
|
||||
htmlpage/static/css/bootstrap.css
|
||||
htmlpage/static/css/bootstrap.css.map
|
||||
html/static/css/bootstrap.css
|
||||
html/static/css/bootstrap.css.map
|
||||
.sass-cache/
|
||||
tmp/
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ We're using a customized Bootstrap theme for this site. You'll need to build the
|
|||
```
|
||||
nix develop
|
||||
cd scss
|
||||
scss custom.scss > ../htmlpage/static/css/bootstrap.css
|
||||
scss custom.scss > ../html/static/css/bootstrap.css
|
||||
```
|
||||
|
||||
## Running
|
||||
|
|
@ -90,5 +90,5 @@ This uses [goose](https://github.com/pressly/goose). You can use the goose comma
|
|||
For iterating on styles
|
||||
|
||||
```
|
||||
watchexec -e *.scss sass --style=compressed scss/custom.scss:htmlpage/static/css/bootstrap.css
|
||||
watchexec -e *.scss sass --style=compressed scss/custom.scss:html/static/css/bootstrap.css
|
||||
```
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pkgs.buildGoModule rec {
|
|||
preBuild = ''
|
||||
|
||||
SASS_SRC_DIR="./scss"
|
||||
CSS_OUTPUT_DIR="./htmlpage/static/css/"
|
||||
CSS_OUTPUT_DIR="./html/static/css/"
|
||||
|
||||
mkdir -p "$CSS_OUTPUT_DIR"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package htmlpage
|
||||
package html
|
||||
|
||||
import (
|
||||
"embed"
|
||||
|
|
@ -12,6 +12,7 @@ import (
|
|||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/config"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
// FileServer conveniently sets up a http.FileServer handler to serve
|
||||
|
|
@ -36,9 +37,21 @@ func FileServer(r chi.Router, path string, root http.FileSystem, embeddedFS embe
|
|||
|
||||
var err error
|
||||
var fileToServe http.File
|
||||
found := false
|
||||
|
||||
if config.IsProductionEnvironment() {
|
||||
// For dev, try the current filesystem
|
||||
if !config.IsProductionEnvironment() {
|
||||
// Try to open from local filesystem for development
|
||||
fileToServe, err = root.Open(requestedPath)
|
||||
if err != nil {
|
||||
log.Warn().Str("path", requestedPath).Msg("Failed to read static file for dev")
|
||||
found = false
|
||||
} else {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
// For production use the embedded filesystem
|
||||
if !found {
|
||||
embeddedFilePath := filepath.Join(embeddedPath, requestedPath)
|
||||
embeddedFile, err := embeddedFS.Open(embeddedFilePath)
|
||||
|
||||
|
|
@ -49,14 +62,6 @@ func FileServer(r chi.Router, path string, root http.FileSystem, embeddedFS embe
|
|||
|
||||
// Wrap the embedded file to implement http.File interface
|
||||
fileToServe = &embeddedFileWrapper{embeddedFile}
|
||||
|
||||
} else {
|
||||
// Try to open from local filesystem for development
|
||||
fileToServe, err = root.Open(requestedPath)
|
||||
if err != nil {
|
||||
RespondError(w, "Failed to open file", err, http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Create a custom ResponseWriter that allows us to modify headers
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package htmlpage
|
||||
package html
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package htmlpage
|
||||
package html
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package htmlpage
|
||||
package html
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
package htmlpage
|
||||
package html
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
//go:embed static/*
|
||||
|
|
@ -14,7 +16,7 @@ var localFS http.Dir
|
|||
|
||||
func AddStaticRoute(r chi.Router, path string) {
|
||||
if localFS == "" {
|
||||
localFS = http.Dir("./htmlpage/static")
|
||||
localFS = http.Dir("./html/static")
|
||||
}
|
||||
FileServer(r, "/static", localFS, EmbeddedStaticFS, "static")
|
||||
}
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 130 KiB |
|
|
@ -4,7 +4,7 @@ import (
|
|||
"net/http"
|
||||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/config"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/go-chi/chi/v5"
|
||||
)
|
||||
|
||||
|
|
@ -57,17 +57,16 @@ func makeContentURL(slug string) ContentURL {
|
|||
Water: makeURLMock(slug, "water"),
|
||||
}
|
||||
}
|
||||
|
||||
func makeURLMock(slug, p string) string {
|
||||
return config.MakeURLReport("/mock/district/%s/%s", slug, p)
|
||||
}
|
||||
func renderMock(t *htmlpage.BuiltTemplate) func(http.ResponseWriter, *http.Request) {
|
||||
func renderMock(t *html.BuiltTemplate) func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
slug := chi.URLParam(r, "slug")
|
||||
if slug == "" {
|
||||
slug = "delta-mvcd"
|
||||
}
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
t,
|
||||
ContentMock{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/Gleipnir-Technology/nidus-sync/db"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/aarondl/opt/omit"
|
||||
"github.com/aarondl/opt/omitnull"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
|
@ -26,7 +26,7 @@ var (
|
|||
)
|
||||
|
||||
func getNuisance(w http.ResponseWriter, r *http.Request) {
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
Nuisance,
|
||||
ContextNuisance{},
|
||||
|
|
@ -34,7 +34,7 @@ func getNuisance(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
func getNuisanceSubmitComplete(w http.ResponseWriter, r *http.Request) {
|
||||
report := r.URL.Query().Get("report")
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
NuisanceSubmitComplete,
|
||||
ContextNuisanceSubmitComplete{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/Gleipnir-Technology/nidus-sync/db"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/aarondl/opt/omit"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
|
@ -31,7 +31,7 @@ var (
|
|||
)
|
||||
|
||||
func getPool(w http.ResponseWriter, r *http.Request) {
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
Pool,
|
||||
ContextPool{
|
||||
|
|
@ -41,7 +41,7 @@ func getPool(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
func getPoolSubmitComplete(w http.ResponseWriter, r *http.Request) {
|
||||
report := r.URL.Query().Get("report")
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
PoolSubmitComplete,
|
||||
ContextPoolSubmitComplete{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import (
|
|||
"github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/h3utils"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/platform/text"
|
||||
"github.com/aarondl/opt/omit"
|
||||
|
|
@ -44,7 +44,7 @@ var (
|
|||
)
|
||||
|
||||
func getQuick(w http.ResponseWriter, r *http.Request) {
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
quickT,
|
||||
ContentQuick{},
|
||||
|
|
@ -80,7 +80,7 @@ func getQuickSubmitComplete(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
}
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
quickSubmitCompleteT,
|
||||
ContentQuickSubmitComplete{
|
||||
|
|
@ -91,7 +91,7 @@ func getQuickSubmitComplete(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
func getRegisterNotificationsComplete(w http.ResponseWriter, r *http.Request) {
|
||||
report := r.URL.Query().Get("report")
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
registerNotificationsCompleteT,
|
||||
ContentRegisterNotificationsComplete{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"net/http"
|
||||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/config"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ var (
|
|||
)
|
||||
|
||||
func getPrivacy(w http.ResponseWriter, r *http.Request) {
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
PrivacyT,
|
||||
ContentPrivacy{
|
||||
|
|
@ -36,7 +36,7 @@ func getPrivacy(w http.ResponseWriter, r *http.Request) {
|
|||
)
|
||||
}
|
||||
func getRoot(w http.ResponseWriter, r *http.Request) {
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
RootT,
|
||||
ContentRoot{},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package rmo
|
||||
|
||||
import (
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/go-chi/chi/v5"
|
||||
)
|
||||
|
||||
|
|
@ -28,6 +28,6 @@ func Router() chi.Router {
|
|||
r.Get("/status", getStatus)
|
||||
r.Get("/status/{report_id}", getStatusByID)
|
||||
r.Get("/terms-of-service", getTerms)
|
||||
htmlpage.AddStaticRoute(r, "/static")
|
||||
html.AddStaticRoute(r, "/static")
|
||||
return r
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"net/http"
|
||||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/config"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
)
|
||||
|
||||
type ContentSearch struct {
|
||||
|
|
@ -17,7 +17,7 @@ var (
|
|||
)
|
||||
|
||||
func getSearch(w http.ResponseWriter, r *http.Request) {
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
Search,
|
||||
ContentSearch{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/Gleipnir-Technology/nidus-sync/db"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/sql"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/stephenafamo/scan"
|
||||
|
|
@ -84,7 +84,7 @@ func formatReportID(s string) string {
|
|||
func getStatus(w http.ResponseWriter, r *http.Request) {
|
||||
report_id_str := r.URL.Query().Get("report")
|
||||
if report_id_str == "" {
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
Status,
|
||||
ContentStatus{
|
||||
|
|
@ -103,7 +103,7 @@ func getStatus(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
if len(results) != 1 {
|
||||
log.Error().Int("count", len(results)).Str("report_id", report_id_str).Msg("Got too many results for report id. This is a programmer error.")
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
Status,
|
||||
ContentStatus{
|
||||
|
|
@ -117,7 +117,7 @@ func getStatus(w http.ResponseWriter, r *http.Request) {
|
|||
http.Redirect(w, r, fmt.Sprintf("/status/%s", report_id), http.StatusFound)
|
||||
return
|
||||
}
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
Status,
|
||||
ContentStatus{
|
||||
|
|
@ -226,7 +226,7 @@ func getStatusByID(w http.ResponseWriter, r *http.Request) {
|
|||
content, err = contentFromQuick(ctx, report_id)
|
||||
}
|
||||
content.MapboxToken = config.MapboxToken
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
StatusByID,
|
||||
content,
|
||||
|
|
@ -235,7 +235,7 @@ func getStatusByID(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
/*
|
||||
func getQuick(w http.ResponseWriter, r *http.Request) {
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
Quick,
|
||||
ContentQuick{},
|
||||
|
|
@ -244,7 +244,7 @@ func getStatusByID(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
func getQuickSubmitComplete(w http.ResponseWriter, r *http.Request) {
|
||||
report := r.URL.Query().Get("report")
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
QuickSubmitComplete,
|
||||
ContentQuickSubmitComplete{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"embed"
|
||||
"fmt"
|
||||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
)
|
||||
|
||||
//go:embed template/*
|
||||
|
|
@ -13,7 +13,7 @@ var embeddedFiles embed.FS
|
|||
var components = [...]string{"footer", "header", "photo-upload", "photo-upload-header"}
|
||||
var svgs = [...]string{"check-report", "mosquito", "pond"}
|
||||
|
||||
func buildTemplate(files ...string) *htmlpage.BuiltTemplate {
|
||||
func buildTemplate(files ...string) *html.BuiltTemplate {
|
||||
subdir := "rmo"
|
||||
full_files := make([]string, 0)
|
||||
for _, f := range files {
|
||||
|
|
@ -25,5 +25,5 @@ func buildTemplate(files ...string) *htmlpage.BuiltTemplate {
|
|||
for _, c := range svgs {
|
||||
full_files = append(full_files, fmt.Sprintf("%s/template/svg/%s.svg", subdir, c))
|
||||
}
|
||||
return htmlpage.NewBuiltTemplate(embeddedFiles, "rmo/", full_files...)
|
||||
return html.NewBuiltTemplate(embeddedFiles, "rmo/", full_files...)
|
||||
}
|
||||
|
|
|
|||
16
sync/dash.go
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/Gleipnir-Technology/nidus-sync/db"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/h3utils"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/google/uuid"
|
||||
"github.com/uber/h3-go/v4"
|
||||
|
|
@ -97,7 +97,7 @@ func getDistrict(w http.ResponseWriter, r *http.Request) {
|
|||
context := ContextDistrict{
|
||||
MapboxToken: config.MapboxToken,
|
||||
}
|
||||
htmlpage.RenderOrError(w, districtT, &context)
|
||||
html.RenderOrError(w, districtT, &context)
|
||||
}
|
||||
|
||||
func getLayoutTest(w http.ResponseWriter, r *http.Request, u *models.User) {
|
||||
|
|
@ -106,7 +106,7 @@ func getLayoutTest(w http.ResponseWriter, r *http.Request, u *models.User) {
|
|||
respondError(w, "Failed to get user", err, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
htmlpage.RenderOrError(w, layoutTestT, &ContentLayoutTest{User: userContent})
|
||||
html.RenderOrError(w, layoutTestT, &ContentLayoutTest{User: userContent})
|
||||
}
|
||||
|
||||
func getRoot(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -241,7 +241,7 @@ func cell(ctx context.Context, w http.ResponseWriter, user *models.User, c int64
|
|||
Treatments: treatments,
|
||||
User: userContent,
|
||||
}
|
||||
htmlpage.RenderOrError(w, cellT, &data)
|
||||
html.RenderOrError(w, cellT, &data)
|
||||
}
|
||||
|
||||
func dashboard(ctx context.Context, w http.ResponseWriter, user *models.User) {
|
||||
|
|
@ -310,7 +310,7 @@ func dashboard(ctx context.Context, w http.ResponseWriter, user *models.User) {
|
|||
RecentRequests: requests,
|
||||
User: userContent,
|
||||
}
|
||||
htmlpage.RenderOrError(w, dashboardT, data)
|
||||
html.RenderOrError(w, dashboardT, data)
|
||||
}
|
||||
|
||||
func settings(w http.ResponseWriter, r *http.Request, user *models.User) {
|
||||
|
|
@ -322,7 +322,7 @@ func settings(w http.ResponseWriter, r *http.Request, user *models.User) {
|
|||
data := ContentAuthenticatedPlaceholder{
|
||||
User: userContent,
|
||||
}
|
||||
htmlpage.RenderOrError(w, settingsT, data)
|
||||
html.RenderOrError(w, settingsT, data)
|
||||
}
|
||||
|
||||
func source(w http.ResponseWriter, r *http.Request, user *models.User, id uuid.UUID) {
|
||||
|
|
@ -383,7 +383,7 @@ func source(w http.ResponseWriter, r *http.Request, user *models.User, id uuid.U
|
|||
User: userContent,
|
||||
}
|
||||
|
||||
htmlpage.RenderOrError(w, sourceT, data)
|
||||
html.RenderOrError(w, sourceT, data)
|
||||
}
|
||||
|
||||
func trap(w http.ResponseWriter, r *http.Request, user *models.User, id uuid.UUID) {
|
||||
|
|
@ -423,5 +423,5 @@ func trap(w http.ResponseWriter, r *http.Request, user *models.User, id uuid.UUI
|
|||
User: userContent,
|
||||
}
|
||||
|
||||
htmlpage.RenderOrError(w, trapT, data)
|
||||
html.RenderOrError(w, trapT, data)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"strconv"
|
||||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/config"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/skip2/go-qrcode"
|
||||
|
|
@ -125,13 +125,13 @@ func mock(t string, w http.ResponseWriter, code string) {
|
|||
SettingUserAdd: "/mock/setting/user/add",
|
||||
},
|
||||
}
|
||||
template, ok := htmlpage.TemplatesByFilename[t+".html"]
|
||||
template, ok := html.TemplatesByFilename[t+".html"]
|
||||
if !ok {
|
||||
log.Error().Str("template", t).Msg("Failed to find template")
|
||||
respondError(w, "Failed to render template", nil, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
htmlpage.RenderOrError(w, &template, data)
|
||||
html.RenderOrError(w, &template, data)
|
||||
}
|
||||
|
||||
func renderMock(templateName string) http.HandlerFunc {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/Gleipnir-Technology/nidus-sync/background"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/config"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
|
|
@ -89,5 +89,5 @@ func oauthPrompt(w http.ResponseWriter, r *http.Request, user *models.User) {
|
|||
data := ContextOauthPrompt{
|
||||
User: userContent,
|
||||
}
|
||||
htmlpage.RenderOrError(w, oauthPromptT, data)
|
||||
html.RenderOrError(w, oauthPromptT, data)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ var embeddedFiles embed.FS
|
|||
|
||||
var components = [...]string{"header", "icons", "map", "sidebar"}
|
||||
|
||||
func buildTemplate(files ...string) *htmlpage.BuiltTemplate {
|
||||
func buildTemplate(files ...string) *html.BuiltTemplate {
|
||||
subdir := "sync"
|
||||
full_files := make([]string, 0)
|
||||
for _, f := range files {
|
||||
|
|
@ -23,7 +23,7 @@ func buildTemplate(files ...string) *htmlpage.BuiltTemplate {
|
|||
for _, c := range components {
|
||||
full_files = append(full_files, fmt.Sprintf("%s/template/components/%s.html", subdir, c))
|
||||
}
|
||||
return htmlpage.NewBuiltTemplate(embeddedFiles, "sync/", full_files...)
|
||||
return html.NewBuiltTemplate(embeddedFiles, "sync/", full_files...)
|
||||
}
|
||||
|
||||
// Respond with an error that is visible to the user
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"net/http"
|
||||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/config"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
)
|
||||
|
||||
type ContentPrivacy struct {
|
||||
|
|
@ -19,7 +19,7 @@ var (
|
|||
)
|
||||
|
||||
func getPrivacy(w http.ResponseWriter, r *http.Request) {
|
||||
htmlpage.RenderOrError(
|
||||
html.RenderOrError(
|
||||
w,
|
||||
PrivacyT,
|
||||
ContentPrivacy{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package sync
|
|||
import (
|
||||
"github.com/Gleipnir-Technology/nidus-sync/api"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/auth"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/go-chi/chi/v5"
|
||||
)
|
||||
|
||||
|
|
@ -67,6 +67,6 @@ func Router() chi.Router {
|
|||
r.Method("GET", "/trap/{globalid}", auth.NewEnsureAuth(getTrap))
|
||||
r.Method("GET", "/text/{destination}", auth.NewEnsureAuth(getTextMessages))
|
||||
|
||||
htmlpage.AddStaticRoute(r, "/static")
|
||||
html.AddStaticRoute(r, "/static")
|
||||
return r
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/auth"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
|
|
@ -92,10 +92,10 @@ func signin(w http.ResponseWriter, errorCode string) {
|
|||
data := ContentSignin{
|
||||
InvalidCredentials: errorCode == "invalid-credentials",
|
||||
}
|
||||
htmlpage.RenderOrError(w, signinT, data)
|
||||
html.RenderOrError(w, signinT, data)
|
||||
}
|
||||
|
||||
func signup(w http.ResponseWriter, path string) {
|
||||
data := ContentSignup{}
|
||||
htmlpage.RenderOrError(w, signupT, data)
|
||||
html.RenderOrError(w, signupT, data)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"net/http"
|
||||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
)
|
||||
|
||||
type ContentTextMessages struct {
|
||||
|
|
@ -24,5 +24,5 @@ func getTextMessages(w http.ResponseWriter, r *http.Request, u *models.User) {
|
|||
content := ContentTextMessages{
|
||||
User: userContent,
|
||||
}
|
||||
htmlpage.RenderOrError(w, textMessagesT, content)
|
||||
html.RenderOrError(w, textMessagesT, content)
|
||||
}
|
||||
|
|
|
|||