ai/at
1
0

test social-app html build

This commit is contained in:
2025-12-13 18:16:37 +09:00
parent a9811f7719
commit ab6331d80e
5 changed files with 41 additions and 554 deletions

View File

@@ -205,52 +205,50 @@ function ios-setup-clone() {
echo "Repository found: $target_dir"
}
# Generate static HTML for at.syui.ai (CF Pages)
function ios-generate-static-html() {
# Generate bskyweb templates from html/ source
# html/ is the source of truth, bskyweb templates are generated
function ios-generate-bskyweb-templates() {
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🌐 Generating static HTML for at.syui.ai..."
echo "🌐 Generating bskyweb templates from html/..."
local html_src="$d/html/about/support"
local templates="$target_dir/bskyweb/templates"
local html_out="$d/html/about/support"
local static_out="$d/html/static"
local static_src="$d/html/static"
local static_out="$target_dir/bskyweb/static"
# Check if templates exist
if [ ! -d "$templates" ]; then
echo "⚠️ Templates not found, skipping static HTML generation"
# Check if html source exists
if [ ! -d "$html_src" ]; then
echo "⚠️ html/about/support not found, skipping template generation"
return 1
fi
# Create output directories
mkdir -p "$html_out"
# Create output directory
mkdir -p "$templates"
mkdir -p "$static_out"
# Convert templates to static HTML
# Replace {{ staticCDNHost }} with empty string (use relative paths)
for template in about-privacy.html about-license.html about-tos.html about-help.html about-app.html; do
if [ -f "$templates/$template" ]; then
local output_name="${template#about-}" # Remove 'about-' prefix
sed 's/{{ staticCDNHost }}//g' "$templates/$template" > "$html_out/$output_name"
# Convert html/ to bskyweb templates
# Add {{ staticCDNHost }} prefix to /static/ paths
for html_file in privacy.html license.html tos.html help.html app.html; do
if [ -f "$html_src/$html_file" ]; then
local template_name="about-${html_file}"
sed 's|href="/static/|href="{{ staticCDNHost }}/static/|g; s|src="/static/|src="{{ staticCDNHost }}/static/|g' \
"$html_src/$html_file" > "$templates/$template_name"
fi
done
# Copy static assets from ios/assets
local favicon_src="$d/ios/assets/favicons"
if [ -d "$favicon_src" ]; then
cp -f "$favicon_src/favicon.png" "$static_out/" 2>/dev/null
fi
if [ -f "$d/ios/assets/logo.png" ]; then
cp -f "$d/ios/assets/logo.png" "$static_out/app.png"
# Also generate about-app.html from index.html if exists
if [ -f "$d/html/index.html" ]; then
sed 's|href="/static/|href="{{ staticCDNHost }}/static/|g; s|src="/static/|src="{{ staticCDNHost }}/static/|g' \
"$d/html/index.html" > "$templates/about-app.html"
fi
# Use about-app.html as index.html (root page)
if [ -f "$templates/about-app.html" ]; then
sed 's/{{ staticCDNHost }}//g' "$templates/about-app.html" > "$d/html/index.html"
# Copy static assets
if [ -d "$static_src" ]; then
cp -f "$static_src/"* "$static_out/" 2>/dev/null
fi
echo "✅ Generated static HTML in $d/html/"
echo " - index.html (app info)"
echo " - about/support/privacy.html"
echo " - about/support/license.html"
echo "✅ Generated bskyweb templates"
echo " - about-privacy.html, about-tos.html, etc."
echo ""
}
@@ -272,7 +270,7 @@ case "$1" in
ios-patch-apply-all
ios-restore-build-placeholder
ios-copy-new-files
ios-generate-static-html
ios-generate-bskyweb-templates
show-failed-patches
exit
;;
@@ -281,8 +279,8 @@ case "$1" in
exit
;;
html)
# Generate static HTML only (requires patches to be applied first)
ios-generate-static-html
# Generate bskyweb templates only (requires patches to be applied first)
ios-generate-bskyweb-templates
exit
;;
*)
@@ -291,7 +289,7 @@ case "$1" in
ios-patch-apply-all
ios-restore-build-placeholder
ios-copy-new-files
ios-generate-static-html
ios-generate-bskyweb-templates
show-failed-patches
;;
esac