update scpt
This commit is contained in:
		
							
								
								
									
										15
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,11 +1,16 @@ | |||||||
| # atproto | # at | ||||||
|  |  | ||||||
| https://github.com/bluesky-social/atproto | https://github.com/bluesky-social/atproto | ||||||
|  |  | ||||||
| - @ | |word|name|example| | ||||||
| - [at]mosphere | |---|---|---| | ||||||
| - at://proto | |at|uri|at://ai.syu.is| | ||||||
| - at protocol | |@|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 | ## 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 |       timeout: 5s | ||||||
|       retries: 5 |       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: |   plc: | ||||||
|     ports: |     ports: | ||||||
|       - 2582:3000 |       - 2582:3000 | ||||||
| @@ -52,8 +40,6 @@ services: | |||||||
|   pds: |   pds: | ||||||
|     ports: |     ports: | ||||||
|       - 2583:3000 |       - 2583:3000 | ||||||
|     #image: itaru2622/bluesky-atproto-pds |  | ||||||
|     #image: ghcr.io/bluesky-social/pds:latest |  | ||||||
|     build: |     build: | ||||||
|       context: ./repos/atproto/ |       context: ./repos/atproto/ | ||||||
|       dockerfile: services/pds/Dockerfile |       dockerfile: services/pds/Dockerfile | ||||||
| @@ -65,8 +51,6 @@ services: | |||||||
|     depends_on: |     depends_on: | ||||||
|       database: |       database: | ||||||
|         condition: service_healthy |         condition: service_healthy | ||||||
|       pds-fix-permission: |  | ||||||
|         condition: service_completed_successfully |  | ||||||
| 
 | 
 | ||||||
|   bgs: |   bgs: | ||||||
|     ports: |     ports: | ||||||
| @@ -121,7 +105,6 @@ services: | |||||||
|   social-app: |   social-app: | ||||||
|     ports: |     ports: | ||||||
|       - 8100:8100 |       - 8100:8100 | ||||||
|         #image: itaru2622/bluesky-social-app |  | ||||||
|     build: |     build: | ||||||
|       context: ./repos/social-app/ |       context: ./repos/social-app/ | ||||||
|       dockerfile: Dockerfile |       dockerfile: Dockerfile | ||||||
| @@ -133,34 +116,18 @@ services: | |||||||
|   bsky: |   bsky: | ||||||
|     ports: |     ports: | ||||||
|       - 2584:2584 |       - 2584:2584 | ||||||
|     image: itaru2622/bluesky-atproto-bsky |     build: | ||||||
|       #build: |       context: ./repos/atproto/ | ||||||
|       #  context: ./repos/atproto/ |       dockerfile: services/bsky/Dockerfile | ||||||
|       #  dockerfile: services/bsky/Dockerfile |  | ||||||
|     restart: always |     restart: always | ||||||
|     env_file: |     env_file: | ||||||
|       - ./envs/bsky |       - ./envs/bsky | ||||||
|     user: root |     user: root | ||||||
|     volumes: |     volumes: | ||||||
|       - ./data/bsky/:/data/ |       - ./data/bsky/:/data/ | ||||||
|         #      - ./repos/bsky.js:/app/services/bsky/api.js:ro |  | ||||||
|     command: node --enable-source-maps api.js |     command: node --enable-source-maps api.js | ||||||
|     depends_on: |     depends_on: | ||||||
|       database: |       database: | ||||||
|         condition: service_healthy |         condition: service_healthy | ||||||
|       redis: |       redis: | ||||||
|         condition: service_healthy |         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 | ||||||
 Submodule repos/atproto deleted from 8f2b80a0dc
									
								
							 Submodule repos/bluesky-selfhost-env deleted from 3e384e3b58
									
								
							 Submodule repos/cookbook deleted from 03739f5268
									
								
							 Submodule repos/did-method-plc deleted from 13da315787
									
								
							 Submodule repos/feed-generator deleted from 9a887dd8f2
									
								
							 Submodule repos/social-app deleted from f6649e22a7
									
								
							| @@ -8,7 +8,7 @@ source $d/src/func.zsh | |||||||
