bless
This commit is contained in:
parent
e7dd84d923
commit
55b575b62e
275
wallet/dist/index.html
vendored
275
wallet/dist/index.html
vendored
@ -1,275 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
|
|
||||||
<!-- Disable zooming: -->
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<!-- change this to your project name -->
|
|
||||||
<title>eframe template</title>
|
|
||||||
|
|
||||||
<!-- config for our rust wasm binary. go to https://trunkrs.dev/assets/#rust for more customization -->
|
|
||||||
|
|
||||||
<script type="module">
|
|
||||||
import init, * as bindings from '/wallet-817ceb420679efc7.js';
|
|
||||||
const wasm = await init({ module_or_path: '/wallet-817ceb420679efc7_bg.wasm' });
|
|
||||||
|
|
||||||
|
|
||||||
window.wasmBindings = bindings;
|
|
||||||
|
|
||||||
|
|
||||||
dispatchEvent(new CustomEvent("TrunkApplicationStarted", {detail: {wasm}}));
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<!-- this is the base url relative to which other urls will be constructed. trunk will insert this from the public-url option -->
|
|
||||||
<base href="/" />
|
|
||||||
|
|
||||||
<meta name="theme-color" media="(prefers-color-scheme: light)" content="white">
|
|
||||||
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#404040">
|
|
||||||
|
|
||||||
<style>
|
|
||||||
html {
|
|
||||||
/* Remove touch delay: */
|
|
||||||
touch-action: manipulation;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
/* Light mode background color for what is not covered by the egui canvas,
|
|
||||||
or where the egui canvas is translucent. */
|
|
||||||
background: #909090;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
body {
|
|
||||||
/* Dark mode background color for what is not covered by the egui canvas,
|
|
||||||
or where the egui canvas is translucent. */
|
|
||||||
background: #404040;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allow canvas to fill entire web page: */
|
|
||||||
html,
|
|
||||||
body {
|
|
||||||
overflow: hidden;
|
|
||||||
margin: 0 !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make canvas fill entire document: */
|
|
||||||
canvas {
|
|
||||||
margin-right: auto;
|
|
||||||
margin-left: auto;
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.centered {
|
|
||||||
margin-right: auto;
|
|
||||||
margin-left: auto;
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
color: #f0f0f0;
|
|
||||||
font-size: 24px;
|
|
||||||
font-family: Ubuntu-Light, Helvetica, sans-serif;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------- */
|
|
||||||
/* Loading animation from https://loading.io/css/ */
|
|
||||||
.lds-dual-ring {
|
|
||||||
display: inline-block;
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lds-dual-ring:after {
|
|
||||||
content: " ";
|
|
||||||
display: block;
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
margin: 0px;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 3px solid #fff;
|
|
||||||
border-color: #fff transparent #fff transparent;
|
|
||||||
animation: lds-dual-ring 1.2s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes lds-dual-ring {
|
|
||||||
0% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<link rel="modulepreload" href="/wallet-817ceb420679efc7.js" crossorigin="anonymous" integrity="sha384-6d8RKSfgbqKZ044wKpV3fQtbdvcpwUIHRJNZ5U/TQh0hA0gn9XWhqw4nstkFYXQN"><link rel="preload" href="/wallet-817ceb420679efc7_bg.wasm" crossorigin="anonymous" integrity="sha384-YCX09L5bwJK+gubBuzo6JIyHVHvIqyl1r/VCD3WWnXzfMaihUYP2Z0zVvHjy0ely" as="fetch" type="application/wasm"></head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<!-- The WASM code will resize the canvas dynamically -->
|
|
||||||
<!-- the id is hardcoded in main.rs . so, make sure both match. -->
|
|
||||||
<canvas id="the_canvas_id"></canvas>
|
|
||||||
|
|
||||||
<!-- the loading spinner will be removed in main.rs -->
|
|
||||||
<div class="centered" id="loading_text">
|
|
||||||
<p style="font-size:16px">
|
|
||||||
Loading…
|
|
||||||
</p>
|
|
||||||
<div class="lds-dual-ring"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--Register Service Worker. this will cache the wasm / js scripts for offline use (for PWA functionality). -->
|
|
||||||
<!-- Force refresh (Ctrl + F5) to load the latest files instead of cached files -->
|
|
||||||
<script>
|
|
||||||
// We disable caching during development so that we always view the latest version.
|
|
||||||
if ('serviceWorker' in navigator && window.location.hash !== "#dev") {
|
|
||||||
window.addEventListener('load', function () {
|
|
||||||
navigator.serviceWorker.register('sw.js');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>"use strict";
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
|
|
||||||
const address = '{{__TRUNK_ADDRESS__}}';
|
|
||||||
const base = '{{__TRUNK_WS_BASE__}}';
|
|
||||||
let protocol = '';
|
|
||||||
protocol =
|
|
||||||
protocol
|
|
||||||
? protocol
|
|
||||||
: window.location.protocol === 'https:'
|
|
||||||
? 'wss'
|
|
||||||
: 'ws';
|
|
||||||
const url = protocol + '://' + address + base + '.well-known/trunk/ws';
|
|
||||||
|
|
||||||
class Overlay {
|
|
||||||
constructor() {
|
|
||||||
// create an overlay
|
|
||||||
this._overlay = document.createElement("div");
|
|
||||||
const style = this._overlay.style;
|
|
||||||
style.height = "100vh";
|
|
||||||
style.width = "100vw";
|
|
||||||
style.position = "fixed";
|
|
||||||
style.top = "0";
|
|
||||||
style.left = "0";
|
|
||||||
style.backgroundColor = "rgba(222, 222, 222, 0.5)";
|
|
||||||
style.fontFamily = "sans-serif";
|
|
||||||
// not sure that's the right approach
|
|
||||||
style.zIndex = "1000000";
|
|
||||||
style.backdropFilter = "blur(1rem)";
|
|
||||||
|
|
||||||
const container = document.createElement("div");
|
|
||||||
// center it
|
|
||||||
container.style.position = "absolute";
|
|
||||||
container.style.top = "30%";
|
|
||||||
container.style.left = "15%";
|
|
||||||
container.style.maxWidth = "85%";
|
|
||||||
|
|
||||||
this._title = document.createElement("div");
|
|
||||||
this._title.innerText = "Build failure";
|
|
||||||
this._title.style.paddingBottom = "2rem";
|
|
||||||
this._title.style.fontSize = "2.5rem";
|
|
||||||
|
|
||||||
this._message = document.createElement("div");
|
|
||||||
this._message.style.whiteSpace = "pre-wrap";
|
|
||||||
|
|
||||||
const icon= document.createElement("div");
|
|
||||||
icon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" fill="#dc3545" viewBox="0 0 16 16"><path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/></svg>';
|
|
||||||
this._title.prepend(icon);
|
|
||||||
|
|
||||||
container.append(this._title, this._message);
|
|
||||||
this._overlay.append(container);
|
|
||||||
|
|
||||||
this._inject();
|
|
||||||
window.setInterval(() => {
|
|
||||||
this._inject();
|
|
||||||
}, 250);
|
|
||||||
}
|
|
||||||
|
|
||||||
set reason(reason) {
|
|
||||||
this._message.textContent = reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
_inject() {
|
|
||||||
if (!this._overlay.isConnected) {
|
|
||||||
// prepend it
|
|
||||||
document.body?.prepend(this._overlay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class Client {
|
|
||||||
constructor(url) {
|
|
||||||
this.url = url;
|
|
||||||
this.poll_interval = 5000;
|
|
||||||
this._overlay = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
const ws = new WebSocket(this.url);
|
|
||||||
ws.onmessage = (ev) => {
|
|
||||||
const msg = JSON.parse(ev.data);
|
|
||||||
switch (msg.type) {
|
|
||||||
case "reload":
|
|
||||||
this.reload();
|
|
||||||
break;
|
|
||||||
case "buildFailure":
|
|
||||||
this.buildFailure(msg.data)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ws.onclose = () => this.onclose();
|
|
||||||
}
|
|
||||||
|
|
||||||
onclose() {
|
|
||||||
window.setTimeout(
|
|
||||||
() => {
|
|
||||||
// when we successfully reconnect, we'll force a
|
|
||||||
// reload (since we presumably lost connection to
|
|
||||||
// trunk due to it being killed, so it will have
|
|
||||||
// rebuilt on restart)
|
|
||||||
const ws = new WebSocket(this.url);
|
|
||||||
ws.onopen = () => window.location.reload();
|
|
||||||
ws.onclose = () => this.onclose();
|
|
||||||
},
|
|
||||||
this.poll_interval);
|
|
||||||
}
|
|
||||||
|
|
||||||
reload() {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
buildFailure({reason}) {
|
|
||||||
// also log the console
|
|
||||||
console.error("Build failed:", reason);
|
|
||||||
|
|
||||||
console.debug("Overlay", this._overlay);
|
|
||||||
|
|
||||||
if (!this._overlay) {
|
|
||||||
this._overlay = new Overlay();
|
|
||||||
}
|
|
||||||
this._overlay.reason = reason;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
new Client(url).start();
|
|
||||||
|
|
||||||
})()
|
|
||||||
</script></body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
||||||
<!-- Powered by egui: https://github.com/emilk/egui/ -->
|
|
||||||
1579
wallet/dist/wallet-817ceb420679efc7.js
vendored
1579
wallet/dist/wallet-817ceb420679efc7.js
vendored
File diff suppressed because it is too large
Load Diff
BIN
wallet/dist/wallet-817ceb420679efc7_bg.wasm
vendored
BIN
wallet/dist/wallet-817ceb420679efc7_bg.wasm
vendored
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user