db: Fix the db app, and show a message instead of an ugly error when you're not signed in.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 15m58s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 15m58s
This commit is contained in:
parent
ef844fbccb
commit
77ff8cef1f
@ -1,4 +1,5 @@
|
||||
{
|
||||
"type": "tildefriends-app",
|
||||
"emoji": "💽"
|
||||
"emoji": "💽",
|
||||
"previous": "&uQzkIe/Aj8yNhLKe3hEq+5fEJsGwIUx8NVBjJKwoV2U=.sha256"
|
||||
}
|
||||
|
@ -51,6 +51,19 @@ async function key_list(db) {
|
||||
app.setDocument(doc);
|
||||
}
|
||||
|
||||
function load() {
|
||||
if (core.user?.credentials?.session) {
|
||||
database_list();
|
||||
} else {
|
||||
app.setDocument(`<!DOCTYPE html>
|
||||
<html>
|
||||
<body style="background: #888">
|
||||
<h1>Must be signed in to examine databases.</h1>
|
||||
</body>
|
||||
</html>`);
|
||||
}
|
||||
}
|
||||
|
||||
core.register('message', async function (message) {
|
||||
if (message.event == 'hashChange') {
|
||||
let hash = message.hash.substring(1);
|
||||
@ -62,9 +75,9 @@ core.register('message', async function (message) {
|
||||
} else if (hash.length) {
|
||||
key_list(await database(hash.split(':').slice(1).join(':')));
|
||||
} else {
|
||||
database_list();
|
||||
load();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
database_list();
|
||||
load();
|
||||
|
@ -716,12 +716,12 @@ async function getProcessBlob(blobId, key, options) {
|
||||
Object.keys(db).map((x) => [x, db[x].bind(db)])
|
||||
);
|
||||
};
|
||||
imports.databases = function () {
|
||||
imports.databases = async function () {
|
||||
return [].concat(
|
||||
databases.list(
|
||||
await databases.list(
|
||||
':shared:' + process.credentials.session.name + ':%'
|
||||
),
|
||||
databases.list(process.credentials.session.name + ':%')
|
||||
await databases.list(process.credentials.session.name + ':%')
|
||||
);
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user