diff --git a/web/index.html b/web/index.html index 65434d1..40978a5 100644 --- a/web/index.html +++ b/web/index.html @@ -7,7 +7,7 @@ + href="https://www.unpkg.com/monaco-editor@0.52.2/min/vs/editor/editor.main.css" /> } */ async function get_schema() { - const res = await fetch( - 'https://raw.githubusercontent.com/house-of-abbey/GarminHomeAssistant/main/config.schema.json' - ); - return res.json(); + const searchParams = new URL(window.location).searchParams; + + const url = searchParams.get('schema'); + if (url) return (await fetch(url)).json(); + + const branch = searchParams.get('branch'); + if (branch) + return ( + await fetch( + `https://raw.githubusercontent.com/house-of-abbey/GarminHomeAssistant/refs/heads/${branch}/config.schema.json` + ) + ).json(); + + const version = searchParams.get('version'); + if (version) + return ( + await fetch( + `https://raw.githubusercontent.com/house-of-abbey/GarminHomeAssistant/refs/tags/${version}/config.schema.json` + ) + ).json(); + + return ( + await fetch( + `https://raw.githubusercontent.com/house-of-abbey/GarminHomeAssistant/main/config.schema.json` + ) + ).json(); } /** diff --git a/web/package.json b/web/package.json index a3b5e4b..ee38f3d 100644 --- a/web/package.json +++ b/web/package.json @@ -10,7 +10,7 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/toastify-js": "^1.12.4", + "@types/toastify-js": "1.12.0", "@vscode/webview-ui-toolkit": "1.4.0", "json-ast-comments": "1.1.1", "monaco-editor": "0.52.2", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 5d56eed..eaca944 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -6,8 +6,8 @@ settings: devDependencies: '@types/toastify-js': - specifier: ^1.12.4 - version: 1.12.4 + specifier: 1.12.0 + version: 1.12.0 '@vscode/webview-ui-toolkit': specifier: 1.4.0 version: 1.4.0(react@18.2.0) @@ -55,8 +55,8 @@ packages: exenv-es6: 1.1.1 dev: true - /@types/toastify-js@1.12.4: - resolution: {integrity: sha512-zfZHU4tKffPCnZRe7pjv/eFKzTVHozKewFCKaCjZ4gFinKgJRz/t0bkZiMCXJxPhv/ZoeDGNOeRD09R0kQZ/nw==} + /@types/toastify-js@1.12.0: + resolution: {integrity: sha512-fqpDHaKhFukN9KRm24bbH0wozvHmSwjvkaLjBUrWcSfSS4zysIwTYqNLG3XbSNhRlsTNRNLGS23tp/VhPwsfHQ==} dev: true /@vscode/webview-ui-toolkit@1.4.0(react@18.2.0):