fix install.zsh
This commit is contained in:
67
install.zsh
67
install.zsh
@@ -1,11 +1,11 @@
|
||||
#!/bin/zsh
|
||||
|
||||
# ./install.zsh $HOST
|
||||
# ./install.zsh $pds
|
||||
|
||||
function at-repos-env() {
|
||||
host=$1
|
||||
pds=$1
|
||||
if [ -z "$1" ];then
|
||||
host=syu.is
|
||||
pds=syu.is
|
||||
fi
|
||||
did=did:plc:6qyecktefllvenje24fcxnie
|
||||
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}
|
||||
dh=${0:a:h:h}
|
||||
name=${host%%.*}
|
||||
domain=${host##*.}
|
||||
name=${pds%%.*}
|
||||
domain=${pds##*.}
|
||||
}
|
||||
|
||||
function at-repos-json() {
|
||||
f=~/.config/atproto/token.json
|
||||
j="{
|
||||
\"did\": \"did:plc:6qyecktefllvenje24fcxnie\",
|
||||
\"didDoc\": {
|
||||
\"service\": [
|
||||
{
|
||||
\"serviceEndpoint\": \"https://syu.is\"
|
||||
}
|
||||
]
|
||||
},
|
||||
\"handle\": \"ai.syu.is\",
|
||||
\"accessJwt\": \"xxx\"
|
||||
}"
|
||||
|
||||
j="{ \"did\": \"${did}\", \"didDoc\": { \"service\": [ { \"serviceEndpoint\": \"https://${pds}\" } ] }, \"handle\": \"ai.${pds}\", \"accessJwt\": \"xxx\" }"
|
||||
if [ ! -f "$f" ];then
|
||||
mkdir -p ~/.config/atproto
|
||||
echo $j >> $f
|
||||
@@ -46,15 +34,15 @@ function at-repos-json() {
|
||||
|
||||
function at-repos-token() {
|
||||
at-repos-json
|
||||
if [ -z "$host" ] && [ -f $f ];then
|
||||
host=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"`
|
||||
if [ -z "$pds" ] && [ -f $f ];then
|
||||
pds=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"`
|
||||
handle=`cat $f|jq -r ".handle"`
|
||||
did=`cat $f|jq -r ".did"`
|
||||
token=`cat $f|jq -r ".token"`
|
||||
host=${host##*/}
|
||||
pds=${pds##*/}
|
||||
fi
|
||||
name=${host%%.*}
|
||||
domain=${host##*.}
|
||||
name=${pds%%.*}
|
||||
domain=${pds##*.}
|
||||
}
|
||||
|
||||
function at-repos-clone() {
|
||||
@@ -114,23 +102,23 @@ function at-repos-social-app-write() {
|
||||
sed -i "s/public.api/bsky/g" $f
|
||||
|
||||
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"
|
||||
grep -R bsky.social .|cut -d : -f 1|sort -u|xargs sed -i "s/bsky.social/${host}/g"
|
||||
grep -R bsky.app .|cut -d : -f 1|sort -u|xargs sed -i "s/bsky.app/${host}/g"
|
||||
t=(api.bsky.app bsky.social bsky.app)
|
||||
for tt in "${t[@]}"; do
|
||||
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
|
||||
sed -i "s/events.${host}/events.bsky.app/g" $f
|
||||
t=(api public.api public.bsky)
|
||||
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
|
||||
sed -i "s/cardyb.${host}/cardyb.bsky.app/g" $f
|
||||
sed -i "s/status.${host}/status.bsky.app/g" $f
|
||||
|
||||
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"
|
||||
t=(cardyb events status)
|
||||
for tt in "${t[@]}"; do
|
||||
grep -R "${tt}\.${pds}" . | cut -d : -f 1 | sort -u | xargs -r sed -i "s/${tt}\.${pds}/${tt}.bsky.app/g"
|
||||
done
|
||||
|
||||
f=$dt/view/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
|
||||
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.${host}/img/avatar/plain/#g" $f
|
||||
sed -i "s#/img/avatar_thumbnail/plain/#https://bsky.${host}/img/avatar/plain/#g" $f
|
||||
sed -i "s#/img/avatar/plain/#https://bsky.${pds}/img/avatar/plain/#g" $f
|
||||
sed -i "s#/img/avatar_thumbnail/plain/#https://bsky.${pds}/img/avatar/plain/#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"
|
||||
}
|
||||
|
Reference in New Issue
Block a user