From abfd02ecbdf93babc4c5638bb5a2cee72ba78a08 Mon Sep 17 00:00:00 2001 From: syui Date: Tue, 24 Mar 2026 18:03:53 +0900 Subject: [PATCH] fix(patch): curl URL delimiter bug, add DM grapheme limit patch --- .gitignore | 1 + envs/chat | 1 + install.zsh | 18 +++++++++++------ ios/build.zsh | 14 ++++++++++++- ...048-social-app-ios-dm-grapheme-limit.patch | 11 ++++++++++ ios/setup.zsh | 15 ++++++++++++++ ...-social-app-dockerfile-chat-grapheme.patch | 11 ++++++++++ .../220-atproto-chat-grapheme-limit.patch | 20 +++++++++++++++++++ .../230-atproto-api-chat-grapheme-limit.patch | 20 +++++++++++++++++++ 9 files changed, 104 insertions(+), 7 deletions(-) create mode 100644 ios/patching/048-social-app-ios-dm-grapheme-limit.patch create mode 100644 patching/049-social-app-dockerfile-chat-grapheme.patch create mode 100644 patching/220-atproto-chat-grapheme-limit.patch create mode 100644 patching/230-atproto-api-chat-grapheme-limit.patch diff --git a/.gitignore b/.gitignore index 7a39228..db17fa6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ web/dist node_modules package-lock.json /tmp +/*.wiki diff --git a/envs/chat b/envs/chat index 42aca80..8c08fa4 100644 --- a/envs/chat +++ b/envs/chat @@ -4,3 +4,4 @@ DB_PATH=/data/chat.db DID_HOST=bsky.syu.is SERVICE_URL=https://bsky.syu.is CHAT_DOMAIN=bsky.chat +APPVIEW_URL=https://bsky.syu.is diff --git a/install.zsh b/install.zsh index a0e2e90..e66e560 100755 --- a/install.zsh +++ b/install.zsh @@ -65,8 +65,8 @@ typeset -a FAILED_PATCHES # Patch file lists typeset -a PATCH_FILES_CURL PATCH_FILES_CURL=( - "4367-atproto-services-bsky-api.diff:https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/services/bsky/api.js:services/bsky/api.js" - "4367-atproto-services-pds-index.diff:https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/services/pds/index.js:services/pds/index.js" + "4367-atproto-services-bsky-api.diff|https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/services/bsky/api.js|services/bsky/api.js" + "4367-atproto-services-pds-index.diff|https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/services/pds/index.js|services/pds/index.js" ) typeset -a PATCH_FILES @@ -76,6 +76,8 @@ PATCH_FILES=( "130-atproto-ozone-enable-daemon-v2.patch" "200-feed-generator-custom.patch" "210-bgs-since-empty-fix.patch" + "220-atproto-chat-grapheme-limit.patch" + "049-social-app-dockerfile-chat-grapheme.patch" ) function at-repos-clone() { @@ -258,10 +260,10 @@ function patch-apply-with-curl() { function at-repos-patch-apply-all() { # Apply curl patches for patch_info in "${PATCH_FILES_CURL[@]}"; do - local filename="${patch_info%%:*}" - local rest="${patch_info#*:}" - local download_url="${rest%%:*}" - local download_target="${rest#*:}" + local filename="${patch_info%%|*}" + local rest="${patch_info#*|}" + local download_url="${rest%%|*}" + local download_target="${rest#*|}" local title="${filename%.*}" local repo="" @@ -285,6 +287,10 @@ function at-repos-patch-apply-all() { # Note: check indigo/bgs BEFORE pds to avoid "newpds" matching "pds" if [[ $filename == *"social-app"* || $filename == *"statsig"* ]]; then repo="social-app" + # Copy chat grapheme limit patch for Dockerfile build + if [[ $filename == "049-social-app-dockerfile-chat-grapheme.patch" ]] && [ -f "$d/patching/230-atproto-api-chat-grapheme-limit.patch" ]; then + cp "$d/patching/230-atproto-api-chat-grapheme-limit.patch" "$d/repos/social-app/" + fi elif [[ $filename == *"indigo"* || $filename == *"bgs"* ]]; then repo="indigo" elif [[ $filename == *"atproto"* ]]; then diff --git a/ios/build.zsh b/ios/build.zsh index cef231a..d2a507b 100755 --- a/ios/build.zsh +++ b/ios/build.zsh @@ -39,6 +39,18 @@ fi echo "1. Installing dependencies (yarn)..." yarn install +# 1.1. Patch @atproto/api lexicon: chat.bsky.convo maxGraphemes +API_DIR="$REPO_DIR/node_modules/@atproto/api" +PATCH_FILE="$SCRIPT_DIR/../patching/230-atproto-api-chat-grapheme-limit.patch" +if [ -d "$API_DIR" ] && [ -f "$PATCH_FILE" ]; then + if patch -f --dry-run -p1 -d "$API_DIR" < "$PATCH_FILE" > /dev/null 2>&1; then + patch -f -p1 -d "$API_DIR" < "$PATCH_FILE" > /dev/null 2>&1 + echo "✅ Patched @atproto/api lexicons.js: chat.bsky.convo maxGraphemes 1000 → 10000" + else + echo "❌ @atproto/api lexicons.js: patch failed (upstream may have changed)" + fi +fi + # 1.5. Copy assets echo "1.5. Copying assets..." if [ -d "$ASSETS_DIR" ]; then @@ -74,7 +86,7 @@ function cleanup_build { echo "2. Running Expo Prebuild..." # Clean old ios folder to remove old entitlements/AppClip targets rm -rf ios - npx expo prebuild --platform ios --clean + yes | npx expo prebuild --platform ios --clean # 3. CocoaPods echo "3. Installing CocoaPods..." diff --git a/ios/patching/048-social-app-ios-dm-grapheme-limit.patch b/ios/patching/048-social-app-ios-dm-grapheme-limit.patch new file mode 100644 index 0000000..62814d2 --- /dev/null +++ b/ios/patching/048-social-app-ios-dm-grapheme-limit.patch @@ -0,0 +1,11 @@ +--- a/src/lib/constants.ts ++++ b/src/lib/constants.ts +@@ -64,7 +64,7 @@ + + export const MAX_DRAFT_GRAPHEME_LENGTH = 1000 + +-export const MAX_DM_GRAPHEME_LENGTH = 1000 ++export const MAX_DM_GRAPHEME_LENGTH = 10000 + + // Recommended is 100 per: https://www.w3.org/WAI/GL/WCAG20/tests/test3.html + // but increasing limit per user feedback diff --git a/ios/setup.zsh b/ios/setup.zsh index 8facb10..e3ee075 100755 --- a/ios/setup.zsh +++ b/ios/setup.zsh @@ -48,6 +48,7 @@ PATCH_FILES_IOS=( "045-social-app-ios-composer-cancel.patch" "046-social-app-ios-null-url-guards.patch" "047-social-app-ios-dynamic-service.patch" # Dynamic proxy/notif per account (syu.is vs bsky.social) + "048-social-app-ios-dm-grapheme-limit.patch" ) function ios-env() { @@ -156,6 +157,20 @@ function ios-patch-apply-all() { local title="${filename%.*}" patch-apply "$title" "$filename" done + + # Patch @atproto/api lexicon: chat.bsky.convo maxGraphemes 1000 -> 10000 + local api_dir="$target_dir/node_modules/@atproto/api" + local patch_file="$d/patching/230-atproto-api-chat-grapheme-limit.patch" + if [ -d "$api_dir" ] && [ -f "$patch_file" ]; then + if patch -f --dry-run -p1 -d "$api_dir" < "$patch_file" > /dev/null 2>&1; then + patch -f -p1 -d "$api_dir" < "$patch_file" > /dev/null 2>&1 + echo "✅ Patched @atproto/api lexicons.js: chat.bsky.convo maxGraphemes 1000 → 10000" + elif patch -f --dry-run -p1 -R -d "$api_dir" < "$patch_file" > /dev/null 2>&1; then + echo "✅ @atproto/api lexicons.js: already patched" + else + echo "❌ @atproto/api lexicons.js: patch failed (upstream may have changed)" + fi + fi } # Copy new files that aren't in patches diff --git a/patching/049-social-app-dockerfile-chat-grapheme.patch b/patching/049-social-app-dockerfile-chat-grapheme.patch new file mode 100644 index 0000000..5566f70 --- /dev/null +++ b/patching/049-social-app-dockerfile-chat-grapheme.patch @@ -0,0 +1,11 @@ +--- a/Dockerfile ++++ b/Dockerfile +@@ -68,6 +68,8 @@ + npm install --global yarn && \ + yarn config set registry https://registry.npmjs.org/ && \ + yarn install --frozen-lockfile --network-timeout 100000 && \ ++ if [ -f 230-atproto-api-chat-grapheme-limit.patch ] && [ -d node_modules/@atproto/api ]; then \ ++ patch -f -p1 -d node_modules/@atproto/api < 230-atproto-api-chat-grapheme-limit.patch || true; fi && \ + yarn intl:build 2>&1 | tee i18n.log && \ + if grep -q "invalid syntax" "i18n.log"; then echo "\n\nFound compilation errors!\n\n" && exit 1; else echo "\n\nNo compile errors!\n\n"; fi && \ + SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN SENTRY_RELEASE=$EXPO_PUBLIC_RELEASE_VERSION SENTRY_DIST=$EXPO_PUBLIC_BUNDLE_IDENTIFIER yarn build-web diff --git a/patching/220-atproto-chat-grapheme-limit.patch b/patching/220-atproto-chat-grapheme-limit.patch new file mode 100644 index 0000000..a5c76a8 --- /dev/null +++ b/patching/220-atproto-chat-grapheme-limit.patch @@ -0,0 +1,20 @@ +--- a/lexicons/chat/bsky/convo/defs.json ++++ b/lexicons/chat/bsky/convo/defs.json +@@ -18,7 +18,7 @@ + "text": { + "type": "string", + "maxLength": 10000, +- "maxGraphemes": 1000 ++ "maxGraphemes": 10000 + }, + "facets": { + "type": "array", +@@ -40,7 +40,7 @@ + "text": { + "type": "string", + "maxLength": 10000, +- "maxGraphemes": 1000 ++ "maxGraphemes": 10000 + }, + "facets": { + "type": "array", diff --git a/patching/230-atproto-api-chat-grapheme-limit.patch b/patching/230-atproto-api-chat-grapheme-limit.patch new file mode 100644 index 0000000..5dac63c --- /dev/null +++ b/patching/230-atproto-api-chat-grapheme-limit.patch @@ -0,0 +1,20 @@ +--- a/dist/client/lexicons.js 2026-04-01 12:13:01 ++++ b/dist/client/lexicons.js 2026-04-01 12:13:12 +@@ -9244,7 +9244,7 @@ + text: { + type: 'string', + maxLength: 10000, +- maxGraphemes: 1000, ++ maxGraphemes: 10000, + }, + facets: { + type: 'array', +@@ -9273,7 +9273,7 @@ + text: { + type: 'string', + maxLength: 10000, +- maxGraphemes: 1000, ++ maxGraphemes: 10000, + }, + facets: { + type: 'array',