Browse Source

remove IndexedDB keys that shouldn't be keys, and remove unused table, and add commentary

starred-projects
Trent Larson 10 months ago
parent
commit
6eb26ea90c
  1. 12
      README.md
  2. 1
      project.task.yaml
  3. 2
      src/db/tables/contacts.ts
  4. 2
      src/db/tables/logs.ts
  5. 7
      sw_scripts/safari-notifications.js

12
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.)

1
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

2
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
};

2
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
};

7
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) {

Loading…
Cancel
Save