diff --git a/package.json b/package.json index db3c5834..50847ecb 100644 --- a/package.json +++ b/package.json @@ -1274,7 +1274,7 @@ "dependencies": { "@vscode/l10n": "^0.0.18", "adm-zip": "^0.5.16", - "discloud.app": "^1.0.1", + "discloud.app": "^1.0.2", "jose": "^6.0.11", "json-schema-library": "^10.1.2", "ws": "^8.18.2" diff --git a/src/commands/apps/profile/avatar.ts b/src/commands/apps/profile/avatar.ts index 267d5b7a..a243ef2e 100644 --- a/src/commands/apps/profile/avatar.ts +++ b/src/commands/apps/profile/avatar.ts @@ -33,7 +33,7 @@ export default class extends Command { const workspaceFolder = await extension.getWorkspaceFolder(); if (workspaceFolder) { - const dConfig = new DiscloudConfig(workspaceFolder.fsPath); + const dConfig = await DiscloudConfig.fromPath(workspaceFolder.fsPath); const ID = dConfig.get(DiscloudConfigScopes.ID); diff --git a/src/commands/apps/profile/name.ts b/src/commands/apps/profile/name.ts index 40c66244..0056585a 100644 --- a/src/commands/apps/profile/name.ts +++ b/src/commands/apps/profile/name.ts @@ -37,7 +37,7 @@ export default class extends Command { const workspaceFolder = await extension.getWorkspaceFolder(); if (workspaceFolder) { - const dConfig = new DiscloudConfig(workspaceFolder.fsPath); + const dConfig = await DiscloudConfig.fromPath(workspaceFolder.fsPath); const ID = dConfig.get(DiscloudConfigScopes.ID); diff --git a/src/commands/logs.ts b/src/commands/logs.ts index ee337b4f..411604b5 100644 --- a/src/commands/logs.ts +++ b/src/commands/logs.ts @@ -19,7 +19,7 @@ export default class extends Command { if (!item?.appId) { const workspaceFolder = await extension.getWorkspaceFolder(); if (workspaceFolder) { - const dConfig = new DiscloudConfig(workspaceFolder.fsPath); + const dConfig = await DiscloudConfig.fromPath(workspaceFolder.fsPath); const ID = dConfig.get(DiscloudConfigScopes.ID); diff --git a/src/commands/upload.ts b/src/commands/upload.ts index 473771f5..2cd51387 100644 --- a/src/commands/upload.ts +++ b/src/commands/upload.ts @@ -30,7 +30,7 @@ export default class extends Command { task.progress.report({ increment: 30, message: t("files.checking") }); - const dConfig = new DiscloudConfig(workspaceFolder.fsPath); + const dConfig = await DiscloudConfig.fromPath(workspaceFolder.fsPath); if (!dConfig.validate(true)) throw Error(t("invalid.discloud.config")); @@ -43,11 +43,11 @@ export default class extends Command { const found = await fs.findFiles(task.token); if (!found.length) throw Error(t("files.missing")); - const main = Uri.parse(dConfig.data.MAIN).fsPath; + const main = dConfig.data.MAIN && Uri.parse(dConfig.data.MAIN).fsPath; - if (!found.some(uri => uri.fsPath.endsWith(main))) + if (!main || !found.some(uri => uri.fsPath.endsWith(main))) throw Error([ - t("missing.discloud.config.main", { file: dConfig.data.MAIN }), + t("missing.discloud.config.main", { file: `${dConfig.data.MAIN}` }), t("readdiscloudconfigdocs"), ].join("\n")); diff --git a/src/structures/Command.ts b/src/structures/Command.ts index 5b66b120..40c38a90 100644 --- a/src/structures/Command.ts +++ b/src/structures/Command.ts @@ -135,7 +135,7 @@ export default abstract class Command { const workspaceFolder = await extension.getWorkspaceFolder().then(f => f?.fsPath); - const dConfig = new DiscloudConfig(workspaceFolder!); + const dConfig = await DiscloudConfig.fromPath(workspaceFolder!); const ID = dConfig.get(DiscloudConfigScopes.ID); diff --git a/src/structures/DiscloudStatusBarItem.ts b/src/structures/DiscloudStatusBarItem.ts index 24864caf..3e4053b4 100644 --- a/src/structures/DiscloudStatusBarItem.ts +++ b/src/structures/DiscloudStatusBarItem.ts @@ -69,7 +69,7 @@ export default class DiscloudStatusBarItem extends BaseStatusBarItem { if (!workspaceFolder) return this.setUpload(); - const dConfig = new DiscloudConfig(workspaceFolder.fsPath); + const dConfig = await DiscloudConfig.fromPath(workspaceFolder.fsPath); const ID = dConfig.get(DiscloudConfigScopes.ID); diff --git a/yarn.lock b/yarn.lock index 7ca091d7..b078711f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14,20 +14,20 @@ dependencies: tslib "^2.8.1" -"@discloudapp/rest@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@discloudapp/rest/-/rest-1.0.1.tgz#ff4abf8f81ae5020f968a22e2ecf5fa07d487693" - integrity sha512-8eTM32ZEeof4tBGkWnKX9TnUox1Xg94jn9IZsrFuw7t9P5T4pLCKcl5YnBgHrKYNvjLWzom1MuNMaoxTzNa4Jg== +"@discloudapp/rest@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@discloudapp/rest/-/rest-1.0.2.tgz#8e88d6dc1e46e6adcccb71787861a0843a828448" + integrity sha512-5TWKl9fDm/Apn2bWVo9Qk3Le2Vc6CqWzfkQSSmWAppXMh541xx1C1pjT1HgB7jusOAkdPPb2gq5Fqyb6ZvLVrQ== dependencies: "@discloudapp/api-types" "^1.0.1" - "@discloudapp/util" "^1.0.1" + "@discloudapp/util" "^1.1.0" source-map-support "^0.5.21" tslib "^2.8.1" -"@discloudapp/util@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@discloudapp/util/-/util-1.0.1.tgz#4ee8a2349d0d0e560b847b4cd631694dd3e24bc8" - integrity sha512-BpW9q1YS/e/f9A+AhptD8mlwgjAkJxYEpKQIQYnk0JPg2ORNCh7G80U9qgodNtFaHpVSmN3exIouCLj7XufVkw== +"@discloudapp/util@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@discloudapp/util/-/util-1.1.0.tgz#beb38442097acd3f74a2c774da039ec5490bb211" + integrity sha512-3Qo+sWHe55xOmL+ufD/W+vtXPnQHTqxEP0tgmIuBsYmrX4OrioOaTUq6b3kLgxmFAgp4IDAqedgu+UuNS4rpLg== dependencies: "@discloudapp/api-types" "^1.0.1" file-type "^21.0.0" @@ -961,14 +961,14 @@ diff@^7.0.0: resolved "https://registry.yarnpkg.com/diff/-/diff-7.0.0.tgz#3fb34d387cd76d803f6eebea67b921dab0182a9a" integrity sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw== -discloud.app@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/discloud.app/-/discloud.app-1.0.1.tgz#974685608d0dfd7187b0e7632bd20cf3d94a3fad" - integrity sha512-SHSrYNZZaUZiKf7+A+nfpX20p9IxmU2eZNNUEpqOG4K5y/4Oy/ZTIGJUXN5EtblSyc2+wUfo9b53OQT6AF9biQ== +discloud.app@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/discloud.app/-/discloud.app-1.0.2.tgz#179fb4763e5e017532d0d0f06b98c72dc95cdffe" + integrity sha512-s1QXGA9+fMSCDfdSHI4ZZkCnm5J3HrPLtAZWUE5DqZ9UIawTQ1CUtwvCFmHlqDW6HC+1q9oFaACdToa1SBdWzg== dependencies: "@discloudapp/api-types" "^1.0.1" - "@discloudapp/rest" "^1.0.1" - "@discloudapp/util" "^1.0.1" + "@discloudapp/rest" "^1.0.2" + "@discloudapp/util" "^1.1.0" source-map-support "^0.5.21" tslib "^2.8.1" zod "^3.25.67"