Spaces:
Sleeping
Sleeping
Update UI
Browse files- src/mods/mods.ts +9 -11
src/mods/mods.ts
CHANGED
|
@@ -74,31 +74,29 @@ export class ModManager {
|
|
| 74 |
}
|
| 75 |
|
| 76 |
const jarPath = item.path;
|
| 77 |
-
const jsonPath = `${jarPath}.json`;
|
| 78 |
|
| 79 |
-
const
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
| 83 |
|
| 84 |
-
if (!jarBlob
|
| 85 |
continue;
|
| 86 |
}
|
| 87 |
|
| 88 |
const jarBuffer = Buffer.from(await jarBlob.arrayBuffer());
|
| 89 |
-
const metadataContent = Buffer.from(await metadataBlob.arrayBuffer()).toString("utf-8");
|
| 90 |
-
|
| 91 |
-
const metadata = JSON.parse(metadataContent) as ModMetadata;
|
| 92 |
const hash = sha256(jarBuffer);
|
| 93 |
|
| 94 |
const filename = path.basename(jarPath);
|
|
|
|
| 95 |
|
| 96 |
mods.push({
|
| 97 |
-
name
|
| 98 |
filename,
|
| 99 |
path: jarPath,
|
| 100 |
sha256: hash,
|
| 101 |
-
url: `https://NSMP-NSMP-Server.hf.space/files/mods/${encodeURIComponent(filename)}`
|
| 102 |
});
|
| 103 |
}
|
| 104 |
|
|
|
|
| 74 |
}
|
| 75 |
|
| 76 |
const jarPath = item.path;
|
|
|
|
| 77 |
|
| 78 |
+
const jarBlob = await downloadFile({
|
| 79 |
+
repo: this.bucketId,
|
| 80 |
+
path: jarPath,
|
| 81 |
+
accessToken: process.env.HF_TOKEN
|
| 82 |
+
});
|
| 83 |
|
| 84 |
+
if (!jarBlob) {
|
| 85 |
continue;
|
| 86 |
}
|
| 87 |
|
| 88 |
const jarBuffer = Buffer.from(await jarBlob.arrayBuffer());
|
|
|
|
|
|
|
|
|
|
| 89 |
const hash = sha256(jarBuffer);
|
| 90 |
|
| 91 |
const filename = path.basename(jarPath);
|
| 92 |
+
const name = filename.replace(/\.jar$/i, "");
|
| 93 |
|
| 94 |
mods.push({
|
| 95 |
+
name,
|
| 96 |
filename,
|
| 97 |
path: jarPath,
|
| 98 |
sha256: hash,
|
| 99 |
+
url: `https://NSMP-NSMP-Server.hf.space/files/mods/${encodeURIComponent(filename)}`
|
| 100 |
});
|
| 101 |
}
|
| 102 |
|