33 lines
1.1 KiB
Bash
33 lines
1.1 KiB
Bash
#!/bin/bash
|
|
# patch-html.sh - Inject Hebrew RTL + translation into Paperclip UI
|
|
set -e
|
|
|
|
# Find the ui-dist directory in the global npm install
|
|
UI_DIR=$(find /usr/local/lib/node_modules/paperclipai -name "ui-dist" -type d | head -1)
|
|
|
|
if [ -z "$UI_DIR" ]; then
|
|
echo "ERROR: Could not find Paperclip ui-dist directory"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Found ui-dist at: $UI_DIR"
|
|
|
|
# Copy assets
|
|
cp /tmp/rtl-override.css "$UI_DIR/assets/rtl-override.css"
|
|
cp /tmp/translate-he.js "$UI_DIR/assets/translate-he.js"
|
|
|
|
# Patch index.html:
|
|
# 1. Set dir="rtl" and lang="he"
|
|
sed -i 's/<html lang="en"/<html lang="he" dir="rtl"/' "$UI_DIR/index.html"
|
|
|
|
# 2. Inject RTL CSS and translation script before </head>
|
|
sed -i 's|</head>|<link rel="stylesheet" href="/assets/rtl-override.css">\n<script defer src="/assets/translate-he.js"></script>\n</head>|' "$UI_DIR/index.html"
|
|
|
|
# 3. Update page title
|
|
sed -i 's|<title>Paperclip</title>|<title>Paperclip - פייפרקליפ</title>|' "$UI_DIR/index.html"
|
|
|
|
echo "Hebrew RTL patch applied successfully"
|
|
echo "Patched files:"
|
|
echo " - $UI_DIR/index.html"
|
|
echo " - $UI_DIR/assets/rtl-override.css"
|
|
echo " - $UI_DIR/assets/translate-he.js" |