diff --git a/internal/embeds/embeds.go b/internal/embeds/embeds.go new file mode 100644 index 0000000..85e125b --- /dev/null +++ b/internal/embeds/embeds.go @@ -0,0 +1,14 @@ +package embeds + +import ( + "embed" +) + +//go:embed static +var Static embed.FS + +//go:embed templates +var Templates embed.FS + +//go:embed mc-config.yaml +var Config embed.FS diff --git a/embeds/mc-config.yaml b/internal/embeds/mc-config.yaml similarity index 100% rename from embeds/mc-config.yaml rename to internal/embeds/mc-config.yaml diff --git a/internal/embeds/static/android-chrome-192x192.png b/internal/embeds/static/android-chrome-192x192.png new file mode 100644 index 0000000..a6ae9c3 Binary files /dev/null and b/internal/embeds/static/android-chrome-192x192.png differ diff --git a/internal/embeds/static/android-chrome-512x512.png b/internal/embeds/static/android-chrome-512x512.png new file mode 100644 index 0000000..613694d Binary files /dev/null and b/internal/embeds/static/android-chrome-512x512.png differ diff --git a/internal/embeds/static/apple-touch-icon.png b/internal/embeds/static/apple-touch-icon.png new file mode 100644 index 0000000..961d036 Binary files /dev/null and b/internal/embeds/static/apple-touch-icon.png differ diff --git a/embeds/static/bootstrap.bundle.js b/internal/embeds/static/bootstrap.bundle.js similarity index 100% rename from embeds/static/bootstrap.bundle.js rename to internal/embeds/static/bootstrap.bundle.js diff --git a/embeds/static/bootstrap.css b/internal/embeds/static/bootstrap.css similarity index 100% rename from embeds/static/bootstrap.css rename to internal/embeds/static/bootstrap.css diff --git a/internal/embeds/static/favicon-16x16.png b/internal/embeds/static/favicon-16x16.png new file mode 100644 index 0000000..fdf7f76 Binary files /dev/null and b/internal/embeds/static/favicon-16x16.png differ diff --git a/internal/embeds/static/favicon-32x32.png b/internal/embeds/static/favicon-32x32.png new file mode 100644 index 0000000..99ee536 Binary files /dev/null and b/internal/embeds/static/favicon-32x32.png differ diff --git a/internal/embeds/static/favicon.ico b/internal/embeds/static/favicon.ico new file mode 100644 index 0000000..4cb5ad8 Binary files /dev/null and b/internal/embeds/static/favicon.ico differ diff --git a/internal/embeds/static/site.webmanifest b/internal/embeds/static/site.webmanifest new file mode 100644 index 0000000..45dc8a2 --- /dev/null +++ b/internal/embeds/static/site.webmanifest @@ -0,0 +1 @@ +{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} \ No newline at end of file diff --git a/internal/embeds/templates/index.html b/internal/embeds/templates/index.html new file mode 100644 index 0000000..e63c434 --- /dev/null +++ b/internal/embeds/templates/index.html @@ -0,0 +1,35 @@ + + + + + Your Page Title + + + + + + + + + + + + + + + + + + + + + + + + + +

Your content here!

+ + + + \ No newline at end of file diff --git a/internal/server/server.go b/internal/server/server.go index 43bd776..469e33b 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -8,6 +8,7 @@ import ( "time" "git.coopcloud.tech/wiki-cafe/member-console/internal/auth" + "git.coopcloud.tech/wiki-cafe/member-console/internal/embeds" "git.coopcloud.tech/wiki-cafe/member-console/internal/middleware" "github.com/rs/cors" ) @@ -86,11 +87,11 @@ func Start(ctx context.Context, cfg Config) error { BaseContext: func(_ net.Listener) context.Context { return ctx }, // Pass base context to all requests } - // Serve the templates and static files - // Serve templates from the "templates" directory - httpRequestRouter.Handle("/", http.FileServer(http.Dir("./templates"))) - // Serve static files from the "static" directory - httpRequestRouter.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static")))) + // Serve the templates and static files using embedded content + // Serve templates from the embedded "templates" directory + httpRequestRouter.Handle("/", http.FileServer(http.FS(embeds.Templates))) + // Serve static files from the embedded "static" directory + httpRequestRouter.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(embeds.Static)))) // Log server startup with structured logging cfg.Logger.Info("starting server", diff --git a/mc-config.yaml b/mc-config.yaml new file mode 100644 index 0000000..e69de29