ai/at
1
0

fix install.zsh

This commit is contained in:
2025-06-27 22:59:42 +09:00
parent dabd3f11f1
commit 2144de098c

View File

@@ -1,11 +1,11 @@
#!/bin/zsh #!/bin/zsh
# ./install.zsh $HOST # ./install.zsh $pds
function at-repos-env() { function at-repos-env() {
host=$1 pds=$1
if [ -z "$1" ];then if [ -z "$1" ];then
host=syu.is pds=syu.is
fi fi
did=did:plc:6qyecktefllvenje24fcxnie did=did:plc:6qyecktefllvenje24fcxnie
icon=https://git.syui.ai/ai/at/raw/branch/main/icons/Logotype.tsx icon=https://git.syui.ai/ai/at/raw/branch/main/icons/Logotype.tsx
@@ -18,25 +18,13 @@ function at-repos-env() {
) )
d=${0:a:h} d=${0:a:h}
dh=${0:a:h:h} dh=${0:a:h:h}
name=${host%%.*} name=${pds%%.*}
domain=${host##*.} domain=${pds##*.}
} }
function at-repos-json() { function at-repos-json() {
f=~/.config/atproto/token.json f=~/.config/atproto/token.json
j="{ j="{ \"did\": \"${did}\", \"didDoc\": { \"service\": [ { \"serviceEndpoint\": \"https://${pds}\" } ] }, \"handle\": \"ai.${pds}\", \"accessJwt\": \"xxx\" }"
\"did\": \"did:plc:6qyecktefllvenje24fcxnie\",
\"didDoc\": {
\"service\": [
{
\"serviceEndpoint\": \"https://syu.is\"
}
]
},
\"handle\": \"ai.syu.is\",
\"accessJwt\": \"xxx\"
}"
if [ ! -f "$f" ];then if [ ! -f "$f" ];then
mkdir -p ~/.config/atproto mkdir -p ~/.config/atproto
echo $j >> $f echo $j >> $f
@@ -46,15 +34,15 @@ function at-repos-json() {
function at-repos-token() { function at-repos-token() {
at-repos-json at-repos-json
if [ -z "$host" ] && [ -f $f ];then if [ -z "$pds" ] && [ -f $f ];then
host=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"` pds=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"`
handle=`cat $f|jq -r ".handle"` handle=`cat $f|jq -r ".handle"`
did=`cat $f|jq -r ".did"` did=`cat $f|jq -r ".did"`
token=`cat $f|jq -r ".token"` token=`cat $f|jq -r ".token"`
host=${host##*/} pds=${pds##*/}
fi fi
name=${host%%.*} name=${pds%%.*}
domain=${host##*.} domain=${pds##*.}
} }
function at-repos-clone() { function at-repos-clone() {
@@ -114,23 +102,23 @@ function at-repos-social-app-write() {
sed -i "s/public.api/bsky/g" $f sed -i "s/public.api/bsky/g" $f
f=$dt/lib/strings/url-helpers.ts f=$dt/lib/strings/url-helpers.ts
sed -i "s#https://go.bsky.app/redirect?u=##g" $f sed -i 's#`https://go\.bsky\.app/redirect\?u=\${encodeURIComponent(url)}`#url#g' $f
grep -R api.bsky.app .|cut -d : -f 1|sort -u|xargs sed -i "s/api.bsky.app/bsky.${host}/g" t=(api.bsky.app bsky.social bsky.app)
grep -R bsky.social .|cut -d : -f 1|sort -u|xargs sed -i "s/bsky.social/${host}/g" for tt in "${t[@]}"; do
grep -R bsky.app .|cut -d : -f 1|sort -u|xargs sed -i "s/bsky.app/${host}/g" escaped_tt=$(echo "$tt" | sed 's/\./\\./g')
grep -R "$escaped_tt" . | cut -d : -f 1 | sort -u | xargs -r sed -i "s/${tt}/bsky.${pds}/g"
done
f=$dt/lib/statsig/statsig.tsx t=(api public.api public.bsky)
sed -i "s/events.${host}/events.bsky.app/g" $f for tt in "${t[@]}"; do
grep -R "${tt}\.${pds}" . | cut -d : -f 1 | sort -u | xargs -r sed -i "s/${tt}\.${pds}/bsky.${pds}/g"
done
f=$dt/lib/constants.ts t=(cardyb events status)
sed -i "s/cardyb.${host}/cardyb.bsky.app/g" $f for tt in "${t[@]}"; do
sed -i "s/status.${host}/status.bsky.app/g" $f grep -R "${tt}\.${pds}" . | cut -d : -f 1 | sort -u | xargs -r sed -i "s/${tt}\.${pds}/${tt}.bsky.app/g"
done
grep -R public.api.${host} .|cut -d : -f 1|sort -u|xargs sed -i "s/public.api.${host}/bsky.${host}/g"
grep -R api.${host} .|cut -d : -f 1|sort -u|xargs sed -i "s/api.${host}/bsky.${host}/g"
grep -R events.${host} .|cut -d : -f 1|sort -u|xargs sed -i "s/events.${host}/events.bsky.app/g"
grep -R public.bsky.${host} .|cut -d : -f 1|sort -u|xargs sed -i "s/public.bsky.${host}/bsky.${host}/g"
f=$dt/view/icons/Logotype.tsx f=$dt/view/icons/Logotype.tsx
o=$d/icons/Logotype.tsx o=$d/icons/Logotype.tsx
@@ -138,9 +126,8 @@ function at-repos-social-app-write() {
f=$dt/view/com/util/UserAvatar.tsx f=$dt/view/com/util/UserAvatar.tsx
curl -sL https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/src/view/com/util/UserAvatar.tsx -o $f curl -sL https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/src/view/com/util/UserAvatar.tsx -o $f
#sed -i "s#/img/avatar/plain/#https://cdn.bsky.app/img/avatar/plain/#g" $f sed -i "s#/img/avatar/plain/#https://bsky.${pds}/img/avatar/plain/#g" $f
sed -i "s#/img/avatar/plain/#https://bsky.${host}/img/avatar/plain/#g" $f sed -i "s#/img/avatar_thumbnail/plain/#https://bsky.${pds}/img/avatar/plain/#g" $f
sed -i "s#/img/avatar_thumbnail/plain/#https://bsky.${host}/img/avatar/plain/#g" $f
sed -i "s#source={{uri: avatar}}#source={{ uri: hackModifyThumbnailPath(avatar, 1 > 0), }}#g" $f sed -i "s#source={{uri: avatar}}#source={{ uri: hackModifyThumbnailPath(avatar, 1 > 0), }}#g" $f
grep -R $did_admin .|cut -d : -f 1|sort -u|xargs sed -i "s/${did_admin}/${did}/g" grep -R $did_admin .|cut -d : -f 1|sort -u|xargs sed -i "s/${did_admin}/${did}/g"
} }