mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2025-09-08 06:58:42 +00:00
69 lines
2.3 KiB
HTML
69 lines
2.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>VoxVera GUI</title>
|
|
<style>
|
|
#log {
|
|
border: 1px solid #ccc;
|
|
padding: 5px;
|
|
height: 150px;
|
|
overflow-y: auto;
|
|
background: #f8f8f8;
|
|
white-space: pre-wrap;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>VoxVera</h1>
|
|
<form id="config-form">
|
|
<div><label>Name <input type="text" id="name"></label></div>
|
|
<div><label>Subdomain <input type="text" id="subdomain"></label></div>
|
|
<div><label>Title <input type="text" id="title"></label></div>
|
|
<div><label>Subtitle <input type="text" id="subtitle"></label></div>
|
|
<div><label>Headline <input type="text" id="headline"></label></div>
|
|
<div><label>Content<br><textarea id="content" rows="5" cols="60"></textarea></label></div>
|
|
<div><label>URL Message <input type="text" id="url_message"></label></div>
|
|
<div><label>URL <input type="text" id="url"></label></div>
|
|
<div><label>Tear-off link <input type="text" id="tear_off_link"></label></div>
|
|
<div><label>Binary message <input type="text" id="binary_message"></label></div>
|
|
<button type="button" id="quickstart">Generate & Serve</button>
|
|
</form>
|
|
<p id="onion-address"></p>
|
|
<pre id="log"></pre>
|
|
<script>
|
|
async function load() {
|
|
const cfg = await window.voxvera.loadConfig();
|
|
for (const [k, v] of Object.entries(cfg)) {
|
|
const el = document.getElementById(k);
|
|
if (el) el.value = v;
|
|
}
|
|
}
|
|
document.addEventListener('DOMContentLoaded', load);
|
|
|
|
document.getElementById('quickstart').addEventListener('click', async () => {
|
|
const ids = ['name','subdomain','title','subtitle','headline','content','url_message','url','tear_off_link','binary_message'];
|
|
const cfg = {};
|
|
ids.forEach(id => {
|
|
const el = document.getElementById(id);
|
|
if (el) cfg[id] = el.value;
|
|
});
|
|
await window.voxvera.quickstart(cfg);
|
|
});
|
|
|
|
window.voxvera.onOnionUrl(url => {
|
|
document.getElementById('onion-address').textContent = `Onion address: ${url}`;
|
|
});
|
|
|
|
window.voxvera.onLog((msg, isErr) => {
|
|
const container = document.getElementById('log');
|
|
const span = document.createElement('span');
|
|
if (isErr) span.style.color = 'red';
|
|
span.textContent = msg;
|
|
container.appendChild(span);
|
|
container.scrollTop = container.scrollHeight;
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|