add noscript option to FileServer

This commit is contained in:
Daniella 2022-07-15 23:12:05 +02:00
parent fd83813ecf
commit ec74401896

View file

@ -8,12 +8,14 @@ import org.w3c.dom.Element;
import de.tudbut.async.Callback;
import de.tudbut.async.ComposeCallback;
import de.tudbut.async.Task;
import de.tudbut.async.TaskCallable;
import de.tudbut.tryumph.config.IRequestCatcher;
import de.tudbut.tryumph.config.TryConfig;
import de.tudbut.tryumph.events.GET;
import de.tudbut.tryumph.events.Path;
import de.tudbut.tryumph.events.RequestHandler;
import de.tudbut.tryumph.server.BrowserContext;
import de.tudbut.tryumph.server.Request;
import de.tudbut.tryumph.server.Response;
import tudbut.parsing.TCN;
@ -89,4 +91,11 @@ public class FileServer implements IRequestCatcher, RequestHandler.Listener {
rej.call(error);
}
@Override
public Task<BrowserContext> processBrowserContext(BrowserContext context) {
if(data.getBoolean("noscript") != null)
context.useJavaScript = !data.getBoolean("noscript");
return IRequestCatcher.super.processBrowserContext(context);
}
}