-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmit.html
More file actions
287 lines (261 loc) · 12 KB
/
Copy pathsubmit.html
File metadata and controls
287 lines (261 loc) · 12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<!DOCTYPE html>
<html lang="en">
<head>
<title>Submit a compatibility report — Viridite</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Submit a game compatibility report for Viridite.">
<link rel="canonical" href="https://viridite.aaronworld.uk/submit">
<link rel="icon" type="image/png" sizes="32x32" href="assets/img/favicon-32.png">
<link rel="icon" type="image/svg+xml" href="assets/img/logo.svg">
<link rel="icon" href="favicon.ico" sizes="any">
<link rel="apple-touch-icon" href="assets/img/apple-touch-icon.png">
<link rel="stylesheet" href="assets/style.css?v=10">
</head>
<body>
<header class="site">
<div class="wrap bar">
<img class="logo" src="assets/img/logo-64.png" alt="" width="32" height="32">
<span class="brand">Virid<span>ite</span></span>
<button type="button" class="nav-toggle" id="nav-toggle" aria-controls="nav-menu" aria-label="Toggle navigation" aria-expanded="false">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>
</button>
<nav class="site" id="nav-menu" aria-label="Main">
<a href="/">Home</a>
<a href="store">Store</a>
<a href="compatibility">Compatibility</a>
<a href="roadmap">Roadmap</a>
<a href="credits">Credits</a>
<a href="docs">Docs</a>
<a href="https://github.com/Viridite">GitHub</a>
<a class="cta" href="download">Download</a>
</nav>
</div>
<form id="report-form">
<div class="field">
<label for="apk_file">The APK</label>
<p class="hint">Attach the .apk file directly (uploads straight to storage, no size problem — real APKs run 50-150MB and that's fine), or paste a direct download link below instead. Split/.xapk packages aren't supported yet.</p>
<input type="file" id="apk_file" accept=".apk">
<p class="filename" id="apk_file_filename"></p>
<input type="url" id="apk_url" name="apk_url" placeholder="https://example.com/path/to/game.apk">
</div>
<div class="field">
<label for="source_site">Where did this APK come from?</label>
<p class="hint">e.g. "APKMirror", "APKPure", "official developer site"</p>
<input type="text" id="source_site" name="source_site" placeholder="APKMirror" required>
</div>
<div class="field">
<label for="github_username">Your GitHub username (optional)</label>
<p class="hint">Only used to credit you on the <a href="credits">Credits page</a> and in-app About screen, under Testers. Leave blank to stay anonymous — not verified, just for display.</p>
<input type="text" id="github_username" name="github_username" placeholder="octocat">
</div>
<div class="field">
<label for="launcher_log">launcher_log.txt</label>
<p class="hint">Attach the file directly, or paste the full contents below — no length limit here either way.</p>
<input type="file" id="launcher_log_file" accept=".txt,text/plain">
<p class="filename" id="launcher_log_filename"></p>
<textarea id="launcher_log" name="launcher_log" required></textarea>
</div>
<div class="field">
<label for="compat_log">compat_log.txt</label>
<p class="hint">Attach the file directly, or paste the full contents below — no length limit here either way.</p>
<input type="file" id="compat_log_file" accept=".txt,text/plain">
<p class="filename" id="compat_log_filename"></p>
<textarea id="compat_log" name="compat_log" required></textarea>
</div>
<div class="field">
<label for="core_log">log.txt (Translation Core)</label>
<p class="hint">Attach the file directly, or paste the full contents below — no length limit here either way.</p>
<input type="file" id="core_log_file" accept=".txt,text/plain">
<p class="filename" id="core_log_filename"></p>
<textarea id="core_log" name="core_log" required></textarea>
</div>
<div class="field">
<label for="notes">Anything else worth knowing? (optional)</label>
<textarea id="notes" name="notes" style="min-height:80px"></textarea>
</div>
<button type="submit" class="btn primary">Submit report</button>
<div id="status"></div>
</form>
</div>
</main>
<footer class="site">
<div class="wrap">
Made by <a href="https://aaronworld.uk">aaronworld.uk</a>, mostly written by Claude AI
<span class="dot">·</span><a href="https://discord.gg/EXpgrAJh">Discord<span id="discord-count"></span></a>
<span class="dot">·</span><a href="https://github.com/Viridite">GitHub org</a>
<span class="dot">·</span><a href="https://github.com/Viridite/Viridite/blob/main/LICENSE">License</a>
<span class="dot">·</span><a href="legal">Legal</a>
<span class="dot">·</span><a href="privacy">Privacy</a>
<span class="dot">·</span><a href="terms">Terms</a>
</div>
</footer>
<script>
(function () {
var toggle = document.getElementById("nav-toggle");
var menu = document.getElementById("nav-menu");
if (!toggle || !menu) return;
toggle.addEventListener("click", function () {
var open = menu.classList.toggle("open");
toggle.setAttribute("aria-expanded", open ? "true" : "false");
});
menu.querySelectorAll("a").forEach(function (a) {
a.addEventListener("click", function () {
menu.classList.remove("open");
toggle.setAttribute("aria-expanded", "false");
});
});
})();
</script>
(function () {
// Wires each log's file input to read the picked file client-side and
// drop its text into the matching textarea — same field the paste path
// already fills, so submit() doesn't need to know which one was used.
["launcher_log", "compat_log", "core_log"].forEach(function (id) {
var fileInput = document.getElementById(id + "_file");
var filenameEl = document.getElementById(id + "_filename");
var textarea = document.getElementById(id);
fileInput.addEventListener("change", function () {
var file = fileInput.files[0];
if (!file) return;
var reader = new FileReader();
reader.onload = function () {
textarea.value = reader.result;
filenameEl.textContent = "Loaded " + file.name + " (" + file.size.toLocaleString() + " bytes)";
filenameEl.style.display = "block";
};
reader.onerror = function () {
filenameEl.textContent = "Couldn't read " + file.name + " — paste the contents instead.";
filenameEl.style.display = "block";
};
reader.readAsText(file);
});
});
})();
<script src="assets/discord-link.js"></script>
(function () {
var RELAY_URL = "https://android-horizon-compat-relay.zeraoralegendary.workers.dev";
var MAX_APK_UPLOAD_BYTES = 300 * 1024 * 1024;
// apkUpload.state: "idle" | "uploading" | "done" | "error"
var apkUpload = { state: "idle", objectKey: null };
var apkFileInput = document.getElementById("apk_file");
var apkFilenameEl = document.getElementById("apk_file_filename");
var apkUrlInput = document.getElementById("apk_url");
var submitBtn = document.querySelector("#report-form button[type=submit]");
function xhrPut(url, file, onProgress) {
return new Promise(function (resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open("PUT", url);
xhr.upload.addEventListener("progress", function (e) {
if (e.lengthComputable) onProgress(e.loaded / e.total);
});
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) resolve();
else reject(new Error("upload failed (HTTP " + xhr.status + ")"));
};
xhr.onerror = function () { reject(new Error("upload failed (network error)")); };
xhr.send(file);
});
}
apkFileInput.addEventListener("change", function () {
var file = apkFileInput.files[0];
apkUpload.state = "idle";
apkUpload.objectKey = null;
if (!file) { apkFilenameEl.style.display = "none"; return; }
if (file.size > MAX_APK_UPLOAD_BYTES) {
apkFilenameEl.textContent = file.name + " is over " + (MAX_APK_UPLOAD_BYTES / (1024 * 1024)) + "MB — use a download link instead.";
apkFilenameEl.style.display = "block";
apkFileInput.value = "";
return;
}
apkUpload.state = "uploading";
apkUrlInput.disabled = true;
submitBtn.disabled = true;
apkFilenameEl.style.display = "block";
apkFilenameEl.textContent = "Uploading " + file.name + "… 0%";
fetch(RELAY_URL + "/apk-upload-url", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ filename: file.name }),
})
.then(function (r) { return r.json(); })
.then(function (result) {
if (!result.ok) throw new Error(result.error || "couldn't get an upload URL");
return xhrPut(result.upload_url, file, function (fraction) {
apkFilenameEl.textContent = "Uploading " + file.name + "… " + Math.round(fraction * 100) + "%";
}).then(function () { return result.object_key; });
})
.then(function (objectKey) {
apkUpload.state = "done";
apkUpload.objectKey = objectKey;
apkFilenameEl.textContent = "Uploaded " + file.name + " (" + file.size.toLocaleString() + " bytes) — the link field below is ignored while a file is attached.";
submitBtn.disabled = false;
})
.catch(function (e) {
apkUpload.state = "error";
apkFilenameEl.textContent = "Couldn't upload " + file.name + " (" + e.message + ") — try again, or use a download link instead.";
apkUrlInput.disabled = false;
submitBtn.disabled = false;
});
});
var form = document.getElementById("report-form");
var status = document.getElementById("status");
form.addEventListener("submit", function (ev) {
ev.preventDefault();
if (apkUpload.state === "uploading") {
status.className = "err";
status.textContent = "Still uploading the APK — wait for it to finish.";
return;
}
if (apkUpload.state !== "done" && !apkUrlInput.value.trim()) {
status.className = "err";
status.textContent = "Attach the APK file or paste a download link.";
return;
}
var payload = {
source_site: document.getElementById("source_site").value.trim(),
github_username: document.getElementById("github_username").value.trim(),
launcher_log: document.getElementById("launcher_log").value,
compat_log: document.getElementById("compat_log").value,
core_log: document.getElementById("core_log").value,
notes: document.getElementById("notes").value,
};
if (apkUpload.state === "done") {
payload.apk_object_key = apkUpload.objectKey;
} else {
payload.apk_url = apkUrlInput.value.trim();
}
submitBtn.disabled = true;
status.className = "pending";
status.textContent = "Submitting…";
fetch(RELAY_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
})
.then(function (r) { return r.json().then(function (j) { return { ok: r.ok, body: j }; }); })
.then(function (result) {
if (result.ok && result.body.ok) {
status.className = "ok";
status.textContent = "Submitted! It'll be analyzed automatically — check the compatibility page in a few minutes.";
form.reset();
apkUpload.state = "idle";
apkUpload.objectKey = null;
apkUrlInput.disabled = false;
apkFilenameEl.style.display = "none";
} else {
status.className = "err";
status.textContent = "Couldn't submit: " + (result.body.error || "unknown error");
submitBtn.disabled = false;
}
})
.catch(function (e) {
status.className = "err";
status.textContent = "Couldn't reach the submission service — try again shortly.";
submitBtn.disabled = false;
});
});
})();
</script>
</body>
</html>