fix(webext): external instances, link opens stored instance
parent
fcf63db24b
commit
58dc2857da
|
@ -5,7 +5,7 @@
|
|||
import { onMount } from "svelte";
|
||||
import "./main.scss";
|
||||
|
||||
const api = new UpEndApi("http://localhost:8093");
|
||||
$: api = new UpEndApi($instanceUrlStore);
|
||||
|
||||
let visitingUpEnd = false;
|
||||
|
||||
|
@ -284,7 +284,7 @@
|
|||
<hr />
|
||||
<div class="row">
|
||||
<label>
|
||||
<a href={instanceUrl} target="_blank"> Instance </a>
|
||||
<a href={$instanceUrlStore} target="_blank"> Instance </a>
|
||||
<input
|
||||
class="instance-input"
|
||||
type="url"
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
import browser from "webextension-polyfill";
|
||||
import { derived, writable } from "svelte/store";
|
||||
|
||||
export const instanceUrlStore = writable<string | undefined>(
|
||||
undefined,
|
||||
(set) => {
|
||||
browser.storage.local.get("instanceUrl").then((result) => {
|
||||
set(result["instanceUrl"] || "http://localhost:8093");
|
||||
});
|
||||
}
|
||||
);
|
||||
export const instanceUrlStore = writable<string>(undefined, (set) => {
|
||||
browser.storage.local.get("instanceUrl").then((result) => {
|
||||
set(result["instanceUrl"] || "http://localhost:8093");
|
||||
});
|
||||
});
|
||||
|
||||
instanceUrlStore.subscribe((instanceUrl) => {
|
||||
browser.storage.local.set({ instanceUrl });
|
||||
|
|
Loading…
Reference in New Issue