chore: safeguard in webext against running in upend
parent
7af13e7d5f
commit
1f6d7fe090
|
@ -7,6 +7,8 @@
|
|||
|
||||
const api = new UpEndApi("http://localhost:8093");
|
||||
|
||||
let visitngUpEnd = false;
|
||||
|
||||
let opening = false;
|
||||
let openError: string | undefined;
|
||||
|
||||
|
@ -44,6 +46,14 @@
|
|||
let currentUrl: string | undefined;
|
||||
let contentType: string | undefined;
|
||||
onMount(async () => {
|
||||
browser.tabs
|
||||
.executeScript(undefined, {
|
||||
code: `document.querySelector('meta[name="application-name"]')?.content`,
|
||||
})
|
||||
.then((result) => {
|
||||
visitngUpEnd = (result[0] as string | undefined) === "UpEnd";
|
||||
});
|
||||
|
||||
currentUrl = await getCurrentUrl();
|
||||
|
||||
browser.tabs.onUpdated.addListener(async () => {
|
||||
|
@ -211,6 +221,7 @@
|
|||
</script>
|
||||
|
||||
<main>
|
||||
{#if !visitngUpEnd}
|
||||
<div class="primary-controls">
|
||||
<button
|
||||
class="button"
|
||||
|
@ -291,6 +302,9 @@
|
|||
<div class="error">{instanceVersionError}</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="visitingUpEnd">You rock :)</div>
|
||||
{/if}
|
||||
</main>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<meta name="application-name" content="UpEnd" />
|
||||
|
||||
<title>UpEnd</title>
|
||||
|
||||
|
|
Loading…
Reference in New Issue