mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-13 06:10:01 -04:00
get shortcut button
This commit is contained in:
parent
c5e7e5354f
commit
9b03d3e086
2 changed files with 52 additions and 2 deletions
|
@ -2,4 +2,47 @@ export { AdriftBareClient } from "./AdriftClient";
|
||||||
export { Connection } from "./Connection";
|
export { Connection } from "./Connection";
|
||||||
export { DevWsTransport } from "./DevWsTransport";
|
export { DevWsTransport } from "./DevWsTransport";
|
||||||
export { RTCTransport } from "./RTCTransport";
|
export { RTCTransport } from "./RTCTransport";
|
||||||
export * as SignalFirebase from "./SignalFirebase";
|
export * as SignalFirebase from "./SignalFirebase";
|
||||||
|
|
||||||
|
|
||||||
|
export function downloadShortcut(name: string, title: string) {
|
||||||
|
let a = document.createElement("a");
|
||||||
|
a.href = "data:text/plain;base64," + btoa(`
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>${title}</title>
|
||||||
|
<style>
|
||||||
|
body,
|
||||||
|
html {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<iframe src="${location.href}" />
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
`);
|
||||||
|
console.log(a.href);
|
||||||
|
a.download = name;
|
||||||
|
a.click();
|
||||||
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
DevWsTransport,
|
DevWsTransport,
|
||||||
RTCTransport,
|
RTCTransport,
|
||||||
SignalFirebase,
|
SignalFirebase,
|
||||||
|
downloadShortcut,
|
||||||
} from "client";
|
} from "client";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
|
@ -233,10 +234,16 @@
|
||||||
A fast and modern decentralized proxy network
|
A fast and modern decentralized proxy network
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-5">
|
<div class="mt-5 flex justify-between">
|
||||||
<Button type="filled" on:click={() => (showTrackerList = true)}
|
<Button type="filled" on:click={() => (showTrackerList = true)}
|
||||||
>Start Browsing</Button
|
>Start Browsing</Button
|
||||||
>
|
>
|
||||||
|
<Button
|
||||||
|
type="text"
|
||||||
|
on:click={() => {
|
||||||
|
downloadShortcut("adrift.html", "Homework");
|
||||||
|
}}>Get Shortcut</Button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue