make more adjustments to try and get logging to work

This commit is contained in:
2023-12-21 20:50:35 -07:00
parent f8002c4550
commit d7f4acb702
9 changed files with 55 additions and 38 deletions

View File

@@ -462,9 +462,7 @@ export default class App extends Vue {
"An error occurred setting notification permissions:",
error,
);
alert(
"Some error occurred setting notification permissions. See logs.",
);
alert("Some error occurred setting notification permissions.");
});
}

View File

@@ -50,7 +50,7 @@ export default class TopMessage extends Vue {
title: "Error Detecting Server",
text: JSON.stringify(err),
},
10000,
-1,
);
}
}

View File

@@ -1,7 +1,8 @@
import BaseDexie, { Table } from "dexie";
import { encrypted, Encryption } from "@pvermeer/dexie-encrypted-addon";
import { Account, AccountsSchema } from "./tables/accounts";
import { Contact, ContactsSchema } from "./tables/contacts";
import { Contact, ContactSchema } from "./tables/contacts";
import { Log, LogSchema } from "@/db/tables/logs";
import {
MASTER_SETTINGS_KEY,
Settings,
@@ -13,6 +14,7 @@ import { AppString } from "@/constants/app";
type SensitiveTables = { accounts: Table<Account> };
type NonsensitiveTables = {
contacts: Table<Contact>;
logs: Table<Log>;
settings: Table<Settings>;
};
@@ -26,7 +28,11 @@ export const accountsDB = new BaseDexie("TimeSafariAccounts") as SensitiveDexie;
const SensitiveSchemas = { ...AccountsSchema };
export const db = new BaseDexie("TimeSafari") as NonsensitiveDexie;
const NonsensitiveSchemas = { ...ContactsSchema, ...SettingsSchema };
const NonsensitiveSchemas = {
...ContactSchema,
...LogSchema,
...SettingsSchema,
};
// Manage the encryption key. If not present in localStorage, create and store it.
const secret =
@@ -38,7 +44,9 @@ encrypted(accountsDB, { secretKey: secret });
// Define the schema for our databases
accountsDB.version(1).stores(SensitiveSchemas);
db.version(1).stores(NonsensitiveSchemas);
// v1 was contacts & settings
// v2 added logs
db.version(2).stores(NonsensitiveSchemas);
// Event handler to initialize the non-sensitive database with default settings
db.on("populate", () => {

View File

@@ -6,6 +6,6 @@ export interface Contact {
registered?: boolean;
}
export const ContactsSchema = {
export const ContactSchema = {
contacts: "&did, name, publicKeyBase64, registered, seesMe",
};

7
src/db/tables/logs.ts Normal file
View File

@@ -0,0 +1,7 @@
export interface Log {
message: string;
}
export const LogSchema = {
logs: "message",
};