Add 'eagler' domain to AsyncSink

This commit is contained in:
ZXMushroom63 2024-11-17 16:25:00 +08:00
parent 0af8737e1d
commit 71f69fe2a0

View File

@ -188,13 +188,19 @@ ModAPI.meta.credits("By ZXMushroom63");
const objectStore = transaction.objectStore("filesystem"); const objectStore = transaction.objectStore("filesystem");
var object = (await promisifyIDBRequest(objectStore.get(["resourcepacks/manifest.json"])))?.data; var object = (await promisifyIDBRequest(objectStore.get(["resourcepacks/manifest.json"])))?.data;
var resourcePackList = object ? JSON.parse(dec.decode(object)) : { resourcePacks: [] }; var resourcePackList = object ? JSON.parse(dec.decode(object)) : { resourcePacks: [] };
if (!resourcePackList.resourcePacks.find(x => x.name === "AsyncSinkLib")) { var pack = {
resourcePackList.resourcePacks.push({ domains: ["minecraft", "eagler"],
domains: ["minecraft"],
folder: "AsyncSinkLib", folder: "AsyncSinkLib",
name: "AsyncSinkLib", name: "AsyncSinkLib",
timestamp: Date.now() timestamp: Date.now()
}); };
if (resourcePackList.resourcePacks.find(x => x.name === "AsyncSinkLib")) {
var idx = resourcePackList.resourcePacks.indexOf(resourcePackList.resourcePacks.find(x => x.name === "AsyncSinkLib"));
resourcePackList.resourcePacks = pack;
} else {
resourcePackList.resourcePacks.push(pack);
}
const writeableTransaction = db.transaction(["filesystem"], "readwrite"); const writeableTransaction = db.transaction(["filesystem"], "readwrite");
const writeableObjectStore = writeableTransaction.objectStore("filesystem"); const writeableObjectStore = writeableTransaction.objectStore("filesystem");
await promisifyIDBRequest(writeableObjectStore.put({ await promisifyIDBRequest(writeableObjectStore.put({
@ -221,7 +227,6 @@ ModAPI.meta.credits("By ZXMushroom63");
await promisifyIDBRequest(imageObjectStore.put(icon)); await promisifyIDBRequest(imageObjectStore.put(icon));
} }
}
// Client side reminders to enable the AsyncSink Resource Pack // Client side reminders to enable the AsyncSink Resource Pack
var asyncSinkInstallStatus = false; var asyncSinkInstallStatus = false;