ai/at
1
0

add bgs patch

This commit is contained in:
2025-12-06 15:09:39 +09:00
parent 9e284d1a18
commit cd9fe029c5
2 changed files with 47 additions and 0 deletions

View File

@@ -21,6 +21,11 @@ function at-repos-env() {
"ozone"
"social-app"
)
handles=(
"syui.syui.ai"
"ai.syui.ai"
"apple.syu.is"
)
d=${0:a:h}
dh=${0:a:h:h}
name=${host%%.*}
@@ -45,6 +50,7 @@ PATCH_FILES=(
"disable-statsig-sdk.diff"
"140-social-app-yarn-network-timeout.patch"
"130-atproto-ozone-enable-daemon-v2.patch"
"190-bgs-disable-ratelimit.patch"
)
function at-repos-clone() {
@@ -114,6 +120,7 @@ function at-repos-social-app-avatar-write() {
grep -R $did_admin .|cut -d : -f 1|sort -u|xargs sed -i "s/${did_admin}/${did}/g"
}
# Common patch function with status detection
function apply-patch() {
local patch_name=$1
@@ -240,6 +247,8 @@ function at-repos-patch-apply-all() {
repo="atproto"
elif [[ $filename == *"pds"* ]]; then
repo="atproto"
elif [[ $filename == *"indigo"* || $filename == *"bgs"* ]]; then
repo="indigo"
fi
patch-apply "$title" "$repo" "$filename"
@@ -345,6 +354,28 @@ function at-repos-pull-docker() {
docker compose up -d --pull always
}
function at-repos-reset-bgs-db() {
dp=at-database-1
BGS_ADMIN_KEY=`cat $d/envs/bgs | grep BGS_ADMIN_KEY | cut -d '=' -f 2`
docker compose down bgs
sudo rm -rf $d/data/bgs/*
docker exec -i $dp psql -U postgres -c "DROP DATABASE IF EXISTS bgs;"
docker exec -i $dp psql -U postgres -c "DROP DATABASE IF EXISTS carstore;"
docker exec -i $dp psql -U postgres -d bgs -c "UPDATE slurp_configs SET new_subs_disabled = false, new_pds_per_day_limit = 1000 WHERE id = 1;"
docker compose restart bgs
curl -X POST "https://bgs.${host}/admin/pds/addTrustedDomain?domain=${host}" \
-H "Authorization: Bearer ${BGS_ADMIN_KEY}"
for ((i=1; i<=${#handles}; i++)); do
handle=${handles[$i]}
did=`curl -sL "https://${host}/xrpc/com.atproto.repo.describeRepo?repo=${handle}" |jq -r .did`
curl -X POST "https://bgs.${host}/admin/repo/reset?did=${did}" \
-H "Authorization: Bearer ${BGS_ADMIN_KEY}"
done
}
at-repos-env
case "$1" in
pull)
@@ -379,6 +410,10 @@ esac
case "`cat /etc/hostname`" in
at)
if [ "$1" == "bgs-reset-db" ];then
at-repos-reset-bgs-db
exit
fi
at-repos-pull-docker
exit
;;