This commit is contained in:
Martti Malmi 2024-01-09 22:35:57 +02:00
parent 91f0afdb89
commit cf6b431d73
4 changed files with 15 additions and 15 deletions

View File

@ -63,6 +63,10 @@ export class MultiAccountStore extends ExternalStore<LoginSession> {
constructor() {
super();
if (typeof ServiceWorkerGlobalScope !== "undefined" && self instanceof ServiceWorkerGlobalScope) {
// return if sw. we might want to use localForage (idb) to share keys between sw and app
return;
}
const existing = window.localStorage.getItem(AccountStoreKey);
if (existing) {
const logins = JSON.parse(existing);
@ -204,8 +208,8 @@ export class MultiAccountStore extends ExternalStore<LoginSession> {
preferences: deepClone(DefaultPreferences),
} as LoginSession;
if ("nostr_os" in window && window.nostr_os) {
window.nostr_os.saveKey(key.value);
if ("nostr_os" in window && window?.nostr_os) {
window?.nostr_os.saveKey(key.value);
newSession.type = LoginSessionType.Nip7os;
newSession.privateKeyData = undefined;
}

View File

@ -334,9 +334,6 @@
"defaultMessage": "Parent",
"description": "Link to parent note in thread"
},
"AIgmDy": {
"defaultMessage": "Add up to 4 hashtags"
},
"ALdW69": {
"defaultMessage": "Note by {name}"
},
@ -1169,15 +1166,9 @@
"d7d0/x": {
"defaultMessage": "LN Address"
},
"d8gpCh": {
"defaultMessage": "Try to use less than 5 hashtags to stay on topic 🙏"
},
"dOQCL8": {
"defaultMessage": "Display name"
},
"ddd3JX": {
"defaultMessage": "Popular Hashtags"
},
"deEeEI": {
"defaultMessage": "Register"
},

View File

@ -31,12 +31,20 @@ registerRoute(
cacheName: "image-cache",
plugins: [
new ExpirationPlugin({
maxEntries: 100,
maxEntries: 200,
}),
],
}),
);
registerRoute(
({ url }) => url.pathname.endsWith("api/v1/preview"),
new StaleWhileRevalidate({
cacheName: "preview-cache",
plugins: [new ExpirationPlugin({ maxAgeSeconds: 4 * 60 * 60 })],
}),
);
self.addEventListener("message", event => {
if (event.data && event.data.type === "SKIP_WAITING") {
self.skipWaiting();

View File

@ -110,7 +110,6 @@
"9wO4wJ": "Lightning Invoice",
"ABAQyo": "Chats",
"ADmfQT": "Parent",
"AIgmDy": "Add up to 4 hashtags",
"ALdW69": "Note by {name}",
"AN0Z7Q": "Muted Words",
"ASRK0S": "This author has been muted",
@ -385,9 +384,7 @@
"d+6YsV": "Lists to mute:",
"d2ebEu": "Not Subscribed to Push",
"d7d0/x": "LN Address",
"d8gpCh": "Try to use less than 5 hashtags to stay on topic 🙏",
"dOQCL8": "Display name",
"ddd3JX": "Popular Hashtags",
"deEeEI": "Register",
"djLctd": "Amount in sats",
"djNL6D": "Read-only",