From 6fdd1e920970b38192c14458a91f68067b43b83e Mon Sep 17 00:00:00 2001 From: lu2000luk Date: Sun, 30 Jun 2024 20:39:22 +0200 Subject: [PATCH 1/6] Base UI for logging in --- src/routes/creators/+page.svelte | 2 +- src/routes/creators/login/+page.svelte | 69 ++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/routes/creators/login/+page.svelte diff --git a/src/routes/creators/+page.svelte b/src/routes/creators/+page.svelte index 9d6df72..4f55aef 100644 --- a/src/routes/creators/+page.svelte +++ b/src/routes/creators/+page.svelte @@ -19,7 +19,7 @@
- +

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

Log in to your account

+

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

+
+ {#if step === 0} +
+
+
+ + +
+
+
+ +
+
+ {:else if step === 1} +
+
+
+
+
+
+
+
+
+
+ +
+
+ {/if} +
+
\ No newline at end of file From f7d31d5d17e6bc43d01f0fed3fc471aac529b912 Mon Sep 17 00:00:00 2001 From: lu2000luk Date: Sun, 30 Jun 2024 22:12:22 +0200 Subject: [PATCH 2/6] Login Page added w/auth --- src/routes/creators/dashboard/+page.svelte | 3 + src/routes/creators/login/+page.svelte | 75 ++++++++++++++++------ 2 files changed, 59 insertions(+), 19 deletions(-) create mode 100644 src/routes/creators/dashboard/+page.svelte 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 index 0b838eb..81dc02a 100644 --- a/src/routes/creators/login/+page.svelte +++ b/src/routes/creators/login/+page.svelte @@ -1,8 +1,48 @@
@@ -11,7 +51,7 @@

Log in to your account

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

- {#if step === 0} + {#if step === 1}
@@ -27,43 +67,40 @@ placeholder="etbrocket@example.com" required={true} type="email" + + bind:value={email} />
-
- {:else if step === 1} + {:else if step === 2} +
-
-
-
-
-
-
-
-
-
+
+
+ +
{/if}
\ No newline at end of file From 94b60b643488e82245f172417336ced9833d87a5 Mon Sep 17 00:00:00 2001 From: lu2000luk Date: Sun, 30 Jun 2024 23:11:08 +0200 Subject: [PATCH 3/6] Added unverified page --- src/routes/creators/not_verified/+page.svelte | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/routes/creators/not_verified/+page.svelte 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 From e46f5675725f7e12bfd0f5bfd92af65086f6ae93 Mon Sep 17 00:00:00 2001 From: lu2000luk <81090607+lu2000luk@users.noreply.github.com> Date: Mon, 1 Jul 2024 12:16:26 +0200 Subject: [PATCH 4/6] Fixes a typo Thx BANANAMAN on Discord (; --- src/routes/creators/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/creators/+page.svelte b/src/routes/creators/+page.svelte index 4f55aef..626b0f3 100644 --- a/src/routes/creators/+page.svelte +++ b/src/routes/creators/+page.svelte @@ -15,7 +15,7 @@
-

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!


From 7b0f60555ba4b96af4b4fdc37abc9bb0474cedfe Mon Sep 17 00:00:00 2001 From: lu2000luk <81090607+lu2000luk@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:39:17 +0200 Subject: [PATCH 5/6] Fixed bug (see Issue #13) Issue #13 on nxmcard.svelte in src/lib/components --- src/lib/components/nxmcard.svelte | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/components/nxmcard.svelte b/src/lib/components/nxmcard.svelte index 8d948d5..4e92a44 100644 --- a/src/lib/components/nxmcard.svelte +++ b/src/lib/components/nxmcard.svelte @@ -108,7 +108,7 @@ } }); - loading = "Foldering" + loading = "Checking" let folder = "" @@ -130,9 +130,6 @@ break; } - invoke("expand_scope", { folderPath: basePath }) - try {await createDir(basePath+folder)} catch {console.log("No directory was created!")} - loading = "Extracting"; //@ts-ignore @@ -186,6 +183,11 @@ //@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())); @@ -237,4 +239,4 @@
- \ No newline at end of file + From 5b744426bdc48647a98bd5cd195cb7baf2891cd8 Mon Sep 17 00:00:00 2001 From: lu2000luk Date: Thu, 4 Jul 2024 17:31:26 +0200 Subject: [PATCH 6/6] Added NXM downloads, More mods from nexus, added coming soon, changed version and fixed a goofy ahh bug Ah ah, new version??? Wtf is the dev on today? Also upated colors --- src-tauri/tauri.conf.json | 2 +- src/lib/components/modcard.svelte | 30 ++++-- src/lib/components/nxmcard.svelte | 9 +- src/routes/creators/+page.svelte | 2 +- src/routes/creators/coming_soon/+page.svelte | 3 + src/routes/mods/+page.svelte | 97 ++++++++++++++++++-- 6 files changed, 123 insertions(+), 20 deletions(-) create mode 100644 src/routes/creators/coming_soon/+page.svelte 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 4e92a44..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() { @@ -190,7 +195,7 @@ 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) diff --git a/src/routes/creators/+page.svelte b/src/routes/creators/+page.svelte index 626b0f3..b4d5dfb 100644 --- a/src/routes/creators/+page.svelte +++ b/src/routes/creators/+page.svelte @@ -19,7 +19,7 @@


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/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}