fix script tags
This commit is contained in:
parent
484281f019
commit
ea50fd13ac
3 changed files with 11 additions and 6 deletions
|
@ -26,7 +26,6 @@ public class Main implements IRequestCatcher {
|
||||||
@Override
|
@Override
|
||||||
public TaskCallable<ComposeCallback<Request, Response>> onConnect(Socket socket) {
|
public TaskCallable<ComposeCallback<Request, Response>> onConnect(Socket socket) {
|
||||||
return (tres, trej) -> tres.call((resp, res, rej) -> {
|
return (tres, trej) -> tres.call((resp, res, rej) -> {
|
||||||
System.out.println(resp.toString());
|
|
||||||
listener.handle(resp, r -> {
|
listener.handle(resp, r -> {
|
||||||
if(r.isHTML) {
|
if(r.isHTML) {
|
||||||
Document html = r.getHTML();
|
Document html = r.getHTML();
|
||||||
|
@ -59,7 +58,6 @@ public class Main implements IRequestCatcher {
|
||||||
@Path("/")
|
@Path("/")
|
||||||
public void onIndex(Request request, Callback<Response> res, Callback<Throwable> rej) {
|
public void onIndex(Request request, Callback<Response> res, Callback<Throwable> rej) {
|
||||||
Response r = new Response(request, request.context.file("index.html"), 200, "OK");
|
Response r = new Response(request, request.context.file("index.html"), 200, "OK");
|
||||||
System.out.println(r.getHTMLData());
|
|
||||||
Document html = r.getHTML();
|
Document html = r.getHTML();
|
||||||
Node node = html.createTextNode(request.fingerPrint());
|
Node node = html.createTextNode(request.fingerPrint());
|
||||||
HTMLParsing.getElementById(html, "fingerprint").appendChild(node);
|
HTMLParsing.getElementById(html, "fingerprint").appendChild(node);
|
||||||
|
|
|
@ -2,7 +2,6 @@ package de.tudbut.tryumph.server;
|
||||||
|
|
||||||
import static de.tudbut.async.Async.*;
|
import static de.tudbut.async.Async.*;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -35,9 +34,7 @@ public class BrowserContext {
|
||||||
private BrowserContext(String cookie, IRequestCatcher requestCatcher) {
|
private BrowserContext(String cookie, IRequestCatcher requestCatcher) {
|
||||||
this.requestCatcher = requestCatcher;
|
this.requestCatcher = requestCatcher;
|
||||||
try {
|
try {
|
||||||
System.out.println("Reading cookie");
|
|
||||||
data = AsyncJSON.read(cookie).err(e -> {throw new RuntimeException(e);}).ok().await();
|
data = AsyncJSON.read(cookie).err(e -> {throw new RuntimeException(e);}).ok().await();
|
||||||
System.out.println("Read cookie");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
data = new TCN("JSON");
|
data = new TCN("JSON");
|
||||||
}
|
}
|
||||||
|
@ -68,6 +65,7 @@ public class BrowserContext {
|
||||||
private Task<BrowserContext> init() {
|
private Task<BrowserContext> init() {
|
||||||
return t((res, rej) -> {
|
return t((res, rej) -> {
|
||||||
requestCatcher.processBrowserContext(this).err(rej).then(res).ok();
|
requestCatcher.processBrowserContext(this).err(rej).then(res).ok();
|
||||||
|
needsChange = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ package de.tudbut.tryumph.server;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
|
||||||
|
@ -22,7 +24,14 @@ public class HTMLParsing {
|
||||||
tidy.setDropProprietaryTags(false);
|
tidy.setDropProprietaryTags(false);
|
||||||
tidy.setDropProprietaryAttributes(false);
|
tidy.setDropProprietaryAttributes(false);
|
||||||
tidy.setSpaces(4);
|
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!
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue