diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index bd0a957..cb154f6 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "ETB Rocket", - "version": "0.9.5" + "version": "0.9.6" }, "tauri": { "allowlist": { diff --git a/src/lib/components/modcard.svelte b/src/lib/components/modcard.svelte index 64e4b8a..02f0242 100644 --- a/src/lib/components/modcard.svelte +++ b/src/lib/components/modcard.svelte @@ -54,9 +54,25 @@ const basePath = steam_game_loc + "/EscapeTheBackrooms/Content/Paks/" if (nexus) { - alert("In this beta you'll need to manually download files from nexus to install them.") - loading = "error"; - installed = false; + loading = "Loading"; + + let file_data_url = "https://api.nexusmods.com/v1/games/escapethebackrooms/mods/"+mod_id+"/files.json?category=update%2Cmain"; + + let file_data_http = await httpclient.get(file_data_url, { + responseType: ResponseType.JSON, + headers: { + apiKey: $NexusConfig.apiKey + } + }); + + let file_data = file_data_http.data; + + console.log(file_data); + + loading = "Opening" + + open("https://www.nexusmods.com/escapethebackrooms/mods/"+mod_id+"?tab=files&file_id="+file_data.files.at(-1).file_id+"&nmm=1") + return; } @@ -114,21 +130,21 @@

Made by {author}

- {#if installed || get(downloaded).includes(downloadLink)} + {#if installed || get(downloaded).includes(downloadLink) || $downloaded.includes(name)} {:else} {#if loading !== "error" && loading} - {:else if loading === "error"} - {:else} - {/if} diff --git a/src/lib/components/nxmcard.svelte b/src/lib/components/nxmcard.svelte index 8d948d5..b745814 100644 --- a/src/lib/components/nxmcard.svelte +++ b/src/lib/components/nxmcard.svelte @@ -72,7 +72,12 @@ loading = "Cleaning up"; loading = "Ready to install"; - await installMod() + + try { + await installMod() + } catch (err) { + alert(err) + } } async function installMod() { @@ -108,7 +113,7 @@ } }); - loading = "Foldering" + loading = "Checking" let folder = "" @@ -130,9 +135,6 @@ break; } - invoke("expand_scope", { folderPath: basePath }) - try {await createDir(basePath+folder)} catch {console.log("No directory was created!")} - loading = "Extracting"; //@ts-ignore @@ -186,9 +188,14 @@ //@ts-ignore let modfile = entries[zipdataname]._reader.blob + loading = "Foldering"; + + invoke("expand_scope", { folderPath: basePath }) + try {await createDir(basePath+folder)} catch {console.log("No directory was created!")} + loading = "Writing"; - await writeBinaryFile(basePath+folder+"/"+zipdataname, new Uint8Array(await modfile.arrayBuffer())); + await writeBinaryFile(basePath+folder+"/"+zipdataname.split("/").at(-1), new Uint8Array(await modfile.arrayBuffer())); loading = "Cleaning"; console.log("Mod File Saved to "+basePath+folder+"/"+zipdataname) @@ -237,4 +244,4 @@
- \ No newline at end of file + diff --git a/src/routes/creators/+page.svelte b/src/routes/creators/+page.svelte index 9d6df72..b4d5dfb 100644 --- a/src/routes/creators/+page.svelte +++ b/src/routes/creators/+page.svelte @@ -15,11 +15,11 @@
-

Here you can upload your mods to our service and give users the best experience downnloading your mods!

+

Here you can upload your mods to our service and give users the best experience downloading your mods!


- +

diff --git a/src/routes/creators/coming_soon/+page.svelte b/src/routes/creators/coming_soon/+page.svelte new file mode 100644 index 0000000..d54c471 --- /dev/null +++ b/src/routes/creators/coming_soon/+page.svelte @@ -0,0 +1,3 @@ +

+ Coming soon... +

\ No newline at end of file diff --git a/src/routes/creators/dashboard/+page.svelte b/src/routes/creators/dashboard/+page.svelte new file mode 100644 index 0000000..bd92406 --- /dev/null +++ b/src/routes/creators/dashboard/+page.svelte @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/routes/creators/login/+page.svelte b/src/routes/creators/login/+page.svelte new file mode 100644 index 0000000..81dc02a --- /dev/null +++ b/src/routes/creators/login/+page.svelte @@ -0,0 +1,106 @@ + + +
+
+
+

Log in to your account

+

Enter your email and one-time password to access your account.

+
+ {#if step === 1} +
+
+
+ + +
+
+
+ +
+
+ {:else if step === 2} +
+
+
+ +
+
+
+ +
+ {/if} +
+
\ No newline at end of file diff --git a/src/routes/creators/not_verified/+page.svelte b/src/routes/creators/not_verified/+page.svelte new file mode 100644 index 0000000..43c141e --- /dev/null +++ b/src/routes/creators/not_verified/+page.svelte @@ -0,0 +1,6 @@ +
+

+ Your account is not verified. Check back later. (Should not take more than 48 hrs) + To get verified faster contact lu2000luk on Discord. +

+
\ No newline at end of file diff --git a/src/routes/mods/+page.svelte b/src/routes/mods/+page.svelte index 44670ae..a681e8d 100644 --- a/src/routes/mods/+page.svelte +++ b/src/routes/mods/+page.svelte @@ -6,6 +6,8 @@ import { NexusConfig } from "$lib/nexus" import { getClient, ResponseType } from '@tauri-apps/api/http'; + let loadingModsPhase = 0; + function limitStringTo240WordsAndRemoveBr(inputString) { let stringWithoutBr = inputString.replace(//gi, ' '); let wordsArray = stringWithoutBr.split(/\s+/); @@ -17,25 +19,102 @@ return wordsArray.join(' '); } - async function nexusGetTrending() { + async function NexusGetOthers() { + let modz = []; if ($NexusConfig.apiKey === false) {return [];} const httpclient = await getClient(); + console.info("HTTPClient Loaded") - const nmods = await httpclient.get("https://api.nexusmods.com/v1/games/escapethebackrooms/mods/trending.json", { + loadingModsPhase++; + + let latest_added = await httpclient.get("https://api.nexusmods.com/v1/games/escapethebackrooms/mods/latest_added.json", { + responseType: ResponseType.JSON, + headers: { + apiKey: $NexusConfig.apiKey + } + }); + + loadingModsPhase++; + + let latest_updated = await httpclient.get("https://api.nexusmods.com/v1/games/escapethebackrooms/mods/latest_updated.json", { + responseType: ResponseType.JSON, + headers: { + apiKey: $NexusConfig.apiKey + } + }); + + loadingModsPhase++; + + let trending = await httpclient.get("https://api.nexusmods.com/v1/games/escapethebackrooms/mods/trending.json", { responseType: ResponseType.JSON, headers: { apiKey: $NexusConfig.apiKey } }); - let mappedMods = []; + loadingModsPhase++; + + let latest_added_mods = latest_added.data; + let latest_updated_mods = latest_updated.data; + let trending_mods = trending.data; + + console.log(latest_added_mods) + console.log(latest_updated_mods) + console.log(trending_mods) + + console.log("Indexing mods") - await nmods.data.forEach(async element => { + function isModAlreadyScanned(mod) { + for (let i = 0; i < modz.length; i++) { + if (modz[i].mod_id === mod.mod_id) { + return true; + } + } + + console.log("Mod not found in array: "+mod) + + return false; + } + + await latest_added_mods.forEach(async element => { if (element.name === "Interpose Map Loader" || element.name === "Interpose Mod Loader" || element.contains_adult_content === true) {return;} - mappedMods.push({ + if (isModAlreadyScanned(element)) {return;} + + modz.push({ + cover: element.picture_url, + modVersion: element.version, + nexus: true, + description: limitStringTo240WordsAndRemoveBr(element.summary), + author: element.author, + name: element.name, + mod_id: element.mod_id + }) + }); + + await latest_updated_mods.forEach(async element => { + if (element.name === "Interpose Map Loader" || element.name === "Interpose Mod Loader" || element.contains_adult_content === true) {return;} + + if (isModAlreadyScanned(element)) {return;} + + modz.push({ + cover: element.picture_url, + modVersion: element.version, + nexus: true, + description: limitStringTo240WordsAndRemoveBr(element.summary), + author: element.author, + name: element.name, + mod_id: element.mod_id + }) + }); + await trending_mods.forEach(async element => { + if (element.name === "Interpose Map Loader" || element.name === "Interpose Mod Loader" || element.contains_adult_content === true) {return;} + + if (isModAlreadyScanned(element)) {return;} + + modz.push({ cover: element.picture_url, modVersion: element.version, nexus: true, @@ -46,9 +125,9 @@ }) }); - console.log(mappedMods) + loadingModsPhase++; - return mappedMods + return modz; } @@ -56,8 +135,8 @@ {/each} -{#await nexusGetTrending()} - Loading... +{#await NexusGetOthers()} + Loading more... [{loadingModsPhase}/5] {:then nlmods} {#each nlmods as mod}