From 6eb26ea90c8028307e739f536753244d301a9aaf Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Mon, 1 Jan 2024 15:30:41 -0700 Subject: [PATCH] remove IndexedDB keys that shouldn't be keys, and remove unused table, and add commentary --- README.md | 12 ++++++------ project.task.yaml | 1 + src/db/tables/contacts.ts | 2 +- src/db/tables/logs.ts | 2 +- sw_scripts/safari-notifications.js | 7 ++----- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index ae846d4..d3faf82 100644 --- a/README.md +++ b/README.md @@ -26,13 +26,13 @@ If you are deploying in a subdirectory, add it to `publicPath` in vue.config.js, * [Tag wth the new version.](https://gitea.anomalistdesign.com/trent_larson/crowd-funder-for-time-pwa/releases) -* If production, change src/constants/app.ts DEFAULT_*_SERVER to be "PROD" and package.json to remove "_Test". +* If production, change src/constants/app.ts DEFAULT_*_SERVER to be "PROD" and package.json to remove "_Test". Also record what version is on production. * `npm run build` * `npx prettier --write ./sw_scripts/` -...to make sure the service worker scripts are in proper form. It's only important if you changed something in that directory. +...to make sure the service worker scripts are in proper form. (It's only important if you changed something in that directory.) * `cp sw_scripts/[ns]* dist/` @@ -40,7 +40,7 @@ If you are deploying in a subdirectory, add it to `publicPath` in vue.config.js, * `rsync -azvu -e "ssh -i ~/.ssh/..." dist ubuntutest@test.timesafari.app:time-safari` -* Revert src/constants/app.ts and package.json, edit package.json to increment version & add "-beta", `npm install`, and commit. +* Revert src/constants/app.ts and package.json, edit package.json to increment version & add "-beta", `npm install`, and commit. Also record what version is on production. @@ -113,9 +113,9 @@ To add an icon, add to main.ts and reference with `fa` element and `icon` attrib ### Clear/Reset data & restart * Clear cache for site. (In Chrome, go to `chrome://settings/cookies` and "all site data and permissions"; in Firefox, go to `about:preferences` and search for "cache" then "Manage Data", and also manually remove the IndexedDB data if the DBs still show.) -* Clear notification permission. (in Chrome, go to `chrome://settings/content/notifications`; in Firefox, go to `about:preferences` and search for "notifications".) -* Unregister service worker. (in Chrome, go to `chrome://serviceworker-internals/`; in Firefox, go to `about:serviceworkers`.) -* Clear Cache Storage. (in Chrome, in dev tools under Application; in Firefox, in dev tools under Storage.) +* Clear notification permission. (In Chrome, go to `chrome://settings/content/notifications`; in Firefox, go to `about:preferences` and search for "notifications".) +* Unregister service worker. (In Chrome, go to `chrome://serviceworker-internals/`; in Firefox, go to `about:serviceworkers`.) +* Clear Cache Storage manually, possibly deleting the DB. (In Chrome, in dev tools under Application; in Firefox, in dev tools under Storage.) (If you find more, add them to the HelpNotificationsView.vue file.) diff --git a/project.task.yaml b/project.task.yaml index 4372e73..1eefe77 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -35,6 +35,7 @@ tasks: - 04 allow user to download chains of VCs, mine + ones I can see about me from others - add VC confirmation +- make server endpoint for full English description of limits - make identicons for contacts into more-memorable faces (and maybe change project identicons, too) - 02 watch for the service worker activation before showing the button to turn on notifications - 01 server - show all claim details when issued by the issuer diff --git a/src/db/tables/contacts.ts b/src/db/tables/contacts.ts index 8ffd2fb..f1e1b90 100644 --- a/src/db/tables/contacts.ts +++ b/src/db/tables/contacts.ts @@ -7,5 +7,5 @@ export interface Contact { } export const ContactSchema = { - contacts: "&did, name, publicKeyBase64, registered, seesMe", + contacts: "&did, name", // no need to key by publicKeyBase64, registered, seesMe }; diff --git a/src/db/tables/logs.ts b/src/db/tables/logs.ts index 9207a2f..b3c1b0d 100644 --- a/src/db/tables/logs.ts +++ b/src/db/tables/logs.ts @@ -6,5 +6,5 @@ export const LogSchema = { // Currently keyed by "date" because A) today's log data is what we need so we append, and // B) we don't want it to grow so we remove everything if this is the first entry today. // See safari-notifications.js logMessage for the associated logic. - logs: "date, message", + logs: "date", // definitely don't key by the potentially large message field }; diff --git a/sw_scripts/safari-notifications.js b/sw_scripts/safari-notifications.js index f070179..de69c3e 100644 --- a/sw_scripts/safari-notifications.js +++ b/sw_scripts/safari-notifications.js @@ -414,11 +414,11 @@ async function appendDailyLog(message) { const db = await openIndexedDB("TimeSafari"); const transaction = db.transaction("logs", "readwrite"); const store = transaction.objectStore("logs"); - // will only keep one day's worth of logs + // only keep one day's worth of logs const todayKey = new Date().toDateString(); const previous = await getRecord(store, todayKey); if (!previous) { - await store.clear(); // clear out anything older than today + await store.clear(); // clear out everything previous when this is today's first log } let fullMessage = (previous && previous.message) || ""; if (fullMessage) { @@ -468,9 +468,6 @@ async function fetchAllAccounts() { if (!db.objectStoreNames.contains("accounts")) { db.createObjectStore("accounts", { keyPath: "id" }); } - if (!db.objectStoreNames.contains("worker_log")) { - db.createObjectStore("worker_log"); - } }; openRequest.onsuccess = function (event) {