add bgs patch
This commit is contained in:
35
install.zsh
35
install.zsh
@@ -21,6 +21,11 @@ function at-repos-env() {
|
|||||||
"ozone"
|
"ozone"
|
||||||
"social-app"
|
"social-app"
|
||||||
)
|
)
|
||||||
|
handles=(
|
||||||
|
"syui.syui.ai"
|
||||||
|
"ai.syui.ai"
|
||||||
|
"apple.syu.is"
|
||||||
|
)
|
||||||
d=${0:a:h}
|
d=${0:a:h}
|
||||||
dh=${0:a:h:h}
|
dh=${0:a:h:h}
|
||||||
name=${host%%.*}
|
name=${host%%.*}
|
||||||
@@ -45,6 +50,7 @@ PATCH_FILES=(
|
|||||||
"disable-statsig-sdk.diff"
|
"disable-statsig-sdk.diff"
|
||||||
"140-social-app-yarn-network-timeout.patch"
|
"140-social-app-yarn-network-timeout.patch"
|
||||||
"130-atproto-ozone-enable-daemon-v2.patch"
|
"130-atproto-ozone-enable-daemon-v2.patch"
|
||||||
|
"190-bgs-disable-ratelimit.patch"
|
||||||
)
|
)
|
||||||
|
|
||||||
function at-repos-clone() {
|
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"
|
grep -R $did_admin .|cut -d : -f 1|sort -u|xargs sed -i "s/${did_admin}/${did}/g"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Common patch function with status detection
|
# Common patch function with status detection
|
||||||
function apply-patch() {
|
function apply-patch() {
|
||||||
local patch_name=$1
|
local patch_name=$1
|
||||||
@@ -240,6 +247,8 @@ function at-repos-patch-apply-all() {
|
|||||||
repo="atproto"
|
repo="atproto"
|
||||||
elif [[ $filename == *"pds"* ]]; then
|
elif [[ $filename == *"pds"* ]]; then
|
||||||
repo="atproto"
|
repo="atproto"
|
||||||
|
elif [[ $filename == *"indigo"* || $filename == *"bgs"* ]]; then
|
||||||
|
repo="indigo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
patch-apply "$title" "$repo" "$filename"
|
patch-apply "$title" "$repo" "$filename"
|
||||||
@@ -345,6 +354,28 @@ function at-repos-pull-docker() {
|
|||||||
docker compose up -d --pull always
|
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
|
at-repos-env
|
||||||
case "$1" in
|
case "$1" in
|
||||||
pull)
|
pull)
|
||||||
@@ -379,6 +410,10 @@ esac
|
|||||||
|
|
||||||
case "`cat /etc/hostname`" in
|
case "`cat /etc/hostname`" in
|
||||||
at)
|
at)
|
||||||
|
if [ "$1" = "reset-bgs-db" ];then
|
||||||
|
at-repos-reset-bgs-db
|
||||||
|
exit
|
||||||
|
fi
|
||||||
at-repos-pull-docker
|
at-repos-pull-docker
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
|
|||||||
12
patching/190-bgs-disable-ratelimit.patch
Normal file
12
patching/190-bgs-disable-ratelimit.patch
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
diff --git a/bgs/fedmgr.go b/bgs/fedmgr.go
|
||||||
|
index 2235c6e..e69de29 100644
|
||||||
|
--- a/bgs/fedmgr.go
|
||||||
|
+++ b/bgs/fedmgr.go
|
||||||
|
@@ -342,6 +342,7 @@ var ErrNewSubsDisabled = fmt.Errorf("new subscriptions temporarily disabled")
|
||||||
|
// Checks whether a host is allowed to be subscribed to
|
||||||
|
// must be called with the slurper lock held
|
||||||
|
func (s *Slurper) canSlurpHost(host string) bool {
|
||||||
|
+ return true
|
||||||
|
// Check if we're over the limit for new PDSs today
|
||||||
|
if !s.NewPDSPerDayLimiter.Allow() {
|
||||||
|
return false
|
||||||
Reference in New Issue
Block a user