2024-07-20 13:43:14 +01:00
|
|
|
import { readable } from "svelte/store";
|
|
|
|
|
2024-07-10 18:35:53 +01:00
|
|
|
type VersionResponse = {
|
|
|
|
commit: string;
|
|
|
|
branch: string;
|
|
|
|
remote: string;
|
|
|
|
version: string;
|
|
|
|
}
|
|
|
|
|
2024-07-20 13:43:14 +01:00
|
|
|
const unknownVersion = {
|
|
|
|
commit: "unknown",
|
|
|
|
branch: "unknown",
|
|
|
|
remote: "unknown",
|
|
|
|
version: "unknown"
|
|
|
|
};
|
2024-07-10 18:35:53 +01:00
|
|
|
|
2024-07-20 13:43:14 +01:00
|
|
|
export const version = readable<VersionResponse>(
|
|
|
|
unknownVersion,
|
|
|
|
(set) => {
|
|
|
|
fetch('/version.json')
|
|
|
|
.then(r => r.json())
|
|
|
|
.then(set)
|
|
|
|
.catch(() => {})
|
2024-07-10 18:35:53 +01:00
|
|
|
}
|
2024-07-20 13:43:14 +01:00
|
|
|
)
|