Skip to content

Commit

Permalink
Update V4.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Elaina69 committed Nov 21, 2024
1 parent 660a78d commit 5a9ebaa
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 436 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
dist/
node_modules/
src/elaina-theme-data/
ElainaV4-typescript.code-workspace
ElainaV4-typescript.code-workspace
TODO-List
14 changes: 6 additions & 8 deletions src/src/services/backupAndRestoreDatastore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ async function importData(url: string): Promise<any> {
try {
const res = await fetch(url, { signal: controller.signal });
if (res.status === 200) {
const serverModule = await import(url);
return serverModule
let Data = await import(url)
return Data.default
}
else {
throw new Error();
}
else throw new Error();
} catch {
let errorMsg = "Can't load default datastore from local"
clearTimeout(timeoutId);
Expand All @@ -32,9 +30,9 @@ async function importData(url: string): Promise<any> {
};

let datastore_list: Object = window.DataStore.get("Dev-mode")
? (await importData(`//plugins/${getThemeName()}/elaina-theme-data/src/config/datastoreDefault.js`)).default
? (await importData(`//plugins/${getThemeName()}/elaina-theme-data/src/config/datastoreDefault.js`))
//@ts-ignore
: (await importData(`https://cdn.jsdelivr.net/npm/elaina-theme-data@latest/src/config/datastoreDefault.js`)).default
: (await importData(`https://cdn.jsdelivr.net/npm/elaina-theme-data@latest/src/config/datastoreDefault.js`))

function setDefaultData(list: Object, restore: Boolean = false) {
Object.entries(list).forEach(([key, value]) => {
Expand All @@ -50,7 +48,7 @@ function setDefaultData(list: Object, restore: Boolean = false) {
}

if (window.DataStore.get("Elaina-Plugins")) {
setDefaultData(datastore_list, false)
setDefaultData(datastore_list)
}
else if (!window.DataStore.get("Elaina-Plugins") || !window.DataStore.has("Elaina-Plugins")) {
//console.log(eConsole+`%c Finding backup file from cloud...`,eCss,"")
Expand Down
Loading

0 comments on commit 5a9ebaa

Please sign in to comment.