add updater version 1.0.2
This commit is contained in:
1 parent
aa3addbeba
commit
6c642935cf
14 files changed
+2394
No files matched your search
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec node /usr/lib/pga-plugin-manager/updater.js "$@"
|
||||
+423
@@ -0,0 +1,423 @@
|
||||
<!doctype html>
|
||||
|
||||
<h3>PGA Modification Downloader for Minecraft - Notice: for internal (LAN) use only. NEVER expose to the internet!</h3>
|
||||
<inp>
|
||||
<p>Absolute Plugin/Mod Folder Path:</p>
|
||||
<p style="color: red"> Warning: Script removes all files excluding folders. Script ignores files that start with "!" in name as an override.</p>
|
||||
<input type="text" id="path"></input>
|
||||
<button onclick="set_path();">Set</button>
|
||||
<p>Modrinth Collection URL (Full):</p>
|
||||
<input type="text" id="url">
|
||||
<button onclick="set_url();">Set</button>
|
||||
<p>Server Type & Minecraft Version:</p>
|
||||
<select id="type">
|
||||
<option value="paper">Paper (default)</option>
|
||||
<option value="spigot">Spigot</option>
|
||||
<option value="fabric">Fabric</option>
|
||||
<option value="forge">Forge</option>
|
||||
<option value="velocity">Velocity</option>
|
||||
</select>
|
||||
|
||||
<select id="options"></select>
|
||||
<button onclick="get_plugins()" type="button" id="submit">Submit</button>
|
||||
</form>
|
||||
|
||||
<p>Log:</p>
|
||||
<div id="log" class="log" style="background-color: black"></div>
|
||||
|
||||
<div class="log_buttons">
|
||||
<button
|
||||
disabled
|
||||
id="btn_download_compatible"
|
||||
onclick="download_compatible()"
|
||||
>
|
||||
Install Compatible Plugins
|
||||
</button>
|
||||
<button disabled id="btn_download_all" onclick="download_all()">
|
||||
Install Compatible AND Incompatible Plugins (may cause issues)
|
||||
</button>
|
||||
<button disabled id="btn_download_zip" onclick="download_zip()">
|
||||
Download zip with no plugin folder changes (safest)
|
||||
</button>
|
||||
|
||||
<input type="file" id="plugins_folder" webkitdirectory multiple hidden />
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
//Call on every refresh
|
||||
rq_vers()
|
||||
url = get_url();
|
||||
get_path();
|
||||
|
||||
// vars
|
||||
let path_set = false;
|
||||
let url_set = false;
|
||||
let all_compatible_versions = [];
|
||||
let all_incompatible_versions = [];
|
||||
|
||||
|
||||
async function set_url() {
|
||||
const url = document.getElementById("url");
|
||||
|
||||
const response = await fetch("http://localhost:3000/api/seturl", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "text/plain",
|
||||
},
|
||||
body: url.value,
|
||||
});
|
||||
|
||||
for await (const text of response.body.pipeThrough(
|
||||
new TextDecoderStream(),
|
||||
)) {
|
||||
alert(text);
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function get_url() {
|
||||
const url = document.getElementById("url");
|
||||
const response = await fetch("http://localhost:3000/api/geturl", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "text/plain",
|
||||
},
|
||||
});
|
||||
|
||||
const data = await response.text();
|
||||
|
||||
if (data === "") {
|
||||
url.placeholder = "URL not set. URL must be set to continue."
|
||||
url_set = false;
|
||||
}
|
||||
|
||||
else {
|
||||
url.innerText = data;
|
||||
url.value = data;
|
||||
url_set = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function get_path() {
|
||||
const path = document.getElementById("path");
|
||||
const response = await fetch("http://localhost:3000/api/getpath", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "text/plain",
|
||||
},
|
||||
});
|
||||
|
||||
const data = await response.text();
|
||||
|
||||
if (data === "") {
|
||||
path.placeholder = "Path not set. Path must be set to continue."
|
||||
path_set = false;
|
||||
}
|
||||
|
||||
else {
|
||||
path.innerText = data;
|
||||
path.value = data;
|
||||
path_set = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async function set_path() {
|
||||
const path = document.getElementById("path");
|
||||
|
||||
const response = await fetch("http://localhost:3000/api/setpath", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "text/plain",
|
||||
},
|
||||
body: path.value,
|
||||
});
|
||||
|
||||
for await (const text of response.body.pipeThrough(
|
||||
new TextDecoderStream(),
|
||||
)) {
|
||||
alert(text);
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
function rq_vers() {
|
||||
const xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.onload = () => {
|
||||
const data = JSON.parse(xhr.responseText);
|
||||
|
||||
const sel = document.getElementById("options");
|
||||
|
||||
for (let i = 0; i < data["versions"]["length"]; i++) {
|
||||
if (data["versions"][i]["type"] === "release") {
|
||||
var opt = document.createElement("option");
|
||||
opt.value = data["versions"][i]["id"];
|
||||
opt.innerHTML = data["versions"][i]["id"];
|
||||
sel.appendChild(opt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.open(
|
||||
"GET",
|
||||
"https://piston-meta.mojang.com/mc/game/version_manifest_v2.json",
|
||||
);
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
|
||||
async function log_server_callback(array) {
|
||||
document.getElementById("btn_download_compatible").disabled = true;
|
||||
document.getElementById("btn_download_all").disabled = true;
|
||||
document.getElementById("btn_download_zip").disabled = true;
|
||||
const log = document.getElementById("log");
|
||||
|
||||
|
||||
const response = await fetch("http://localhost:3000/api/downloader/", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(array),
|
||||
});
|
||||
|
||||
for await (const chunk of response.body.pipeThrough(
|
||||
new TextDecoderStream(),
|
||||
)) {
|
||||
for (const line of chunk.split("\n")) {
|
||||
if (!line.trim()) continue;
|
||||
|
||||
log.insertAdjacentHTML("beforeend", `${line}<br>`);
|
||||
}
|
||||
|
||||
log.scrollTop = log.scrollHeight;
|
||||
}
|
||||
}
|
||||
|
||||
async function download_compatible() {
|
||||
log_server_callback(all_compatible_versions);
|
||||
all_compatible_versions = [];
|
||||
all_incompatible_versions = [];
|
||||
}
|
||||
|
||||
function download_all() {
|
||||
let combined = all_compatible_versions.concat(
|
||||
all_incompatible_versions,
|
||||
);
|
||||
log_server_callback(combined);
|
||||
all_compatible_versions = [];
|
||||
all_incompatible_versions = [];
|
||||
}
|
||||
|
||||
async function fetch_zip(array, file_name) {
|
||||
const response = await fetch("http://localhost:3000/api/downloader/direct", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(array),
|
||||
});
|
||||
|
||||
const blob = await response.blob();
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const a = document.createElement("a");
|
||||
|
||||
a.href = url;
|
||||
a.download = file_name;
|
||||
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
async function download_zip() {
|
||||
|
||||
document.getElementById("btn_download_compatible").disabled = true;
|
||||
document.getElementById("btn_download_all").disabled = true;
|
||||
document.getElementById("btn_download_zip").disabled = true;
|
||||
const log = document.getElementById("log");
|
||||
var lv = document.createElement("p");
|
||||
var lv2 = document.createElement("p");
|
||||
|
||||
lv.innerHTML = `Downloading Zips.. Please wait..`;
|
||||
lv.style.color = "white";
|
||||
lv.style.font = "Arial";
|
||||
log.appendChild(lv);
|
||||
|
||||
if (all_compatible_versions.length > 0) {
|
||||
await fetch_zip(all_compatible_versions, "compatible_versions.zip")
|
||||
}
|
||||
|
||||
if (all_incompatible_versions.length > 0) {
|
||||
await fetch_zip(all_incompatible_versions, "incompatible_versions.zip")
|
||||
}
|
||||
|
||||
all_compatible_versions = [];
|
||||
all_incompatible_versions = [];
|
||||
|
||||
lv2.innerHTML = `All downloads complete!`;
|
||||
lv2.style.color = "green";
|
||||
lv2.style.font = "Arial";
|
||||
log.appendChild(lv2);
|
||||
|
||||
}
|
||||
|
||||
async function get_plugins() {
|
||||
|
||||
if (path_set == false) {
|
||||
alert("Please set your plugin/mod folder before continuing.")
|
||||
return;
|
||||
}
|
||||
|
||||
if (url_set == false) {
|
||||
alert("Please set your Modrinth Collection URL before continuing.")
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const sel = document.getElementById("options");
|
||||
const log = document.getElementById("log");
|
||||
const submit = document.getElementById("submit");
|
||||
const type = document.getElementById("type");
|
||||
const url = document.getElementById("url");
|
||||
submit.disabled = true;
|
||||
document.getElementById("btn_download_compatible").disabled = true;
|
||||
document.getElementById("btn_download_all").disabled = true;
|
||||
document.getElementById("btn_download_zip").disabled = true;
|
||||
all_compatible_versions = [];
|
||||
all_incompatible_versions = [];
|
||||
compatible_mods_ids = [];
|
||||
incompatible_mods_ids = [];
|
||||
|
||||
log.innerHTML = "";
|
||||
const id = url.value.split("/").pop();
|
||||
|
||||
const response = await fetch(
|
||||
`http://localhost:3000/api/modrinth/collection/${id}`,
|
||||
);
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.projects) {
|
||||
var not_found = document.createElement("p");
|
||||
|
||||
not_found.innerHTML = "The specified collection is empty or does not exist!";
|
||||
not_found.style.color = "#fc5d07";
|
||||
not_found.style.font = "Arial";
|
||||
|
||||
log.appendChild(not_found);
|
||||
|
||||
submit.disabled = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < data.projects["length"]; i++) {
|
||||
let id = data.projects[i];
|
||||
|
||||
const versions = await fetch(
|
||||
`https://api.modrinth.com/v2/project/${id}/version`,
|
||||
).then((r) => r.json());
|
||||
|
||||
const project = await fetch(
|
||||
`https://api.modrinth.com/v2/project/${id}`,
|
||||
).then((r) => r.json());
|
||||
|
||||
let latest = null;
|
||||
let latest_incompatible = null;
|
||||
|
||||
for (const version of versions) {
|
||||
if (!version.loaders.includes(type.value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (version.game_versions.includes(sel.value)) {
|
||||
if (latest === null ||new Date(version.date_published) > new Date(latest.date_published)) {
|
||||
latest = version;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
if (latest_incompatible === null || new Date(version.date_published) > new Date(latest_incompatible.date_published)
|
||||
) {
|
||||
latest_incompatible = version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var lv = document.createElement("p");
|
||||
|
||||
var project_link = `https://modrinth.com/plugin/${project.slug}`;
|
||||
|
||||
if (latest) {
|
||||
lv.innerHTML = `Found matching version with name: ${latest["name"]}, <a href="${project_link}" target="_blank">link: ${project_link}</a>`;
|
||||
lv.style.color = "green";
|
||||
lv.style.font = "Arial";
|
||||
all_compatible_versions.push(latest.id);
|
||||
log.appendChild(lv);
|
||||
} else if (latest_incompatible) {
|
||||
lv.innerHTML = `No compatible version found for ${id}, name: ${project.title}, <a href="${project_link}" target="_blank">link: ${project_link}</a>`;
|
||||
lv.style.color = "#fc5d07";
|
||||
lv.style.font = "Arial";
|
||||
all_incompatible_versions.push(latest_incompatible.id);
|
||||
|
||||
log.appendChild(lv);
|
||||
} else {
|
||||
lv.innerHTML = `Mod/Plugin ${project.title} does not have an option for the selected loader`
|
||||
lv.style.color = "#fc5d07";
|
||||
lv.style.font = "Arial";
|
||||
log.appendChild(lv);
|
||||
|
||||
}
|
||||
|
||||
if (!versions.length) {
|
||||
console.warn(`No versions found for ${project.id}`);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
submit.disabled = false;
|
||||
|
||||
if (all_compatible_versions.length > 0 || all_incompatible_versions > 0) {
|
||||
document.getElementById("btn_download_compatible").disabled = false;
|
||||
document.getElementById("btn_download_all").disabled = false;
|
||||
document.getElementById("btn_download_zip").disabled = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
a {
|
||||
color: #c4c9ce;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: #c4c9ce;
|
||||
}
|
||||
|
||||
.log {
|
||||
width: 100%;
|
||||
height: 350px;
|
||||
color: white;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.log_buttons {
|
||||
margin-top: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.log_buttons button:disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
Generated
+924
@@ -0,0 +1,924 @@
|
||||
{
|
||||
"name": "pgapluginupdater",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pgapluginupdater",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@zip.js/zip.js": "^2.8.52",
|
||||
"express": "^5.2.1",
|
||||
"js-yaml": "^5.3.0",
|
||||
"node-deb": "^0.10.7",
|
||||
"os": "^0.1.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@zip.js/zip.js": {
|
||||
"version": "2.8.52",
|
||||
"resolved": "https://registry.npmjs.org/@zip.js/zip.js/-/zip.js-2.8.52.tgz",
|
||||
"integrity": "sha512-ZVXpmXRROrjz/0Glm9homDpSUAiavgpdnR+0tGlTtvtIsqs/d7f7qqbkOxrRKfUaNML68YXb4reIA3vZjul3uQ==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"bun": ">=0.7.0",
|
||||
"deno": ">=1.0.0",
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
|
||||
"integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-types": "^3.0.0",
|
||||
"negotiator": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
|
||||
"license": "Python-2.0"
|
||||
},
|
||||
"node_modules/body-parser": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.3.0.tgz",
|
||||
"integrity": "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "^3.1.2",
|
||||
"content-type": "^2.0.0",
|
||||
"debug": "^4.4.3",
|
||||
"http-errors": "^2.0.1",
|
||||
"iconv-lite": "^0.7.2",
|
||||
"on-finished": "^2.4.1",
|
||||
"qs": "^6.15.2",
|
||||
"raw-body": "^3.0.2",
|
||||
"type-is": "^2.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/body-parser/node_modules/content-type": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz",
|
||||
"integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind-apply-helpers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bound": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
|
||||
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"get-intrinsic": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz",
|
||||
"integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/content-type": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
||||
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
|
||||
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie-signature": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
|
||||
"integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/depd": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
||||
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
||||
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
|
||||
"integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/express": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
|
||||
"integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"accepts": "^2.0.0",
|
||||
"body-parser": "^2.2.1",
|
||||
"content-disposition": "^1.0.0",
|
||||
"content-type": "^1.0.5",
|
||||
"cookie": "^0.7.1",
|
||||
"cookie-signature": "^1.2.1",
|
||||
"debug": "^4.4.0",
|
||||
"depd": "^2.0.0",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"finalhandler": "^2.1.0",
|
||||
"fresh": "^2.0.0",
|
||||
"http-errors": "^2.0.0",
|
||||
"merge-descriptors": "^2.0.0",
|
||||
"mime-types": "^3.0.0",
|
||||
"on-finished": "^2.4.1",
|
||||
"once": "^1.4.0",
|
||||
"parseurl": "^1.3.3",
|
||||
"proxy-addr": "^2.0.7",
|
||||
"qs": "^6.14.0",
|
||||
"range-parser": "^1.2.1",
|
||||
"router": "^2.2.0",
|
||||
"send": "^1.1.0",
|
||||
"serve-static": "^2.2.0",
|
||||
"statuses": "^2.0.1",
|
||||
"type-is": "^2.0.1",
|
||||
"vary": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/finalhandler": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",
|
||||
"integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.4.0",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"on-finished": "^2.4.1",
|
||||
"parseurl": "^1.3.3",
|
||||
"statuses": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/fresh": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
|
||||
"integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"math-intrinsics": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
|
||||
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/http-errors": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
|
||||
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"depd": "~2.0.0",
|
||||
"inherits": "~2.0.4",
|
||||
"setprototypeof": "~1.2.0",
|
||||
"statuses": "~2.0.2",
|
||||
"toidentifier": "~1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.3.tgz",
|
||||
"integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/ipaddr.js": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/is-promise": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
|
||||
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.3.0.tgz",
|
||||
"integrity": "sha512-muutsYr+e2+d3rTgUGslq5rxbBlUy3cJ61IsHag2QNDQV+7zXWjkUpmALIajhrlLlrgRUiymj6U3zUr/TMK84Q==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/puzrin"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/nodeca"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.mjs"
|
||||
}
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/media-typer": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.1.tgz",
|
||||
"integrity": "sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/merge-descriptors": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
|
||||
"integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.54.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
|
||||
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz",
|
||||
"integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-db": "^1.54.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
|
||||
"integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/node-deb": {
|
||||
"version": "0.10.7",
|
||||
"resolved": "https://registry.npmjs.org/node-deb/-/node-deb-0.10.7.tgz",
|
||||
"integrity": "sha512-MEXsGSjNcf7HVkaId8wIBjmEa5l1FuLR+KYr84n4RIDj9gDF9VwxU0gvV+9fUYYmZZ9bP+1MvDDOz/ELrMizAA==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"node-deb": "node-deb"
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.4",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
|
||||
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/on-finished": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
||||
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/os": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/os/-/os-0.1.2.tgz",
|
||||
"integrity": "sha512-ZoXJkvAnljwvc56MbvhtKVWmSkzV712k42Is2mA0+0KTSRakq5XXuXpjZjgAt9ctzl51ojhQWakQQpmOvXWfjQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-to-regexp": {
|
||||
"version": "8.4.2",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz",
|
||||
"integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-addr": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"forwarded": "0.2.0",
|
||||
"ipaddr.js": "1.9.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.15.3",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz",
|
||||
"integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"es-define-property": "^1.0.1",
|
||||
"side-channel": "^1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/range-parser": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.3.0.tgz",
|
||||
"integrity": "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/raw-body": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz",
|
||||
"integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "~3.1.2",
|
||||
"http-errors": "~2.0.1",
|
||||
"iconv-lite": "~0.7.0",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/router": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
|
||||
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.4.0",
|
||||
"depd": "^2.0.0",
|
||||
"is-promise": "^4.0.0",
|
||||
"parseurl": "^1.3.3",
|
||||
"path-to-regexp": "^8.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/send": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",
|
||||
"integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.4.3",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"fresh": "^2.0.0",
|
||||
"http-errors": "^2.0.1",
|
||||
"mime-types": "^3.0.2",
|
||||
"ms": "^2.1.3",
|
||||
"on-finished": "^2.4.1",
|
||||
"range-parser": "^1.2.1",
|
||||
"statuses": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/serve-static": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz",
|
||||
"integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"parseurl": "^1.3.3",
|
||||
"send": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/setprototypeof": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
|
||||
"integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.4",
|
||||
"side-channel-list": "^1.0.1",
|
||||
"side-channel-map": "^1.0.1",
|
||||
"side-channel-weakmap": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-list": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
|
||||
"integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-map": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
||||
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-weakmap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
||||
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-map": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/statuses": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
||||
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/toidentifier": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/type-is": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz",
|
||||
"integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"content-type": "^2.0.0",
|
||||
"media-typer": "^1.1.0",
|
||||
"mime-types": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/type-is/node_modules/content-type": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz",
|
||||
"integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||
"license": "ISC"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "pgapluginupdater",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"license": "ISC",
|
||||
"author": "",
|
||||
"type": "commonjs",
|
||||
"main": "updater.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@zip.js/zip.js": "^2.8.52",
|
||||
"express": "^5.2.1",
|
||||
"js-yaml": "^5.3.0",
|
||||
"node-deb": "^0.10.7",
|
||||
"os": "^0.1.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
Package: pga-plugin-manager
|
||||
Version: 1.0.2
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Depends: nodejs, npm
|
||||
Maintainer: Evan Niederwerfer
|
||||
Description: Minecraft infrustructure for plugins
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
cd /usr/lib/pga-plugin-manager
|
||||
npm install --omit=dev
|
||||
|
||||
cp /usr/lib/pga-plugin-manager/pga-plugin-manager.service /etc/systemd/system/pga-plugin-manager.service
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now pga-plugin-manager.service
|
||||
echo "Now running at http://localhost:3000, and will run on every boot. "
|
||||
exit 0
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd /usr/lib/pga-plugin-manager || exit 1
|
||||
exec ./app.sh "$@"
|
||||
EOF
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec node /usr/lib/pga-plugin-manager/updater.js "$@"
|
||||
@@ -0,0 +1,423 @@
|
||||
<!doctype html>
|
||||
|
||||
<h3>PGA Modification Downloader for Minecraft - Notice: for internal (LAN) use only. NEVER expose to the internet!</h3>
|
||||
<inp>
|
||||
<p>Absolute Plugin/Mod Folder Path:</p>
|
||||
<p style="color: red"> Warning: Script removes all files excluding folders. Script ignores files that start with "!" in name as an override.</p>
|
||||
<input type="text" id="path"></input>
|
||||
<button onclick="set_path();">Set</button>
|
||||
<p>Modrinth Collection URL (Full):</p>
|
||||
<input type="text" id="url">
|
||||
<button onclick="set_url();">Set</button>
|
||||
<p>Server Type & Minecraft Version:</p>
|
||||
<select id="type">
|
||||
<option value="paper">Paper (default)</option>
|
||||
<option value="spigot">Spigot</option>
|
||||
<option value="fabric">Fabric</option>
|
||||
<option value="forge">Forge</option>
|
||||
<option value="velocity">Velocity</option>
|
||||
</select>
|
||||
|
||||
<select id="options"></select>
|
||||
<button onclick="get_plugins()" type="button" id="submit">Submit</button>
|
||||
</form>
|
||||
|
||||
<p>Log:</p>
|
||||
<div id="log" class="log" style="background-color: black"></div>
|
||||
|
||||
<div class="log_buttons">
|
||||
<button
|
||||
disabled
|
||||
id="btn_download_compatible"
|
||||
onclick="download_compatible()"
|
||||
>
|
||||
Install Compatible Plugins
|
||||
</button>
|
||||
<button disabled id="btn_download_all" onclick="download_all()">
|
||||
Install Compatible AND Incompatible Plugins (may cause issues)
|
||||
</button>
|
||||
<button disabled id="btn_download_zip" onclick="download_zip()">
|
||||
Download zip with no plugin folder changes (safest)
|
||||
</button>
|
||||
|
||||
<input type="file" id="plugins_folder" webkitdirectory multiple hidden />
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
//Call on every refresh
|
||||
rq_vers()
|
||||
url = get_url();
|
||||
get_path();
|
||||
|
||||
// vars
|
||||
let path_set = false;
|
||||
let url_set = false;
|
||||
let all_compatible_versions = [];
|
||||
let all_incompatible_versions = [];
|
||||
|
||||
|
||||
async function set_url() {
|
||||
const url = document.getElementById("url");
|
||||
|
||||
const response = await fetch("http://localhost:3000/api/seturl", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "text/plain",
|
||||
},
|
||||
body: url.value,
|
||||
});
|
||||
|
||||
for await (const text of response.body.pipeThrough(
|
||||
new TextDecoderStream(),
|
||||
)) {
|
||||
alert(text);
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function get_url() {
|
||||
const url = document.getElementById("url");
|
||||
const response = await fetch("http://localhost:3000/api/geturl", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "text/plain",
|
||||
},
|
||||
});
|
||||
|
||||
const data = await response.text();
|
||||
|
||||
if (data === "") {
|
||||
url.placeholder = "URL not set. URL must be set to continue."
|
||||
url_set = false;
|
||||
}
|
||||
|
||||
else {
|
||||
url.innerText = data;
|
||||
url.value = data;
|
||||
url_set = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function get_path() {
|
||||
const path = document.getElementById("path");
|
||||
const response = await fetch("http://localhost:3000/api/getpath", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "text/plain",
|
||||
},
|
||||
});
|
||||
|
||||
const data = await response.text();
|
||||
|
||||
if (data === "") {
|
||||
path.placeholder = "Path not set. Path must be set to continue."
|
||||
path_set = false;
|
||||
}
|
||||
|
||||
else {
|
||||
path.innerText = data;
|
||||
path.value = data;
|
||||
path_set = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async function set_path() {
|
||||
const path = document.getElementById("path");
|
||||
|
||||
const response = await fetch("http://localhost:3000/api/setpath", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "text/plain",
|
||||
},
|
||||
body: path.value,
|
||||
});
|
||||
|
||||
for await (const text of response.body.pipeThrough(
|
||||
new TextDecoderStream(),
|
||||
)) {
|
||||
alert(text);
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
function rq_vers() {
|
||||
const xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.onload = () => {
|
||||
const data = JSON.parse(xhr.responseText);
|
||||
|
||||
const sel = document.getElementById("options");
|
||||
|
||||
for (let i = 0; i < data["versions"]["length"]; i++) {
|
||||
if (data["versions"][i]["type"] === "release") {
|
||||
var opt = document.createElement("option");
|
||||
opt.value = data["versions"][i]["id"];
|
||||
opt.innerHTML = data["versions"][i]["id"];
|
||||
sel.appendChild(opt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.open(
|
||||
"GET",
|
||||
"https://piston-meta.mojang.com/mc/game/version_manifest_v2.json",
|
||||
);
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
|
||||
async function log_server_callback(array) {
|
||||
document.getElementById("btn_download_compatible").disabled = true;
|
||||
document.getElementById("btn_download_all").disabled = true;
|
||||
document.getElementById("btn_download_zip").disabled = true;
|
||||
const log = document.getElementById("log");
|
||||
|
||||
|
||||
const response = await fetch("http://localhost:3000/api/downloader/", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(array),
|
||||
});
|
||||
|
||||
for await (const chunk of response.body.pipeThrough(
|
||||
new TextDecoderStream(),
|
||||
)) {
|
||||
for (const line of chunk.split("\n")) {
|
||||
if (!line.trim()) continue;
|
||||
|
||||
log.insertAdjacentHTML("beforeend", `${line}<br>`);
|
||||
}
|
||||
|
||||
log.scrollTop = log.scrollHeight;
|
||||
}
|
||||
}
|
||||
|
||||
async function download_compatible() {
|
||||
log_server_callback(all_compatible_versions);
|
||||
all_compatible_versions = [];
|
||||
all_incompatible_versions = [];
|
||||
}
|
||||
|
||||
function download_all() {
|
||||
let combined = all_compatible_versions.concat(
|
||||
all_incompatible_versions,
|
||||
);
|
||||
log_server_callback(combined);
|
||||
all_compatible_versions = [];
|
||||
all_incompatible_versions = [];
|
||||
}
|
||||
|
||||
async function fetch_zip(array, file_name) {
|
||||
const response = await fetch("http://localhost:3000/api/downloader/direct", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(array),
|
||||
});
|
||||
|
||||
const blob = await response.blob();
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const a = document.createElement("a");
|
||||
|
||||
a.href = url;
|
||||
a.download = file_name;
|
||||
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
async function download_zip() {
|
||||
|
||||
document.getElementById("btn_download_compatible").disabled = true;
|
||||
document.getElementById("btn_download_all").disabled = true;
|
||||
document.getElementById("btn_download_zip").disabled = true;
|
||||
const log = document.getElementById("log");
|
||||
var lv = document.createElement("p");
|
||||
var lv2 = document.createElement("p");
|
||||
|
||||
lv.innerHTML = `Downloading Zips.. Please wait..`;
|
||||
lv.style.color = "white";
|
||||
lv.style.font = "Arial";
|
||||
log.appendChild(lv);
|
||||
|
||||
if (all_compatible_versions.length > 0) {
|
||||
await fetch_zip(all_compatible_versions, "compatible_versions.zip")
|
||||
}
|
||||
|
||||
if (all_incompatible_versions.length > 0) {
|
||||
await fetch_zip(all_incompatible_versions, "incompatible_versions.zip")
|
||||
}
|
||||
|
||||
all_compatible_versions = [];
|
||||
all_incompatible_versions = [];
|
||||
|
||||
lv2.innerHTML = `All downloads complete!`;
|
||||
lv2.style.color = "green";
|
||||
lv2.style.font = "Arial";
|
||||
log.appendChild(lv2);
|
||||
|
||||
}
|
||||
|
||||
async function get_plugins() {
|
||||
|
||||
if (path_set == false) {
|
||||
alert("Please set your plugin/mod folder before continuing.")
|
||||
return;
|
||||
}
|
||||
|
||||
if (url_set == false) {
|
||||
alert("Please set your Modrinth Collection URL before continuing.")
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const sel = document.getElementById("options");
|
||||
const log = document.getElementById("log");
|
||||
const submit = document.getElementById("submit");
|
||||
const type = document.getElementById("type");
|
||||
const url = document.getElementById("url");
|
||||
submit.disabled = true;
|
||||
document.getElementById("btn_download_compatible").disabled = true;
|
||||
document.getElementById("btn_download_all").disabled = true;
|
||||
document.getElementById("btn_download_zip").disabled = true;
|
||||
all_compatible_versions = [];
|
||||
all_incompatible_versions = [];
|
||||
compatible_mods_ids = [];
|
||||
incompatible_mods_ids = [];
|
||||
|
||||
log.innerHTML = "";
|
||||
const id = url.value.split("/").pop();
|
||||
|
||||
const response = await fetch(
|
||||
`http://localhost:3000/api/modrinth/collection/${id}`,
|
||||
);
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.projects) {
|
||||
var not_found = document.createElement("p");
|
||||
|
||||
not_found.innerHTML = "The specified collection is empty or does not exist!";
|
||||
not_found.style.color = "#fc5d07";
|
||||
not_found.style.font = "Arial";
|
||||
|
||||
log.appendChild(not_found);
|
||||
|
||||
submit.disabled = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < data.projects["length"]; i++) {
|
||||
let id = data.projects[i];
|
||||
|
||||
const versions = await fetch(
|
||||
`https://api.modrinth.com/v2/project/${id}/version`,
|
||||
).then((r) => r.json());
|
||||
|
||||
const project = await fetch(
|
||||
`https://api.modrinth.com/v2/project/${id}`,
|
||||
).then((r) => r.json());
|
||||
|
||||
let latest = null;
|
||||
let latest_incompatible = null;
|
||||
|
||||
for (const version of versions) {
|
||||
if (!version.loaders.includes(type.value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (version.game_versions.includes(sel.value)) {
|
||||
if (latest === null ||new Date(version.date_published) > new Date(latest.date_published)) {
|
||||
latest = version;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
if (latest_incompatible === null || new Date(version.date_published) > new Date(latest_incompatible.date_published)
|
||||
) {
|
||||
latest_incompatible = version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var lv = document.createElement("p");
|
||||
|
||||
var project_link = `https://modrinth.com/plugin/${project.slug}`;
|
||||
|
||||
if (latest) {
|
||||
lv.innerHTML = `Found matching version with name: ${latest["name"]}, <a href="${project_link}" target="_blank">link: ${project_link}</a>`;
|
||||
lv.style.color = "green";
|
||||
lv.style.font = "Arial";
|
||||
all_compatible_versions.push(latest.id);
|
||||
log.appendChild(lv);
|
||||
} else if (latest_incompatible) {
|
||||
lv.innerHTML = `No compatible version found for ${id}, name: ${project.title}, <a href="${project_link}" target="_blank">link: ${project_link}</a>`;
|
||||
lv.style.color = "#fc5d07";
|
||||
lv.style.font = "Arial";
|
||||
all_incompatible_versions.push(latest_incompatible.id);
|
||||
|
||||
log.appendChild(lv);
|
||||
} else {
|
||||
lv.innerHTML = `Mod/Plugin ${project.title} does not have an option for the selected loader`
|
||||
lv.style.color = "#fc5d07";
|
||||
lv.style.font = "Arial";
|
||||
log.appendChild(lv);
|
||||
|
||||
}
|
||||
|
||||
if (!versions.length) {
|
||||
console.warn(`No versions found for ${project.id}`);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
submit.disabled = false;
|
||||
|
||||
if (all_compatible_versions.length > 0 || all_incompatible_versions > 0) {
|
||||
document.getElementById("btn_download_compatible").disabled = false;
|
||||
document.getElementById("btn_download_all").disabled = false;
|
||||
document.getElementById("btn_download_zip").disabled = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
a {
|
||||
color: #c4c9ce;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: #c4c9ce;
|
||||
}
|
||||
|
||||
.log {
|
||||
width: 100%;
|
||||
height: 350px;
|
||||
color: white;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.log_buttons {
|
||||
margin-top: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.log_buttons button:disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "pgapluginupdater",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"license": "ISC",
|
||||
"author": "",
|
||||
"type": "commonjs",
|
||||
"main": "updater.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@zip.js/zip.js": "^2.8.52",
|
||||
"express": "^5.2.1",
|
||||
"js-yaml": "^5.3.0",
|
||||
"node-deb": "^0.10.7",
|
||||
"os": "^0.1.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=PGA Plugin Manager
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
WorkingDirectory=/usr/lib/pga-plugin-manager
|
||||
ExecStart=/usr/bin/pga-plugin-manager
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,273 @@
|
||||
const express = require("express");
|
||||
const fspath = require("path");
|
||||
const fsp = require("fs/promises");
|
||||
const fs = require("fs");
|
||||
const yaml = require("js-yaml");
|
||||
const zip = require("@zip.js/zip.js");
|
||||
const os = require("os");
|
||||
|
||||
const app = express();
|
||||
app.use(express.json());
|
||||
app.use(express.text());
|
||||
|
||||
let plugin_path = null;
|
||||
const configDir = fspath.join(os.homedir(), ".config", "pga-plugin-manager");
|
||||
const yaml_filename = fspath.join(configDir, "config.yaml");
|
||||
const appDir = __dirname;
|
||||
|
||||
async function set_yaml(data) {
|
||||
let current = {};
|
||||
|
||||
try {
|
||||
fs.mkdirSync(configDir, { recursive: true });
|
||||
const yamlstr = await fsp.readFile(yaml_filename, "utf8");
|
||||
current = yaml.load(yamlstr);
|
||||
} catch (err) {
|
||||
if (err.code !== "ENOENT") {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
const updated = {
|
||||
...current,
|
||||
...data,
|
||||
};
|
||||
|
||||
await fsp.writeFile(yaml_filename, yaml.dump(updated), "utf8");
|
||||
}
|
||||
|
||||
app.get("/api/geturl/", async (req, res) => {
|
||||
const yamlstr = yaml.load(fs.readFileSync(yaml_filename, "utf8"));
|
||||
res.send(yamlstr.URL);
|
||||
});
|
||||
|
||||
app.post("/api/seturl/", async (req, res) => {
|
||||
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
||||
res.setHeader("Cache-Control", "no-cache, no-transform");
|
||||
res.setHeader("Connection", "keep-alive");
|
||||
res.flushHeaders();
|
||||
|
||||
const send = (message) => {
|
||||
res.write(message + "\n");
|
||||
};
|
||||
|
||||
const base_url = "https://modrinth.com/collection/";
|
||||
|
||||
if (req.body.startsWith(base_url)) {
|
||||
const data = {
|
||||
URL: req.body,
|
||||
};
|
||||
|
||||
set_yaml(data);
|
||||
|
||||
send("Success (If the URL is valid collection)!");
|
||||
} else {
|
||||
send(
|
||||
"ERR: Please submit a URL like https://modrinth.com/collection/(id_here)",
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/getpath/", async (req, res) => {
|
||||
const yamlstr = yaml.load(fs.readFileSync(yaml_filename, "utf8"));
|
||||
res.send(yamlstr.PATH);
|
||||
});
|
||||
|
||||
app.post("/api/setpath/", async (req, res) => {
|
||||
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
||||
res.setHeader("Cache-Control", "no-cache, no-transform");
|
||||
res.setHeader("Connection", "keep-alive");
|
||||
res.flushHeaders();
|
||||
|
||||
const send = (message) => {
|
||||
res.write(message + "\n");
|
||||
};
|
||||
|
||||
try {
|
||||
await fsp.access(req.body, fsp.constants.W_OK).then(() => {
|
||||
const data = {
|
||||
PATH: req.body,
|
||||
};
|
||||
|
||||
set_yaml(data);
|
||||
send("File set successfully to: " + req.body);
|
||||
});
|
||||
} catch (err) {
|
||||
send(
|
||||
"ERR: Path failed to set properly. Either the directory doesn't exist, or the program has no read or write access. " +
|
||||
err,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// Download as zip to browser
|
||||
app.post("/api/downloader/direct", async (req, res) => {
|
||||
res.setHeader("Content-Type", "application/octet-stream; charset=utf-8");
|
||||
res.setHeader("Cache-Control", "no-cache, no-transform");
|
||||
res.setHeader("Connection", "keep-alive");
|
||||
res.flushHeaders();
|
||||
|
||||
const zipFileWriter = new zip.BlobWriter();
|
||||
const zipWriter = new zip.ZipWriter(zipFileWriter);
|
||||
|
||||
for (const versionId of req.body) {
|
||||
const response = await fetch(
|
||||
`https://api.modrinth.com/v2/version/${versionId}`,
|
||||
);
|
||||
|
||||
const version = await response.json();
|
||||
|
||||
// Get the first file attached to the version
|
||||
const file = version.files[0];
|
||||
|
||||
if (!file) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const fileResponse = await fetch(file.url);
|
||||
|
||||
const buffer = Buffer.from(await fileResponse.arrayBuffer());
|
||||
|
||||
const reader = new zip.Uint8ArrayReader(buffer);
|
||||
|
||||
await zipWriter.add(file.filename, reader);
|
||||
}
|
||||
|
||||
await zipWriter.close();
|
||||
const blob = await zipFileWriter.getData();
|
||||
const buffer = Buffer.from(await blob.arrayBuffer());
|
||||
|
||||
res.end(buffer);
|
||||
});
|
||||
|
||||
// Download to server
|
||||
app.post("/api/downloader/", async (req, res) => {
|
||||
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
||||
res.setHeader("Cache-Control", "no-cache, no-transform");
|
||||
res.setHeader("Connection", "keep-alive");
|
||||
res.flushHeaders();
|
||||
|
||||
const send = (message) => {
|
||||
res.write(message + "\n");
|
||||
};
|
||||
|
||||
if (!req.body) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!plugin_path) {
|
||||
send("Unable to update server. No mod/plugin path specified.");
|
||||
console.log("Unable to update server. No mod/plugin path specified.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove all files in Plugins
|
||||
try {
|
||||
const files = await fsp.readdir(plugin_path);
|
||||
|
||||
for (const file of files) {
|
||||
try {
|
||||
if (file.startsWith("!")) {
|
||||
continue;
|
||||
} else {
|
||||
await fsp.unlink(fspath.join(plugin_path, file));
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.code === "EISDIR") {
|
||||
continue;
|
||||
} else {
|
||||
send(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
send("Removed all existing plugins...");
|
||||
|
||||
// Download new files from modrinth
|
||||
|
||||
for (const versionId of req.body) {
|
||||
const response = await fetch(
|
||||
`https://api.modrinth.com/v2/version/${versionId}`,
|
||||
);
|
||||
|
||||
const version = await response.json();
|
||||
|
||||
// Get the first file attached to the version
|
||||
const file = version.files[0];
|
||||
|
||||
if (!file) {
|
||||
send("No files found for version", version, ", skipping..");
|
||||
continue;
|
||||
}
|
||||
|
||||
const fileResponse = await fetch(file.url);
|
||||
|
||||
const buffer = Buffer.from(await fileResponse.arrayBuffer());
|
||||
|
||||
await fsp.writeFile(fspath.join(plugin_path, file.filename), buffer);
|
||||
|
||||
send(`Downloaded ${file.filename}`);
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.code === "ENOENT") {
|
||||
send(
|
||||
"Unable to download plugins, the set directory no longer exists. Please set a new one.",
|
||||
);
|
||||
console.log(
|
||||
"Unable to download plugins, the set directory no longer exists. Please set a new one.",
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
send(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
send("Downloads Complete! Restart your server to finish changes.");
|
||||
|
||||
res.end();
|
||||
});
|
||||
|
||||
app.get("/api/modrinth/collection/:id", async (req, res) => {
|
||||
const { id } = req.params;
|
||||
|
||||
const response = await fetch(
|
||||
`https://api.modrinth.com/v3/collection/${encodeURIComponent(id)}`,
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
return res.status(response.status).json({
|
||||
error: "Modrinth API request failed",
|
||||
});
|
||||
}
|
||||
|
||||
const collection = await response.json();
|
||||
|
||||
res.json(collection);
|
||||
});
|
||||
|
||||
app.get("/", async (req, res) => {
|
||||
try {
|
||||
const yamlstr = yaml.load(fs.readFileSync(yaml_filename, "utf8"));
|
||||
plugin_path = yamlstr.PATH;
|
||||
res.sendFile(fspath.join(appDir, "index.html"));
|
||||
} catch (err) {
|
||||
if (err.code === "ENOENT") {
|
||||
const data = {
|
||||
PATH: "",
|
||||
URL: "",
|
||||
};
|
||||
await set_yaml(data);
|
||||
const yamlstr = yaml.load(fs.readFileSync(yaml_filename, "utf8"));
|
||||
plugin_path = yamlstr.PATH;
|
||||
res.sendFile(fspath.join(appDir, "index.html"));
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log("Server is running on http://localhost:3000");
|
||||
});
|
||||
+273
@@ -0,0 +1,273 @@
|
||||
const express = require("express");
|
||||
const fspath = require("path");
|
||||
const fsp = require("fs/promises");
|
||||
const fs = require("fs");
|
||||
const yaml = require("js-yaml");
|
||||
const zip = require("@zip.js/zip.js");
|
||||
const os = require("os");
|
||||
|
||||
const app = express();
|
||||
app.use(express.json());
|
||||
app.use(express.text());
|
||||
|
||||
let plugin_path = null;
|
||||
const configDir = fspath.join(os.homedir(), ".config", "pga-plugin-manager");
|
||||
const yaml_filename = fspath.join(configDir, "config.yaml");
|
||||
const appDir = __dirname;
|
||||
|
||||
async function set_yaml(data) {
|
||||
let current = {};
|
||||
|
||||
try {
|
||||
fs.mkdirSync(configDir, { recursive: true });
|
||||
const yamlstr = await fsp.readFile(yaml_filename, "utf8");
|
||||
current = yaml.load(yamlstr);
|
||||
} catch (err) {
|
||||
if (err.code !== "ENOENT") {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
const updated = {
|
||||
...current,
|
||||
...data,
|
||||
};
|
||||
|
||||
await fsp.writeFile(yaml_filename, yaml.dump(updated), "utf8");
|
||||
}
|
||||
|
||||
app.get("/api/geturl/", async (req, res) => {
|
||||
const yamlstr = yaml.load(fs.readFileSync(yaml_filename, "utf8"));
|
||||
res.send(yamlstr.URL);
|
||||
});
|
||||
|
||||
app.post("/api/seturl/", async (req, res) => {
|
||||
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
||||
res.setHeader("Cache-Control", "no-cache, no-transform");
|
||||
res.setHeader("Connection", "keep-alive");
|
||||
res.flushHeaders();
|
||||
|
||||
const send = (message) => {
|
||||
res.write(message + "\n");
|
||||
};
|
||||
|
||||
const base_url = "https://modrinth.com/collection/";
|
||||
|
||||
if (req.body.startsWith(base_url)) {
|
||||
const data = {
|
||||
URL: req.body,
|
||||
};
|
||||
|
||||
set_yaml(data);
|
||||
|
||||
send("Success (If the URL is valid collection)!");
|
||||
} else {
|
||||
send(
|
||||
"ERR: Please submit a URL like https://modrinth.com/collection/(id_here)",
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/getpath/", async (req, res) => {
|
||||
const yamlstr = yaml.load(fs.readFileSync(yaml_filename, "utf8"));
|
||||
res.send(yamlstr.PATH);
|
||||
});
|
||||
|
||||
app.post("/api/setpath/", async (req, res) => {
|
||||
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
||||
res.setHeader("Cache-Control", "no-cache, no-transform");
|
||||
res.setHeader("Connection", "keep-alive");
|
||||
res.flushHeaders();
|
||||
|
||||
const send = (message) => {
|
||||
res.write(message + "\n");
|
||||
};
|
||||
|
||||
try {
|
||||
await fsp.access(req.body, fsp.constants.W_OK).then(() => {
|
||||
const data = {
|
||||
PATH: req.body,
|
||||
};
|
||||
|
||||
set_yaml(data);
|
||||
send("File set successfully to: " + req.body);
|
||||
});
|
||||
} catch (err) {
|
||||
send(
|
||||
"ERR: Path failed to set properly. Either the directory doesn't exist, or the program has no read or write access. " +
|
||||
err,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// Download as zip to browser
|
||||
app.post("/api/downloader/direct", async (req, res) => {
|
||||
res.setHeader("Content-Type", "application/octet-stream; charset=utf-8");
|
||||
res.setHeader("Cache-Control", "no-cache, no-transform");
|
||||
res.setHeader("Connection", "keep-alive");
|
||||
res.flushHeaders();
|
||||
|
||||
const zipFileWriter = new zip.BlobWriter();
|
||||
const zipWriter = new zip.ZipWriter(zipFileWriter);
|
||||
|
||||
for (const versionId of req.body) {
|
||||
const response = await fetch(
|
||||
`https://api.modrinth.com/v2/version/${versionId}`,
|
||||
);
|
||||
|
||||
const version = await response.json();
|
||||
|
||||
// Get the first file attached to the version
|
||||
const file = version.files[0];
|
||||
|
||||
if (!file) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const fileResponse = await fetch(file.url);
|
||||
|
||||
const buffer = Buffer.from(await fileResponse.arrayBuffer());
|
||||
|
||||
const reader = new zip.Uint8ArrayReader(buffer);
|
||||
|
||||
await zipWriter.add(file.filename, reader);
|
||||
}
|
||||
|
||||
await zipWriter.close();
|
||||
const blob = await zipFileWriter.getData();
|
||||
const buffer = Buffer.from(await blob.arrayBuffer());
|
||||
|
||||
res.end(buffer);
|
||||
});
|
||||
|
||||
// Download to server
|
||||
app.post("/api/downloader/", async (req, res) => {
|
||||
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
||||
res.setHeader("Cache-Control", "no-cache, no-transform");
|
||||
res.setHeader("Connection", "keep-alive");
|
||||
res.flushHeaders();
|
||||
|
||||
const send = (message) => {
|
||||
res.write(message + "\n");
|
||||
};
|
||||
|
||||
if (!req.body) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!plugin_path) {
|
||||
send("Unable to update server. No mod/plugin path specified.");
|
||||
console.log("Unable to update server. No mod/plugin path specified.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove all files in Plugins
|
||||
try {
|
||||
const files = await fsp.readdir(plugin_path);
|
||||
|
||||
for (const file of files) {
|
||||
try {
|
||||
if (file.startsWith("!")) {
|
||||
continue;
|
||||
} else {
|
||||
await fsp.unlink(fspath.join(plugin_path, file));
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.code === "EISDIR") {
|
||||
continue;
|
||||
} else {
|
||||
send(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
send("Removed all existing plugins...");
|
||||
|
||||
// Download new files from modrinth
|
||||
|
||||
for (const versionId of req.body) {
|
||||
const response = await fetch(
|
||||
`https://api.modrinth.com/v2/version/${versionId}`,
|
||||
);
|
||||
|
||||
const version = await response.json();
|
||||
|
||||
// Get the first file attached to the version
|
||||
const file = version.files[0];
|
||||
|
||||
if (!file) {
|
||||
send("No files found for version", version, ", skipping..");
|
||||
continue;
|
||||
}
|
||||
|
||||
const fileResponse = await fetch(file.url);
|
||||
|
||||
const buffer = Buffer.from(await fileResponse.arrayBuffer());
|
||||
|
||||
await fsp.writeFile(fspath.join(plugin_path, file.filename), buffer);
|
||||
|
||||
send(`Downloaded ${file.filename}`);
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.code === "ENOENT") {
|
||||
send(
|
||||
"Unable to download plugins, the set directory no longer exists. Please set a new one.",
|
||||
);
|
||||
console.log(
|
||||
"Unable to download plugins, the set directory no longer exists. Please set a new one.",
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
send(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
send("Downloads Complete! Restart your server to finish changes.");
|
||||
|
||||
res.end();
|
||||
});
|
||||
|
||||
app.get("/api/modrinth/collection/:id", async (req, res) => {
|
||||
const { id } = req.params;
|
||||
|
||||
const response = await fetch(
|
||||
`https://api.modrinth.com/v3/collection/${encodeURIComponent(id)}`,
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
return res.status(response.status).json({
|
||||
error: "Modrinth API request failed",
|
||||
});
|
||||
}
|
||||
|
||||
const collection = await response.json();
|
||||
|
||||
res.json(collection);
|
||||
});
|
||||
|
||||
app.get("/", async (req, res) => {
|
||||
try {
|
||||
const yamlstr = yaml.load(fs.readFileSync(yaml_filename, "utf8"));
|
||||
plugin_path = yamlstr.PATH;
|
||||
res.sendFile(fspath.join(appDir, "index.html"));
|
||||
} catch (err) {
|
||||
if (err.code === "ENOENT") {
|
||||
const data = {
|
||||
PATH: "",
|
||||
URL: "",
|
||||
};
|
||||
await set_yaml(data);
|
||||
const yamlstr = yaml.load(fs.readFileSync(yaml_filename, "utf8"));
|
||||
plugin_path = yamlstr.PATH;
|
||||
res.sendFile(fspath.join(appDir, "index.html"));
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log("Server is running on http://localhost:3000");
|
||||
});
|
||||
Reference in new issue
Block a user