Skip to content

Commit

Permalink
include old viewer in jar
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr0nox committed Nov 30, 2024
1 parent 4b52586 commit e6b12f7
Show file tree
Hide file tree
Showing 9 changed files with 1,057 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@
<targetPath>report-viewer</targetPath>
<directory>../report-viewer/dist</directory>
</resource>
<!-- Even though it is already in the resources folder, it needs to be explicitly included to be part of the jar -->
<resource>
<targetPath>v5</targetPath>
<directory>src/main/resources/v5</directory>
</resource>
</resources>
<plugins>
<plugin>
Expand Down
5 changes: 5 additions & 0 deletions cli/src/main/java/de/jplag/cli/server/ReportViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class ReportViewer implements HttpHandler {
private static final String REPORT_VIEWER_RESOURCE_PREFIX = "report-viewer";
private static final String INDEX_PATH = "index.html";
private static final String RESULT_PATH = "results.zip";
private static final String[] OLD_VERSION_DIRECTORIES = new String[] {"v5"};

private static final Logger logger = LoggerFactory.getLogger(ReportViewer.class);
private static final int SUCCESS_RESPONSE = 200;
Expand All @@ -45,6 +46,10 @@ public ReportViewer(File zipFile, int port) throws IOException {

this.routingTree.insertRouting("", new RoutingResources(REPORT_VIEWER_RESOURCE_PREFIX).or(new RoutingAlias(INDEX_PATH)));
this.routingTree.insertRouting(RESULT_PATH, new RoutingStaticFile(zipFile, ContentType.ZIP));
for (String version : OLD_VERSION_DIRECTORIES) {
this.routingTree.insertRouting(version, new RoutingResources(version).or(new RoutingAlias(version + "/" + INDEX_PATH)));
}

this.port = port;
}

Expand Down
9 changes: 9 additions & 0 deletions cli/src/main/resources/v5/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!doctype html>
<html lang="">
<script>
const UrlPath = window.location.pathname
const branch = UrlPath.split('/')[1]
const url = 'https://jplag.github.io/' + branch + '/'
location.replace(url)
</script>
</html>
1,017 changes: 1,017 additions & 0 deletions cli/src/main/resources/v5/assets/index-D6LlQyWf.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cli/src/main/resources/v5/assets/index-DPPiA3g-.css

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cli/src/main/resources/v5/favicon.ico
Binary file not shown.
20 changes: 20 additions & 0 deletions cli/src/main/resources/v5/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/v5/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>JPlag Report Viewer</title>
<script type="module" crossorigin src="/v5/assets/index-D6LlQyWf.js"></script>
<link rel="stylesheet" crossorigin href="/v5/assets/index-DPPiA3g-.css">
</head>
<body style="overflow: hidden">
<noscript>
<strong
>We're sorry but the JPlag Report Viewer does not work properly without JavaScript enabled.
Please enable it to continue.</strong
>
</noscript>
<div id="app"></div>
</body>
</html>
Expand Down

0 comments on commit e6b12f7

Please sign in to comment.