mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-17 07:50:00 -04:00
add url bar and fix corium invocation for single-file mode
This commit is contained in:
parent
a5840d54dc
commit
099b191981
3 changed files with 54 additions and 21 deletions
|
@ -1,14 +1,19 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
|
||||||
<title></title>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
|
|
||||||
<script type="module" src="src/entry.ts"></script>
|
<head>
|
||||||
</head>
|
<title></title>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
|
||||||
|
<script type="module" src="src/entry.ts"></script>
|
||||||
|
<script src="uv/uv.bundle.js"></script>
|
||||||
|
<script src="uv.config.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
</body>
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
|
@ -16,7 +16,7 @@
|
||||||
import { getDatabase, onValue, ref, set } from "firebase/database";
|
import { getDatabase, onValue, ref, set } from "firebase/database";
|
||||||
import type { Transport } from "protocol";
|
import type { Transport } from "protocol";
|
||||||
|
|
||||||
import { openWindow } from "../../corium";
|
import { Win, openWindow } from "../../corium";
|
||||||
|
|
||||||
let transport: Transport;
|
let transport: Transport;
|
||||||
|
|
||||||
|
@ -124,17 +124,32 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function visitURL() {
|
function visitURL(url: string) {
|
||||||
if (!import.meta.env.VITE_ADRIFT_SINGLEFILE) {
|
if (!import.meta.env.VITE_ADRIFT_SINGLEFILE) {
|
||||||
alert("TODO");
|
let path = `${__uv$config.prefix}${__uv$config.encodeUrl(url)}`;
|
||||||
|
proxyIframe.src = path;
|
||||||
} else {
|
} else {
|
||||||
let bare = new BareClient();
|
let bare = new BareClient();
|
||||||
openWindow(new Request(url), "_self", bare, "replace");
|
openWindow(
|
||||||
|
new Request(url),
|
||||||
|
"_self",
|
||||||
|
proxyIframe.contentWindow! as unknown as Win,
|
||||||
|
bare,
|
||||||
|
"replace"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !import.meta.env.VITE_ADRIFT_DEV}
|
{#if ready}
|
||||||
|
<div class="container h-full w-full">
|
||||||
|
<div class="container">
|
||||||
|
<input bind:value={url} type="text" />
|
||||||
|
<button on:click={() => visitURL(url)}>Go!</button>
|
||||||
|
</div>
|
||||||
|
<iframe class="h-full w-full" bind:this={proxyIframe} />
|
||||||
|
</div>
|
||||||
|
{:else if !import.meta.env.VITE_ADRIFT_DEV}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<label for="email">email</label>
|
<label for="email">email</label>
|
||||||
<input name="email" type="text" bind:value={email} />
|
<input name="email" type="text" bind:value={email} />
|
||||||
|
@ -149,16 +164,26 @@
|
||||||
<button on:click={connectDevWS}>Connect with dev websocket</button>
|
<button on:click={connectDevWS}>Connect with dev websocket</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if ready}
|
|
||||||
<input bind:value={url} type="text" />
|
|
||||||
<button on:click={visitURL}>Go!</button>
|
|
||||||
<iframe bind:this={proxyIframe} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
:global(body, html, #app) {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
iframe {
|
||||||
|
outline: none;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: max-content;
|
width: max-content;
|
||||||
}
|
}
|
||||||
|
.h-full {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.w-full {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
3
frontend/src/env.d.ts
vendored
3
frontend/src/env.d.ts
vendored
|
@ -7,3 +7,6 @@ interface ImportMetaEnv {
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
readonly env: ImportMetaEnv;
|
readonly env: ImportMetaEnv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare const Ultraviolet: any;
|
||||||
|
declare const __uv$config: any;
|
Loading…
Add table
Add a link
Reference in a new issue