fixed replit support in zip-generator

This commit is contained in:
LAX1DUDE 2022-08-26 17:41:13 -07:00
parent eb0c7cb961
commit 8eb53986b1
12 changed files with 19335 additions and 64 deletions

View file

@ -1,4 +0,0 @@
@echo off
title CreateStableDownload
java -jar zip-generator/zipGenerator.jar
pause

4
ZipStableDownload.bat Normal file
View file

@ -0,0 +1,4 @@
@echo off
title ZipStableDownload
java -cp zip-generator/deps/*;zip-generator/zipGenerator.jar net.lax1dude.eaglercraft.zip_generator.ZipGenerator
pause

2
ZipStableDownload.sh Normal file
View file

@ -0,0 +1,2 @@
#!/bin/sh
java -cp zip-generator/deps/*:zip-generator/zipGenerator.jar net.lax1dude.eaglercraft.zip_generator.ZipGenerator

19253
stable-download/classes.js Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -1,6 +1,6 @@
@echo off
setlocal enabledelayedexpansion
title zip-generator
title ZipStableDownload
cd ..
echo enter the path to your java 11 installation (or leave blank to assume it is the default):
SET /P "JAVA11PATH="
@ -14,6 +14,6 @@ if "!JAVA11PATH!" neq "" (
)
)
echo Using java at: "!JAVA11PATH!java"
"!JAVA11PATH!java" -jar zip-generator/zipGenerator.jar
"!JAVA11PATH!java" -cp zip-generator/deps/*;zip-generator/zipGenerator.jar net.lax1dude.eaglercraft.zip_generator.ZipGenerator
endlocal
pause

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<title>My Drive - Google Drive</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Eaglercraft is real Minecraft 1.5.2 that you can play in any regular web browser. That includes school chromebooks, it works on all chromebooks. You can join real Minecraft 1.5.2 servers with it through a custom proxy based on Bungeecord." />
<meta name="keywords" content="minecraft, applet, chromebook, lax1dude, games, eaglercraft, eagler" />
<meta name="author" content="LAX1DUDE" />
<meta property="og:title" content="Eaglercraft" />
<meta property="og:locale" content="en-US" />
<meta property="og:type" content="website" />
<meta property="og:image" content="https://media.discordapp.net/attachments/378764518081429506/932053915061587978/thumbnail2.png" />
<meta property="og:description" content="Eaglercraft is real Minecraft 1.5.2 that you can play in any regular web browser. That includes school chromebooks, it works on all chromebooks. You can join real Minecraft 1.5.2 servers with it through a custom proxy based on Bungeecord." />
<link type="image/png" rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGAUlEQVRYw7VXa0xTZxj+oKjJNjWZ10EtZqIQjBdsT2utlZYiMsfiZltUtpiYOZ0zceOmcZfsGLmoQ25hS1jmNJpBL1xEuWwZGduPjW0xcVniLn/YfmlrK6wDRulpz7v3O+1BCgUs4pc8+U5Ov6/P877v837nHEKiGzHEZpYQVhcXEfQ3uuaJjOCfP9pSG5E8GXIzmS+r0Rtk1bqcxCrti+NB76XVaA3EzM6fUxHmELmm7bXkjVde6pPV6WD1x/owyBDrEaTOAD9fTeqDLpJM98CciIBgTRVW0211Rx4k1WWOSiu0flnlDgGrEBsQpELnZz9hRuErAqNNMb8IW+Ex/SCvPzJPILebjm69eQAYm8m7+doeWHVRC0guIBGxDkEupsPfDSsBmokXumLB10TeFETUk3mPFbmq89VFCovJxdhNIG80BhirCVLqd4G0Yjtg9LC5UgvkIx1c/XQTJQevXRLgWwj47MSFJVg860yMRW81VW1tPwCKRqNPYTECxZaGV2B1VTqswUw8jZFrq7ZDv/UZ8Ddh+u0xCOKDL1FEM6maVRZE46ls5lSFNUiK4IW50Qg0C6mXdsPmCg2QCj10f54iRD9il1Bymn6ezhwVZCOpURtSFIDkHaob+yk5J0YvQoMg1YbA0RpVwGsnAvEEcNAhiOiISoCuB080HEqLKUfVti8iOcU2qylArr0MfzTIaPQoQjJJBGZCEOG3kxxBRA+Jm/moDQ2M/jdlSy4l808kZ1DUdswMseW2IHkLdCI5kkXIgh/aaFuS3x96expDisaTW4wFE403DtQLvBa7gjS/nogCEgMt4bWfAMGQWIqC6Q3JsrF0SrOZl2HbebDnHxpvPFAUFYciq8WtSFxNSShZBAG8v1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51C4bUpH3G9wFRAF7E6EqHj2Ptr2A0l9HdswKa97IW/2P/Wc9xkRhm/HYcEzH3Ax79wxUzwELcXIFFwBP7an7M8T8H1bLLDGWzFAAAAABJRU5ErkJggg==" />
<script type="text/javascript" src="classes.js"></script>
<script type="text/javascript">
window.addEventListener("load", function(){
window.minecraftOpts = [
"game_frame","assets.epk",
"CgAACQAHc2VydmVycwoAAAABCAAEbmFtZQAMbG9jYWwgc2VydmVyCAACaXAAD2xvY2FsaG9zdDoyNTU2NQEAC2hpZGVBZGRyZXNzAAAKAAhtYWluTWVudQkACHNwbGFzaGVzCAAAAAoACkRhcnZpZ2xldCEADkRhcnZpZ2xvcGhpbGUhAAtZb3UgRWFnbGVyIQALWWVlZWVlZWVlZSEAC1lvdSBZZWVsZXIhAA1FRUVFRUVFRUVFRUUhAAtZb3UgRGFydmlnIQAJWW91IFZpZ2chAAI6PgACfD4AAA=="
];
(function(){
var q = window.location.search;
if(typeof q === 'string' && q.startsWith("?")) {
q = new URLSearchParams(q);
var s = q.get("server");
if(s) window.minecraftOpts.push(s);
}
})();
main();
});
</script>
</head>
<body style="margin:0px;width:100vw;height:100vh;" id="game_frame">
</body>
</html>

View file

@ -1,5 +0,0 @@
@echo off
title zip-generator
cd ..
java -jar zip-generator/zipGenerator.jar
pause

View file

@ -1,2 +0,0 @@
#!/bin/sh
java -jar zip-generator/zipGenerator.jar

View file

@ -96,73 +96,59 @@ public class ZipGenerator {
zOut.close();
System.out.println("Writing 'stable-download/stable-download_repl.zip'");
zOut = new ZipOutputStream(new FileOutputStream(new File("stable-download/stable-download_repl.zip")));
zOut.setLevel(9);
ZipOutputStream zOutRepl = new ZipOutputStream(new FileOutputStream(new File("stable-download/stable-download_repl.zip")));
zOutRepl.setLevel(9);
zipFolder(zOutRepl, "web", new File("stable-download/web"), true);
zipFolder(zOutRepl, "java", new File("stable-download/java"));
zOutRepl.close();
zipFolder(zOut, "web", new File("stable-download/web"), "web/classes.js", "web/eagswebrtc.js", "web/index.html");
zipFolder(zOut, "java", new File("stable-download/java"));
zOut.putNextEntry(new ZipEntry("web/classes.js"));
IOUtils.write(classesJs + "\n" + classesWebRTCJs, zOut, "UTF-8");
zOut.putNextEntry(new ZipEntry("web/index.html"));
IOUtils.write(FileUtils.readFileToByteArray(new File("zip-generator/repl_index.html")), zOut);
zOut.close();
}
private static void zipFolder(ZipOutputStream zOut, String pfx, File file) throws IOException {
zipFolder(zOut, pfx, file, false);
private static void zipFolder(ZipOutputStream zOut, String pfx, File file, String... exclude) throws IOException {
zipFolder0(zOut, file.getAbsolutePath().replace('\\', '/'), pfx, file, exclude);
}
private static void zipFolder(ZipOutputStream zOut, String pfx, File file, boolean repl) throws IOException {
zipFolder0(zOut, file.getAbsolutePath().replace('\\', '/'), pfx, file, repl);
}
private static void zipFolder0(ZipOutputStream zOut, String pfx, String writePfx, File file) throws IOException {
zipFolder0(zOut, pfx, writePfx, file, false);
}
private static void zipFolder0(ZipOutputStream zOut, String pfx, String writePfx, File file, boolean repl) throws IOException {
byte[] replCache = new byte[0];
if(writePfx.length() > 0 && !writePfx.endsWith("/")) {
writePfx = writePfx + "/";
}
private static void zipFolder0(ZipOutputStream zOut, String pfx, String writePfx, File file, String... exclude) throws IOException {
for(File f : file.listFiles()) {
if(f.isDirectory()) {
zipFolder0(zOut, pfx, writePfx, f); // do not apply repl boolean to subdirs, as it only happens for this one top level directory in the web folder
zipFolder0(zOut, pfx, writePfx, f);
}else if(f.isFile()) {
String path = f.getAbsolutePath().replace('\\', '/').replace(pfx, "");
if(path.startsWith("/")) {
path = path.substring(1);
}
if (repl && (f.getName().equals("classes.js") || f.getName().equals("eagswebrtc.js"))) {
if (replCache.length == 0) {
replCache = FileUtils.readFileToByteArray(f);
} else {
System.out.println("Concatenating 'eagswebrtc.js' onto 'classes.js'");
byte[] newFile = FileUtils.readFileToByteArray(f);
byte[] replCacheCache = replCache;
replCache = new byte[replCache.length + 2 + newFile.length];
System.arraycopy(replCacheCache, 0, replCache, 0, replCacheCache.length);
System.arraycopy(newFile, 0, replCache, replCacheCache.length + 2, newFile.length);
// add line breaks between them
replCache[replCacheCache.length] = 10;
replCache[replCacheCache.length + 1] = 10;
}
} else {
zipFile(zOut, writePfx + path, f);
if(writePfx.length() > 0 && !writePfx.endsWith("/")) {
writePfx = writePfx + "/";
}
path = writePfx + path;
if(!shouldExclude(path, exclude)) {
zipFile(zOut, path, f);
}
}
}
if (repl) {
zipFile(zOut, writePfx + "classes.js", replCache);
}
}
private static void zipFile(ZipOutputStream zOut, String name, File file) throws IOException {
zipFile(zOut, name, FileUtils.readFileToByteArray(file));
}
private static void zipFile(ZipOutputStream zOut, String name, byte[] data) throws IOException {
zOut.putNextEntry(new ZipEntry(name));
IOUtils.write(data, zOut);
IOUtils.write(FileUtils.readFileToByteArray(file), zOut);
}
private static boolean shouldExclude(String name, String... exclude) {
for(int i = 0; i < exclude.length; ++i) {
if(exclude[i].equalsIgnoreCase(name)) {
return true;
}
}
return false;
}
}
}

Binary file not shown.