ai/at
2
0

fix(patch): curl URL delimiter bug, add DM grapheme limit patch

This commit is contained in:
2026-03-24 18:03:53 +09:00
parent fde5046b22
commit abfd02ecbd
9 changed files with 104 additions and 7 deletions

1
.gitignore vendored
View File

@@ -10,3 +10,4 @@ web/dist
node_modules
package-lock.json
/tmp
/*.wiki

View File

@@ -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

View File

@@ -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

View File

@@ -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..."

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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",

View File

@@ -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',