diff options
author | Mike Crute <mike@crute.us> | 2023-07-31 13:34:44 -0700 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2023-07-31 13:34:44 -0700 |
commit | db217bbb1f74b7aa955d3095fef62c71946768cf (patch) | |
tree | 80ee49b11f137412cf440262950e4a116099eb24 /cmd | |
parent | 6d867608837f879be2eb934d034f49359f973c84 (diff) | |
download | websocket_proxy-db217bbb1f74b7aa955d3095fef62c71946768cf.tar.bz2 websocket_proxy-db217bbb1f74b7aa955d3095fef62c71946768cf.tar.xz websocket_proxy-db217bbb1f74b7aa955d3095fef62c71946768cf.zip |
Complete registration flow
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web/server.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd/web/server.go b/cmd/web/server.go index 6eb585a..62624e2 100644 --- a/cmd/web/server.go +++ b/cmd/web/server.go | |||
@@ -32,14 +32,14 @@ import ( | |||
32 | "github.com/spf13/cobra" | 32 | "github.com/spf13/cobra" |
33 | ) | 33 | ) |
34 | 34 | ||
35 | func Register(root *cobra.Command, embeddedTemplates fs.FS, appVersion string) { | 35 | func Register(root *cobra.Command, embeddedTemplates, embeddedClients fs.FS, appVersion string) { |
36 | webCmd := &cobra.Command{ | 36 | webCmd := &cobra.Command{ |
37 | Use: "web [options]", | 37 | Use: "web [options]", |
38 | Short: "Run web server", | 38 | Short: "Run web server", |
39 | Run: func(c *cobra.Command, args []string) { | 39 | Run: func(c *cobra.Command, args []string) { |
40 | cfg := app.Config{} | 40 | cfg := app.Config{} |
41 | cli.MustGetConfig(c, &cfg) | 41 | cli.MustGetConfig(c, &cfg) |
42 | webMain(cfg, embeddedTemplates, appVersion) | 42 | webMain(cfg, embeddedTemplates, embeddedClients, appVersion) |
43 | }, | 43 | }, |
44 | } | 44 | } |
45 | cli.AddFlags(webCmd, &app.Config{}, app.DefaultConfig, "web") | 45 | cli.AddFlags(webCmd, &app.Config{}, app.DefaultConfig, "web") |
@@ -62,7 +62,7 @@ func PopulateTemplateContext(c echo.Context) (interface{}, error) { | |||
62 | }, nil | 62 | }, nil |
63 | } | 63 | } |
64 | 64 | ||
65 | func webMain(cfg app.Config, embeddedTemplates fs.FS, appVersion string) { | 65 | func webMain(cfg app.Config, embeddedTemplates, embeddedClients fs.FS, appVersion string) { |
66 | ctx, cancel := context.WithCancel(context.Background()) | 66 | ctx, cancel := context.WithCancel(context.Background()) |
67 | defer cancel() | 67 | defer cancel() |
68 | 68 | ||
@@ -221,6 +221,10 @@ func webMain(cfg app.Config, embeddedTemplates fs.FS, appVersion string) { | |||
221 | 221 | ||
222 | csm := glmiddleware.CSRFProtect(ss) | 222 | csm := glmiddleware.CSRFProtect(ss) |
223 | 223 | ||
224 | glecho.StaticFS(s.GET, embeddedClients, "/clients", "./clients/") | ||
225 | |||
226 | s.NeverCacheStaticRoute("/js", "js") | ||
227 | |||
224 | s.GET("/login", gt.Handle, csm) | 228 | s.GET("/login", gt.Handle, csm) |
225 | s.GET("/register", gt.Handle, csm) | 229 | s.GET("/register", gt.Handle, csm) |
226 | 230 | ||