mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-10-31 23:48:13 +00:00
Select schema version in web
This commit is contained in:
27
web/main.js
27
web/main.js
@@ -141,10 +141,29 @@ async function get_services() {
|
||||
* @returns {Promise<{}>}
|
||||
*/
|
||||
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 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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user