Add debug web server

This commit is contained in:
Brahim Hadriche committed 2022-11-29 23:13:52 -05:00
1 parent 68a32afc38
commit a059702a0e
6 files changed
+50 -13

No files matched your search

@@ -11,6 +11,7 @@ import "pkg:/components/WebServer/Middleware/BasicAuthMiddleware.bs"
import "pkg:/components/WebServer/Middleware/DashRouter.bs"
#const WEB_SERVER_BASIC_AUTH = false
#const WEB_SERVER_PACKAGE_DEBUG = false
function Init()
m.top.functionName = "WebServerLoop"
@@ -38,7 +39,10 @@ function WebServerLoop()
m.server.UseRouter(new Http.CommandsApiRouter())
m.server.UseRouter(new Http.StateApiRouter())
m.server.UseRouter(new Http.InvidiousRouter())
m.server.UseRouter(new Http.HttpStaticFilesRouter(m.settings.WwwRoot))
m.server.UseRouter(new Http.HttpStaticFilesRouter("/", m.settings.WwwRoot))
#if WEB_SERVER_PACKAGE_DEBUG
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug", "pkg:/", true, true))
#end if
#if WEB_SERVER_BASIC_AUTH
m.server.UseRouter(new Http.BasicAuthMiddleware())
#end if