get shortcut button

This commit is contained in:
CoolElectronics 2023-08-21 14:50:26 -04:00
parent c5e7e5354f
commit 9b03d3e086
No known key found for this signature in database
GPG key ID: F63593D168636C50
2 changed files with 52 additions and 2 deletions

View file

@ -3,3 +3,46 @@ 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();
}

View file

@ -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>