fix install.zsh
This commit is contained in:
122
install.zsh
122
install.zsh
@ -1,7 +1,7 @@
|
||||
#!/bin/zsh
|
||||
|
||||
# ./install.zsh $HOST
|
||||
repos_v='{}'
|
||||
|
||||
function at-repos-env() {
|
||||
host=$1
|
||||
if [ -z "$1" ];then
|
||||
@ -15,8 +15,6 @@ function at-repos-env() {
|
||||
https://github.com/bluesky-social/atproto
|
||||
https://github.com/bluesky-social/social-app
|
||||
https://github.com/bluesky-social/feed-generator
|
||||
https://github.com/bluesky-social/ozone
|
||||
https://github.com/bluesky-social/jetstream
|
||||
)
|
||||
d=${0:a:h}
|
||||
dh=${0:a:h:h}
|
||||
@ -26,7 +24,19 @@ function at-repos-env() {
|
||||
|
||||
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:plc:6qyecktefllvenje24fcxnie\",
|
||||
\"didDoc\": {
|
||||
\"service\": [
|
||||
{
|
||||
\"serviceEndpoint\": \"https://syu.is\"
|
||||
}
|
||||
]
|
||||
},
|
||||
\"handle\": \"ai.syu.is\",
|
||||
\"accessJwt\": \"xxx\"
|
||||
}"
|
||||
|
||||
if [ ! -f "$f" ];then
|
||||
mkdir -p ~/.config/atproto
|
||||
echo $j >> $f
|
||||
@ -48,16 +58,16 @@ function at-repos-token() {
|
||||
}
|
||||
|
||||
function at-repos-clone() {
|
||||
if [ ! -d $d/repos ];then
|
||||
mkdir -p $d/repos
|
||||
fi
|
||||
cd $d/repos
|
||||
for ((i=1; i<=${#repos}; i++)); do
|
||||
repo=${repos[$i]}
|
||||
echo $repo
|
||||
if [ -d $d/repos/${repo##*/} ] && [ "${repo##*/}" = "social-app" ];then
|
||||
rm -rf $d/repos/${repo##*/}
|
||||
fi
|
||||
if [ ! -d $d/repos/${repo##*/} ];then
|
||||
git clone $repo
|
||||
|
||||
fi
|
||||
done
|
||||
if [ ! -f $d/repos/feed-generator/Dockerfile ] && [ -f $d/docker/feed/Dockerfile ];then
|
||||
@ -73,16 +83,11 @@ function at-repos-pull() {
|
||||
if [ -d $d/repos/${repo##*/} ];then
|
||||
cd $d/repos/${repo##*/}
|
||||
if ! git pull;then
|
||||
cd $d/repos
|
||||
rm -rf $d/repos/${repo##*/}
|
||||
at-repos-clone
|
||||
fi
|
||||
fi
|
||||
rv=$(echo "$repos_v" | jq -r ".[\"${repo##*/}\"]")
|
||||
if [ "$rv" != "null" ];then
|
||||
cd $d/repos/${repo##*/}
|
||||
git reset --hard $rv
|
||||
cd ..
|
||||
fi
|
||||
done
|
||||
cd $d
|
||||
}
|
||||
@ -100,25 +105,43 @@ function at-repos-social-app-icon-origin() {
|
||||
}
|
||||
|
||||
function at-repos-social-app-write() {
|
||||
did_admin=did:plc:6qyecktefllvenje24fcxnie
|
||||
did_admin=did:plc:z72i7hdynmk6r22z27h6tvur
|
||||
|
||||
dt=$d/repos/social-app/src
|
||||
cd $dt
|
||||
grep -R syu.is .|cut -d : -f 1|sort -u|xargs sed -i "s/syu.is/${host}/g"
|
||||
grep -R web.syu.is .|cut -d : -f 1|sort -u|xargs sed -i "s/web.syu.is/web.${host}/g"
|
||||
|
||||
f=$dt/lib/constants.ts
|
||||
sed -i "s/public.api.web/bsky/g" $f
|
||||
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
|
||||
|
||||
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"
|
||||
|
||||
f=$dt/lib/statsig/statsig.tsx
|
||||
sed -i "s/events.${host}/events.bsky.app/g" $f
|
||||
|
||||
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"
|
||||
|
||||
f=$dt/view/icons/Logotype.tsx
|
||||
o=$d/icons/Logotype.tsx
|
||||
cp -rf $o $f
|
||||
|
||||
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.web.syu.is/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/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#source={{uri: avatar}}#source={{ uri: hackModifyThumbnailPath(avatar, 1 > 0), }}#g" $f
|
||||
curl -sL https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/src/lib/strings/url-helpers.ts -o $dt/lib/strings/url-helpers.ts
|
||||
sed -i "s#https://go.web.syu.is/redirect?u=\${encodeURIComponent(url)}#\${url}#g" $dt/lib/strings/url-helpers.ts
|
||||
grep -R $did_admin .|cut -d : -f 1|sort -u|xargs sed -i "s/${did_admin}/${did}/g"
|
||||
}
|
||||
|
||||
@ -126,58 +149,19 @@ function at-repos-bsky-patch() {
|
||||
f=$d/repos/atproto/services/bsky/api.js
|
||||
curl -sL https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/services/bsky/api.js -o $f
|
||||
d_=$d/repos/atproto
|
||||
p_=$d/patching/105-atproto-services-for-docker.diff
|
||||
cd ${d_}
|
||||
if [ ! -f ${p_} ];then
|
||||
p_=$d_/105-atproto-services-for-docker.diff
|
||||
cd $d_
|
||||
# https://github.com/itaru2622/bluesky-selfhost-env/blob/master/patching/105-atproto-services-for-docker.diff
|
||||
echo download patch: https://github.com/itaru2622/bluesky-selfhost-env/blob/master/patching/105-atproto-services-for-docker.diff
|
||||
curl -sL https://raw.githubusercontent.com/itaru2622/bluesky-selfhost-env/refs/heads/master/patching/105-atproto-services-for-docker.diff -o ${p_}
|
||||
else
|
||||
echo local patch
|
||||
fi
|
||||
echo "applying patch: under ${f} for ${p_}"
|
||||
pushd ${d_}
|
||||
patch -p1 < ${p_}
|
||||
popd
|
||||
}
|
||||
|
||||
function at-repos-social-app-patch() {
|
||||
f=$d/repos/social-app/Dockerfile
|
||||
p_=$d/patching/social-app-dockerfile.diff
|
||||
d_=$d/repos/social-app
|
||||
cd ${d_}
|
||||
curl -sLO https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/Dockerfile
|
||||
echo "applying patch: under ${f} for ${p_}"
|
||||
pushd ${d_}
|
||||
patch -p1 < ${p_}
|
||||
popd
|
||||
}
|
||||
|
||||
function at-repos-ozone-patch() {
|
||||
#DOMAIN=syu.is
|
||||
cd $d/repos
|
||||
d_=$d/repos/ozone
|
||||
rm -rf ${d_}
|
||||
p_=$d/patching/120-ozone-runtimeEnvVars.diff
|
||||
git clone https://github.com/bluesky-social/ozone
|
||||
cd ${d_}
|
||||
pushd ${d_}
|
||||
echo "applying patch: under ${d_} for ${p_}"
|
||||
patch -p1 < ${p_}
|
||||
popd
|
||||
|
||||
p_=$d/patching/122-ozone-enable-daemon.diff
|
||||
curl -sLO https://raw.githubusercontent.com/itaru2622/bluesky-selfhost-env/refs/heads/master/patching/105-atproto-services-for-docker.diff
|
||||
echo "applying patch: under ${d_} for ${p_}"
|
||||
pushd ${d_}
|
||||
patch -p1 < ${p_}
|
||||
popd
|
||||
|
||||
#cp -rf $d/repos/atproto/service/ozone/* $d/ozone/service/
|
||||
}
|
||||
|
||||
function at-repos-docker() {
|
||||
cd $d
|
||||
docker compose build && docker compose up -d
|
||||
docker compose build $1 && docker compose up -d
|
||||
}
|
||||
|
||||
at-repos-env
|
||||
@ -187,15 +171,5 @@ at-repos-social-app-icon
|
||||
at-repos-social-app-icon-origin
|
||||
at-repos-social-app-write
|
||||
at-repos-bsky-patch
|
||||
at-repos-social-app-patch
|
||||
at-repos-ozone-patch
|
||||
|
||||
at-repos-docker
|
||||
#echo "[y]docker compose build && up"
|
||||
#read key
|
||||
#case $key in
|
||||
# [yY])
|
||||
# at-repos-docker
|
||||
# ;;
|
||||
#esac
|
||||
at-repos-docker $1
|
||||
|
||||
|
@ -15,7 +15,7 @@ function at-env() {
|
||||
collection=`echo $at_uri|cut -d / -f 4`
|
||||
rkey=`echo $at_uri|cut -d / -f 5`
|
||||
d=${0:a:h}
|
||||
f=~/.config/ai/token.json
|
||||
f=~/.config/syui/ai/bot/token.json
|
||||
if [ -f $f ];then
|
||||
host=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"|cut -d / -f 3`
|
||||
token=`cat $f|jq -r .accessJwt`
|
||||
|
Reference in New Issue
Block a user