fix install.zsh
This commit is contained in:
parent
69a3df8320
commit
a93f08dcc6
99
install.zsh
99
install.zsh
@ -1,23 +1,34 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
d=${0:a:h}
|
function at-repos-env() {
|
||||||
|
|
||||||
repos=(
|
|
||||||
https://github.com/did-method-plc/did-method-plc
|
|
||||||
https://github.com/bluesky-social/indigo
|
|
||||||
https://github.com/bluesky-social/atproto
|
|
||||||
https://github.com/bluesky-social/social-app
|
|
||||||
https://github.com/bluesky-social/feed-generator
|
|
||||||
)
|
|
||||||
|
|
||||||
function run-env() {
|
|
||||||
host=syu.is
|
host=syu.is
|
||||||
name=${host%%.*}
|
did=did:plc:6qyecktefllvenje24fcxnie
|
||||||
domain=${host##*.}
|
icon=https://git.syui.ai/ai/at/raw/branch/main/icons/Logotype.tsx
|
||||||
|
repos=(
|
||||||
|
https://github.com/did-method-plc/did-method-plc
|
||||||
|
https://github.com/bluesky-social/indigo
|
||||||
|
https://github.com/bluesky-social/atproto
|
||||||
|
https://github.com/bluesky-social/social-app
|
||||||
|
https://github.com/bluesky-social/feed-generator
|
||||||
|
)
|
||||||
|
d=${0:a:h}
|
||||||
dh=${0:a:h:h}
|
dh=${0:a:h:h}
|
||||||
}
|
}
|
||||||
|
|
||||||
function run-dl() {
|
function at-repos-token() {
|
||||||
|
f=~/.config/atproto/token.json
|
||||||
|
if [ -z "$host" ] && [ -f $f ];then
|
||||||
|
host=`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##*/}
|
||||||
|
fi
|
||||||
|
name=${host%%.*}
|
||||||
|
domain=${host##*.}
|
||||||
|
}
|
||||||
|
|
||||||
|
function at-repos-clone() {
|
||||||
mkdir -p $d/repos
|
mkdir -p $d/repos
|
||||||
cd $d/repos
|
cd $d/repos
|
||||||
for ((i=1; i<=${#repos}; i++)); do
|
for ((i=1; i<=${#repos}; i++)); do
|
||||||
@ -27,37 +38,49 @@ function run-dl() {
|
|||||||
git clone $repo
|
git clone $repo
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ! -f $d/repos/feed-generator/Dockerfile ];then
|
if [ ! -f $d/repos/feed-generator/Dockerfile ] && [ -f $d/docker/feed/Dockerfile ];then
|
||||||
cp -rf $d/docker/feed/Dockerfile $d/repos/feed-generator/
|
cp -rf $d/docker/feed/Dockerfile $d/repos/feed-generator/
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function run-update() {
|
function at-repos-pull() {
|
||||||
cd $d/repos
|
cd $d/repos
|
||||||
for ((i=1; i<=${#repos}; i++)); do
|
for ((i=1; i<=${#repos}; i++)); do
|
||||||
repo=${repos[$i]}
|
repo=${repos[$i]}
|
||||||
echo $repo
|
echo $repo
|
||||||
if [ -d $d/repos/${repo##*/} ];then
|
if [ -d $d/repos/${repo##*/} ];then
|
||||||
cd $d/repos/${repo##*/}
|
cd $d/repos/${repo##*/}
|
||||||
git pull
|
if ! git pull;then
|
||||||
|
cd $d/repos
|
||||||
|
rm -rf $d/repos/${repo##*/}
|
||||||
|
at-repos-clone
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
cd $d
|
cd $d
|
||||||
echo "docker compose build && docker compose up -d"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function run-dl-icon() {
|
function at-repos-social-app-icon() {
|
||||||
curl -sL https://raw.githubusercontent.com/bluesky-social/social-app/main/src/view/icons/Logotype.tsx -o $d/repos/social-app/src/view/icons/Logotype.tsx
|
curl -sL https://raw.githubusercontent.com/bluesky-social/social-app/main/src/view/icons/Logotype.tsx -o $d/repos/social-app/src/view/icons/Logotype.tsx
|
||||||
|
if [ -d $d/icons ];then
|
||||||
|
mkdir -p $d/icons
|
||||||
|
fi
|
||||||
cp -rf $d/repos/social-app/src/view/icons/Logotype.tsx $d/icons/
|
cp -rf $d/repos/social-app/src/view/icons/Logotype.tsx $d/icons/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function at-repos-social-app-icon-origin() {
|
||||||
|
curl -sL $icon -o $d/icons/Logotype.tsx
|
||||||
|
}
|
||||||
|
|
||||||
|
function at-repos-social-app-write() {
|
||||||
|
did_admin=did:plc:z72i7hdynmk6r22z27h6tvur
|
||||||
|
|
||||||
function web-write() {
|
|
||||||
dt=$d/repos/social-app/src
|
dt=$d/repos/social-app/src
|
||||||
cd $dt
|
cd $dt
|
||||||
grep -R bsky.social .|cut -d : -f 1|sort -u|xargs sed -i "s/bsky.social/syu.is/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/web.syu.is/g"
|
grep -R bsky.app .|cut -d : -f 1|sort -u|xargs sed -i "s/bsky.app/web.${host}/g"
|
||||||
grep -R public.api.syu.is ./lib/constants.ts | cut -d : -f 1|sort -u|xargs sed -i "s/public.api/bsky/g"
|
f=$dt/lib/constants.ts
|
||||||
|
sed -i "s/public.api.web/bsky/g" $f
|
||||||
f=$dt/view/icons/Logotype.tsx
|
f=$dt/view/icons/Logotype.tsx
|
||||||
o=$d/icons/Logotype.tsx
|
o=$d/icons/Logotype.tsx
|
||||||
cp -rf $o $f
|
cp -rf $o $f
|
||||||
@ -65,22 +88,26 @@ function web-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://cdn.bsky.app/img/avatar/plain/#g" $f
|
||||||
sed -i "s#/img/avatar_thumbnail/plain/#https://bsky.syu.is/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"
|
||||||
did_bskyadmin=did:plc:z72i7hdynmk6r22z27h6tvur
|
|
||||||
# curl -sL "syu.is/xrpc/com.atproto.repo.describeRepo?repo=ai.syu.is" |jq -r .did
|
|
||||||
did_ai=did:plc:6qyecktefllvenje24fcxnie
|
|
||||||
grep -R $did_bskyadmin .|cut -d : -f 1|sort -u|xargs sed -i "s/$did_bskyadmin/$did_ai/g"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
run-env
|
function at-repos-docker() {
|
||||||
run-dl
|
cd $d
|
||||||
|
docker compose build && docker compose up -d
|
||||||
|
}
|
||||||
|
|
||||||
|
at-repos-env
|
||||||
|
at-repos-token
|
||||||
|
at-repos-clone
|
||||||
|
at-repos-pull
|
||||||
|
at-repos-social-app-icon
|
||||||
|
at-repos-social-app-icon-origin
|
||||||
|
at-repos-social-app-write
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
update)
|
docker|d)
|
||||||
run-update
|
at-repos-docker
|
||||||
;;
|
|
||||||
web)
|
|
||||||
web-write
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user