87 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			87 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/zsh
 | |
| 
 | |
| d=${0:a:h}
 | |
| 
 | |
| 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
 | |
| )
 | |
| 
 | |
| function run-env() {
 | |
| 	host=syu.is
 | |
| 	name=${host%%.*}
 | |
| 	domain=${host##*.}
 | |
| 	dh=${0:a:h:h}
 | |
| }
 | |
| 
 | |
| function run-dl() {
 | |
| 	mkdir -p $d/repos
 | |
| 	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 ];then
 | |
| 		cp -rf $d/docker/feed/Dockerfile $d/repos/feed-generator/
 | |
| 	fi
 | |
| }
 | |
| 
 | |
| function run-update() {
 | |
| 	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##*/}
 | |
| 			git pull
 | |
| 		fi
 | |
| 	done
 | |
| 	cd $d
 | |
| 	echo "docker compose build && docker compose up -d"
 | |
| }
 | |
| 
 | |
| function run-dl-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
 | |
| 	cp -rf $d/repos/social-app/src/view/icons/Logotype.tsx $d/icons/
 | |
| }
 | |
| 
 | |
| 
 | |
| function web-write() {
 | |
| 	dt=$d/repos/social-app/src
 | |
| 	cd $dt
 | |
| 	grep -R bsky.social .|cut -d : -f 1|sort -u|xargs sed -i "s/bsky.social/syu.is/g"
 | |
| 	grep -R bsky.app .|cut -d : -f 1|sort -u|xargs sed -i "s/bsky.app/web.syu.is/g"
 | |
| 	grep -R public.api.syu.is ./lib/constants.ts | cut -d : -f 1|sort -u|xargs sed -i "s/public.api/bsky/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.bsky.app/img/avatar/plain/#g" $f
 | |
| 	sed -i "s#/img/avatar_thumbnail/plain/#https://bsky.syu.is/img/avatar/plain/#g" $f
 | |
| 	sed -i "s#source={{uri: avatar}}#source={{ uri: hackModifyThumbnailPath(avatar, 1 > 0), }}#g" $f
 | |
| 
 | |
| 	did_bskyadmin=did:plc:z72i7hdynmk6r22z27h6tvur
 | |
| 	# curl -sL "syu.is/xrpc/com.atproto.repo.describeRepo?repo=ai.syu.is" |jq -r .did
 | |
| 	did_ai=did:plc:6qyecktefllvenje24fcxnie
 | |
| 	grep -R $did_bskyadmin .|cut -d : -f 1|sort -u|xargs sed -i "s/$did_bskyadmin/$did_ai/g"
 | |
| }
 | |
| 
 | |
| run-env
 | |
| run-dl
 | |
| case $1 in
 | |
| 	update)
 | |
| 		run-update
 | |
| 		;;
 | |
| 	web)
 | |
| 		web-write
 | |
| 		;;
 | |
| esac
 |