From 07dd1e97dce56994c9e5aedc31736297d8871e13 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Thu, 13 Feb 2025 14:26:00 -0800 Subject: [PATCH] Fix long-running subscriptions clogging things up --- ios/App/App.xcodeproj/project.pbxproj | 12 ++-- ios/App/App/Info.plist | 6 +- package-lock.json | 74 +++++++++++++--------- package.json | 4 +- src/app/components/ContentLinkBlock.svelte | 9 ++- src/app/requests.ts | 12 ++-- 6 files changed, 75 insertions(+), 42 deletions(-) diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index aa5550f2..bf6663e9 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -351,12 +351,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = S26U9DYW3A; INFOPLIST_FILE = App/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "Flotilla Chat"; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking"; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 0.2.8; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = social.flotilla; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -374,12 +376,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = S26U9DYW3A; INFOPLIST_FILE = App/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "Flotilla Chat"; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking"; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 0.2.8; PRODUCT_BUNDLE_IDENTIFIER = social.flotilla; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/ios/App/App/Info.plist b/ios/App/App/Info.plist index e155f0b7..e3674ac7 100644 --- a/ios/App/App/Info.plist +++ b/ios/App/App/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion en CFBundleDisplayName - Flotilla + Flotilla CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -30,6 +30,8 @@ armv7 + UIStatusBarStyle + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait @@ -45,5 +47,7 @@ UIViewControllerBasedStatusBarAppearance + ITSAppUsesNonExemptEncryption + diff --git a/package-lock.json b/package-lock.json index cd74b7d6..2b61b008 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "flotilla", - "version": "0.2.7", + "version": "0.2.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "flotilla", - "version": "0.2.7", + "version": "0.2.8", "dependencies": { "@capacitor/android": "^7.0.0", "@capacitor/app": "^7.0.0", @@ -22,15 +22,15 @@ "@vite-pwa/assets-generator": "^0.2.6", "@vite-pwa/sveltekit": "^0.6.6", "@welshman/app": "~0.0.42", - "@welshman/content": "~0.0.17", + "@welshman/content": "~0.0.18", "@welshman/dvm": "~0.0.14", - "@welshman/editor": "~0.0.13", + "@welshman/editor": "~0.0.15", "@welshman/feeds": "~0.0.30", - "@welshman/lib": "~0.0.40", - "@welshman/net": "~0.0.46", + "@welshman/lib": "~0.0.41", + "@welshman/net": "~0.0.47", "@welshman/signer": "~0.0.20", "@welshman/store": "~0.0.16", - "@welshman/util": "~0.0.60", + "@welshman/util": "~0.0.61", "daisyui": "^4.12.10", "date-picker-svelte": "^2.13.0", "dotenv": "^16.4.5", @@ -4766,13 +4766,13 @@ } }, "node_modules/@welshman/content": { - "version": "0.0.17", - "resolved": "https://registry.npmjs.org/@welshman/content/-/content-0.0.17.tgz", - "integrity": "sha512-xiBSL8BSzHrwRmGqKXkR/S6EK7a1wT1rG1qdlQN30lBX5ZS+NSkoI0aNuF8p313mElHNZWgrqxFaat+FML4yOw==", + "version": "0.0.18", + "resolved": "https://registry.npmjs.org/@welshman/content/-/content-0.0.18.tgz", + "integrity": "sha512-7LHs9xKStrkaet9VY1PWSEUWrdIaIThIo+ByN6lF3nRZwPTExrBy4rPXnEa5roVAAwgmlhXw3zTkfGP15V6joQ==", "license": "MIT", "dependencies": { "@braintree/sanitize-url": "^7.0.2", - "@welshman/lib": "~0.0.37", + "@welshman/lib": "~0.0.40", "nostr-tools": "^2.7.2" }, "engines": { @@ -4793,9 +4793,9 @@ } }, "node_modules/@welshman/editor": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/@welshman/editor/-/editor-0.0.13.tgz", - "integrity": "sha512-860kn8iOXHKGBOnL3zalFQVw8eeILNU6YQ4V+xFtgqIxxCMk1c/9F5k0k0OyloUqRNjtSG6hvLdQLacBvhz2WQ==", + "version": "0.0.15", + "resolved": "https://registry.npmjs.org/@welshman/editor/-/editor-0.0.15.tgz", + "integrity": "sha512-Eg3alzv+cjCXtr6oEItRqoRSD4DTllt3c2JyJTxpF/KNiy8XHHMeUSpVFgph3+pAt5jwyl6b1feKPEwpShgqHw==", "license": "MIT", "dependencies": { "@tiptap/core": "^2.11.5", @@ -4813,11 +4813,25 @@ "@tiptap/suggestion": "^2.11.5", "@welshman/lib": "~0.0.40", "@welshman/util": "^0.0.60", - "nostr-editor": "^0.0.4-pre.12", + "nostr-editor": "^0.0.4-pre.13", "nostr-tools": "^2.10.4", "tippy.js": "^6.3.7" } }, + "node_modules/@welshman/editor/node_modules/@welshman/util": { + "version": "0.0.60", + "resolved": "https://registry.npmjs.org/@welshman/util/-/util-0.0.60.tgz", + "integrity": "sha512-kqZgYnrwxKx0JTDZnTSaQYc2ev7E9ZjNDy5MclX36d5T/qPUspmwksAOodFJY9kJoJd49bf1omAmBTgnFJfeHw==", + "license": "MIT", + "dependencies": { + "@types/ws": "^8.5.13", + "@welshman/lib": "~0.0.37", + "nostr-tools": "^2.7.2" + }, + "engines": { + "node": ">=10.4.0" + } + }, "node_modules/@welshman/feeds": { "version": "0.0.30", "resolved": "https://registry.npmjs.org/@welshman/feeds/-/feeds-0.0.30.tgz", @@ -4829,9 +4843,9 @@ } }, "node_modules/@welshman/lib": { - "version": "0.0.40", - "resolved": "https://registry.npmjs.org/@welshman/lib/-/lib-0.0.40.tgz", - "integrity": "sha512-6Qk5fJABv+7HPqhNC5eLM4VZxCLpcu22nShmrNMbamkMwr4eLj2Bl4dRmuzFsvMcsL/Jc148zqpfuq37CY2NCw==", + "version": "0.0.41", + "resolved": "https://registry.npmjs.org/@welshman/lib/-/lib-0.0.41.tgz", + "integrity": "sha512-FMJVoPZw8Vi1fd2/ulwqlBS1tvjkFAm9lg+Dz5SXItXxrNC06YMRTjGjInCBEkArrvNGPUjchzSFDNmbH0fxHQ==", "license": "MIT", "dependencies": { "@scure/base": "^1.1.6", @@ -4840,13 +4854,13 @@ } }, "node_modules/@welshman/net": { - "version": "0.0.46", - "resolved": "https://registry.npmjs.org/@welshman/net/-/net-0.0.46.tgz", - "integrity": "sha512-ehH4grz0VHjuofyVUE3r5GoynHTh+cIT/XFH6ov6nOGRU/LZXCLGk/9CUPlqNYHRfc/zBtaIyfVu0AelLqV6lw==", + "version": "0.0.47", + "resolved": "https://registry.npmjs.org/@welshman/net/-/net-0.0.47.tgz", + "integrity": "sha512-/mIr+QyLH+RlD16rsPDTIW250lOm5eNaLO6dhZw8dMKznMhVtSWe/X/lJZOXmexzbB2z7WYZVN5x5TggZROyxA==", "license": "MIT", "dependencies": { - "@welshman/lib": "~0.0.37", - "@welshman/util": "~0.0.58", + "@welshman/lib": "~0.0.40", + "@welshman/util": "~0.0.59", "isomorphic-ws": "^5.0.0", "ws": "^8.16.0" } @@ -4917,13 +4931,13 @@ } }, "node_modules/@welshman/util": { - "version": "0.0.60", - "resolved": "https://registry.npmjs.org/@welshman/util/-/util-0.0.60.tgz", - "integrity": "sha512-kqZgYnrwxKx0JTDZnTSaQYc2ev7E9ZjNDy5MclX36d5T/qPUspmwksAOodFJY9kJoJd49bf1omAmBTgnFJfeHw==", + "version": "0.0.61", + "resolved": "https://registry.npmjs.org/@welshman/util/-/util-0.0.61.tgz", + "integrity": "sha512-+l4YX01msAtnyylzpIFIAYubvnBLyr9hGx3iRO5LS3OPv/yUDOeyYJseWDqorkIiN5BRT7PCgnWJdlQP71ZtAw==", "license": "MIT", "dependencies": { "@types/ws": "^8.5.13", - "@welshman/lib": "~0.0.37", + "@welshman/lib": "~0.0.40", "nostr-tools": "^2.7.2" }, "engines": { @@ -10152,9 +10166,9 @@ } }, "node_modules/nostr-editor": { - "version": "0.0.4-pre.12", - "resolved": "https://registry.npmjs.org/nostr-editor/-/nostr-editor-0.0.4-pre.12.tgz", - "integrity": "sha512-vztmbEKxt2jnO1JEoprwVf3s4TN4D3B0fcsrhckOITR1KaDX88QhIG+qTee92xp+n96vYj4GQt0W06rSv3NXHA==", + "version": "0.0.4-pre.13", + "resolved": "https://registry.npmjs.org/nostr-editor/-/nostr-editor-0.0.4-pre.13.tgz", + "integrity": "sha512-izIidrrIjQp41MAY2dNoticQSc0E5XOFKEe04tmZdTdF9Ry8CKxIdv6yvO3qh4gdhrOq+QPLTRii6X3X5iC/5Q==", "license": "MIT", "dependencies": { "light-bolt11-decoder": "^3.1.1" diff --git a/package.json b/package.json index 0f0e3d98..ee68d180 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flotilla", - "version": "0.2.7", + "version": "0.2.8", "private": true, "scripts": { "dev": "vite dev", @@ -56,7 +56,7 @@ "@welshman/editor": "~0.0.15", "@welshman/feeds": "~0.0.30", "@welshman/lib": "~0.0.41", - "@welshman/net": "~0.0.46", + "@welshman/net": "~0.0.47", "@welshman/signer": "~0.0.20", "@welshman/store": "~0.0.16", "@welshman/util": "~0.0.61", diff --git a/src/app/components/ContentLinkBlock.svelte b/src/app/components/ContentLinkBlock.svelte index 19182338..285912f5 100644 --- a/src/app/components/ContentLinkBlock.svelte +++ b/src/app/components/ContentLinkBlock.svelte @@ -8,6 +8,8 @@ const {value} = $props() + let hideImage = $state(false) + const url = value.url.toString() const loadPreview = async () => { @@ -20,6 +22,10 @@ return json } + const onError = () => { + hideImage = true + } + const expand = () => pushModal(ContentLinkDetail, {url}, {fullscreen: true}) @@ -40,9 +46,10 @@ {:then preview}
- {#if preview.image} + {#if preview.image && !hideImage} Link preview {/if} diff --git a/src/app/requests.ts b/src/app/requests.ts index 9169e4e8..abc569be 100644 --- a/src/app/requests.ts +++ b/src/app/requests.ts @@ -1,5 +1,5 @@ import {get, writable} from "svelte/store" -import {partition, int, YEAR, MONTH, insert, sortBy, assoc, now} from "@welshman/lib" +import {partition, shuffle, int, YEAR, MONTH, insert, sortBy, assoc, now} from "@welshman/lib" import { MESSAGE, DELETE, @@ -285,13 +285,17 @@ export const makeCalendarFeed = ({ export const listenForNotifications = () => { const subs: Subscription[] = [] - for (const [url, rooms] of userRoomsByUrl.get()) { + for (const [url, allRooms] of userRoomsByUrl.get()) { + // Limit how many rooms we load at a time, since we have to send a separate filter + // for each one due to nip 29 breaking postel's law + const rooms = shuffle(Array.from(allRooms)).slice(0, 30) + load({ relays: [url], filters: [ {kinds: [THREAD], limit: 1}, {kinds: [COMMENT], "#K": [String(THREAD)], limit: 1}, - ...Array.from(rooms).map(room => ({kinds: [MESSAGE], "#h": [room], limit: 1})), + ...rooms.map(room => ({kinds: [MESSAGE], "#h": [room], limit: 1})), ], }) @@ -301,7 +305,7 @@ export const listenForNotifications = () => { filters: [ {kinds: [THREAD], since: now()}, {kinds: [COMMENT], "#K": [String(THREAD)], since: now()}, - ...Array.from(rooms).map(room => ({kinds: [MESSAGE], "#h": [room], since: now()})), + ...rooms.map(room => ({kinds: [MESSAGE], "#h": [room], since: now()})), ], }), )