Skip to content

Commit

Permalink
Packs #1
Browse files Browse the repository at this point in the history
  • Loading branch information
lu2000luk committed Oct 27, 2024
1 parent b5a20eb commit e9cc2a8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "ETB Rocket",
"version": "0.9.65"
"version": "0.9.7"
},
"tauri": {
"allowlist": {
Expand All @@ -18,7 +18,7 @@
},
"fs": {
"all": true,
"scope": ["**", "**/*", "/**/*","$RESOURCE/*"]
"scope": ["**", "**/*", "/**/*","$RESOURCE/*", "$APP/*", "$APP/*/*", "$APP/*/*/*"]
},
"shell": {
"open": true
Expand Down
11 changes: 6 additions & 5 deletions src/lib/components/modcard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
console.log("HTTP Client loaded!")
const steam_game_loc = $steamPath+"/steamapps/common/EscapeTheBackrooms"
const basePath = steam_game_loc + "/EscapeTheBackrooms/Content/Paks/"
const basePathError = steam_game_loc + "/EscapeTheBackrooms/Content/Paks/"
if (nexus) {
loading = "Loading";
Expand Down Expand Up @@ -88,16 +88,17 @@
console.log("File downloaded!")
loading = "Foldering";
invoke("expand_scope", { folderPath: basePath })
try {await createDir(basePath+folder)} catch {console.log("No directory was created!")}
try {await createDir("", { dir: BaseDirectory.App })} catch {console.log("No BASE directory was created!")}
try {await createDir("mods", { dir: BaseDirectory.App })} catch {console.log("No MODS directory was created!")}
try {await createDir("mods/"+folder, { dir: BaseDirectory.App })} catch {console.log("No MODLOADER directory was created!")}
loading = "Writing";
console.log("Writing binary file")
await writeBinaryFile(basePath+folder+"/"+url.split('#')[0].split('?')[0].split('/').pop(), new Uint8Array(file.data));
await writeBinaryFile("mods/"+folder+"/"+url.split('#')[0].split('?')[0].split('/').pop(), new Uint8Array(file.data), { dir: BaseDirectory.App });
loading = "Cleaning";
console.log("Mod File Saved to "+basePath+folder+"/"+url.split('#')[0].split('?')[0].split('/').pop())
console.log("Mod File Saved to "+folder+"/"+url.split('#')[0].split('?')[0].split('/').pop())
if (!reinstalling) {
let dc = get(downloaded)
Expand Down
18 changes: 8 additions & 10 deletions src/lib/components/nxmcard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
} else {
foundLoader = true
is_interpose = false;
loader = "Cant ";
loader = "Unknown";
}
loading = "Cleaning up";
Expand All @@ -76,6 +76,8 @@
try {
await installMod()
} catch (err) {
console.log("Error installing mod:")
console.error(err)
alert(err)
}
}
Expand Down Expand Up @@ -180,25 +182,21 @@
console.log(entries[zipdataname])
// Comment to whoever will look at the code:
// Its a mess i know. But, it somehow work. It seems that it dosent if you look at the files but at the same time
// for some wierd magic, it works. I dont know why. I dont know how. But it works. So, i will leave it as is.
// If you think you have a better solution go to the Pull Request and make a PR. I will be happy to merge it.
//@ts-ignore
let modfile = await entries[zipdataname].arrayBuffer()
loading = "Foldering";
invoke("expand_scope", { folderPath: basePath })
try {await createDir(basePath+folder)} catch {console.log("No directory was created!")}
try {await createDir("", { dir: BaseDirectory.App })} catch {console.log("No BASE directory was created!")}
try {await createDir("mods", { dir: BaseDirectory.App })} catch {console.log("No MODS directory was created!")}
try {await createDir("mods/"+folder, { dir: BaseDirectory.App })} catch {console.log("No MODLOADER directory was created!")}
loading = "Writing";
await writeBinaryFile(basePath+folder+"/"+zipdataname.split("/").at(-1), modfile);
await writeBinaryFile("mods/"+folder+"/"+zipdataname.split("/").at(-1), modfile, { dir: BaseDirectory.App });
loading = "Cleaning";
console.log("Mod File Saved to "+basePath+folder+"/"+zipdataname)
console.log("Mod File Saved to mods/"+folder+"/"+zipdataname)
let dc: any[string] = get(downloaded)
Expand Down
29 changes: 20 additions & 9 deletions src/routes/mods/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@
let loadingModsPhase = 0;
function limitStringTo240WordsAndRemoveBr(inputString) {
let stringWithoutBr = inputString.replace(/<br\s*\/?>/gi, ' ');
let wordsArray = stringWithoutBr.split(/\s+/);
try {
let stringWithoutBr = inputString.replace(/<br\s*\/?>/gi, ' ');
let wordsArray = stringWithoutBr.split(/\s+/);
if (wordsArray.length > 240) {
wordsArray = wordsArray.slice(0, 240);
if (wordsArray.length > 240) {
wordsArray = wordsArray.slice(0, 240);
}
return wordsArray.join(' ');
} catch {
// Limit to 400 chars
return false;
}
return wordsArray.join(' ');
}
async function NexusGetOthers() {
Expand Down Expand Up @@ -83,11 +87,14 @@
if (isModAlreadyScanned(element)) {return;}
let description = limitStringTo240WordsAndRemoveBr(element.summary);
if (description === false) {return;}
modz.push({
cover: element.picture_url,
modVersion: element.version,
nexus: true,
description: limitStringTo240WordsAndRemoveBr(element.summary),
description: description,
author: element.author,
name: element.name,
mod_id: element.mod_id
Expand All @@ -98,12 +105,14 @@
if (element.name === "Interpose Map Loader" || element.name === "Interpose Mod Loader" || element.contains_adult_content === true) {return;}
if (isModAlreadyScanned(element)) {return;}
let description = limitStringTo240WordsAndRemoveBr(element.summary);
if (description === false) {return;}
modz.push({
cover: element.picture_url,
modVersion: element.version,
nexus: true,
description: limitStringTo240WordsAndRemoveBr(element.summary),
description: description,
author: element.author,
name: element.name,
mod_id: element.mod_id
Expand All @@ -113,12 +122,14 @@
if (element.name === "Interpose Map Loader" || element.name === "Interpose Mod Loader" || element.contains_adult_content === true) {return;}
if (isModAlreadyScanned(element)) {return;}
let description = limitStringTo240WordsAndRemoveBr(element.summary);
if (description === false) {return;}
modz.push({
cover: element.picture_url,
modVersion: element.version,
nexus: true,
description: limitStringTo240WordsAndRemoveBr(element.summary),
description: description,
author: element.author,
name: element.name,
mod_id: element.mod_id
Expand Down

0 comments on commit e9cc2a8

Please sign in to comment.