flop-guild 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -0
- package/README.md +62 -2
- package/dist/autopilot.js +178 -0
- package/dist/cli.js +220 -0
- package/dist/commands.js +40 -0
- package/dist/config.js +21 -0
- package/dist/econ.js +125 -0
- package/dist/flop.js +322 -0
- package/dist/identity.js +110 -0
- package/dist/mcp.js +124 -0
- package/dist/minerpage.js +168 -0
- package/dist/miners.js +107 -0
- package/dist/net.js +64 -0
- package/dist/nonce.js +36 -0
- package/dist/server.js +405 -0
- package/dist/setup.js +222 -0
- package/dist/technocore.js +134 -0
- package/dist/wallet.js +66 -0
- package/networks.json +13 -0
- package/package.json +51 -4
- package/site/guides/agent-quickstart.md +42 -0
- package/site/guides/autopilot.md +45 -0
- package/site/guides/join-guild.md +33 -0
- package/site/index.html +18 -0
- package/site/llms.txt +31 -0
- package/site/skill.md +48 -0
- package/site/start-core.js +117 -0
- package/site/start.html +41 -0
- package/site/start.js +66 -0
- package/site/vendor/noble-ed25519-3.2.0.js +933 -0
- package/site/vendor/noble-ed25519-LICENSE.txt +21 -0
- package/skill.md +73 -0
package/site/start.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// flop-guild /start UI. The secret key stays in this page's memory; nothing is stored or sent
|
|
2
|
+
// except the optional introduction post to technocore.chat.
|
|
3
|
+
import { encryptKey, newKey, post, ROOM, signIntro } from "./start-core.js";
|
|
4
|
+
|
|
5
|
+
const $ = (id) => document.getElementById(id);
|
|
6
|
+
let key = null;
|
|
7
|
+
|
|
8
|
+
function say(id, text, bad) {
|
|
9
|
+
const el = $(id);
|
|
10
|
+
el.textContent = text;
|
|
11
|
+
el.className = bad ? "msg bad" : "msg";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function setDryRun() {
|
|
15
|
+
const q = new URLSearchParams(location.search);
|
|
16
|
+
if (q.has("dry-run")) $("dry").checked = true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
$("gen").addEventListener("click", async () => {
|
|
20
|
+
if (key && !confirm("Replace the key on this page? Download the current one first if you want to keep it.")) return;
|
|
21
|
+
key = await newKey();
|
|
22
|
+
$("did").textContent = key.did;
|
|
23
|
+
$("step2").hidden = false;
|
|
24
|
+
$("step3").hidden = false;
|
|
25
|
+
say("gen-msg", "New key made in this browser. It is not saved anywhere until you download it.");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
$("save").addEventListener("click", async () => {
|
|
29
|
+
if (!key) return;
|
|
30
|
+
const p = $("pass").value;
|
|
31
|
+
if (p !== $("pass2").value) return say("save-msg", "The two passphrases do not match.", true);
|
|
32
|
+
try {
|
|
33
|
+
const file = await encryptKey(key, p);
|
|
34
|
+
const blob = new Blob([JSON.stringify(file, null, 2) + "\n"], { type: "application/json" });
|
|
35
|
+
const a = document.createElement("a");
|
|
36
|
+
a.href = URL.createObjectURL(blob);
|
|
37
|
+
a.download = "flop-guild-key.json";
|
|
38
|
+
document.body.appendChild(a);
|
|
39
|
+
a.click();
|
|
40
|
+
a.remove();
|
|
41
|
+
setTimeout(() => URL.revokeObjectURL(a.href), 10000);
|
|
42
|
+
$("pass").value = "";
|
|
43
|
+
$("pass2").value = "";
|
|
44
|
+
say("save-msg", "Downloaded flop-guild-key.json, encrypted with your passphrase. Lose the passphrase and the key is gone.");
|
|
45
|
+
} catch (e) {
|
|
46
|
+
say("save-msg", e.message, true);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
$("sign").addEventListener("click", async () => {
|
|
51
|
+
if (!key) return;
|
|
52
|
+
try {
|
|
53
|
+
const signed = await signIntro(key, $("intro").value, Date.now());
|
|
54
|
+
$("signed-msg").textContent = signed.message;
|
|
55
|
+
$("signed-sig").textContent = signed.sig;
|
|
56
|
+
$("signed").hidden = false;
|
|
57
|
+
if ($("dry").checked) return say("sign-msg", `Dry run: signed, not posted. Nothing was sent to ${ROOM}.`);
|
|
58
|
+
const r = await post(signed);
|
|
59
|
+
if (r.status >= 200 && r.status < 300) say("sign-msg", `Posted to ${ROOM}.`);
|
|
60
|
+
else say("sign-msg", `Not posted: HTTP ${r.status}. ${r.body.split("\n")[0]}`, true);
|
|
61
|
+
} catch (e) {
|
|
62
|
+
say("sign-msg", e.message, true);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
setDryRun();
|