site/com: the .com pages from the design canvas, installed
Captain Bob, 2026-11-07: build the .com from the StarshipOS.com canvas.
canvas/ holds the artboards as drawn; build.py makes Main, Inquiries and
TryIt as {{html}} pages (the wiki's links and domains, the images as
attachments, the real console in Try it, the forms by e-mail); install.sh
puts them on the wiki and checks a guest's view. Installed on
starshipos-f18.com: every page and image reads 200 as a guest, and renders
without a macro error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
This commit is contained in:
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
# install.sh -- the starshipos-f18.com XWiki's pages, from the "StarshipOS.com" design canvas
|
||||
# (build.py makes them): Main.WebHome (Home), Inquiries.WebHome, TryIt.WebHome, and the two
|
||||
# images, attachments of Main.WebHome. All readable by everyone; the wiki's own rights decide the
|
||||
# rest. Through XWiki's REST API:
|
||||
#
|
||||
# XWIKI_USER=rajames XWIKI_PASSWORD=... site/com/install.sh [https://starshipos-f18.com]
|
||||
#
|
||||
# Run it again after build.py: pages and images are replaced. It ends by checking, without
|
||||
# logging in, that every page and image is there.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
base=${1:-https://starshipos-f18.com}
|
||||
rest="$base/rest/wikis/xwiki"
|
||||
user=${XWIKI_USER:?set XWIKI_USER}
|
||||
pass=${XWIKI_PASSWORD:?set XWIKI_PASSWORD}
|
||||
auth=(-u "$user:$pass")
|
||||
|
||||
page() { # page <space> <title> <file>: create or replace <space>.WebHome
|
||||
local body
|
||||
body=$(python3 -c '
|
||||
import sys
|
||||
from xml.sax.saxutils import escape
|
||||
print("<page xmlns=\"http://www.xwiki.org\"><title>%s</title><syntax>xwiki/2.1</syntax>"
|
||||
"<content>%s</content></page>" % (escape(sys.argv[1]), escape(open(sys.argv[2]).read())))' "$2" "$3")
|
||||
curl -fsS -o /dev/null -w " page $1.WebHome: %{http_code}\n" "${auth[@]}" -X PUT \
|
||||
-H 'Content-Type: application/xml' --data-binary "$body" "$rest/spaces/$1/pages/WebHome"
|
||||
}
|
||||
attach() { # attach <space> <file>: create or replace an attachment of <space>.WebHome
|
||||
curl -fsS -o /dev/null -w " attachment $1.WebHome/$2: %{http_code}\n" "${auth[@]}" -X PUT \
|
||||
-H 'Content-Type: image/jpeg' --data-binary "@$2" "$rest/spaces/$1/pages/WebHome/attachments/$2"
|
||||
}
|
||||
|
||||
echo "=== $base, as $user"
|
||||
page Main "StarshipOS" Main.WebHome.xwiki
|
||||
attach Main badge.jpg
|
||||
attach Main captain-bob.jpg
|
||||
page Inquiries "Inquiries" Inquiries.WebHome.xwiki
|
||||
page TryIt "Try StarshipOS" TryIt.WebHome.xwiki
|
||||
|
||||
echo "=== as a guest"
|
||||
bad=
|
||||
for u in /bin/view/Main/ /bin/view/Inquiries/ /bin/view/TryIt/ \
|
||||
/bin/download/Main/WebHome/badge.jpg /bin/download/Main/WebHome/captain-bob.jpg; do
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' "$base$u")
|
||||
if [ "$code" = 200 ]; then echo " $u: 200"; else echo " $u: $code -- NOT readable"; bad=1; fi
|
||||
done
|
||||
[ -z "$bad" ] || { echo "install: a guest cannot read everything; see above" >&2; exit 1; }
|
||||
echo "=== done: $base/bin/view/Main/"
|
||||
Reference in New Issue
Block a user