Only allow display registration on local machine

This commit is contained in:
EpicKiwi 2023-09-15 12:02:08 +02:00
parent 7e954291ac
commit 050f887398
Signed by: epickiwi
GPG Key ID: C4B28FD2729941CE

View File

@ -8,6 +8,12 @@ let display = null;
router.get("/_loled/display/register", (ctx) => { router.get("/_loled/display/register", (ctx) => {
if(ctx.request.ip != "127.0.0.1"){
ctx.response.status = 403
ctx.response.body = "Only local machine is allowed to register a display"
return;
}
let name = ctx.request.url.searchParams.get("name"); let name = ctx.request.url.searchParams.get("name");
if(!name){ if(!name){
name = "display-"+displayIndex name = "display-"+displayIndex