Add styling and handle spaces in URL queries. Also improve formatting

main
sigonasr2, Sig, Sigo 3 years ago
parent 4e9dfee799
commit 24fa2a205d
  1. 14
      out/DIRECTORY_LISTING
  2. 8
      out/articles/DIRECTORY_LISTING
  3. 8
      out/articles/test articles/DIRECTORY_LISTING
  4. 2
      out/codeBackground
  5. 2
      out/otherpage.html
  6. 5
      out/sig.css
  7. 2
      out/testfile.html
  8. 2
      ref/DEFAULT.html
  9. 10
      sigPlace.java
  10. 4
      sigServer.java
  11. 5
      sitefiles/sig.css

@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<script type="text/javascript"> <script type="text/javascript">
function loadCodeBackground() { function loadCodeBackground() {
fetch("codeBackground").then((data)=>data.text()) fetch("/codeBackground").then((data)=>data.text())
.then((data)=>{ .then((data)=>{
document.getElementById("codeForeground").innerText=data document.getElementById("codeForeground").innerText=data
document.getElementById("codeBackground").innerText=data document.getElementById("codeBackground").innerText=data
@ -18,12 +18,12 @@
<body> <body>
<div class="contentBody"> <div class="contentBody">
articles 2022-05-04T18:30:43.309932Z gitpod 116<br/> <div class="folderlisting"><a href="/articles">articles</a> 2022-05-04T18:44:57.634585Z gitpod 116</div><br/>
codeBackground 2022-05-04T18:30:43.285932Z gitpod 2635<br/> <div class="filelisting"><a href="/codeBackground">codeBackground</a> 2022-05-04T18:44:57.606585Z gitpod 2635</div><br/>
otherpage.html 2022-05-04T18:30:43.289932Z gitpod 900<br/> <div class="filelisting"><a href="/otherpage.html">otherpage.html</a> 2022-05-04T18:44:57.614585Z gitpod 901</div><br/>
reset.css 2022-05-04T18:30:43.293932Z gitpod 1093<br/> <div class="filelisting"><a href="/reset.css">reset.css</a> 2022-05-04T18:44:57.618585Z gitpod 1093</div><br/>
sig.css 2022-05-04T18:30:43.301932Z gitpod 3550<br/> <div class="filelisting"><a href="/sig.css">sig.css</a> 2022-05-04T18:44:57.626585Z gitpod 3652</div><br/>
testfile.html 2022-05-04T18:30:43.301932Z gitpod 828<br/> <div class="filelisting"><a href="/testfile.html">testfile.html</a> 2022-05-04T18:44:57.626585Z gitpod 829</div><br/>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<script type="text/javascript"> <script type="text/javascript">
function loadCodeBackground() { function loadCodeBackground() {
fetch("codeBackground").then((data)=>data.text()) fetch("/codeBackground").then((data)=>data.text())
.then((data)=>{ .then((data)=>{
document.getElementById("codeForeground").innerText=data document.getElementById("codeForeground").innerText=data
document.getElementById("codeBackground").innerText=data document.getElementById("codeBackground").innerText=data
@ -18,9 +18,9 @@
<body> <body>
<div class="contentBody"> <div class="contentBody">
curabitur vel tempus ex.article 2022-05-04T18:30:43.269932Z gitpod 618<br/> <div class="filelisting"><a href="/articles/curabitur vel tempus ex.article">curabitur vel tempus ex.article</a> 2022-05-04T18:44:57.590585Z gitpod 618</div><br/>
sigplace1.article 2022-05-04T18:30:43.273932Z gitpod 1559<br/> <div class="filelisting"><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-05-04T18:44:57.594585Z gitpod 1559</div><br/>
test articles 2022-05-04T18:30:43.205932Z gitpod 69<br/> <div class="folderlisting"><a href="/articles/test articles">test articles</a> 2022-05-04T18:44:57.446585Z gitpod 69</div><br/>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<script type="text/javascript"> <script type="text/javascript">
function loadCodeBackground() { function loadCodeBackground() {
fetch("codeBackground").then((data)=>data.text()) fetch("/codeBackground").then((data)=>data.text())
.then((data)=>{ .then((data)=>{
document.getElementById("codeForeground").innerText=data document.getElementById("codeForeground").innerText=data
document.getElementById("codeBackground").innerText=data document.getElementById("codeBackground").innerText=data
@ -18,9 +18,9 @@
<body> <body>
<div class="contentBody"> <div class="contentBody">
test1.article 2022-05-04T18:30:43.277932Z gitpod 1111<br/> <div class="filelisting"><a href="/articles/test articles/test1.article">test1.article</a> 2022-05-04T18:44:57.598585Z gitpod 1111</div><br/>
test2.article 2022-05-04T18:30:43.277932Z gitpod 807<br/> <div class="filelisting"><a href="/articles/test articles/test2.article">test2.article</a> 2022-05-04T18:44:57.598585Z gitpod 807</div><br/>
test3.article 2022-05-04T18:30:43.281932Z gitpod 1020<br/> <div class="filelisting"><a href="/articles/test articles/test3.article">test3.article</a> 2022-05-04T18:44:57.602585Z gitpod 1020</div><br/>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -29,7 +29,7 @@
//Send default directory. //Send default directory.
CreateRequest(client,"200","OK","testfile.html"); CreateRequest(client,"200","OK","testfile.html");
} else { } else {
CreateRequest(client,"200","OK",requestloc.replaceFirst("/","")); CreateRequest(client,"200","OK",URLDecoder.decode(requestloc.replaceFirst("/",""),StandardCharsets.UTF_8));
} }
} }
} else { } else {

@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<script type="text/javascript"> <script type="text/javascript">
function loadCodeBackground() { function loadCodeBackground() {
fetch("codeBackground").then((data)=>data.text()) fetch("/codeBackground").then((data)=>data.text())
.then((data)=>{ .then((data)=>{
document.getElementById("codeForeground").innerText=data document.getElementById("codeForeground").innerText=data
document.getElementById("codeBackground").innerText=data document.getElementById("codeBackground").innerText=data

@ -126,3 +126,8 @@ body{
bottom:-8px; bottom:-8px;
background: linear-gradient(180deg,rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 5%, rgba(32,32,32,1.0) 100%); background: linear-gradient(180deg,rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 5%, rgba(32,32,32,1.0) 100%);
} }
.contentBody .filelisting{
padding:12px 4px 2px 4px;
font-size:1.75em;
}

@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<script type="text/javascript"> <script type="text/javascript">
function loadCodeBackground() { function loadCodeBackground() {
fetch("codeBackground").then((data)=>data.text()) fetch("/codeBackground").then((data)=>data.text())
.then((data)=>{ .then((data)=>{
document.getElementById("codeForeground").innerText=data document.getElementById("codeForeground").innerText=data
document.getElementById("codeBackground").innerText=data document.getElementById("codeBackground").innerText=data

@ -6,7 +6,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<script type="text/javascript"> <script type="text/javascript">
function loadCodeBackground() { function loadCodeBackground() {
fetch("codeBackground").then((data)=>data.text()) fetch("/codeBackground").then((data)=>data.text())
.then((data)=>{ .then((data)=>{
document.getElementById("codeForeground").innerText=data document.getElementById("codeForeground").innerText=data
document.getElementById("codeBackground").innerText=data document.getElementById("codeBackground").innerText=data

@ -171,18 +171,18 @@ public class sigPlace {
} }
sb.append(d).append("\n"); sb.append(d).append("\n");
} }
sb.append("<div class=\"filelisting\">");
for (Path f : map.get(key)) { for (Path f : map.get(key)) {
sb.append(f.getFileName()) sb.append("<div class=\"").append((Files.isDirectory(f)?"folderlisting":"filelisting")).append("\">")
.append("\t") .append("<a href=\""+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),""))+"\">")
.append(f.getFileName())
.append("</a>\t")
.append(Files.getLastModifiedTime(f)) .append(Files.getLastModifiedTime(f))
.append("\t") .append("\t")
.append(Files.getOwner(f)) .append(Files.getOwner(f))
.append("\t") .append("\t")
.append(Files.size(f)) .append(Files.size(f))
.append("<br/>\n"); .append("</div>\n");
} }
sb.append("</div>");
for (String d : data2) { for (String d : data2) {
for (String k : sigPlace.map.keySet()) { for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));

@ -5,6 +5,8 @@ import java.io.OutputStream;
import java.net.ServerSocket; import java.net.ServerSocket;
import java.net.Socket; import java.net.Socket;
import java.net.SocketException; import java.net.SocketException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
@ -45,7 +47,7 @@ public class sigServer {
//Send default directory. //Send default directory.
CreateRequest(client,"200","OK","testfile.html"); CreateRequest(client,"200","OK","testfile.html");
} else { } else {
CreateRequest(client,"200","OK",requestloc.replaceFirst("/","")); CreateRequest(client,"200","OK",URLDecoder.decode(requestloc.replaceFirst("/",""),StandardCharsets.UTF_8));
} }
} }
} else { } else {

@ -126,3 +126,8 @@ body{
bottom:-8px; bottom:-8px;
background: linear-gradient(180deg,rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 5%, rgba(32,32,32,1.0) 100%); background: linear-gradient(180deg,rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 5%, rgba(32,32,32,1.0) 100%);
} }
.contentBody .filelisting{
padding:12px 4px 2px 4px;
font-size:1.75em;
}
Loading…
Cancel
Save