tildefriends/apps/user_settings/app.js

47 lines
1.1 KiB
JavaScript

import * as tfrpc from '/tfrpc.js';
tfrpc.register(async function getIdentities() {
return ssb.getIdentities();
});
tfrpc.register(async function getPrivateKey(id) {
return bip39Words(await ssb.getPrivateKey(id));
});
tfrpc.register(async function getThemes() {
// TODO
return ['solarized', 'gruvbox', 'light'];
});
tfrpc.register(async function setTheme() {
// TODO
console.warn("setTheme called - not implemented")
return null;
});
async function main() {
// Get body.html
const body = utf8Decode(await getFile('body.html'));
// Build the document
const document = `
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/static/tildefriends-latest.css"/>
<link rel="stylesheet" href="style.css"/>
<script src="script.js" type="module"></script>
<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>
</head>
<body class="flex-column">
${body}
</body>
</html>`;
// Send it to the browser
app.setDocument(document);
}
main();