2024-03-21 14:25:07 -04:00
|
|
|
import * as tfrpc from '/tfrpc.js';
|
|
|
|
|
|
|
|
tfrpc.register(async function getIdentities() {
|
|
|
|
return ssb.getIdentities();
|
|
|
|
});
|
|
|
|
tfrpc.register(async function createID(id) {
|
|
|
|
return await ssb.createIdentity();
|
|
|
|
});
|
|
|
|
tfrpc.register(async function getPrivateKey(id) {
|
|
|
|
return bip39Words(await ssb.getPrivateKey(id));
|
|
|
|
});
|
2024-03-21 15:10:35 -04:00
|
|
|
tfrpc.register(async function addID(id) {
|
|
|
|
return await ssb.addIdentity(bip39Bytes(id));
|
|
|
|
});
|
|
|
|
tfrpc.register(async function deleteID(id) {
|
|
|
|
return await ssb.deleteIdentity(id);
|
|
|
|
});
|
2024-03-21 14:25:07 -04:00
|
|
|
tfrpc.register(async function getThemes() {
|
|
|
|
// TODO
|
|
|
|
return ['solarized', 'gruvbox', 'light'];
|
|
|
|
});
|
2024-03-21 15:45:04 -04:00
|
|
|
tfrpc.register(async function getTheme() {
|
|
|
|
// TODO
|
|
|
|
return 'solarized';
|
|
|
|
});
|
2024-03-21 14:25:07 -04:00
|
|
|
tfrpc.register(async function setTheme() {
|
|
|
|
// TODO
|
2024-03-21 15:10:35 -04:00
|
|
|
console.warn('setTheme called - not implemented');
|
2024-03-21 14:25:07 -04:00
|
|
|
return null;
|
|
|
|
});
|
|
|
|
tfrpc.register(async function reload() {
|
|
|
|
await main();
|
|
|
|
});
|
|
|
|
|
2024-02-22 17:18:12 -05:00
|
|
|
async function main() {
|
|
|
|
// Get body.html
|
2024-03-21 14:25:07 -04:00
|
|
|
const body = utf8Decode(await getFile('body.html'));
|
2024-02-22 17:18:12 -05:00
|
|
|
|
|
|
|
// Build the document
|
|
|
|
const document = `
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2024-03-21 14:25:07 -04:00
|
|
|
<link rel="stylesheet" href="/static/tildefriends-v1.css"/>
|
|
|
|
<script src="tf-theme-picker.js" type="module"></script>
|
|
|
|
<script src="tf-password-form.js" type="module"></script>
|
|
|
|
<script src="tf-delete-account-btn.js" type="module"></script>
|
|
|
|
<script src="tf-identity-manager.js" type="module"></script>
|
2024-02-22 17:18:12 -05:00
|
|
|
</head>
|
|
|
|
|
2024-03-21 14:25:07 -04:00
|
|
|
<body class="flex-column">
|
2024-02-22 17:18:12 -05:00
|
|
|
${body}
|
|
|
|
</body>
|
|
|
|
</html>`;
|
|
|
|
|
|
|
|
// Send it to the browser
|
|
|
|
app.setDocument(document);
|
|
|
|
}
|
|
|
|
|
|
|
|
main();
|