fix script tags

This commit is contained in:
Daniella / Tove 2022-07-03 21:30:12 +02:00
parent 484281f019
commit ea50fd13ac
3 changed files with 11 additions and 6 deletions

View file

@ -26,7 +26,6 @@ public class Main implements IRequestCatcher {
@Override
public TaskCallable<ComposeCallback<Request, Response>> onConnect(Socket socket) {
return (tres, trej) -> tres.call((resp, res, rej) -> {
System.out.println(resp.toString());
listener.handle(resp, r -> {
if(r.isHTML) {
Document html = r.getHTML();
@ -59,7 +58,6 @@ public class Main implements IRequestCatcher {
@Path("/")
public void onIndex(Request request, Callback<Response> res, Callback<Throwable> rej) {
Response r = new Response(request, request.context.file("index.html"), 200, "OK");
System.out.println(r.getHTMLData());
Document html = r.getHTML();
Node node = html.createTextNode(request.fingerPrint());
HTMLParsing.getElementById(html, "fingerprint").appendChild(node);

View file

@ -2,7 +2,6 @@ package de.tudbut.tryumph.server;
import static de.tudbut.async.Async.*;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
@ -35,9 +34,7 @@ public class BrowserContext {
private BrowserContext(String cookie, IRequestCatcher requestCatcher) {
this.requestCatcher = requestCatcher;
try {
System.out.println("Reading cookie");
data = AsyncJSON.read(cookie).err(e -> {throw new RuntimeException(e);}).ok().await();
System.out.println("Read cookie");
} catch (Exception e) {
data = new TCN("JSON");
}
@ -68,6 +65,7 @@ public class BrowserContext {
private Task<BrowserContext> init() {
return t((res, rej) -> {
requestCatcher.processBrowserContext(this).err(rej).then(res).ok();
needsChange = true;
});
}

View file

@ -2,6 +2,8 @@ package de.tudbut.tryumph.server;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.Writer;
@ -22,7 +24,14 @@ public class HTMLParsing {
tidy.setDropProprietaryTags(false);
tidy.setDropProprietaryAttributes(false);
tidy.setSpaces(4);
tidy.setXHTML(true);
tidy.setShowWarnings(false);
tidy.setShowErrors(0);
tidy.setErrout(new PrintWriter(new OutputStream() {
@Override
public void write(int b) throws IOException {
// do nothing. we dont want output!
}
}));
}