| at-env | at-env | ||||||
| case $1 in | case $1 in | ||||||
| 	version|v) | 	version|v) | ||||||
| 		at-version | 		at-version $2 | ||||||
| 		;; | 		;; | ||||||
| 	uri|u) | 	uri|u) | ||||||
| 		at-uri $2 | 		at-uri $2 | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| function at-env() { | function at-env() { | ||||||
| 	host=bsky.social | 	host=https://bsky.social | ||||||
| 	handle_syui=syui.ai | 	handle_syui=syui.ai | ||||||
| 	handle_yui=yui.syui.ai | 	handle_yui=yui.syui.ai | ||||||
| 	did_yui=did:plc:4hqjfn7m6n5hno3doamuhgef | 	did_yui=did:plc:4hqjfn7m6n5hno3doamuhgef | ||||||
| @@ -15,6 +15,7 @@ function at-env() { | |||||||
| 	d=${0:a:h} | 	d=${0:a:h} | ||||||
| 	f=~/.config/.at-zsh.json | 	f=~/.config/.at-zsh.json | ||||||
| 	if [ -f $f ];then | 	if [ -f $f ];then | ||||||
|  | 		host=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"` | ||||||
| 		token=`cat $f|jq -r .accessJwt` | 		token=`cat $f|jq -r .accessJwt` | ||||||
| 		did=`cat $f|jq -r .did` | 		did=`cat $f|jq -r .did` | ||||||
| 		handle=`cat $f|jq -r .handle` | 		handle=`cat $f|jq -r .handle` | ||||||
| @@ -26,8 +27,45 @@ function at-unset() { | |||||||
| 	unset t password token refresh | 	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() { | function at-version() { | ||||||
| 	curl -sL ${host}/xrpc/_health |jq . | 	at-version-env $1 | ||||||
|  | 	at-version-json |jq . | ||||||
| } | } | ||||||
|  |  | ||||||
| function at-uri() { | function at-uri() { | ||||||
| @@ -98,7 +136,7 @@ function at-refresh() { | |||||||
| 	echo $f | 	echo $f | ||||||
| 	token=`cat $f|jq -r .refreshJwt` | 	token=`cat $f|jq -r .refreshJwt` | ||||||
| 	req=/xrpc/com.atproto.server.refreshSession | 	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` | 	t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url` | ||||||
| 	if echo $t |jq .;then | 	if echo $t |jq .;then | ||||||
| 		echo $t >! $f | 		echo $t >! $f | ||||||
| @@ -109,13 +147,13 @@ function at-cid() { | |||||||
| 	did=`at-did $1|jq -r .did` | 	did=`at-did $1|jq -r .did` | ||||||
| 	cid=$2 | 	cid=$2 | ||||||
| 	req=/xrpc/com.atproto.sync.getBlob | 	req=/xrpc/com.atproto.sync.getBlob | ||||||
| 	url="https://${host}${req}?did=${did}&cid=${cid}" | 	url="${host}${req}?did=${did}&cid=${cid}" | ||||||
| 	curl -sL $url | 	curl -sL $url | ||||||
| } | } | ||||||
|  |  | ||||||
| function at-session() { | function at-session() { | ||||||
| 	req=/xrpc/com.atproto.server.getSession | 	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` | 	t=`curl -sL -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url` | ||||||
| 	if ! echo $t |jq .;then | 	if ! echo $t |jq .;then | ||||||
| 		echo refresh | 		echo refresh | ||||||
| @@ -131,6 +169,6 @@ function at-profile() { | |||||||
| 		t=`at-session` | 		t=`at-session` | ||||||
| 	fi | 	fi | ||||||
| 	req=/xrpc/app.bsky.actor.getProfile | 	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 . | 	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 | 	https://github.com/did-method-plc/did-method-plc | ||||||
| ) | ) | ||||||
| tag=( at bsky bsync pds bgs plc ozone feed jetstream social-app oauth ) | tag=( at bsky bsync pds bgs plc ozone feed jetstream social-app oauth ) | ||||||
|  | #pds_list=(bsky.social syu.is boobee.blue socl.is ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user