Play API prototype (#8)

* Play API prototype

* Web app

* Drag and drop support

* Handle different urls

* Fix redirect

* Increase max connections

* changelog

* Limit timeout

* Use fetch

* Redirects

* Formatting
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2022-11-21 18:47:12 -05:00
1 parent 192eec9519
commit 651bb54dee
15 files changed
+180 -39

No files matched your search

@@ -5,6 +5,7 @@ import "pkg:/components/WebServer/Middleware/HttpDefaultRouter.bs"
import "pkg:/components/WebServer/Middleware/InvidiousRouter.bs"
import "pkg:/components/WebServer/Middleware/RegistryApiRouter.bs"
import "pkg:/components/WebServer/Middleware/StateApiRouter.bs"
import "pkg:/components/WebServer/Middleware/CommandsApiRouter.bs"
function Init()
m.top.functionName = "WebServerLoop"
@@ -16,8 +17,18 @@ function WebServerLoop()
m.settings = new Http.HttpSettings(m.webServerPort)
' Root at www to get http://IP_ADDRESS:PORT/index.html
m.settings.WwwRoot = "pkg:/www"
m.settings.Timeout = 5000
m.server = new Http.HttpServer(m.settings, m)
homeRouter = new Http.HttpRouter()
homeRouter.Get("/", function(context as object) as boolean
response = context.response
response.Redirect("/index.html?tab=settings", 302)
return true
end function)
m.server.UseRouter(homeRouter)
m.server.UseRouter(new Http.CommandsApiRouter())
m.server.UseRouter(new Http.StateApiRouter())
m.server.UseRouter(new Http.RegistryApiRouter())
m.server.UseRouter(new Http.InvidiousRouter())
@@ -3,5 +3,6 @@
<component name="WebServerTask" extends="Task">
<interface>
<field id="login" type="boolean" alwaysNotify="true" />
<field id="command" type="string" alwaysNotify="true" />
</interface>
</component>