Compare commits

...

11 Commits

Author SHA1 Message Date
priyanshu_bharti ca787fb1ed refactor: parse og html template once 2026-04-18 03:11:04 +05:30
priyanshu_bharti 382056c6ba feat: improve og invite preview 2026-04-18 02:53:34 +05:30
deveshanim3 56edad77a8 fix: added logic for password requirements on signup (#230)
Co-authored-by: deveshanim3 <deveshsingh6986@gmail.com>
Co-committed-by: deveshanim3 <deveshsingh6986@gmail.com>
2026-04-17 19:43:27 +00:00
priyanshu_bharti fdb604e350 Use type=email for signup/login email inputs (#225) (#228)
Co-authored-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
Co-committed-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
2026-04-17 18:55:04 +00:00
deveshanim3 3c66dfd83c fix/wrong-message-offline (#222)
Co-authored-by: deveshanim3 <deveshsingh6986@gmail.com>
Co-committed-by: deveshanim3 <deveshsingh6986@gmail.com>
2026-04-17 18:24:55 +00:00
userAdityaa 81633b0a1e fix: vertical alignment of emoji and overflow buttons in shared event action row (#219)
Co-authored-by: userAdityaa <aditya.chaudhary1558@gmail.com>
Co-committed-by: userAdityaa <aditya.chaudhary1558@gmail.com>
2026-04-17 15:22:40 +00:00
Khushvendra 4a967de184 fix(chat): suppress programmatic scroll while user is scrolling (#132) (#216)
Co-authored-by: 1amKhush <khushvendras99@gmail.com>
Co-committed-by: 1amKhush <khushvendras99@gmail.com>
2026-04-16 23:20:17 +00:00
deveshanim3 59961cbdb5 fix: supported nip overflow in SpaceRelayStatus.svelte (#215)
Co-authored-by: deveshanim3 <deveshsingh6986@gmail.com>
Co-committed-by: deveshanim3 <deveshsingh6986@gmail.com>
2026-04-16 21:36:14 +00:00
Jon Staab 95d9d8bf23 Bump version 2026-04-16 14:10:50 -07:00
Jon Staab 2fd9741a2b Fix safe area inset for chat fab
Docker / build-and-push-image (push) Successful in 16m42s
2026-04-16 14:08:25 -07:00
Jon Staab fe9c325580 Update universal links 2026-04-16 13:50:13 -07:00
20 changed files with 1047 additions and 34 deletions
+4
View File
@@ -1,5 +1,9 @@
# Changelog
# 1.7.4
* Fix safe area inset for FAB
# 1.7.3
* Add native share support for space invites
+7 -3
View File
@@ -21,12 +21,16 @@ ENV VITE_BUILD_HASH=${VITE_BUILD_HASH}
ENV NODE_OPTIONS=--max_old_space_size=16384
RUN pnpm run build
RUN pnpm prune --prod
FROM node:20-alpine
FROM node:20-bookworm-slim
WORKDIR /app
# Copy only the built output - no source, no .env, no dev deps
# Copy production runtime only
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/build ./build
COPY --from=builder /app/server.js ./server.js
CMD ["npx", "serve", "-s", "build"]
CMD ["node", "server.js"]
+1 -1
View File
@@ -31,7 +31,7 @@ To run your own Flotilla, it's as simple as:
```sh
pnpm install
pnpm run build
npx serve -s build
node server.js
```
Or, if you prefer to use a container:
+2 -2
View File
@@ -8,8 +8,8 @@ android {
applicationId "social.flotilla"
minSdk rootProject.ext.minSdkVersion
targetSdk rootProject.ext.targetSdkVersion
versionCode 45
versionName "1.7.3"
versionCode 46
versionName "1.7.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
+4 -4
View File
@@ -358,14 +358,14 @@
CODE_SIGN_ENTITLEMENTS = "Flotilla Chat.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 37;
DEVELOPMENT_TEAM = S26U9DYW3A;
INFOPLIST_FILE = App/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Flotilla Chat";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.7.3;
MARKETING_VERSION = 1.7.4;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = social.flotilla;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -385,14 +385,14 @@
CODE_SIGN_ENTITLEMENTS = "Flotilla Chat.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 37;
DEVELOPMENT_TEAM = S26U9DYW3A;
INFOPLIST_FILE = App/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Flotilla Chat";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.7.3;
MARKETING_VERSION = 1.7.4;
PRODUCT_BUNDLE_IDENTIFIER = social.flotilla;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
+5 -1
View File
@@ -1,9 +1,10 @@
{
"name": "flotilla",
"version": "1.7.3",
"version": "1.7.4",
"private": true,
"scripts": {
"dev": "vite dev",
"start": "node server.js",
"build": "./build.sh",
"release:android": "./build.sh && cap build android --androidreleasetype APK --signing-type apksigner",
"tauri:dev": "tauri dev",
@@ -60,6 +61,7 @@
"@capawesome/capacitor-badge": "^8.0.0",
"@getalby/lightning-tools": "^6.1.0",
"@getalby/sdk": "^5.1.2",
"@hono/node-server": "^1.19.14",
"@noble/curves": "^1.9.7",
"@pomade/core": "^0.2.3",
"@poppanator/sveltekit-svg": "^4.2.1",
@@ -80,12 +82,14 @@
"@welshman/signer": "^0.8.13",
"@welshman/store": "^0.8.13",
"@welshman/util": "^0.8.13",
"cheerio": "^1.2.0",
"compressorjs-next": "^1.1.2",
"daisyui": "^5.5.19",
"date-picker-svelte": "^2.17.0",
"dotenv": "^16.6.1",
"emoji-picker-element": "^1.28.1",
"fuse.js": "^7.1.0",
"hono": "^4.12.14",
"husky": "^9.1.7",
"idb": "^8.0.3",
"livekit-client": "^2.17.2",
+141
View File
@@ -62,6 +62,9 @@ importers:
'@getalby/sdk':
specifier: ^5.1.2
version: 5.1.2(typescript@5.9.3)
'@hono/node-server':
specifier: ^1.19.14
version: 1.19.14(hono@4.12.14)
'@noble/curves':
specifier: ^1.9.7
version: 1.9.7
@@ -122,6 +125,9 @@ importers:
'@welshman/util':
specifier: ^0.8.13
version: 0.8.13(@noble/curves@1.9.7)(@welshman/lib@0.8.13)(nostr-tools@2.20.0(typescript@5.9.3))
cheerio:
specifier: ^1.2.0
version: 1.2.0
compressorjs-next:
specifier: ^1.1.2
version: 1.1.2
@@ -140,6 +146,9 @@ importers:
fuse.js:
specifier: ^7.1.0
version: 7.1.0
hono:
specifier: ^4.12.14
version: 4.12.14
husky:
specifier: ^9.1.7
version: 9.1.7
@@ -1096,6 +1105,12 @@ packages:
resolution: {integrity: sha512-yUF9LhuvdIFOwjV1aG0ryzfwDiGBFk/CRLkRvrrM9dsE38SUjKsf1FDga5jxsKMu80nWcPZR9TiGGASWedoYPA==}
engines: {node: '>=14'}
'@hono/node-server@1.19.14':
resolution: {integrity: sha512-GwtvgtXxnWsucXvbQXkRgqksiH2Qed37H9xHZocE5sA3N8O8O8/8FA3uclQXxXVzc9XBZuEOMK7+r02FmSpHtw==}
engines: {node: '>=18.14.1'}
peerDependencies:
hono: ^4
'@humanfs/core@0.19.1':
resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==}
engines: {node: '>=18.18.0'}
@@ -2465,6 +2480,13 @@ packages:
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
engines: {node: '>=10'}
cheerio-select@2.1.0:
resolution: {integrity: sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==}
cheerio@1.2.0:
resolution: {integrity: sha512-WDrybc/gKFpTYQutKIK6UvfcuxijIZfMfXaYm8NMsPQxSYvf+13fXUJ4rztGGbJcBQ/GF55gvrZ0Bc0bj/mqvg==}
engines: {node: '>=20.18.1'}
chevrotain@7.1.1:
resolution: {integrity: sha512-wy3mC1x4ye+O+QkEinVJkPf5u2vsrDIYW9G7ZuwFl6v/Yu0LwUuT2POsb+NUWApebyxfkQq6+yDfRExbnI5rcw==}
@@ -2830,6 +2852,9 @@ packages:
emoji-regex@8.0.0:
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
encoding-sniffer@0.2.1:
resolution: {integrity: sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==}
enhanced-resolve@5.20.1:
resolution: {integrity: sha512-Qohcme7V1inbAfvjItgw0EaxVX5q2rdVEZHRBrEQdRZTssLDGsL8Lwrznl8oQ/6kuTJONLaDcGjkNP247XEhcA==}
engines: {node: '>=10.13.0'}
@@ -2841,6 +2866,14 @@ packages:
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
engines: {node: '>=0.12'}
entities@6.0.1:
resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==}
engines: {node: '>=0.12'}
entities@7.0.1:
resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==}
engines: {node: '>=0.12'}
env-paths@2.2.1:
resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==}
engines: {node: '>=6'}
@@ -3234,6 +3267,10 @@ packages:
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
hasBin: true
hono@4.12.14:
resolution: {integrity: sha512-am5zfg3yu6sqn5yjKBNqhnTX7Cv+m00ox+7jbaKkrLMRJ4rAdldd1xPd/JzbBWspqaQv6RSTrgFN95EsfhC+7w==}
engines: {node: '>=16.9.0'}
hosted-git-info@2.8.9:
resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==}
@@ -3241,6 +3278,9 @@ packages:
resolution: {integrity: sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==}
engines: {node: '>=10'}
htmlparser2@10.1.0:
resolution: {integrity: sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==}
husky@9.1.7:
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
engines: {node: '>=18'}
@@ -3249,6 +3289,10 @@ packages:
ico-endec@0.1.6:
resolution: {integrity: sha512-ZdLU38ZoED3g1j3iEyzcQj+wAkY2xfWNkymszfJPoxucIUhK7NayQ+/C4Kv0nDFMIsbtbEHldv3V8PU494/ueQ==}
iconv-lite@0.6.3:
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
engines: {node: '>=0.10.0'}
idb@7.1.1:
resolution: {integrity: sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==}
@@ -4015,6 +4059,15 @@ packages:
resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==}
engines: {node: '>=8'}
parse5-htmlparser2-tree-adapter@7.1.0:
resolution: {integrity: sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==}
parse5-parser-stream@7.1.2:
resolution: {integrity: sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==}
parse5@7.3.0:
resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==}
path-exists@3.0.0:
resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==}
engines: {node: '>=4'}
@@ -4456,6 +4509,9 @@ packages:
resolution: {integrity: sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==}
engines: {node: '>= 0.4'}
safer-buffer@2.1.2:
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
sax@1.1.4:
resolution: {integrity: sha512-5f3k2PbGGp+YtKJjOItpg3P99IMD84E4HOvcfleTb5joCHNXYLsR9yWFPOYGgaeMPDubQILTCMdsFb2OMeOjtg==}
@@ -4891,6 +4947,10 @@ packages:
undici-types@7.16.0:
resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==}
undici@7.25.0:
resolution: {integrity: sha512-xXnp4kTyor2Zq+J1FfPI6Eq3ew5h6Vl0F/8d9XU5zZQf1tX9s2Su1/3PiMmUANFULpmksxkClamIZcaUqryHsQ==}
engines: {node: '>=20.18.1'}
unicode-canonical-property-names-ecmascript@2.0.1:
resolution: {integrity: sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==}
engines: {node: '>=4'}
@@ -5009,6 +5069,15 @@ packages:
resolution: {integrity: sha512-5ZZY1+lGq8LEKuDlg9M2RPJHlH3R7OVwyHqMcUsLKCgd9Wvf+QrFTCItkXXYPmrJn8H6gRLXbSgxLLdexiqHxw==}
engines: {node: '>=6.0.0', npm: '>=3.10.0'}
whatwg-encoding@3.1.1:
resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==}
engines: {node: '>=18'}
deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation
whatwg-mimetype@4.0.0:
resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==}
engines: {node: '>=18'}
whatwg-url@5.0.0:
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
@@ -6228,6 +6297,10 @@ snapshots:
transitivePeerDependencies:
- typescript
'@hono/node-server@1.19.14(hono@4.12.14)':
dependencies:
hono: 4.12.14
'@humanfs/core@0.19.1': {}
'@humanfs/node@0.16.7':
@@ -7642,6 +7715,29 @@ snapshots:
ansi-styles: 4.3.0
supports-color: 7.2.0
cheerio-select@2.1.0:
dependencies:
boolbase: 1.0.0
css-select: 5.2.2
css-what: 6.2.2
domelementtype: 2.3.0
domhandler: 5.0.3
domutils: 3.2.2
cheerio@1.2.0:
dependencies:
cheerio-select: 2.1.0
dom-serializer: 2.0.0
domhandler: 5.0.3
domutils: 3.2.2
encoding-sniffer: 0.2.1
htmlparser2: 10.1.0
parse5: 7.3.0
parse5-htmlparser2-tree-adapter: 7.1.0
parse5-parser-stream: 7.1.2
undici: 7.25.0
whatwg-mimetype: 4.0.0
chevrotain@7.1.1:
dependencies:
regexp-to-ast: 0.5.0
@@ -8032,6 +8128,11 @@ snapshots:
emoji-regex@8.0.0: {}
encoding-sniffer@0.2.1:
dependencies:
iconv-lite: 0.6.3
whatwg-encoding: 3.1.1
enhanced-resolve@5.20.1:
dependencies:
graceful-fs: 4.2.11
@@ -8041,6 +8142,10 @@ snapshots:
entities@4.5.0: {}
entities@6.0.1: {}
entities@7.0.1: {}
env-paths@2.2.1: {}
env-paths@3.0.0: {}
@@ -8550,16 +8655,29 @@ snapshots:
he@1.2.0: {}
hono@4.12.14: {}
hosted-git-info@2.8.9: {}
hosted-git-info@4.1.0:
dependencies:
lru-cache: 6.0.0
htmlparser2@10.1.0:
dependencies:
domelementtype: 2.3.0
domhandler: 5.0.3
domutils: 3.2.2
entities: 7.0.1
husky@9.1.7: {}
ico-endec@0.1.6: {}
iconv-lite@0.6.3:
dependencies:
safer-buffer: 2.1.2
idb@7.1.1: {}
idb@8.0.3: {}
@@ -9266,6 +9384,19 @@ snapshots:
json-parse-even-better-errors: 2.3.1
lines-and-columns: 1.2.4
parse5-htmlparser2-tree-adapter@7.1.0:
dependencies:
domhandler: 5.0.3
parse5: 7.3.0
parse5-parser-stream@7.1.2:
dependencies:
parse5: 7.3.0
parse5@7.3.0:
dependencies:
entities: 6.0.1
path-exists@3.0.0: {}
path-exists@4.0.0: {}
@@ -9704,6 +9835,8 @@ snapshots:
es-errors: 1.3.0
is-regex: 1.2.1
safer-buffer@2.1.2: {}
sax@1.1.4: {}
sax@1.4.4: {}
@@ -10229,6 +10362,8 @@ snapshots:
undici-types@7.16.0: {}
undici@7.25.0: {}
unicode-canonical-property-names-ecmascript@2.0.1: {}
unicode-match-property-ecmascript@2.0.0:
@@ -10309,6 +10444,12 @@ snapshots:
dependencies:
sdp: 3.2.1
whatwg-encoding@3.1.1:
dependencies:
iconv-lite: 0.6.3
whatwg-mimetype@4.0.0: {}
whatwg-url@5.0.0:
dependencies:
tr46: 0.0.3
+816
View File
@@ -0,0 +1,816 @@
// @ts-nocheck
import {readFile} from "node:fs/promises"
import {dirname, extname, join} from "node:path"
import {fileURLToPath} from "node:url"
import {load as loadHtml} from "cheerio"
import {serve} from "@hono/node-server"
import {serveStatic} from "@hono/node-server/serve-static"
import {Hono} from "hono"
import {request} from "@welshman/net"
import {
Address,
CLASSIFIED,
EVENT_TIME,
POLL,
ROOM_META,
THREAD,
ZAP_GOAL,
displayPubkey,
getTagValue,
normalizeRelayUrl,
readRoomMeta,
} from "@welshman/util"
const __dirname = dirname(fileURLToPath(import.meta.url))
const buildDir = join(__dirname, "build")
const indexPath = join(buildDir, "index.html")
const RELAY_CACHE_TTL_MS = 5 * 60 * 1000
const NOSTR_CACHE_TTL_MS = 60 * 1000
const RELAY_TIMEOUT_MS = 1500
const NOSTR_TIMEOUT_MS = 1800
const META_TOKENS = {
card: "__FLOTILLA_META_CARD__",
description: "__FLOTILLA_META_DESCRIPTION__",
image: "__FLOTILLA_META_IMAGE__",
site: "__FLOTILLA_META_SITE__",
title: "__FLOTILLA_META_TITLE__",
type: "__FLOTILLA_META_TYPE__",
url: "__FLOTILLA_META_URL__",
}
const staticTitles = new Map([
["/", "Redirecting"],
["/home", "Home"],
["/spaces", "Spaces"],
["/spaces/create", "Create a Space"],
["/chat", "Messages"],
["/join", "Join Space"],
["/people", "Find People"],
["/settings/about", "About"],
["/settings/profile", "Profile Settings"],
["/settings/content", "Content Settings"],
["/settings/privacy", "Privacy Settings"],
["/settings/relays", "Relay Settings"],
["/settings/alerts", "Alert Settings"],
["/settings/wallet", "Wallet Settings"],
])
const spaceSectionTitles = new Map([
["chat", "Space Chat"],
["recent", "Recent Activity"],
["threads", "Threads"],
["classifieds", "Classifieds"],
["calendar", "Calendar"],
["goals", "Goals"],
["polls", "Polls"],
])
const eventRouteKinds = new Map([
["threads", THREAD],
["goals", ZAP_GOAL],
["calendar", EVENT_TIME],
["classifieds", CLASSIFIED],
["polls", POLL],
])
const reservedSingleSegments = new Set([
"home",
"spaces",
"space",
"chat",
"join",
"people",
"settings",
])
const relayInfoCache = new Map()
const roomInfoCache = new Map()
const eventCache = new Map()
const indexHtml = await readFile(indexPath, "utf8").catch(error => {
console.error("Unable to start server: build/index.html is missing. Run `pnpm run build` first.")
throw error
})
const defaults = getHtmlDefaults(indexHtml)
const htmlTemplate = createHtmlTemplate(indexHtml)
const app = new Hono()
const staticFiles = serveStatic({
root: "./build",
rewriteRequestPath: path => path.replace(/^\/+/, ""),
})
app.use("*", staticFiles)
app.get("*", async c => {
const requestUrl = new URL(c.req.url)
if (extname(requestUrl.pathname)) {
return c.text("Not Found", 404)
}
const origin = getRequestOrigin(c.req.raw, requestUrl)
const meta = await buildRouteMeta(requestUrl, origin)
const html = renderHtml(htmlTemplate, meta)
c.header("Cache-Control", "no-cache")
return c.html(html)
})
app.notFound(c => c.text("Not Found", 404))
app.onError((error, c) => {
console.error(error)
return c.text("Internal Server Error", 500)
})
const port = Number.parseInt(process.env.PORT || "3000", 10)
const host = process.env.HOST || "0.0.0.0"
serve({fetch: app.fetch, hostname: host, port})
console.log(`Flotilla server listening on http://${host}:${port}`)
async function buildRouteMeta(requestUrl, origin) {
const absoluteDefaultImage = toAbsoluteHttpUrl(defaults.image, origin)
if (!absoluteDefaultImage) {
throw new Error(`Default twitter:image must resolve to an absolute URL. Found: ${defaults.image}`)
}
const meta = {
card: "summary",
description: defaults.description,
image: absoluteDefaultImage,
site: defaults.site,
title: defaults.title,
type: "website",
url: requestUrl.href,
}
const route = parseRoute(requestUrl.pathname)
if (route.kind === "join") {
return await buildJoinMeta(meta, requestUrl, origin)
}
if (route.kind === "static") {
meta.title = route.title
return meta
}
if (route.kind === "chat") {
meta.title = getChatTitle(route.chat)
return meta
}
if (route.kind === "bech32") {
meta.title = "Opening Link"
return meta
}
if (!route.relay) {
return meta
}
const relayUrl = normalizeRelayParam(route.relay)
const relayInfo = relayUrl ? await loadRelayInfo(relayUrl) : undefined
const relayName = relayInfo?.name || (relayUrl ? getRelayDisplay(relayUrl) : "Space")
const relayHttpUrl = relayUrl ? toRelayHttpUrl(relayUrl) : undefined
if (relayInfo?.icon) {
meta.image = relayInfo.icon
}
if (relayInfo?.description) {
meta.description = relayInfo.description
}
if (route.kind === "space") {
meta.title = relayName
return meta
}
if (route.kind === "space-section") {
meta.title = composeSpaceTitle(relayName, route.sectionTitle)
return meta
}
if (route.kind === "room") {
const roomInfo = relayUrl ? await loadRoomInfo(relayUrl, route.h) : undefined
const roomName = roomInfo?.name || route.h
meta.title = composeSpaceTitle(relayName, roomName)
meta.description = roomInfo?.about || meta.description
const roomImage = roomInfo?.picture
? toAbsoluteHttpUrl(roomInfo.picture, relayHttpUrl || origin)
: undefined
if (roomImage) {
meta.image = roomImage
}
return meta
}
if (route.kind === "event") {
const event = relayUrl
? await loadEventForRoute(relayUrl, route.section, route.identifier)
: undefined
const eventTitle = getEventTitle(route.section, event)
meta.title = composeSpaceTitle(relayName, eventTitle)
meta.description = getEventDescription(route.section, event, meta.description)
const eventImage = getTagValue("image", event?.tags || [])
const absoluteEventImage = eventImage
? toAbsoluteHttpUrl(eventImage, relayHttpUrl || origin)
: undefined
if (absoluteEventImage) {
meta.image = absoluteEventImage
meta.card = "summary_large_image"
}
return meta
}
return meta
}
function parseRoute(pathname) {
const normalizedPath = normalizePathname(pathname)
if (normalizedPath === "/join") {
return {kind: "join"}
}
if (staticTitles.has(normalizedPath)) {
return {kind: "static", title: staticTitles.get(normalizedPath)}
}
const segments = getPathSegments(normalizedPath)
if (segments.length === 2 && segments[0] === "chat") {
return {chat: segments[1], kind: "chat"}
}
if (segments.length === 1 && !reservedSingleSegments.has(segments[0])) {
return {bech32: segments[0], kind: "bech32"}
}
if ((segments[0] === "spaces" || segments[0] === "space") && segments.length >= 2) {
const relay = segments[1]
if (segments.length === 2) {
return {kind: "space", relay}
}
const section = segments[2]
if (segments.length === 3) {
if (spaceSectionTitles.has(section)) {
return {
kind: "space-section",
relay,
section,
sectionTitle: spaceSectionTitles.get(section),
}
}
return {h: section, kind: "room", relay}
}
if (segments.length === 4 && eventRouteKinds.has(section)) {
return {
identifier: segments[3],
kind: "event",
relay,
section,
}
}
}
return {kind: "unknown"}
}
async function buildJoinMeta(meta, requestUrl, origin) {
const relayUrl = parseInviteRelay(requestUrl)
if (!relayUrl) {
meta.title = staticTitles.get("/join")
return meta
}
const relayInfo = await loadRelayInfo(relayUrl)
const relayDisplay = relayInfo?.name || getRelayDisplay(relayUrl)
meta.title = `Invitation to join ${relayDisplay}`
meta.description = relayInfo?.description || `Join this Flotilla space on ${relayDisplay}.`
meta.image = relayInfo?.icon || meta.image
meta.url = requestUrl.href
meta.site = defaults.site
return meta
}
function getChatTitle(chat) {
if (!chat) {
return "Chat"
}
const peers = chat
.split(",")
.map(part => part.trim())
.filter(Boolean)
if (peers.length === 1) {
return `Chat with ${displayPubkey(peers[0])}`
}
if (peers.length > 1) {
return `Group chat (${peers.length})`
}
return "Chat"
}
function getEventTitle(section, event) {
if (section === "threads") {
return getTagValue("title", event?.tags || []) || "Thread"
}
if (section === "calendar") {
return getTagValue("title", event?.tags || []) || "Event"
}
if (section === "classifieds") {
return getTagValue("title", event?.tags || []) || "Listing"
}
if (section === "goals") {
return event?.content?.trim() || getTagValue("summary", event?.tags || []) || "Goal"
}
if (section === "polls") {
return getTagValue("title", event?.tags || []) || "Poll"
}
return "Event"
}
function getEventDescription(section, event, fallback) {
const summary =
getTagValue("summary", event?.tags || []) || getTagValue("description", event?.tags || [])
if (summary) {
return clip(summary, 220)
}
if (event?.content?.trim()) {
return clip(event.content.trim(), 220)
}
if (section === "threads") {
return "Read this thread in Flotilla."
}
if (section === "goals") {
return "Track this goal in Flotilla."
}
if (section === "calendar") {
return "View this calendar event in Flotilla."
}
if (section === "classifieds") {
return "Browse this listing in Flotilla."
}
if (section === "polls") {
return "Take this poll in Flotilla."
}
return fallback
}
function composeSpaceTitle(spaceName, leafTitle) {
const cleanedSpace = spaceName?.trim()
const cleanedLeaf = leafTitle?.trim()
if (cleanedSpace && cleanedLeaf) {
return `${cleanedSpace} / ${cleanedLeaf}`
}
return cleanedLeaf || cleanedSpace || defaults.title
}
async function loadRelayInfo(relayUrl) {
const cached = getCachedValue(relayInfoCache, relayUrl)
if (cached) {
return cached
}
const relayHttpUrl = toRelayHttpUrl(relayUrl)
if (!relayHttpUrl) {
setCachedValue(relayInfoCache, relayUrl, undefined, RELAY_CACHE_TTL_MS)
return undefined
}
const controller = new AbortController()
const timeout = setTimeout(() => controller.abort(), RELAY_TIMEOUT_MS)
let value
try {
const response = await fetch(relayHttpUrl, {
headers: {Accept: "application/nostr+json"},
signal: controller.signal,
})
if (response.ok) {
const json = await response.json()
const name = typeof json.name === "string" ? json.name.trim() : ""
const description = typeof json.description === "string" ? json.description.trim() : ""
const icon = typeof json.icon === "string" ? toAbsoluteHttpUrl(json.icon, relayHttpUrl) : undefined
value = {
description: description || undefined,
icon,
name: name || undefined,
}
}
} catch {
value = undefined
} finally {
clearTimeout(timeout)
}
setCachedValue(relayInfoCache, relayUrl, value, RELAY_CACHE_TTL_MS)
return value
}
async function loadRoomInfo(relayUrl, h) {
const cacheKey = `${relayUrl}|${h}`
const cached = getCachedValue(roomInfoCache, cacheKey)
if (cached !== undefined) {
return cached
}
const events = await requestEvents(relayUrl, [{"#d": [h], kinds: [ROOM_META], limit: 20}])
const roomMetas = []
for (const event of events) {
try {
const roomMeta = readRoomMeta(event)
if (roomMeta.h === h) {
roomMetas.push(roomMeta)
}
} catch {
// Ignore malformed room metadata.
}
}
const latest = roomMetas.sort((a, b) => b.event.created_at - a.event.created_at)[0]
const roomInfo = latest
? {
about: latest.about,
name: latest.name,
picture: latest.picture,
}
: undefined
setCachedValue(roomInfoCache, cacheKey, roomInfo, NOSTR_CACHE_TTL_MS)
return roomInfo
}
async function loadEventForRoute(relayUrl, section, identifier) {
const kind = eventRouteKinds.get(section)
if (!kind || !identifier) {
return undefined
}
const cacheKey = `${relayUrl}|${section}|${identifier}`
const cached = getCachedValue(eventCache, cacheKey)
if (cached !== undefined) {
return cached
}
const filters = getEventFilters(kind, identifier)
const events = filters.length > 0 ? await requestEvents(relayUrl, filters) : []
const event = events[0]
setCachedValue(eventCache, cacheKey, event, NOSTR_CACHE_TTL_MS)
return event
}
function getEventFilters(kind, identifier) {
if (kind === EVENT_TIME || kind === CLASSIFIED) {
try {
const address = Address.from(identifier)
return [
{
"#d": [address.identifier],
authors: [address.pubkey],
kinds: [address.kind],
limit: 1,
},
]
} catch {
return [{ids: [identifier], kinds: [kind], limit: 1}]
}
}
return [{ids: [identifier], kinds: [kind], limit: 1}]
}
async function requestEvents(relayUrl, filters) {
const controller = new AbortController()
const timeout = setTimeout(() => controller.abort(), NOSTR_TIMEOUT_MS)
try {
return await request({
autoClose: true,
filters,
relays: [relayUrl],
signal: controller.signal,
})
} catch {
return []
} finally {
clearTimeout(timeout)
}
}
function createHtmlTemplate(html) {
const $ = loadHtml(html)
upsertTitle($, META_TOKENS.title)
upsertMetaTag($, "name", "description", META_TOKENS.description)
upsertMetaTag($, "name", "og:url", META_TOKENS.url)
upsertMetaTag($, "name", "og:type", META_TOKENS.type)
upsertMetaTag($, "name", "og:title", META_TOKENS.title)
upsertMetaTag($, "name", "og:description", META_TOKENS.description)
upsertMetaTag($, "name", "twitter:card", META_TOKENS.card)
upsertMetaTag($, "name", "twitter:site", META_TOKENS.site)
upsertMetaTag($, "name", "twitter:title", META_TOKENS.title)
upsertMetaTag($, "name", "twitter:description", META_TOKENS.description)
upsertMetaTag($, "name", "twitter:image", META_TOKENS.image)
upsertMetaTag($, "property", "og:url", META_TOKENS.url)
upsertMetaTag($, "property", "og:type", META_TOKENS.type)
upsertMetaTag($, "property", "og:title", META_TOKENS.title)
upsertMetaTag($, "property", "og:description", META_TOKENS.description)
upsertMetaTag($, "property", "og:image", META_TOKENS.image)
return $.html()
}
function renderHtml(template, meta) {
return template
.replaceAll(META_TOKENS.card, escapeHtml(meta.card))
.replaceAll(META_TOKENS.description, escapeHtml(meta.description))
.replaceAll(META_TOKENS.image, escapeHtml(meta.image))
.replaceAll(META_TOKENS.site, escapeHtml(meta.site))
.replaceAll(META_TOKENS.title, escapeHtml(meta.title))
.replaceAll(META_TOKENS.type, escapeHtml(meta.type))
.replaceAll(META_TOKENS.url, escapeHtml(meta.url))
}
function escapeHtml(value) {
return String(value)
.replaceAll("&", "&amp;")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll('"', "&quot;")
.replaceAll("'", "&#39;")
}
function upsertTitle($, value) {
let titleTag = $("head > title").first()
if (titleTag.length === 0) {
$("head").prepend("<title></title>")
titleTag = $("head > title").first()
}
titleTag.text(value)
}
function upsertMetaTag($, attribute, key, content) {
const selector = `meta[${attribute}="${key}"]`
let metaTag = $(selector).first()
if (metaTag.length === 0) {
metaTag = $("<meta>").attr(attribute, key)
$("head").append(metaTag)
}
metaTag.attr("content", content)
}
function getHtmlDefaults(html) {
const $ = loadHtml(html)
return {
description: readRequiredMetaContent($, "og:description"),
image: readRequiredMetaContent($, "twitter:image"),
site: readRequiredMetaContent($, "twitter:site"),
title: readRequiredMetaContent($, "og:title"),
}
}
function readRequiredMetaContent($, key) {
const content = readMetaContent($, key)
if (!content) {
throw new Error(`Missing required meta tag ${key} in build/index.html. Ensure it exists in src/app.html.`)
}
return content
}
function readMetaContent($, key) {
const byName = $(`meta[name="${key}"]`).attr("content")
if (typeof byName === "string" && byName.trim()) {
return byName.trim()
}
const byProperty = $(`meta[property="${key}"]`).attr("content")
return typeof byProperty === "string" && byProperty.trim() ? byProperty.trim() : undefined
}
function parseInviteRelay(requestUrl) {
const relay = requestUrl.searchParams.get("r") || requestUrl.searchParams.get("relay")
if (!relay) {
return undefined
}
return normalizeRelayParam(relay)
}
function normalizeRelayParam(value) {
const decoded = value.trim()
if (!decoded) {
return undefined
}
const hasProtocol = /^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(decoded)
const withProtocol = hasProtocol ? decoded : `wss://${decoded}`
try {
const normalized = normalizeRelayUrl(withProtocol)
if (normalized.startsWith("ws://") || normalized.startsWith("wss://")) {
return normalized.replace(/\/+$/, "")
}
} catch {
// Ignore malformed relay URLs.
}
return undefined
}
function toRelayHttpUrl(relayUrl) {
if (relayUrl.startsWith("wss://")) {
return `https://${relayUrl.slice(6)}`
}
if (relayUrl.startsWith("ws://")) {
return `http://${relayUrl.slice(5)}`
}
return undefined
}
function getRelayDisplay(relayUrl) {
const relayHttpUrl = toRelayHttpUrl(relayUrl)
if (!relayHttpUrl) {
return relayUrl
}
try {
return new URL(relayHttpUrl).host
} catch {
return relayUrl
}
}
function toAbsoluteHttpUrl(value, baseUrl) {
try {
const parsed = new URL(value, baseUrl)
if (parsed.protocol === "http:" || parsed.protocol === "https:") {
return parsed.href
}
} catch {
// Ignore malformed URLs.
}
return undefined
}
function getRequestOrigin(req, requestUrl) {
const protocol = firstHeaderValue(req.headers.get("x-forwarded-proto")) || requestUrl.protocol.slice(0, -1)
const host =
firstHeaderValue(req.headers.get("x-forwarded-host")) ||
req.headers.get("host") ||
requestUrl.host ||
"localhost"
return `${protocol}://${host}`
}
function firstHeaderValue(value) {
if (typeof value === "string") {
return value.split(",")[0].trim()
}
return undefined
}
function normalizePathname(pathname) {
const cleanPath = pathname.replace(/\/+/g, "/")
if (cleanPath === "/") {
return "/"
}
return cleanPath.replace(/\/+$/, "") || "/"
}
function getPathSegments(pathname) {
const normalized = normalizePathname(pathname)
if (normalized === "/") {
return []
}
return normalized
.slice(1)
.split("/")
.map(decodeSegment)
}
function decodeSegment(value) {
try {
return decodeURIComponent(value)
} catch {
return value
}
}
function clip(text, maxLength) {
if (text.length <= maxLength) {
return text
}
return `${text.slice(0, maxLength - 1).trimEnd()}`
}
function getCachedValue(cache, key) {
const cached = cache.get(key)
if (!cached) {
return undefined
}
if (cached.expiresAt <= Date.now()) {
cache.delete(key)
return undefined
}
return cached.value
}
function setCachedValue(cache, key, value, ttlMs) {
cache.set(key, {expiresAt: Date.now() + ttlMs, value})
}
+10 -10
View File
@@ -2,6 +2,16 @@
@config "../tailwind.config.js";
/* root */
:root {
font-family: Lato;
--sait: var(--safe-area-inset-top, env(safe-area-inset-top));
--saib: var(--safe-area-inset-bottom, env(safe-area-inset-bottom));
--sail: var(--safe-area-inset-left, env(safe-area-inset-left));
--sair: var(--safe-area-inset-right, env(safe-area-inset-right));
}
@utility pt-sai {
padding-top: var(--sait);
}
@@ -22,16 +32,6 @@
@apply pl-sai pr-sai;
}
/* root */
:root {
font-family: Lato;
--sait: var(--safe-area-inset-top, env(safe-area-inset-top));
--saib: var(--safe-area-inset-bottom, env(safe-area-inset-bottom));
--sail: var(--safe-area-inset-left, env(safe-area-inset-left));
--sair: var(--safe-area-inset-right, env(safe-area-inset-right));
}
@utility py-sai {
@apply pt-sai pb-sai;
}
+3 -2
View File
@@ -42,7 +42,7 @@
let popover: Instance | undefined = $state()
</script>
<Button class="join rounded-full">
<div class="join items-center rounded-full">
{#if ENABLE_ZAPS && !hideZap}
<ZapButton {url} {event} class="btn join-item btn-neutral btn-xs">
<Icon icon={Bolt} size={4} />
@@ -52,6 +52,7 @@
<Icon icon={SmileCircle} size={4} />
</EmojiButton>
<Tippy
class="flex"
bind:popover
component={EventMenu}
props={{url, noun, event, customActions, onClick: hidePopover}}
@@ -60,4 +61,4 @@
<Icon icon={MenuDots} size={4} />
</Button>
</Tippy>
</Button>
</div>
+1 -1
View File
@@ -90,7 +90,7 @@
{#snippet input()}
<label class="input input-bordered flex w-full items-center gap-2">
<Icon icon={Letter} />
<input bind:value={email} />
<input type="email" bind:value={email} />
</label>
{/snippet}
</FieldInline>
+1 -1
View File
@@ -61,7 +61,7 @@
{#snippet input()}
<label class="input input-bordered flex w-full items-center gap-2">
<Icon icon={Letter} />
<input bind:value={email} />
<input type="email" bind:value={email} />
</label>
{/snippet}
</FieldInline>
+4 -1
View File
@@ -120,7 +120,7 @@
{#snippet input()}
<label class="input input-bordered flex w-full items-center gap-2">
<Icon icon={Letter} />
<input bind:value={email} />
<input type="email" bind:value={email} />
</label>
{/snippet}
</FieldInline>
@@ -134,6 +134,9 @@
<input type="password" bind:value={password} />
</label>
{/snippet}
{#snippet info()}
Must be at least 12 characters long.
{/snippet}
</FieldInline>
</ModalBody>
<ModalFooter>
+22 -2
View File
@@ -25,6 +25,16 @@
const {url} = $props()
const authError = deriveRelayAuthError(url)
let networkError = $state(false)
const isExplicitAuthError = $derived(
$authError &&
!(
$authError.toLowerCase().includes("failed") ||
$authError.toLowerCase().includes("timeout") ||
$authError.toLowerCase().includes("network")
),
)
const isGenericError = $derived(networkError || ($authError && !isExplicitAuthError))
const back = () => history.back()
const copyInvite = () => clip(invite)
@@ -70,8 +80,14 @@
])
claim = getTagValue("claim", event?.tags || []) || ""
} catch {
} catch (err) {
claim = ""
if (
(err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError")) ||
!navigator.onLine
) {
networkError = true
}
} finally {
loading = false
}
@@ -92,7 +108,11 @@
<p class="center">
<Spinner {loading}>Requesting an invite link...</Spinner>
</p>
{:else if $authError}
{:else if isGenericError}
<p class="center text-center">
Unable to reach the relay. Please check your connection and try again.
</p>
{:else if isExplicitAuthError}
<p class="center">Oops! It looks like you're not a member of this relay.</p>
{:else}
<div class="flex flex-col items-center gap-6">
+1 -1
View File
@@ -46,7 +46,7 @@
</div>
{/if}
{#if Array.isArray(supported_nips)}
<p class="badge badge-neutral">
<p class="badge badge-neutral text-wrap h-auto">
<span class="ellipsize">Supported NIPs: {supported_nips.join(", ")}</span>
</p>
{/if}
+1
View File
@@ -31,6 +31,7 @@
<svelte:document onmousemove={onMouseMove} />
<Tippy
class="flex"
bind:popover
component={EmojiPicker}
props={{onClick}}
+1 -1
View File
@@ -14,7 +14,7 @@
} = $props()
</script>
<div class={cx("fixed bottom-20 right-4 z-nav hide-on-keyboard md:hidden", className)}>
<div class={cx("fixed bottom-20 mb-sai right-4 z-nav hide-on-keyboard md:hidden", className)}>
<Button
class="btn btn-primary border-none shadow-xl hover:opacity-90 transition-all size-[50px] rounded-xl p-0"
{onclick}>
+9 -1
View File
@@ -4,6 +4,7 @@
import {page} from "$app/stores"
import {goto} from "$app/navigation"
import type {Readable} from "svelte/store"
import {debounce} from "throttle-debounce"
import {pubkey, publishThunk, waitForThunkError, joinRoom, leaveRoom} from "@welshman/app"
import {now, ifLet, int, formatTimestampAsDate, ago, MINUTE} from "@welshman/lib"
import type {MakeNonOptional} from "@welshman/lib"
@@ -244,6 +245,8 @@
const onScroll = () => {
if (!isProgrammaticScroll) {
userHasScrolled = true
isUserScrolling = true
clearIsUserScrolling()
manageScrollPosition()
}
@@ -265,6 +268,7 @@
let leaving = $state(false)
let userHasScrolled = $state(false)
let isProgrammaticScroll = $state(false)
let isUserScrolling = $state(false)
let loadingBackward = $state(true)
let loadingForward = $state(true)
let share = $state(popKey<TrustedEvent | undefined>("share"))
@@ -278,6 +282,10 @@
let compose: RoomCompose | undefined = $state()
let eventToEdit: TrustedEvent | undefined = $state()
const clearIsUserScrolling = debounce(150, () => {
isUserScrolling = false
})
const elements = $derived.by(() => {
const elements = []
const seen = new Set()
@@ -351,7 +359,7 @@
})
$effect(() => {
if (elements.length > 0) {
if (elements.length > 0 && !isUserScrolling) {
requestAnimationFrame(manageScrollPosition)
}
})
+9 -1
View File
@@ -4,6 +4,7 @@
import {goto} from "$app/navigation"
import type {Readable} from "svelte/store"
import {readable} from "svelte/store"
import {debounce} from "throttle-debounce"
import {now, int, ifLet, formatTimestampAsDate, MINUTE, ago} from "@welshman/lib"
import type {TrustedEvent, EventContent} from "@welshman/util"
import {makeEvent, MESSAGE, RELAY_ADD_MEMBER} from "@welshman/util"
@@ -139,6 +140,8 @@
const onScroll = () => {
if (!isProgrammaticScroll) {
userHasScrolled = true
isUserScrolling = true
clearIsUserScrolling()
manageScrollPosition()
}
@@ -160,6 +163,7 @@
let loadingForward = $state(true)
let userHasScrolled = $state(false)
let isProgrammaticScroll = $state(false)
let isUserScrolling = $state(false)
let share = $state(popKey<TrustedEvent | undefined>("share"))
let parent: TrustedEvent | undefined = $state()
let element: HTMLElement | undefined = $state()
@@ -171,6 +175,10 @@
let compose: RoomCompose | undefined = $state()
let eventToEdit: TrustedEvent | undefined = $state()
const clearIsUserScrolling = debounce(150, () => {
isUserScrolling = false
})
const elements = $derived.by(() => {
const elements = []
const seen = new Set()
@@ -244,7 +252,7 @@
})
$effect(() => {
if (elements.length > 0) {
if (elements.length > 0 && !isUserScrolling) {
requestAnimationFrame(manageScrollPosition)
}
})
+5 -2
View File
@@ -1,12 +1,15 @@
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"relation": [
"delegate_permission/common.handle_all_urls"
],
"target": {
"namespace": "android_app",
"package_name": "social.flotilla",
"sha256_cert_fingerprints": [
"D0:2A:2E:82:75:92:4D:E2:13:E8:46:B8:EA:09:15:17:7F:46:7B:D1:49:E3:12:60:F0:01:D3:EF:42:9B:A2:DA",
"6D:AF:68:3E:1C:A8:3A:4C:D8:85:73:E9:73:9E:2A:A9:44:C8:5D:56:15:4E:34:42:30:55:7C:FF:ED:4A:D7:8C"
"6D:AF:68:3E:1C:A8:3A:4C:D8:85:73:E9:73:9E:2A:A9:44:C8:5D:56:15:4E:34:42:30:55:7C:FF:ED:4A:D7:8C",
"8C:EE:37:F9:8A:08:02:A7:BB:55:2B:64:E5:A5:93:D8:58:73:14:26:66:71:DD:B0:4F:AB:9D:D5:4C:DF:FB:F7"
]
}
}