replace buffer implementation with a md5 hash. This also adds the ts-md5 library.

This commit is contained in:
FurbyOnSteroids
2025-08-16 13:53:56 +02:00
parent 9cafaf5aad
commit f98b811ab9
3 changed files with 10 additions and 7 deletions
+2 -1
View File
@@ -58,7 +58,8 @@
"vue-router": "latest", "vue-router": "latest",
"vue3-carousel": "^0.16.0", "vue3-carousel": "^0.16.0",
"vue3-carousel-nuxt": "^1.1.5", "vue3-carousel-nuxt": "^1.1.5",
"vuedraggable": "^4.1.0" "vuedraggable": "^4.1.0",
"ts-md5": "^2.0.1"
}, },
"devDependencies": { "devDependencies": {
"@intlify/eslint-plugin-vue-i18n": "^4.0.1", "@intlify/eslint-plugin-vue-i18n": "^4.0.1",
+3 -6
View File
@@ -14,17 +14,14 @@ import notificationSystem from "../notifications";
import { GameNotFoundError, type LibraryProvider } from "./provider"; import { GameNotFoundError, type LibraryProvider } from "./provider";
import { logger } from "../logging"; import { logger } from "../logging";
import type { GameModel } from "~/prisma/client/models"; import type { GameModel } from "~/prisma/client/models";
import { Md5 } from "ts-md5";
export function createGameImportTaskId(libraryId: string, libraryPath: string) { export function createGameImportTaskId(libraryId: string, libraryPath: string) {
const text = `import:${libraryId}:${libraryPath}`; return Md5.hashStr(`import:${libraryId}:${libraryPath}`);
// base64 can contain "/" which breaks the URL. So we remove it
return Buffer.from(text, "utf8").toString("base64").replaceAll("/", "");
} }
export function createVersionImportTaskId(gameId: string, versionName: string) { export function createVersionImportTaskId(gameId: string, versionName: string) {
const text = `import:${gameId}:${versionName}`; return Md5.hashStr(`import:${gameId}:${versionName}`);
// base64 can contain "/" which breaks the URL. So we remove it
return Buffer.from(text, "utf8").toString("base64").replaceAll("/", "");
} }
class LibraryManager { class LibraryManager {
+5
View File
@@ -8652,6 +8652,11 @@ ts-api-utils@^2.1.0:
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-2.1.0.tgz#595f7094e46eed364c13fd23e75f9513d29baf91" resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-2.1.0.tgz#595f7094e46eed364c13fd23e75f9513d29baf91"
integrity sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ== integrity sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==
ts-md5@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/ts-md5/-/ts-md5-2.0.1.tgz#b05fb6d65f2116aa4591280c8d0510084567f291"
integrity sha512-yF35FCoEOFBzOclSkMNEUbFQZuv89KEQ+5Xz03HrMSGUGB1+r+El+JiGOFwsP4p9RFNzwlrydYoTLvPOuICl9w==
tslib@^2.4.0, tslib@^2.6.3, tslib@^2.8.0, tslib@^2.8.1: tslib@^2.4.0, tslib@^2.6.3, tslib@^2.8.0, tslib@^2.8.1:
version "2.8.1" version "2.8.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f"