Add Svelte app boilerplate (#27)
* Add Svelte app boilerplate * Delete www folder * Web app setup * Fix vector images * README
This commit is contained in:
1 parent
f71c70d90b
commit
9031f51d5d
31 files changed
+3403
-68
No files matched your search
@@ -0,0 +1,10 @@
|
||||
<script lang="ts">
|
||||
let count: number = 0
|
||||
const increment = () => {
|
||||
count += 1
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={increment}>
|
||||
count is {count}
|
||||
</button>
|
||||
@@ -0,0 +1,16 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { GetHost } from "./Host";
|
||||
|
||||
let currentInstance = "N/A";
|
||||
|
||||
onMount(async () => {
|
||||
const response = await fetch(`http://${GetHost()}/api/state`);
|
||||
const state = await response.json();
|
||||
currentInstance = state.invidious.selected_instance;
|
||||
})
|
||||
|
||||
</script>
|
||||
<div>
|
||||
Current Instance: {currentInstance}
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
function GetHost() {
|
||||
const urlSearchParams = new URLSearchParams(window.location.search);
|
||||
return urlSearchParams.get('host') ?? window.location.host
|
||||
}
|
||||
|
||||
export { GetHost }
|
||||
Reference in new issue
Block a user