update scpt
This commit is contained in:
parent
f26ef781f3
commit
b5e44947da
15
README.md
15
README.md
@ -1,11 +1,16 @@
|
||||
# atproto
|
||||
# at
|
||||
|
||||
https://github.com/bluesky-social/atproto
|
||||
|
||||
- @
|
||||
- [at]mosphere
|
||||
- at://proto
|
||||
- at protocol
|
||||
|word|name|example|
|
||||
|---|---|---|
|
||||
|at|uri|at://ai.syu.is|
|
||||
|@|user|@ai.syu.is|
|
||||
|[at]proto|repo|`git@github.com:bluesky-social/atproto`|
|
||||
|[at]mosphere|system|pds, bsky(appview), ozone, bgs, plc|
|
||||
|[a]uthenticated [t]ransfer|protocol|[did](https://www.w3.org/TR/did-core/)|
|
||||
|
||||
- https://atproto.com/ja/guides/glossary
|
||||
|
||||
## account
|
||||
|
||||
|
30
build.sh
30
build.sh
@ -1,30 +0,0 @@
|
||||
#!/bin/zsh
|
||||
|
||||
d=${0:a:h}
|
||||
cd $d/repos
|
||||
|
||||
t="
|
||||
https://github.com/bluesky-social/atproto
|
||||
https://github.com/did-method-plc/did-method-plc
|
||||
https://github.com/bluesky-social/feed-generator
|
||||
https://github.com/bluesky-social/social-app
|
||||
https://github.com/bluesky-social/cookbook
|
||||
https://github.com/itaru2622/bluesky-selfhost-env
|
||||
"
|
||||
|
||||
t=`echo $t|grep -v '^$'`
|
||||
n=`echo $t|wc -l`
|
||||
|
||||
for ((i=1;i<=$n;i++))
|
||||
do
|
||||
tt=`echo $t|awk "NR==$i"`
|
||||
dd=$d/repos/$tt:t
|
||||
if [ -d $dd ];then
|
||||
echo ok
|
||||
cd $dd
|
||||
git pull
|
||||
cd $d/repos
|
||||
else
|
||||
git clone $tt
|
||||
fi
|
||||
done
|
@ -24,18 +24,6 @@ services:
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
pds-fix-permission:
|
||||
image: alpine:latest
|
||||
volumes:
|
||||
- ./data/pds/:/data/
|
||||
command: chown 1000.1000 /data
|
||||
|
||||
bsky-fix-permission:
|
||||
image: alpine:latest
|
||||
volumes:
|
||||
- ./data/bsky/:/data/
|
||||
command: chown 1000.1000 /data
|
||||
|
||||
plc:
|
||||
ports:
|
||||
- 2582:3000
|
||||
@ -52,8 +40,6 @@ services:
|
||||
pds:
|
||||
ports:
|
||||
- 2583:3000
|
||||
#image: itaru2622/bluesky-atproto-pds
|
||||
#image: ghcr.io/bluesky-social/pds:latest
|
||||
build:
|
||||
context: ./repos/atproto/
|
||||
dockerfile: services/pds/Dockerfile
|
||||
@ -65,8 +51,6 @@ services:
|
||||
depends_on:
|
||||
database:
|
||||
condition: service_healthy
|
||||
pds-fix-permission:
|
||||
condition: service_completed_successfully
|
||||
|
||||
bgs:
|
||||
ports:
|
||||
@ -121,7 +105,6 @@ services:
|
||||
social-app:
|
||||
ports:
|
||||
- 8100:8100
|
||||
#image: itaru2622/bluesky-social-app
|
||||
build:
|
||||
context: ./repos/social-app/
|
||||
dockerfile: Dockerfile
|
||||
@ -133,34 +116,18 @@ services:
|
||||
bsky:
|
||||
ports:
|
||||
- 2584:2584
|
||||
image: itaru2622/bluesky-atproto-bsky
|
||||
#build:
|
||||
# context: ./repos/atproto/
|
||||
# dockerfile: services/bsky/Dockerfile
|
||||
build:
|
||||
context: ./repos/atproto/
|
||||
dockerfile: services/bsky/Dockerfile
|
||||
restart: always
|
||||
env_file:
|
||||
- ./envs/bsky
|
||||
user: root
|
||||
volumes:
|
||||
- ./data/bsky/:/data/
|
||||
# - ./repos/bsky.js:/app/services/bsky/api.js:ro
|
||||
command: node --enable-source-maps api.js
|
||||
depends_on:
|
||||
database:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
bsky-fix-permission:
|
||||
condition: service_completed_successfully
|
||||
|
||||
feed:
|
||||
ports:
|
||||
- 2586:2586
|
||||
build:
|
||||
context: ./repos/feed-generator/
|
||||
restart: always
|
||||
env_file:
|
||||
- ./envs/feed
|
||||
volumes:
|
||||
- ./data/feed/:/data/
|
||||
|
147
install.zsh
Executable file
147
install.zsh
Executable file
@ -0,0 +1,147 @@
|
||||
#!/bin/zsh
|
||||
|
||||
# ./install.zsh $HOST
|
||||
|
||||
function at-repos-env() {
|
||||
host=$1
|
||||
if [ -z "$1" ];then
|
||||
host=syu.is
|
||||
fi
|
||||
did=did:plc:6qyecktefllvenje24fcxnie
|
||||
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}
|
||||
name=${host%%.*}
|
||||
domain=${host##*.}
|
||||
}
|
||||
|
||||
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\" }"
|
||||
if [ ! -f "$f" ];then
|
||||
mkdir -p ~/.config/atproto
|
||||
echo $j >> $f
|
||||
fi
|
||||
echo $f
|
||||
}
|
||||
|
||||
function at-repos-token() {
|
||||
at-repos-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() {
|
||||
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##*/} ];then
|
||||
git clone $repo
|
||||
fi
|
||||
done
|
||||
if [ ! -f $d/repos/feed-generator/Dockerfile ] && [ -f $d/docker/feed/Dockerfile ];then
|
||||
cp -rf $d/docker/feed/Dockerfile $d/repos/feed-generator/
|
||||
fi
|
||||
}
|
||||
|
||||
function at-repos-pull() {
|
||||
cd $d/repos
|
||||
for ((i=1; i<=${#repos}; i++)); do
|
||||
repo=${repos[$i]}
|
||||
echo $repo
|
||||
if [ -d $d/repos/${repo##*/} ];then
|
||||
cd $d/repos/${repo##*/}
|
||||
if ! git pull;then
|
||||
rm -rf $d/repos/${repo##*/}
|
||||
at-repos-clone
|
||||
fi
|
||||
fi
|
||||
done
|
||||
cd $d
|
||||
}
|
||||
|
||||
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
|
||||
if [ -d $d/icons ];then
|
||||
mkdir -p $d/icons
|
||||
fi
|
||||
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
|
||||
|
||||
dt=$d/repos/social-app/src
|
||||
cd $dt
|
||||
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.${host}/g"
|
||||
f=$dt/lib/constants.ts
|
||||
sed -i "s/public.api.web/bsky/g" $f
|
||||
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.bsky.app/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
|
||||
grep -R $did_admin .|cut -d : -f 1|sort -u|xargs sed -i "s/${did_admin}/${did}/g"
|
||||
}
|
||||
|
||||
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_/105-atproto-services-for-docker.diff
|
||||
cd $d_
|
||||
# https://github.com/itaru2622/bluesky-selfhost-env/blob/master/patching/105-atproto-services-for-docker.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
|
||||
}
|
||||
|
||||
function at-repos-docker() {
|
||||
cd $d
|
||||
sudo docker compose build && sudo docker compose up -d
|
||||
}
|
||||
|
||||
at-repos-env
|
||||
at-repos-clone
|
||||
at-repos-pull
|
||||
at-repos-social-app-icon
|
||||
at-repos-social-app-icon-origin
|
||||
at-repos-social-app-write
|
||||
at-repos-bsky-patch
|
||||
|
||||
echo "[y]docker compose build && up"
|
||||
read key
|
||||
case $key in
|
||||
[yY])
|
||||
at-repos-docker
|
||||
;;
|
||||
esac
|
@ -1 +0,0 @@
|
||||
Subproject commit 8f2b80a0dcf118652452ea09764a947b09991e0f
|
@ -1 +0,0 @@
|
||||
Subproject commit 3e384e3b58b8284c68e9562d16920867f8905340
|
@ -1 +0,0 @@
|
||||
Subproject commit 03739f5268d5915e0dc7e8815723575f4b457bda
|
@ -1 +0,0 @@
|
||||
Subproject commit 13da315787e50bd79548d5b695f4f597b43b4015
|
@ -1 +0,0 @@
|
||||
Subproject commit 9a887dd8f2ee634c5e524cfa802f754878a91e5a
|
@ -1 +0,0 @@
|
||||
Subproject commit f6649e22a762fa8f4d3060da0a274f3b83ecb06f
|
@ -8,7 +8,7 @@ source $d/src/func.zsh
|
||||
at-env
|
||||
case $1 in
|
||||
version|v)
|
||||
at-version
|
||||
at-version $2
|
||||
;;
|
||||
uri|u)
|
||||
at-uri $2
|
||||
|
@ -1,5 +1,5 @@
|
||||
function at-env() {
|
||||
host=bsky.social
|
||||
host=https://bsky.social
|
||||
handle_syui=syui.ai
|
||||
handle_yui=yui.syui.ai
|
||||
did_yui=did:plc:4hqjfn7m6n5hno3doamuhgef
|
||||
@ -15,6 +15,7 @@ function at-env() {
|
||||
d=${0:a:h}
|
||||
f=~/.config/.at-zsh.json
|
||||
if [ -f $f ];then
|
||||
host=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"`
|
||||
token=`cat $f|jq -r .accessJwt`
|
||||
did=`cat $f|jq -r .did`
|
||||
handle=`cat $f|jq -r .handle`
|
||||
@ -26,8 +27,45 @@ function at-unset() {
|
||||
unset t password token refresh
|
||||
}
|
||||
|
||||
function at-version-env() {
|
||||
case $1 in
|
||||
bsky)
|
||||
tag=$1
|
||||
list=( public.api.bsky.app bsky.syu.is )
|
||||
;;
|
||||
ozone)
|
||||
tag=$1
|
||||
list=( ozone.bsky.social ozone.syu.is )
|
||||
;;
|
||||
*)
|
||||
tag=pds
|
||||
list=( bsky.social syu.is boobee.blue socl.is )
|
||||
;;
|
||||
esac
|
||||
title="atproto $tag version"
|
||||
latest=https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/packages/$tag/package.json
|
||||
|
||||
# bgs=( bsky.network bgs.syu.is )
|
||||
# plc=( plc.directory plc.syu.is )
|
||||
}
|
||||
|
||||
function at-version-json() {
|
||||
latest=`curl -sL $latest |jq -r .version`
|
||||
echo "[{\"title\":\"$title\",\"latest\":\"$latest\"},["
|
||||
e=${list[@]: -1}
|
||||
for i in $list; do
|
||||
t=`curl -sL ${i}/xrpc/_health |jq -r .version`
|
||||
echo "{\"$i\":\"$t\"}"
|
||||
if [ "$e" != "$i" ];then
|
||||
echo ,
|
||||
fi
|
||||
done
|
||||
echo "]]"
|
||||
}
|
||||
|
||||
function at-version() {
|
||||
curl -sL ${host}/xrpc/_health |jq .
|
||||
at-version-env $1
|
||||
at-version-json |jq .
|
||||
}
|
||||
|
||||
function at-uri() {
|
||||
@ -98,7 +136,7 @@ function at-refresh() {
|
||||
echo $f
|
||||
token=`cat $f|jq -r .refreshJwt`
|
||||
req=/xrpc/com.atproto.server.refreshSession
|
||||
url=https://${host}${req}
|
||||
url=${host}${req}
|
||||
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url`
|
||||
if echo $t |jq .;then
|
||||
echo $t >! $f
|
||||
@ -109,13 +147,13 @@ function at-cid() {
|
||||
did=`at-did $1|jq -r .did`
|
||||
cid=$2
|
||||
req=/xrpc/com.atproto.sync.getBlob
|
||||
url="https://${host}${req}?did=${did}&cid=${cid}"
|
||||
url="${host}${req}?did=${did}&cid=${cid}"
|
||||
curl -sL $url
|
||||
}
|
||||
|
||||
function at-session() {
|
||||
req=/xrpc/com.atproto.server.getSession
|
||||
url=https://${host}${req}
|
||||
url=${host}${req}
|
||||
t=`curl -sL -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url`
|
||||
if ! echo $t |jq .;then
|
||||
echo refresh
|
||||
@ -131,6 +169,6 @@ function at-profile() {
|
||||
t=`at-session`
|
||||
fi
|
||||
req=/xrpc/app.bsky.actor.getProfile
|
||||
url="https://${host}${req}?actor=$did"
|
||||
url="${host}${req}?actor=$did"
|
||||
curl -sL -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url|jq .
|
||||
}
|
||||
|
@ -37,3 +37,4 @@ github=(
|
||||
https://github.com/did-method-plc/did-method-plc
|
||||
)
|
||||
tag=( at bsky bsync pds bgs plc ozone feed jetstream social-app oauth )
|
||||
#pds_list=(bsky.social syu.is boobee.blue socl.is )
|
||||
|
Loading…
x
Reference in New Issue
Block a user