~/hooky

hooky/command/public/glue.js -rw-r--r-- 1.07 kB
406fafb5 — Arthur Melton format some 2 years ago
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const invoke = window.__TAURI__.invoke

export async function invokeGen(features, payload, sendTo) {
    document.getElementById("GenCover").style.display = "block";
    document.getElementById("setup").style.display = "none";
    await invoke("gen", {
        features: features,
        payload: payload,
        sendTo: sendTo
    });
    while (!(await is_done())) {
        await new Promise(r => setTimeout(r, 100));
    }
    document.getElementById("GenCover").style.display = "none";
    document.getElementById("dashboard").style.display = "block";
}

async function is_done() {
    return await invoke("is_done", {});
}

export async function isOn(id) {
    return await document.getElementById(id).checked;
}

export async function setPayload() {
    document.getElementById("payload").value = await window.__TAURI__.dialog.open();
}

export async function getPayload() {
    return document.getElementById("payload").value;
}

export async function getIp() {
    return document.getElementById("ip").value + ":" + document.getElementById("port").value;
}