Compare commits
21 Commits
09916187d5
...
main
Author | SHA1 | Date | |
---|---|---|---|
ded3110fce
|
|||
6f4712e461
|
|||
bd3299154c
|
|||
8b97cbfd9b
|
|||
246f95a00c
|
|||
cc27f367ea
|
|||
72b8f39825
|
|||
c3d75140d8
|
|||
a45ba54323
|
|||
a77cdc1e58
|
|||
9db0aab05a
|
|||
320d98b2da
|
|||
e05868c9b1
|
|||
9d78ee8627
|
|||
16c785bf0f
|
|||
b5e44947da
|
|||
f26ef781f3
|
|||
b5b3850f7b
|
|||
c61fd5c748
|
|||
005ddc36cf
|
|||
5acaa7aeec
|
38
.github/workflows/generate-record.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
name: Generate Record JSON
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: # 手動トリガー
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- scpt/generate_record.py # スクリプトに変更があったとき
|
||||||
|
schedule:
|
||||||
|
- cron: '0 3 * * *' # 毎日03:00 UTCに自動生成(任意)
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: |
|
||||||
|
pip install -r requirements.txt || true # 必要なら
|
||||||
|
|
||||||
|
- name: Run Record Generator Script
|
||||||
|
run: |
|
||||||
|
python scpt/generate_record.py
|
||||||
|
|
||||||
|
- name: Commit and Push Generated JSON
|
||||||
|
run: |
|
||||||
|
git config --global user.name "GitHub Actions Bot"
|
||||||
|
git config --global user.email "actions@github.com"
|
||||||
|
git add record.json
|
||||||
|
git commit -m "🧬 Auto-generate record.json" || echo "No changes to commit"
|
||||||
|
git push origin main
|
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
repos
|
21
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
|
||||||
|
|
||||||
@ -15,6 +20,10 @@ https://github.com/bluesky-social/atproto
|
|||||||
- https://plc.syu.is/did:plc:6qyecktefllvenje24fcxnie
|
- https://plc.syu.is/did:plc:6qyecktefllvenje24fcxnie
|
||||||
- https://plc.directory/did:plc:ytvoptig4ddshmwdsjmhtcym
|
- https://plc.directory/did:plc:ytvoptig4ddshmwdsjmhtcym
|
||||||
|
|
||||||
|
[@yui.syui.ai](https://bsky.app/profile/did:plc:4hqjfn7m6n5hno3doamuhgef)
|
||||||
|
|
||||||
|
- https://pds.syu.is/at://did:plc:4hqjfn7m6n5hno3doamuhgef
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ curl -sL syu.is/xrpc/_health
|
$ curl -sL syu.is/xrpc/_health
|
||||||
{"version":"0.4.65"}
|
{"version":"0.4.65"}
|
||||||
@ -56,7 +65,7 @@ currently, bsky and bsync require patches to function properly. additionally, so
|
|||||||
|name|service|patch|
|
|name|service|patch|
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
|pds|https://github.com/bluesky-social/atproto/blob/main/services/pds/Dockerfile||
|
|pds|https://github.com/bluesky-social/atproto/blob/main/services/pds/Dockerfile||
|
||||||
|bsky|https://github.com/bluesky-social/atproto/blob/main/services/bsky/Dockerfile|[itaru2622/bluesky-atproto-bsky](https://hub.docker.com/r/itaru2622/bluesky-atproto-bsky)|
|
|bsky|https://github.com/bluesky-social/atproto/blob/main/services/bsky/Dockerfile|[itaru2622/bluesky-atproto-bsky](https://github.com/itaru2622/bluesky-selfhost-env/blob/master/patching/105-atproto-services-for-docker.diff)|
|
||||||
|bsync|https://github.com/bluesky-social/atproto/blob/main/services/bsync/Dockerfile||
|
|bsync|https://github.com/bluesky-social/atproto/blob/main/services/bsync/Dockerfile||
|
||||||
|ozone|https://github.com/bluesky-social/atproto/blob/main/services/ozone/Dockerfile||
|
|ozone|https://github.com/bluesky-social/atproto/blob/main/services/ozone/Dockerfile||
|
||||||
|plc|https://github.com/did-method-plc/did-method-plc/tree/main/packages/server||
|
|plc|https://github.com/did-method-plc/did-method-plc/tree/main/packages/server||
|
||||||
|
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:
|
||||||
@ -83,45 +67,9 @@ services:
|
|||||||
database:
|
database:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
||||||
ozone:
|
|
||||||
ports:
|
|
||||||
- 2585:3000
|
|
||||||
build:
|
|
||||||
context: ./repos/atproto/
|
|
||||||
dockerfile: services/ozone/Dockerfile
|
|
||||||
restart: always
|
|
||||||
command: node --enable-source-maps api.js
|
|
||||||
volumes:
|
|
||||||
- ./data/ozone/:/data/
|
|
||||||
- ./repos/ozone.js:/app/services/ozone/api.js:ro
|
|
||||||
env_file:
|
|
||||||
- ./envs/ozone
|
|
||||||
healthcheck:
|
|
||||||
test: "wget -q --spider http://localhost:3000/xrpc/_health"
|
|
||||||
interval: 5s
|
|
||||||
retries: 20
|
|
||||||
depends_on:
|
|
||||||
database:
|
|
||||||
condition: service_healthy
|
|
||||||
|
|
||||||
ozone-daemon:
|
|
||||||
build:
|
|
||||||
context: ./repos/atproto/
|
|
||||||
dockerfile: services/ozone/Dockerfile
|
|
||||||
restart: always
|
|
||||||
command: node --enable-source-maps daemon.js
|
|
||||||
env_file:
|
|
||||||
- ./envs/ozone
|
|
||||||
depends_on:
|
|
||||||
ozone:
|
|
||||||
condition: service_healthy
|
|
||||||
database:
|
|
||||||
condition: service_healthy
|
|
||||||
|
|
||||||
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 +81,68 @@ 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:
|
jetstream:
|
||||||
ports:
|
|
||||||
- 2586:2586
|
|
||||||
build:
|
build:
|
||||||
context: ./repos/feed-generator/
|
context: ./repos/jetstream/
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- 6008:6008
|
||||||
|
volumes:
|
||||||
|
- ./data/jetstream:/data
|
||||||
restart: always
|
restart: always
|
||||||
env_file:
|
env_file:
|
||||||
- ./envs/feed
|
- ./envs/jetstream
|
||||||
volumes:
|
|
||||||
- ./data/feed/:/data/
|
|
||||||
|
|
||||||
|
ozone-web:
|
||||||
|
build:
|
||||||
|
context: ./repos/ozone/
|
||||||
|
ports:
|
||||||
|
- 2586:3000
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./data/ozone/:/data/
|
||||||
|
env_file:
|
||||||
|
- ./envs/ozone
|
||||||
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
ozone:
|
||||||
|
build:
|
||||||
|
context: ./repos/atproto/
|
||||||
|
dockerfile: services/ozone/Dockerfile
|
||||||
|
ports:
|
||||||
|
- 2585:3000
|
||||||
|
restart: always
|
||||||
|
command: node --enable-source-maps api.js
|
||||||
|
volumes:
|
||||||
|
- ./data/ozone/:/data/
|
||||||
|
env_file:
|
||||||
|
- ./envs/ozone
|
||||||
|
|
||||||
|
ozone-daemon:
|
||||||
|
build:
|
||||||
|
context: ./repos/atproto/
|
||||||
|
dockerfile: services/ozone/Dockerfile
|
||||||
|
restart: always
|
||||||
|
command: node --enable-source-maps daemon.js
|
||||||
|
volumes:
|
||||||
|
- ./data/ozone/:/data/
|
||||||
|
env_file:
|
||||||
|
- ./envs/ozone
|
5
envs/jetstream
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
JETSTREAM_WS_URL=wss://bgs.${host}/xrpc/com.atproto.sync.subscribeRepos
|
||||||
|
JETSTREAM_DATA_DIR=/data
|
||||||
|
JETSTREAM_LISTEN_ADDR=:6008
|
||||||
|
JETSTREAM_METRICS_LISTEN_ADDR=:6009
|
||||||
|
JETSTREAM_LIVENESS_TTL=96h
|
@ -19,3 +19,9 @@ OZONE_DB_MIGRATE=1
|
|||||||
|
|
||||||
OZONE_ADMIN_PASSWORD
|
OZONE_ADMIN_PASSWORD
|
||||||
OZONE_SIGNING_KEY_HEX
|
OZONE_SIGNING_KEY_HEX
|
||||||
|
OZONE_BLOB_DIVERT_ADMIN_PASSWORD
|
||||||
|
OZONE_VERIFIER_URL
|
||||||
|
OZONE_VERIFIER_DID
|
||||||
|
OZONE_VERIFIER_PASSWORD
|
||||||
|
OZONE_VERIFIER_ISSUERS_TO_INDEX
|
||||||
|
OZONE_VERIFIER_JETSTREAM_URL
|
||||||
|
201
install.zsh
Executable file
@ -0,0 +1,201 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
# ./install.zsh $HOST
|
||||||
|
repos_v='{}'
|
||||||
|
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
|
||||||
|
https://github.com/bluesky-social/ozone
|
||||||
|
https://github.com/bluesky-social/jetstream
|
||||||
|
)
|
||||||
|
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
|
||||||
|
rv=$(echo "$repos_v" | jq -r ".[\"${repo##*/}\"]")
|
||||||
|
if [ "$rv" != "null" ];then
|
||||||
|
cd $d/repos/${repo##*/}
|
||||||
|
git reset --hard $rv
|
||||||
|
cd ..
|
||||||
|
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:6qyecktefllvenje24fcxnie
|
||||||
|
|
||||||
|
dt=$d/repos/social-app/src
|
||||||
|
cd $dt
|
||||||
|
grep -R syu.is .|cut -d : -f 1|sort -u|xargs sed -i "s/syu.is/${host}/g"
|
||||||
|
grep -R web.syu.is .|cut -d : -f 1|sort -u|xargs sed -i "s/web.syu.is/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.web.syu.is/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
|
||||||
|
curl -sL https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/src/lib/strings/url-helpers.ts -o $dt/lib/strings/url-helpers.ts
|
||||||
|
sed -i "s#https://go.web.syu.is/redirect?u=\${encodeURIComponent(url)}#\${url}#g" $dt/lib/strings/url-helpers.ts
|
||||||
|
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/patching/105-atproto-services-for-docker.diff
|
||||||
|
cd ${d_}
|
||||||
|
if [ ! -f ${p_} ];then
|
||||||
|
# https://github.com/itaru2622/bluesky-selfhost-env/blob/master/patching/105-atproto-services-for-docker.diff
|
||||||
|
echo download patch: https://github.com/itaru2622/bluesky-selfhost-env/blob/master/patching/105-atproto-services-for-docker.diff
|
||||||
|
curl -sL https://raw.githubusercontent.com/itaru2622/bluesky-selfhost-env/refs/heads/master/patching/105-atproto-services-for-docker.diff -o ${p_}
|
||||||
|
else
|
||||||
|
echo local patch
|
||||||
|
fi
|
||||||
|
echo "applying patch: under ${f} for ${p_}"
|
||||||
|
pushd ${d_}
|
||||||
|
patch -p1 < ${p_}
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
|
function at-repos-social-app-patch() {
|
||||||
|
f=$d/repos/social-app/Dockerfile
|
||||||
|
p_=$d/patching/social-app-dockerfile.diff
|
||||||
|
d_=$d/repos/social-app
|
||||||
|
cd ${d_}
|
||||||
|
curl -sLO https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/Dockerfile
|
||||||
|
echo "applying patch: under ${f} for ${p_}"
|
||||||
|
pushd ${d_}
|
||||||
|
patch -p1 < ${p_}
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
|
function at-repos-ozone-patch() {
|
||||||
|
#DOMAIN=syu.is
|
||||||
|
cd $d/repos
|
||||||
|
d_=$d/repos/ozone
|
||||||
|
rm -rf ${d_}
|
||||||
|
p_=$d/patching/120-ozone-runtimeEnvVars.diff
|
||||||
|
git clone https://github.com/bluesky-social/ozone
|
||||||
|
cd ${d_}
|
||||||
|
pushd ${d_}
|
||||||
|
echo "applying patch: under ${d_} for ${p_}"
|
||||||
|
patch -p1 < ${p_}
|
||||||
|
popd
|
||||||
|
|
||||||
|
p_=$d/patching/122-ozone-enable-daemon.diff
|
||||||
|
echo "applying patch: under ${d_} for ${p_}"
|
||||||
|
pushd ${d_}
|
||||||
|
patch -p1 < ${p_}
|
||||||
|
popd
|
||||||
|
|
||||||
|
#cp -rf $d/repos/atproto/service/ozone/* $d/ozone/service/
|
||||||
|
}
|
||||||
|
|
||||||
|
function at-repos-docker() {
|
||||||
|
cd $d
|
||||||
|
docker compose build && 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
|
||||||
|
at-repos-social-app-patch
|
||||||
|
at-repos-ozone-patch
|
||||||
|
|
||||||
|
at-repos-docker
|
||||||
|
#echo "[y]docker compose build && up"
|
||||||
|
#read key
|
||||||
|
#case $key in
|
||||||
|
# [yY])
|
||||||
|
# at-repos-docker
|
||||||
|
# ;;
|
||||||
|
#esac
|
||||||
|
|
BIN
item/card/0.png
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
item/card/0.webp
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
item/card/1.png
Normal file
After Width: | Height: | Size: 544 KiB |
BIN
item/card/1.webp
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
item/card/10.png
Normal file
After Width: | Height: | Size: 933 KiB |
BIN
item/card/10.webp
Normal file
After Width: | Height: | Size: 160 KiB |
BIN
item/card/11.png
Normal file
After Width: | Height: | Size: 688 KiB |
BIN
item/card/11.webp
Normal file
After Width: | Height: | Size: 136 KiB |
BIN
item/card/12.png
Normal file
After Width: | Height: | Size: 516 KiB |
BIN
item/card/12.webp
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
item/card/13.png
Normal file
After Width: | Height: | Size: 324 KiB |
BIN
item/card/13.webp
Normal file
After Width: | Height: | Size: 105 KiB |
BIN
item/card/135.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
item/card/135.webp
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
item/card/136.mp4
Normal file
BIN
item/card/136.png
Normal file
After Width: | Height: | Size: 2.6 MiB |
BIN
item/card/136.webp
Normal file
After Width: | Height: | Size: 4.4 MiB |
BIN
item/card/14.png
Normal file
After Width: | Height: | Size: 462 KiB |
BIN
item/card/14.webp
Normal file
After Width: | Height: | Size: 109 KiB |
BIN
item/card/2.png
Normal file
After Width: | Height: | Size: 361 KiB |
BIN
item/card/2.webp
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
item/card/3.png
Normal file
After Width: | Height: | Size: 683 KiB |
BIN
item/card/3.webp
Normal file
After Width: | Height: | Size: 94 KiB |
BIN
item/card/4.png
Normal file
After Width: | Height: | Size: 805 KiB |
BIN
item/card/4.webp
Normal file
After Width: | Height: | Size: 94 KiB |
BIN
item/card/5.png
Normal file
After Width: | Height: | Size: 402 KiB |
BIN
item/card/5.webp
Normal file
After Width: | Height: | Size: 81 KiB |
BIN
item/card/6.png
Normal file
After Width: | Height: | Size: 476 KiB |
BIN
item/card/6.webp
Normal file
After Width: | Height: | Size: 104 KiB |
BIN
item/card/7.png
Normal file
After Width: | Height: | Size: 713 KiB |
BIN
item/card/7.webp
Normal file
After Width: | Height: | Size: 90 KiB |
BIN
item/card/8.png
Normal file
After Width: | Height: | Size: 330 KiB |
BIN
item/card/8.webp
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
item/card/9.png
Normal file
After Width: | Height: | Size: 680 KiB |
BIN
item/card/9.webp
Normal file
After Width: | Height: | Size: 103 KiB |
38
item/card/readme.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# card
|
||||||
|
|
||||||
|
カードの仕様を決定します。
|
||||||
|
|
||||||
|
基本的に`3:4`の`1620x2160`で生成していましたが、`4:5`の`1080x1350`で生成することにしました。これはwindows動画編集が4:5にしか対応していないからです。`.mov`から動画編集で`.mp4`に変換し、それを`.webp`にします。
|
||||||
|
|
||||||
|
comfyuiの動画生成はカードの大きさではなかなか思うような動画が作れませんでした。やはり`1920x1080(1080p)`からの生成が最適でした。
|
||||||
|
|
||||||
|
- [16:9] 1920x1080 (1080p)
|
||||||
|
- [16:9] 1280×720 (720p)
|
||||||
|
- [16:9] 854x480 (480p)
|
||||||
|
- [4:3] 2160x1620
|
||||||
|
- [4:3] 1440x1080
|
||||||
|
- [4:3] 1024×768
|
||||||
|
- [4:3] 640×480
|
||||||
|
- [4:5] 2025x1620
|
||||||
|
- [4:5] 1536x2048
|
||||||
|
- [4:5] 1080x1350
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ magick convert -resize 480x -quality 100 4.png 4.webp
|
||||||
|
$ magick convert -quality 100 1.png 1.webp
|
||||||
|
|
||||||
|
$ magick convert -size 1620x2160 xc:white 1080p.png
|
||||||
|
$ magick convert -resize 1080x -quality 100 1.png 1.webp
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ ffmpeg -i 4.mp4 -vf "fps=15,setpts=PTS/4" -c:v libwebp -loop 1 -quality 100 4.webp
|
||||||
|
```
|
||||||
|
|
||||||
|
## list
|
||||||
|
|
||||||
|
<img src="https://git.syui.ai/ai/ai/raw/branch/main/card/1.webp" width="200px">
|
||||||
|
<img src="https://git.syui.ai/ai/ai/raw/branch/main/card/2.webp" width="200px">
|
||||||
|
<img src="https://git.syui.ai/ai/ai/raw/branch/main/card/3.webp" width="200px">
|
||||||
|
<img src="https://git.syui.ai/ai/ai/raw/branch/main/card/4.webp" width="200px">
|
||||||
|
|
153
lex/ai.syui.system.json
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
{
|
||||||
|
"lexicon": 1,
|
||||||
|
"id": "ai.syui.system",
|
||||||
|
"revision": 1,
|
||||||
|
"description": "Syui's system definitions for game logic and metaphysics",
|
||||||
|
"defs": {
|
||||||
|
"main": {
|
||||||
|
"type": "record",
|
||||||
|
"record": {
|
||||||
|
"key": "self",
|
||||||
|
"recordType": "document",
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["card", "system"],
|
||||||
|
"properties": {
|
||||||
|
"card": {
|
||||||
|
"type": "array",
|
||||||
|
"items": { "$ref": "#card" }
|
||||||
|
},
|
||||||
|
"system": {
|
||||||
|
"type": "array",
|
||||||
|
"items": { "$ref": "#system" }
|
||||||
|
},
|
||||||
|
"weapon": {
|
||||||
|
"type": "array",
|
||||||
|
"items": { "$ref": "#weapon" }
|
||||||
|
},
|
||||||
|
"ability": {
|
||||||
|
"type": "array",
|
||||||
|
"items": { "$ref": "#ability" }
|
||||||
|
},
|
||||||
|
"character": {
|
||||||
|
"type": "array",
|
||||||
|
"items": { "$ref": "#character" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"card": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["id", "img", "name", "lang"],
|
||||||
|
"properties": {
|
||||||
|
"id": { "type": "integer" },
|
||||||
|
"img": { "type": "string" },
|
||||||
|
"name": { "type": "string" },
|
||||||
|
"lang": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"ja": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": { "type": "string" },
|
||||||
|
"text": { "type": "string" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"system": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["id", "enum", "name", "lang"],
|
||||||
|
"properties": {
|
||||||
|
"id": { "type": "integer" },
|
||||||
|
"enum": {
|
||||||
|
"type": "array",
|
||||||
|
"items": { "type": "string" }
|
||||||
|
},
|
||||||
|
"name": { "type": "string" },
|
||||||
|
"alias": {
|
||||||
|
"type": "array",
|
||||||
|
"items": { "type": "string" }
|
||||||
|
},
|
||||||
|
"lang": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"ja": { "type": "string" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": { "type": "string" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"weapon": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["id", "img", "name", "lang"],
|
||||||
|
"properties": {
|
||||||
|
"id": { "type": "integer" },
|
||||||
|
"img": { "type": "string" },
|
||||||
|
"name": { "type": "string" },
|
||||||
|
"lang": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"ja": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": { "type": "string" },
|
||||||
|
"text": { "type": "string" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ability": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["id", "name", "color"],
|
||||||
|
"properties": {
|
||||||
|
"id": { "type": "integer" },
|
||||||
|
"name": { "type": "string" },
|
||||||
|
"lang": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"ja": { "type": "string" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"color": { "type": "string" },
|
||||||
|
"group": {
|
||||||
|
"type": "array",
|
||||||
|
"items": { "type": "string" }
|
||||||
|
},
|
||||||
|
"duration": { "type": "integer" },
|
||||||
|
"multiplier": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": { "type": "number" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"character": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["id", "name", "lang"],
|
||||||
|
"properties": {
|
||||||
|
"id": { "type": "integer" },
|
||||||
|
"img": { "type": "string" },
|
||||||
|
"name": { "type": "string" },
|
||||||
|
"lang": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"ja": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": { "type": "string" },
|
||||||
|
"text": { "type": "string" },
|
||||||
|
"description": { "type": "string" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"text": { "type": "string" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
56
lexicons/ai/syui/card.json
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"lexicon": 1,
|
||||||
|
"id": "ai.syui.card",
|
||||||
|
"defs": {
|
||||||
|
"main": {
|
||||||
|
"type": "record",
|
||||||
|
"description": "Record containing a cards box.",
|
||||||
|
"key": "tid",
|
||||||
|
"record": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["verify", "createdAt"],
|
||||||
|
"properties": {
|
||||||
|
"id":{
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 14,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"cp":{
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1,
|
||||||
|
"maximum": 5000,
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
|
"rank":{
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 7,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"rare": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["normal", "super", "ultra", "yui", "ai"],
|
||||||
|
"default": "normal"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uri",
|
||||||
|
"description": "https://verify...",
|
||||||
|
"default": "https://yui.syui.ai"
|
||||||
|
},
|
||||||
|
"verify": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "at-uri",
|
||||||
|
"description": "at://verify..."
|
||||||
|
},
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "datetime",
|
||||||
|
"description": "Client-declared timestamp when this post was originally created."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
72
lexicons/ai/syui/card/verify.json
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"lexicon": 1,
|
||||||
|
"id": "ai.syui.card.verify",
|
||||||
|
"defs": {
|
||||||
|
"main": {
|
||||||
|
"type": "record",
|
||||||
|
"description": "Record containing a card verify.",
|
||||||
|
"key": "tid",
|
||||||
|
"record": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"handle",
|
||||||
|
"did",
|
||||||
|
"createdAt"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 14,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"cp": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1,
|
||||||
|
"maximum": 10000,
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
|
"rank": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 7,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"rare": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"normal",
|
||||||
|
"super",
|
||||||
|
"ultra",
|
||||||
|
"yui",
|
||||||
|
"ai"
|
||||||
|
],
|
||||||
|
"default": "normal"
|
||||||
|
},
|
||||||
|
"handle": {
|
||||||
|
"type": "string",
|
||||||
|
"maxLength": 32,
|
||||||
|
"maxGraphemes": 32
|
||||||
|
},
|
||||||
|
"did": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"embed": {
|
||||||
|
"type": "union",
|
||||||
|
"refs": [
|
||||||
|
"app.bsky.embed.images",
|
||||||
|
"app.bsky.embed.external",
|
||||||
|
"app.bsky.embed.record",
|
||||||
|
"app.bsky.embed.recordWithMedia"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "datetime",
|
||||||
|
"description": "Client-declared timestamp when this post was originally created."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
lexicons/ai/syui/game.json
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"lexicon": 1,
|
||||||
|
"id": "ai.syui.game",
|
||||||
|
"defs": {
|
||||||
|
"main": {
|
||||||
|
"type": "record",
|
||||||
|
"description": "Record containing a game.",
|
||||||
|
"key": "literal:self",
|
||||||
|
"record": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["account", "createdAt"],
|
||||||
|
"properties": {
|
||||||
|
"account": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "at-uri",
|
||||||
|
"description": "at://verify..."
|
||||||
|
},
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "datetime",
|
||||||
|
"description": "Client-declared timestamp when this post was originally created."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
80
lexicons/ai/syui/game/character.json
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
"lexicon": 1,
|
||||||
|
"id": "ai.syui.game.character",
|
||||||
|
"defs": {
|
||||||
|
"main": {
|
||||||
|
"type": "record",
|
||||||
|
"key": "string",
|
||||||
|
"description": "record containing a game character.",
|
||||||
|
"input": {
|
||||||
|
"encoding": "application/json",
|
||||||
|
"record": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"createdAt"
|
||||||
|
],
|
||||||
|
"charactor": {
|
||||||
|
"type": "object",
|
||||||
|
"enum": [
|
||||||
|
"ai",
|
||||||
|
"manny",
|
||||||
|
"quinn",
|
||||||
|
"chinese",
|
||||||
|
"phoenix",
|
||||||
|
"kirin",
|
||||||
|
"leviathan",
|
||||||
|
"wyvern",
|
||||||
|
"cerberus",
|
||||||
|
"dragon",
|
||||||
|
"kitsune",
|
||||||
|
"pegasus"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"season": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 3,
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "fantasy",
|
||||||
|
"enum": [
|
||||||
|
"origin",
|
||||||
|
"fantasy",
|
||||||
|
"animal"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gender": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"none",
|
||||||
|
"male",
|
||||||
|
"famale"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"fullname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"nickname": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "datetime",
|
||||||
|
"description": "Client-declared timestamp when this post was originally created."
|
||||||
|
},
|
||||||
|
"updatedAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "datetime"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
101
lexicons/ai/syui/game/user.json
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
{
|
||||||
|
"lexicon": 1,
|
||||||
|
"id": "ai.syui.game.user",
|
||||||
|
"defs": {
|
||||||
|
"main": {
|
||||||
|
"type": "record",
|
||||||
|
"key": "tid",
|
||||||
|
"description": "Record containing a game user.",
|
||||||
|
"input": {
|
||||||
|
"encoding": "application/json",
|
||||||
|
"record": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["did", "createdAt"],
|
||||||
|
"properties": {
|
||||||
|
"aiten":{
|
||||||
|
"type": "integer",
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"did": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"login": {
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
"limit": {
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
"charactor": {
|
||||||
|
"type": "object",
|
||||||
|
"enum": ["ai","cerberus","chinesedragon","dragon","kirin","kitsune","leviathan","pegasus","phoenix"],
|
||||||
|
"properties": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"group":{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"season":{
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"lv":{
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1,
|
||||||
|
"maximum": 7,
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
|
"exp":{
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"rank":{
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 7,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"mode":{
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 7,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"hp":{
|
||||||
|
"type": "integer",
|
||||||
|
"maximum": 255,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"attach":{
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1,
|
||||||
|
"maximum": 255,
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
|
"critical":{
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 255,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"critical_d":{
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 255,
|
||||||
|
"default": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "datetime",
|
||||||
|
"description": "Client-declared timestamp when this post was originally created."
|
||||||
|
},
|
||||||
|
"updatedAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "datetime"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
30
lexicons/ai/syui/o/comment.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"lexicon": 1,
|
||||||
|
"id": "ai.syui.o.comment",
|
||||||
|
"defs": {
|
||||||
|
"main": {
|
||||||
|
"type": "record",
|
||||||
|
"description": "Record containing a Frontpage comment.",
|
||||||
|
"key": "tid",
|
||||||
|
"record": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["content", "createdAt", "post"],
|
||||||
|
"properties": {
|
||||||
|
"content": {
|
||||||
|
"type": "string",
|
||||||
|
"maxLength": 100000,
|
||||||
|
"maxGraphemes": 10000,
|
||||||
|
"description": "The content of the comment."
|
||||||
|
},
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "datetime",
|
||||||
|
"description": "Client-declared timestamp when this comment was originally created."
|
||||||
|
},
|
||||||
|
"parent": { "type": "ref", "ref": "com.atproto.repo.strongRef" },
|
||||||
|
"post": { "type": "ref", "ref": "com.atproto.repo.strongRef" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
lexicons/ai/syui/o/post.json
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"lexicon": 1,
|
||||||
|
"id": "ai.syui.o.post",
|
||||||
|
"defs": {
|
||||||
|
"main": {
|
||||||
|
"type": "record",
|
||||||
|
"description": "Record containing a Frontpage post.",
|
||||||
|
"key": "tid",
|
||||||
|
"record": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["title", "url", "createdAt"],
|
||||||
|
"properties": {
|
||||||
|
"title": {
|
||||||
|
"type": "string",
|
||||||
|
"maxLength": 3000,
|
||||||
|
"maxGraphemes": 300,
|
||||||
|
"description": "The title of the post."
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uri",
|
||||||
|
"description": "The URL of the post."
|
||||||
|
},
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "datetime",
|
||||||
|
"description": "Client-declared timestamp when this post was originally created."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
23
lexicons/ai/syui/o/vote.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"lexicon": 1,
|
||||||
|
"id": "ai.syui.o.vote",
|
||||||
|
"defs": {
|
||||||
|
"main": {
|
||||||
|
"type": "record",
|
||||||
|
"description": "Record containing a Frontpage vote.",
|
||||||
|
"key": "tid",
|
||||||
|
"record": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["subject", "createdAt"],
|
||||||
|
"properties": {
|
||||||
|
"subject": { "type": "ref", "ref": "com.atproto.repo.strongRef" },
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "datetime",
|
||||||
|
"description": "Client-declared timestamp when this vote was originally created."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
85
patching/105-atproto-services-for-docker.diff
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
diff --git a/services/bsky/api.js b/services/bsky/api.js
|
||||||
|
index 56c769b9d..5d14c0057 100644
|
||||||
|
--- a/services/bsky/api.js
|
||||||
|
+++ b/services/bsky/api.js
|
||||||
|
@@ -44,19 +44,62 @@ const assert = require('node:assert')
|
||||||
|
const cluster = require('node:cluster')
|
||||||
|
const path = require('node:path')
|
||||||
|
|
||||||
|
-const { BskyAppView, ServerConfig } = require('@atproto/bsky')
|
||||||
|
+const bsky = require('@atproto/bsky') // import all bsky features
|
||||||
|
const { Secp256k1Keypair } = require('@atproto/crypto')
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const env = getEnv()
|
||||||
|
- const config = ServerConfig.readEnv()
|
||||||
|
+ const config = bsky.ServerConfig.readEnv()
|
||||||
|
assert(env.serviceSigningKey, 'must set BSKY_SERVICE_SIGNING_KEY')
|
||||||
|
const signingKey = await Secp256k1Keypair.import(env.serviceSigningKey)
|
||||||
|
- const bsky = BskyAppView.create({ config, signingKey })
|
||||||
|
- await bsky.start()
|
||||||
|
+
|
||||||
|
+// starts: involve logics in packages/dev-env/src/bsky.ts >>>>>>>>>>>>>
|
||||||
|
+// Separate migration db in case migration changes some connection state that we need in the tests, e.g. "alter database ... set ..."
|
||||||
|
+ const migrationDb = new bsky.Database({
|
||||||
|
+ url: env.dbPostgresUrl,
|
||||||
|
+ schema: env.dbPostgresSchema,
|
||||||
|
+ })
|
||||||
|
+ if (env.migration) {
|
||||||
|
+ await migrationDb.migrateToOrThrow(env.migration)
|
||||||
|
+ } else {
|
||||||
|
+ await migrationDb.migrateToLatestOrThrow()
|
||||||
|
+ }
|
||||||
|
+ await migrationDb.close()
|
||||||
|
+
|
||||||
|
+ const db = new bsky.Database({
|
||||||
|
+ url: env.dbPostgresUrl,
|
||||||
|
+ schema: env.dbPostgresSchema,
|
||||||
|
+ poolSize: 10,
|
||||||
|
+ })
|
||||||
|
+
|
||||||
|
+ const dataplane = await bsky.DataPlaneServer.create(
|
||||||
|
+ db,
|
||||||
|
+ env.dataplanePort,
|
||||||
|
+ config.didPlcUrl
|
||||||
|
+ )
|
||||||
|
+
|
||||||
|
+ const bsync = await bsky.MockBsync.create(db, env.bsyncPort)
|
||||||
|
+
|
||||||
|
+// ends: involve logics in packages/dev-env/src/bsky.ts <<<<<<<<<<<<<
|
||||||
|
+
|
||||||
|
+ const server = bsky.BskyAppView.create({ config, signingKey })
|
||||||
|
+// starts: involve logics in packages/dev-env/src/bsky.ts >>>>>>>>>>>>>
|
||||||
|
+ const sub = new bsky.RepoSubscription({
|
||||||
|
+ service: env.repoProvider,
|
||||||
|
+ db,
|
||||||
|
+ idResolver: dataplane.idResolver,
|
||||||
|
+ background: new bsky.BackgroundQueue(db),
|
||||||
|
+ })
|
||||||
|
+// ends: involve logics in packages/dev-env/src/bsky.ts <<<<<<<<<<<<<
|
||||||
|
+ await server.start()
|
||||||
|
+ sub.start() // involve logics in packages/dev-env/src/bsky.ts
|
||||||
|
// Graceful shutdown (see also https://aws.amazon.com/blogs/containers/graceful-shutdowns-with-ecs/)
|
||||||
|
const shutdown = async () => {
|
||||||
|
- await bsky.destroy()
|
||||||
|
+ await server.destroy()
|
||||||
|
+ await bsync.destroy()
|
||||||
|
+ await dataplane.destroy()
|
||||||
|
+ await sub.destroy()
|
||||||
|
+ await db.close()
|
||||||
|
}
|
||||||
|
process.on('SIGTERM', shutdown)
|
||||||
|
process.on('disconnect', shutdown) // when clustering
|
||||||
|
@@ -64,6 +107,12 @@ const main = async () => {
|
||||||
|
|
||||||
|
const getEnv = () => ({
|
||||||
|
serviceSigningKey: process.env.BSKY_SERVICE_SIGNING_KEY || undefined,
|
||||||
|
+ dbPostgresUrl: process.env.BSKY_DB_POSTGRES_URL || undefined,
|
||||||
|
+ dbPostgresSchema: process.env.BSKY_DB_POSTGRES_SCHEMA || undefined,
|
||||||
|
+ dataplanePort : maybeParseInt(process.env.BSKY_DATAPLANE_PORT) || undefined,
|
||||||
|
+ bsyncPort : maybeParseInt(process.env.BSKY_BSYNC_PORT) || undefined,
|
||||||
|
+ migration: process.env.ENABLE_MIGRATIONS === 'true' || undefined,
|
||||||
|
+ repoProvider: process.env.BSKY_REPO_PROVIDER || undefined
|
||||||
|
})
|
||||||
|
|
||||||
|
const maybeParseInt = (str) => {
|
119
patching/120-ozone-runtimeEnvVars.diff
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
diff --git a/app/layout.tsx b/app/layout.tsx
|
||||||
|
index bfc3470..9350629 100644
|
||||||
|
--- a/app/layout.tsx
|
||||||
|
+++ b/app/layout.tsx
|
||||||
|
@@ -5,6 +5,7 @@ import 'yet-another-react-lightbox/styles.css'
|
||||||
|
import 'yet-another-react-lightbox/plugins/thumbnails.css'
|
||||||
|
import 'yet-another-react-lightbox/plugins/captions.css'
|
||||||
|
import { ToastContainer } from 'react-toastify'
|
||||||
|
+import { PublicEnvScript } from 'next-runtime-env';
|
||||||
|
|
||||||
|
import { Shell } from '@/shell/Shell'
|
||||||
|
import { CommandPaletteRoot } from '@/shell/CommandPalette/Root'
|
||||||
|
@@ -36,6 +37,7 @@ export default function RootLayout({
|
||||||
|
isDarkModeEnabled() ? 'dark' : ''
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
+ <head>
|
||||||
|
<title>Ozone</title>
|
||||||
|
<link
|
||||||
|
rel="icon"
|
||||||
|
@@ -43,6 +45,8 @@ export default function RootLayout({
|
||||||
|
sizes="any"
|
||||||
|
/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
+ <PublicEnvScript />
|
||||||
|
+ </head>
|
||||||
|
<body className="h-full overflow-hidden">
|
||||||
|
<ToastContainer
|
||||||
|
position="bottom-right"
|
||||||
|
diff --git a/environment.d.ts b/environment.d.ts
|
||||||
|
index 7a47cc2..33ab29f 100644
|
||||||
|
--- a/environment.d.ts
|
||||||
|
+++ b/environment.d.ts
|
||||||
|
@@ -9,6 +9,8 @@ declare global {
|
||||||
|
NEXT_PUBLIC_OZONE_SERVICE_DID?: string // e.g. did:plc:xxx#atproto_labeler
|
||||||
|
NEXT_PUBLIC_OZONE_PUBLIC_URL?: string // e.g. https://ozone.example.com (falls back to window.location.origin)
|
||||||
|
NEXT_PUBLIC_SOCIAL_APP_URL?: string // e.g. https://bsky.app
|
||||||
|
+ NEXT_PUBLIC_SOCIAL_APP_DOMAIN?: string // e.g. bsky.app
|
||||||
|
+ NEXT_PUBLIC_HANDLE_RESOLVER_URL?: string // e.g. https://api.bsky.app
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/lib/constants.ts b/lib/constants.ts
|
||||||
|
index fe7c0e8..c286ac6 100644
|
||||||
|
--- a/lib/constants.ts
|
||||||
|
+++ b/lib/constants.ts
|
||||||
|
@@ -1,29 +1,32 @@
|
||||||
|
+import { env } from 'next-runtime-env';
|
||||||
|
+
|
||||||
|
export const OAUTH_SCOPE = 'atproto transition:generic'
|
||||||
|
|
||||||
|
export const OZONE_SERVICE_DID =
|
||||||
|
- process.env.NEXT_PUBLIC_OZONE_SERVICE_DID || undefined
|
||||||
|
+ env('NEXT_PUBLIC_OZONE_SERVICE_DID') || undefined
|
||||||
|
|
||||||
|
export const OZONE_PUBLIC_URL =
|
||||||
|
- process.env.NEXT_PUBLIC_OZONE_PUBLIC_URL || undefined
|
||||||
|
+ env('NEXT_PUBLIC_OZONE_PUBLIC_URL') || undefined
|
||||||
|
|
||||||
|
export const PLC_DIRECTORY_URL =
|
||||||
|
- process.env.NEXT_PUBLIC_PLC_DIRECTORY_URL ||
|
||||||
|
+ env('NEXT_PUBLIC_PLC_DIRECTORY_URL') ||
|
||||||
|
(process.env.NODE_ENV === 'development'
|
||||||
|
? 'http://localhost:2582'
|
||||||
|
: 'https://plc.directory')
|
||||||
|
|
||||||
|
-export const QUEUE_CONFIG = process.env.NEXT_PUBLIC_QUEUE_CONFIG || '{}'
|
||||||
|
+export const QUEUE_CONFIG = env('NEXT_PUBLIC_QUEUE_CONFIG') || '{}'
|
||||||
|
|
||||||
|
-export const QUEUE_SEED = process.env.NEXT_PUBLIC_QUEUE_SEED || ''
|
||||||
|
+export const QUEUE_SEED = env('NEXT_PUBLIC_QUEUE_SEED') || ''
|
||||||
|
|
||||||
|
+export const SOCIAL_APP_DOMAIN = env('NEXT_PUBLIC_SOCIAL_APP_DOMAIN') || 'bsky.app'
|
||||||
|
export const SOCIAL_APP_URL =
|
||||||
|
- process.env.NEXT_PUBLIC_SOCIAL_APP_URL ||
|
||||||
|
+ env('NEXT_PUBLIC_SOCIAL_APP_URL') ||
|
||||||
|
(process.env.NODE_ENV === 'development'
|
||||||
|
? 'http://localhost:2584'
|
||||||
|
- : 'https://bsky.app')
|
||||||
|
+ : `https://${SOCIAL_APP_DOMAIN}`)
|
||||||
|
|
||||||
|
export const HANDLE_RESOLVER_URL =
|
||||||
|
- process.env.NEXT_PUBLIC_HANDLE_RESOLVER_URL ||
|
||||||
|
+ env('NEXT_PUBLIC_HANDLE_RESOLVER_URL') ||
|
||||||
|
(process.env.NODE_ENV === 'development'
|
||||||
|
? 'http://localhost:2584'
|
||||||
|
: 'https://api.bsky.app')
|
||||||
|
diff --git a/lib/util.ts b/lib/util.ts
|
||||||
|
index 0aa4460..ecec7d1 100644
|
||||||
|
--- a/lib/util.ts
|
||||||
|
+++ b/lib/util.ts
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
import { CollectionId } from '@/reports/helpers/subject'
|
||||||
|
-import { SOCIAL_APP_URL } from './constants'
|
||||||
|
+import { SOCIAL_APP_URL, SOCIAL_APP_DOMAIN } from './constants'
|
||||||
|
import { AtUri } from '@atproto/api'
|
||||||
|
|
||||||
|
export function classNames(...classes: (string | undefined)[]) {
|
||||||
|
@@ -57,7 +57,7 @@ export function takesKeyboardEvt(el?: EventTarget | null) {
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
-const blueSkyUrlMatcher = new RegExp('(https?://)?.*bsky.app')
|
||||||
|
+const blueSkyUrlMatcher = new RegExp('(https?://)?.*'+ `${SOCIAL_APP_DOMAIN}`)
|
||||||
|
|
||||||
|
export const isBlueSkyAppUrl = (url: string) => blueSkyUrlMatcher.test(url)
|
||||||
|
|
||||||
|
diff --git a/package.json b/package.json
|
||||||
|
index 8919841..750dce9 100644
|
||||||
|
--- a/package.json
|
||||||
|
+++ b/package.json
|
||||||
|
@@ -37,6 +37,7 @@
|
||||||
|
"kbar": "^0.1.0-beta.45",
|
||||||
|
"lande": "^1.0.10",
|
||||||
|
"next": "15.2.4",
|
||||||
|
+ "next-runtime-env": "^3.2.1",
|
||||||
|
"react": "19.1.0",
|
||||||
|
"react-dom": "19.1.0",
|
||||||
|
"react-dropzone": "^14.3.5",
|
82
patching/122-ozone-enable-daemon.diff
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
diff --git a/service/index.js b/service/index.js
|
||||||
|
index 943c281..7721cd9 100644
|
||||||
|
--- a/service/index.js
|
||||||
|
+++ b/service/index.js
|
||||||
|
@@ -1,5 +1,7 @@
|
||||||
|
const next = require('next')
|
||||||
|
-const {
|
||||||
|
+const ozone = require('@atproto/ozone')
|
||||||
|
+/*
|
||||||
|
+{
|
||||||
|
readEnv,
|
||||||
|
httpLogger,
|
||||||
|
envToCfg,
|
||||||
|
@@ -7,6 +9,7 @@ const {
|
||||||
|
OzoneService,
|
||||||
|
Database,
|
||||||
|
} = require('@atproto/ozone')
|
||||||
|
+*/
|
||||||
|
const pkg = require('@atproto/ozone/package.json')
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
@@ -16,37 +19,48 @@ async function main() {
|
||||||
|
const frontendHandler = frontend.getRequestHandler()
|
||||||
|
await frontend.prepare()
|
||||||
|
// backend
|
||||||
|
- const env = readEnv()
|
||||||
|
+ const env = ozone.readEnv()
|
||||||
|
env.version ??= pkg.version
|
||||||
|
- const config = envToCfg(env)
|
||||||
|
- const secrets = envToSecrets(env)
|
||||||
|
+ const config = ozone.envToCfg(env)
|
||||||
|
+ const secrets = ozone.envToSecrets(env)
|
||||||
|
const migrate = process.env.OZONE_DB_MIGRATE === '1'
|
||||||
|
if (migrate) {
|
||||||
|
- const db = new Database({
|
||||||
|
+ const db = new ozone.Database({
|
||||||
|
url: config.db.postgresUrl,
|
||||||
|
schema: config.db.postgresSchema,
|
||||||
|
})
|
||||||
|
await db.migrateToLatestOrThrow()
|
||||||
|
await db.close()
|
||||||
|
}
|
||||||
|
- const ozone = await OzoneService.create(config, secrets)
|
||||||
|
+ const server = await ozone.OzoneService.create(config, secrets)
|
||||||
|
// setup handlers
|
||||||
|
- ozone.app.get('/.well-known/ozone-metadata.json', (_req, res) => {
|
||||||
|
+ server.app.get('/.well-known/ozone-metadata.json', (_req, res) => {
|
||||||
|
return res.json({
|
||||||
|
- did: ozone.ctx.cfg.service.did,
|
||||||
|
- url: ozone.ctx.cfg.service.publicUrl,
|
||||||
|
- publicKey: ozone.ctx.signingKey.did(),
|
||||||
|
+ did: server.ctx.cfg.service.did,
|
||||||
|
+ url: server.ctx.cfg.service.publicUrl,
|
||||||
|
+ publicKey: server.ctx.signingKey.did(),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// Note: We must use `use()` here. This should be the last middleware.
|
||||||
|
- ozone.app.use((req, res) => {
|
||||||
|
+ server.app.use((req, res) => {
|
||||||
|
void frontendHandler(req, res, undefined)
|
||||||
|
})
|
||||||
|
// run
|
||||||
|
- const httpServer = await ozone.start()
|
||||||
|
+ const httpServer = await server.start()
|
||||||
|
+ // starts: involve ops from atproto/packages/dev-env/src/ozone.ts >>>
|
||||||
|
+ ozone.httpLogger.info('starts ozone daemon')
|
||||||
|
+ const daemon = await ozone.OzoneDaemon.create(config, secrets)
|
||||||
|
+ await daemon.start()
|
||||||
|
+ //if (process.env.OZONE_ENABLE_EVENT_REVERSER != 'true') // atproto/services/ozone/daemon.js doesn't stop eventReverser
|
||||||
|
+ //{
|
||||||
|
+ // ozone.httpLogger.info('disable ozone daemon eventReverser')
|
||||||
|
+ // await daemon.ctx.eventReverser.destroy()
|
||||||
|
+ //}
|
||||||
|
+ // ends: involve ops from atproto/packages/dev-env/src/ozone.ts <<<
|
||||||
|
+
|
||||||
|
/** @type {import('net').AddressInfo} */
|
||||||
|
const addr = httpServer.address()
|
||||||
|
- httpLogger.info(`Ozone is running at http://localhost:${addr.port}`)
|
||||||
|
+ ozone.httpLogger.info(`Ozone is running at http://localhost:${addr.port}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
main().catch(console.error)
|
10
patching/social-app-dockerfile.diff
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
--- a/Dockerfile
|
||||||
|
+++ b/Dockerfile
|
||||||
|
@@ -37,6 +37,7 @@ RUN \. "$NVM_DIR/nvm.sh" && \
|
||||||
|
echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$EXPO_PUBLIC_BUNDLE_IDENTIFIER" >> .env && \
|
||||||
|
echo "EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H")" >> .env && \
|
||||||
|
npm install --global yarn && \
|
||||||
|
+ yarn config set network-timeout 600000 && \
|
||||||
|
yarn && \
|
||||||
|
yarn intl:build && \
|
||||||
|
EXPO_PUBLIC_BUNDLE_IDENTIFIER=$EXPO_PUBLIC_BUNDLE_IDENTIFIER EXPO_PUBLIC_BUNDLE_DATE=$() yarn build-web
|
@ -1,4 +1,4 @@
|
|||||||
FROM node:20
|
FROM node:21
|
||||||
|
|
||||||
RUN npm install -g pnpm
|
RUN npm install -g pnpm
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
@ -3,4 +3,4 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
ports:
|
ports:
|
||||||
- 3000:13213
|
- 3001:13213
|
||||||
|
@ -1,15 +1,47 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import solidPlugin from "vite-plugin-solid";
|
import solidPlugin from "vite-plugin-solid";
|
||||||
import UnoCSS from "unocss/vite";
|
import UnoCSS from "unocss/vite";
|
||||||
|
import metadata from "./public/client-metadata.json";
|
||||||
|
|
||||||
const SERVER_HOST = "0.0.0.0";
|
const SERVER_HOST = "0.0.0.0";
|
||||||
const SERVER_PORT = 13213;
|
const SERVER_PORT = 13213;
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [UnoCSS(), solidPlugin()],
|
plugins: [
|
||||||
|
UnoCSS(),
|
||||||
|
solidPlugin(),
|
||||||
|
// Injects OAuth-related variables
|
||||||
|
{
|
||||||
|
name: "oauth",
|
||||||
|
config(_conf, { command }) {
|
||||||
|
if (command === "build") {
|
||||||
|
process.env.VITE_OAUTH_CLIENT_ID = metadata.client_id;
|
||||||
|
process.env.VITE_OAUTH_REDIRECT_URL = metadata.redirect_uris[0];
|
||||||
|
} else {
|
||||||
|
const redirectUri = ((): string => {
|
||||||
|
const url = new URL(metadata.redirect_uris[0]);
|
||||||
|
return `http://${SERVER_HOST}:${SERVER_PORT}${url.pathname}`;
|
||||||
|
})();
|
||||||
|
|
||||||
|
const clientId =
|
||||||
|
`http://localhost` +
|
||||||
|
`?redirect_uri=${encodeURIComponent(redirectUri)}` +
|
||||||
|
`&scope=${encodeURIComponent(metadata.scope)}`;
|
||||||
|
|
||||||
|
process.env.VITE_DEV_SERVER_PORT = "" + SERVER_PORT;
|
||||||
|
process.env.VITE_OAUTH_CLIENT_ID = clientId;
|
||||||
|
process.env.VITE_OAUTH_REDIRECT_URL = redirectUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
process.env.VITE_CLIENT_URI = metadata.client_uri;
|
||||||
|
process.env.VITE_OAUTH_SCOPE = metadata.scope;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
server: {
|
server: {
|
||||||
host: SERVER_HOST,
|
host: SERVER_HOST,
|
||||||
port: SERVER_PORT,
|
port: SERVER_PORT,
|
||||||
|
allowedHosts: ['pds.syu.is'],
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
target: "esnext",
|
target: "esnext",
|
||||||
|
33
scpt/at.zsh
@ -4,11 +4,14 @@ d=${0:a:h}
|
|||||||
|
|
||||||
source $d/src/tag.zsh
|
source $d/src/tag.zsh
|
||||||
source $d/src/func.zsh
|
source $d/src/func.zsh
|
||||||
|
source $d/src/ue.zsh
|
||||||
|
source $d/src/ai/syui/game/character.zsh
|
||||||
|
source $d/src/is/syu/main.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
|
||||||
@ -38,16 +41,34 @@ case $1 in
|
|||||||
at-profile
|
at-profile
|
||||||
;;
|
;;
|
||||||
download-character-icon)
|
download-character-icon)
|
||||||
source $d/ai/syui/game/character.zsh
|
|
||||||
download_character_icon
|
download_character_icon
|
||||||
;;
|
;;
|
||||||
create-game-character)
|
create-game-character)
|
||||||
source $d/ai/syui/game/character.zsh
|
|
||||||
create_game_character
|
create_game_character
|
||||||
;;
|
;;
|
||||||
ai-create-user)
|
create-game-user)
|
||||||
source $d/ai/syui/game/character.zsh
|
create_game_user $2
|
||||||
ai_create_user
|
;;
|
||||||
|
create-system)
|
||||||
|
create_system
|
||||||
|
;;
|
||||||
|
get-game-user)
|
||||||
|
get_game_user $2
|
||||||
|
;;
|
||||||
|
delete-game-user)
|
||||||
|
delete_game_user $2 $3
|
||||||
|
;;
|
||||||
|
verify-icon)
|
||||||
|
verify-icon
|
||||||
|
;;
|
||||||
|
self-col)
|
||||||
|
self-col $2
|
||||||
|
;;
|
||||||
|
ue-system)
|
||||||
|
ue-system
|
||||||
|
;;
|
||||||
|
ue-user)
|
||||||
|
ue-user $2
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "${help[@]}"
|
echo "${help[@]}"
|
||||||
|
10
scpt/generate_record.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
record = {
|
||||||
|
"$type": "app.bsky.feed.post",
|
||||||
|
"text": "テスト投稿 from script",
|
||||||
|
"createdAt": "2025-05-26T12:00:00Z"
|
||||||
|
}
|
||||||
|
|
||||||
|
with open("record.json", "w", encoding="utf-8") as f:
|
||||||
|
json.dump(record, f, ensure_ascii=False, indent=2)
|
@ -1,33 +1,3 @@
|
|||||||
character=(
|
|
||||||
ai
|
|
||||||
manny
|
|
||||||
quinn
|
|
||||||
chinese
|
|
||||||
kirin
|
|
||||||
leviathan
|
|
||||||
phoenix
|
|
||||||
wyvern
|
|
||||||
cerberus
|
|
||||||
dragon
|
|
||||||
kitsune
|
|
||||||
pegasus
|
|
||||||
)
|
|
||||||
|
|
||||||
img=(
|
|
||||||
bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
|
||||||
bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
|
||||||
bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
|
||||||
bafkreidlealfybajqzwv5eoz4jshnsijc2vnktlhpw4ph47krwj6aigqby
|
|
||||||
bafkreiegpqedlrfa4ljhssdnkrr5hyd5huy2xhh2zszj5wq2wuuzejggmq
|
|
||||||
bafkreig6vszkx3c4dcortjwfsz6sa6zwqgj7zpxj4lxfrrkwql4xhiu5ou
|
|
||||||
bafkreich7fsumke2yvumvixkruonzrcevk3f6g2cntzfwdn4n2c2vox5dm
|
|
||||||
bafkreiacjvagsekhiiljz3j237b6klrt6pkptxljt7kltprgg5276gv25q
|
|
||||||
bafkreihpni4lp55jysalcntulzal5rbhidtbseanlucpyucagzxmv6xj24
|
|
||||||
bafkreia3huw2gdenqatoobx3hcft74chced46bw4znfgepo5aenegobkri
|
|
||||||
bafkreidy74aieb6ie646xhosginox5zbnbnrtd76cnt4pbn73hrxgfnple
|
|
||||||
bafkreifnbfj27fr6nv7qeqqmwdibf7qrw4lauvzoknw5hexbifmwqt6kmq
|
|
||||||
)
|
|
||||||
|
|
||||||
function download_character_icon(){
|
function download_character_icon(){
|
||||||
|
|
||||||
t=(
|
t=(
|
||||||
@ -189,35 +159,85 @@ json="{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ai_create_user() {
|
function get_game_user() {
|
||||||
|
rkey=$did.$pds
|
||||||
|
pds=bsky.social
|
||||||
|
if [ "$1" = "syui" ] || [ "$1" = "ai" ];then
|
||||||
|
rkey=$1
|
||||||
|
fi
|
||||||
|
req=com.atproto.repo.getRecord
|
||||||
|
url="https://$pds/xrpc/$req?rkey=$rkey&repo=$did_yui&collection=ai.syui.game"
|
||||||
|
curl -sL $url|jq .
|
||||||
|
}
|
||||||
|
|
||||||
col=ai.syui.game.user
|
delete_game_user() {
|
||||||
rkey=ai
|
rkey=$2
|
||||||
did=$did_yui
|
if [ -z "$1" ];then
|
||||||
handle=$handle_yui
|
col=ai.syui.game
|
||||||
|
else
|
||||||
|
col=$1
|
||||||
|
fi
|
||||||
|
req=com.atproto.repo.DeleteRecord
|
||||||
|
url=https://$pds/xrpc/$req
|
||||||
|
repo=$did
|
||||||
|
#repo=did:plc:6qyecktefllvenje24fcxnie
|
||||||
|
json="{\"collection\":\"$col\", \"rkey\":\"$rkey\", \"repo\":\"$repo\"}"
|
||||||
|
echo $json
|
||||||
|
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_game_user() {
|
||||||
|
col=ai.syui.game
|
||||||
|
rkey=$1
|
||||||
|
handle_yui=$handle
|
||||||
|
did_yui=$did
|
||||||
|
pds=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"|cut -d / -f 3`
|
||||||
|
if [ "$pds" != "syu.is" ];then
|
||||||
|
pds=bsky.social
|
||||||
|
fi
|
||||||
|
version=4
|
||||||
#rkey=syui
|
#rkey=syui
|
||||||
#img=https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:4hqjfn7m6n5hno3doamuhgef/bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy@jpeg
|
#img=https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:4hqjfn7m6n5hno3doamuhgef/bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy@jpeg
|
||||||
req=com.atproto.repo.putRecord
|
req=com.atproto.repo.putRecord
|
||||||
url=https://$host/xrpc/$req
|
url=https://$pds/xrpc/$req
|
||||||
|
|
||||||
for ((i=1; i<=${#character}; i++)); do
|
cname=dragon
|
||||||
|
cid=bafkreia3huw2gdenqatoobx3hcft74chced46bw4znfgepo5aenegobkri
|
||||||
|
|
||||||
cname=${character[$i]}
|
if [ "$rkey" = "ai" ];then
|
||||||
cid=${img[$i]}
|
cname=$rkey
|
||||||
|
cid=bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
||||||
|
gender=none
|
||||||
|
fi
|
||||||
|
if [ "$rkey" = "syui" ];then
|
||||||
|
cname=chinese
|
||||||
|
did=$did_syui
|
||||||
|
handle=syui.ai
|
||||||
|
cid=bafkreidlealfybajqzwv5eoz4jshnsijc2vnktlhpw4ph47krwj6aigqby
|
||||||
|
gender=male
|
||||||
|
fi
|
||||||
|
if [ "$rkey" = "self" ];then
|
||||||
|
cname=manny
|
||||||
|
unset did handle gender
|
||||||
|
pds=bsky.social
|
||||||
|
plc=plc.directory
|
||||||
|
fi
|
||||||
imguri=https://cdn.bsky.app/img/feed_thumbnail/plain/$did_yui/${cid}@jpeg
|
imguri=https://cdn.bsky.app/img/feed_thumbnail/plain/$did_yui/${cid}@jpeg
|
||||||
echo $imguri
|
|
||||||
echo $i $character $cname
|
|
||||||
season=1
|
season=1
|
||||||
group=test
|
group=test
|
||||||
lv=1
|
lv=1
|
||||||
hp=100
|
hp=1
|
||||||
exp=0
|
exp=0
|
||||||
rank=0
|
rare=0
|
||||||
mode=0
|
mode=0
|
||||||
attack=0
|
attack=0
|
||||||
attack_post=0
|
attack_post=0
|
||||||
critical=0
|
critical=0
|
||||||
critical_d=0
|
critical_d=0
|
||||||
|
card=0
|
||||||
|
weapon=0
|
||||||
|
coin=0
|
||||||
|
count=0
|
||||||
|
|
||||||
case $cname in
|
case $cname in
|
||||||
ai)
|
ai)
|
||||||
@ -233,16 +253,10 @@ function ai_create_user() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
jc="\"$cname\": { \"group\": \"$group\", \"season\": $season, \"img\": \"$imguri\", \"lv\": $lv, \"exp\": $exp, \"hp\": $hp, \"rank\": $rank, \"mode\": $mode, \"attack\": $attack, \"attack_post\": $attack_post, \"critical\": $critical, \"critical_d\": $critical_d }"
|
json="\"$cname\": { \"group\": \"$group\", \"season\": $season, \"lv\": $lv, \"exp\": $exp, \"hp\": $hp, \"mode\": $mode, \"attack\": $attack, \"critical\": $critical, \"critical_d\": $critical_d, \"card\": $card, \"coin\": $coin, \"weapon\": $weapon, \"count\": $count, \"rare\": $rare}"
|
||||||
|
#json="\"$cname\": { \"group\": \"$group\", \"season\": $season, \"img\": \"$imguri\", \"lv\": $lv, \"exp\": $exp, \"hp\": $hp, \"rank\": $rank, \"mode\": $mode, \"attack\": $attack, \"attack_post\": $attack_post, \"critical\": $critical, \"critical_d\": $critical_d }"
|
||||||
|
|
||||||
if [ $#character -ne $i ];then
|
v1_json="
|
||||||
jc=${jc},
|
|
||||||
fi
|
|
||||||
|
|
||||||
json=${json}${jc}
|
|
||||||
|
|
||||||
done
|
|
||||||
json="
|
|
||||||
{
|
{
|
||||||
\"repo\": \"$handle_yui\",
|
\"repo\": \"$handle_yui\",
|
||||||
\"did\": \"$did_yui\",
|
\"did\": \"$did_yui\",
|
||||||
@ -254,7 +268,7 @@ function ai_create_user() {
|
|||||||
\"login\": false,
|
\"login\": false,
|
||||||
\"handle\": \"$handle\",
|
\"handle\": \"$handle\",
|
||||||
\"aiten\": 10,
|
\"aiten\": 10,
|
||||||
\"gender\": \"famale\",
|
\"gender\": \"$gender\",
|
||||||
\"character\": {
|
\"character\": {
|
||||||
$json
|
$json
|
||||||
},
|
},
|
||||||
@ -263,40 +277,101 @@ function ai_create_user() {
|
|||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
|
|
||||||
|
json_item="
|
||||||
|
\"coin\": [{\"id\": 0, \"cp\": 0, \"rare\": 0, \"count\": 0}],
|
||||||
|
\"card\": [{\"id\": 0, \"cp\": 0, \"rare\": 0, \"count\": 0}],
|
||||||
|
\"weapon\": [{\"id\": 0, \"cp\": 0, \"rare\": 0, \"count\": 0}]
|
||||||
|
"
|
||||||
|
|
||||||
if echo $json|jq . ;then
|
json="
|
||||||
echo $token_yui
|
{
|
||||||
echo y
|
|
||||||
read y
|
|
||||||
if [ "y" = "$y" ];then
|
|
||||||
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token_yui" -d $json $url
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
col=ai.syui.game
|
|
||||||
rkey=self
|
|
||||||
at_uri=at://$did_yui/ai.syui.game.user/ai
|
|
||||||
|
|
||||||
json="
|
|
||||||
{
|
|
||||||
\"repo\": \"$handle_yui\",
|
\"repo\": \"$handle_yui\",
|
||||||
\"did\": \"$did_yui\",
|
\"did\": \"$did_yui\",
|
||||||
\"collection\": \"$col\",
|
\"collection\": \"$col\",
|
||||||
\"rkey\": \"$rkey\",
|
\"rkey\": \"$rkey\",
|
||||||
\"record\": {
|
\"record\": {
|
||||||
\"account\": \"$at_uri\",
|
\"version\": $version,
|
||||||
\"username\": \"ai\",
|
\"did\": \"$did\",
|
||||||
\"createdAt\": \"$created\"
|
\"handle\": \"$handle\",
|
||||||
}
|
\"plc\": \"$plc\",
|
||||||
|
\"pds\": \"$pds\",
|
||||||
|
\"player\": {
|
||||||
|
\"limit\": false,
|
||||||
|
\"login\": false,
|
||||||
|
\"ten\": 0,
|
||||||
|
\"gender\": \"$gender\"
|
||||||
|
},
|
||||||
|
\"character\": {
|
||||||
|
$json
|
||||||
|
},
|
||||||
|
\"item\": {
|
||||||
|
$json_item
|
||||||
|
},
|
||||||
|
\"createdAt\": \"${created}\",
|
||||||
|
\"updatedAt\": \"${created}\"
|
||||||
|
}
|
||||||
}"
|
}"
|
||||||
|
|
||||||
if echo $json|jq . ;then
|
if echo $json|jq . ;then
|
||||||
echo y
|
echo y
|
||||||
read y
|
read y
|
||||||
if [ "y" = "$y" ];then
|
if [ "y" = "$y" ];then
|
||||||
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token_yui" -d $json $url
|
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url`
|
||||||
|
echo $t|jq .
|
||||||
|
#f=~/ai/ue/json/v${version}_${rkey}.json
|
||||||
|
#if [ -f $f ];then
|
||||||
|
# get_game_user $rkey >! $f
|
||||||
|
#fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function create_system() {
|
||||||
|
col=ai.syui.system
|
||||||
|
rkey=self
|
||||||
|
did=$did
|
||||||
|
handle=$handle
|
||||||
|
pds=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"|cut -d / -f 3`
|
||||||
|
if [ "$pds" != "syu.is" ];then
|
||||||
|
pds=bsky.social
|
||||||
|
fi
|
||||||
|
version=1
|
||||||
|
#rkey=syui
|
||||||
|
#img=https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:4hqjfn7m6n5hno3doamuhgef/bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy@jpeg
|
||||||
|
req=com.atproto.repo.putRecord
|
||||||
|
url=https://$pds/xrpc/$req
|
||||||
|
#cid=bafkreia3huw2gdenqatoobx3hcft74chced46bw4znfgepo5aenegobkri
|
||||||
|
#imguri=https://cdn.bsky.app/img/feed_thumbnail/plain/$did_yui/${cid}@jpeg
|
||||||
|
imgurl=https://git.syui.ai/ai/ai/raw/branch/main/img/item/card
|
||||||
|
json_card=" \"id\": $id, \"name\": \"$name\", \"img\": \"${imgurl}/${id}.webp\""
|
||||||
|
json_card=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/card.json|jq ".[]"`
|
||||||
|
json_weapon=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/weapon.json|jq ".[]"`
|
||||||
|
json_system=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/system.json|jq ".[]"`
|
||||||
|
json_character=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/character.json|jq ".[]"`
|
||||||
|
json_ability=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/ability.json|jq ".[]"`
|
||||||
|
json="
|
||||||
|
{
|
||||||
|
\"repo\": \"$handle\",
|
||||||
|
\"did\": \"$did\",
|
||||||
|
\"collection\": \"$col\",
|
||||||
|
\"rkey\": \"$rkey\",
|
||||||
|
\"record\": {
|
||||||
|
\"card\": ${json_card},
|
||||||
|
\"weapon\": ${json_weapon},
|
||||||
|
\"system\": ${json_system},
|
||||||
|
\"character\": ${json_character},
|
||||||
|
\"ability\": ${json_ability},
|
||||||
|
\"createdAt\": \"${created}\",
|
||||||
|
\"updatedAt\": \"${created}\"
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
|
||||||
|
if echo $json|jq . ;then
|
||||||
|
echo y
|
||||||
|
read y
|
||||||
|
if [ "y" = "$y" ];then
|
||||||
|
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url`
|
||||||
|
echo $t|jq .
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
@ -1,33 +1,76 @@
|
|||||||
function at-env() {
|
function at-env() {
|
||||||
host=bsky.social
|
pds=bsky.social
|
||||||
|
plc=plc.directory
|
||||||
|
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
|
||||||
did_syui=did:plc:uqzpqmrjnptsxezjx4xuh2mn
|
did_syui=did:plc:uqzpqmrjnptsxezjx4xuh2mn
|
||||||
handle=$handle_yui
|
handle=$handle_yui
|
||||||
did=$did_yui
|
did=$did_yui
|
||||||
created=2020-01-01T00:00:00+09:00
|
created=2025-04-21T00:00:00.323Z
|
||||||
at_uri=at://$did_yui/ai.syui.game.user/syui
|
|
||||||
docs_uri=https://docs.bsky.app/docs/api
|
docs_uri=https://docs.bsky.app/docs/api
|
||||||
|
at_uri=at://$handle/ai.syui.game/ai
|
||||||
did=`echo $at_uri|cut -d / -f 3`
|
did=`echo $at_uri|cut -d / -f 3`
|
||||||
collection=`echo $at_uri|cut -d / -f 4`
|
collection=`echo $at_uri|cut -d / -f 4`
|
||||||
rkey=`echo $at_uri|cut -d / -f 5`
|
rkey=`echo $at_uri|cut -d / -f 5`
|
||||||
d=${0:a:h}
|
d=${0:a:h}
|
||||||
f=~/.config/.at-zsh.json
|
f=~/.config/ai/token.json
|
||||||
if [ -f $f ];then
|
if [ -f $f ];then
|
||||||
|
host=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"|cut -d / -f 3`
|
||||||
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`
|
||||||
actor=$did
|
actor=$did
|
||||||
fi
|
fi
|
||||||
|
if [ "$host" = "syu.is" ];then
|
||||||
|
plc=plc.syu.is
|
||||||
|
pds=$host
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function at-unset() {
|
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 socl.is )
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
title="atproto $tag version"
|
||||||
|
latest=https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/packages/$tag/package.json
|
||||||
|
latest=`curl -sL $latest |jq -r .version`
|
||||||
|
# bgs=( bsky.network bgs.syu.is )
|
||||||
|
# plc=( plc.directory plc.syu.is )
|
||||||
|
}
|
||||||
|
|
||||||
|
function at-version-json() {
|
||||||
|
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
|
||||||
|
at-version-json|jq .
|
||||||
}
|
}
|
||||||
|
|
||||||
function at-uri() {
|
function at-uri() {
|
||||||
@ -98,7 +141,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 +152,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 +174,35 @@ 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 .
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function verify-icon() {
|
||||||
|
syuisadmin_handle=ai.syu.is
|
||||||
|
syuisadmin_did=did:plc:6qyecktefllvenje24fcxnie
|
||||||
|
#rkey=
|
||||||
|
col=app.bsky.graph.verification
|
||||||
|
handle=syui.syu.is
|
||||||
|
subject=did:plc:vzsvtbtbnwn22xjqhcu3vd6y
|
||||||
|
displayName=syui
|
||||||
|
req=/xrpc/com.atproto.repo.createRecord
|
||||||
|
url=${host}${req}
|
||||||
|
json="
|
||||||
|
{
|
||||||
|
\"repo\": \"$syuisadmin_handle\",
|
||||||
|
\"did\": \"$syuisadmin_did\",
|
||||||
|
\"collection\": \"$col\",
|
||||||
|
\"record\": {
|
||||||
|
\"subject\": \"$subject\",
|
||||||
|
\"handle\": \"$handle\",
|
||||||
|
\"displayName\": \"$displayName\",
|
||||||
|
\"createdAt\": \"${created}\"
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
|
||||||
|
if echo $json|jq . ;then
|
||||||
|
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url`
|
||||||
|
echo $t
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
18
scpt/src/is/syu/main.zsh
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
function self-col(){
|
||||||
|
if [ -n "$1" ];then
|
||||||
|
t=`curl -sL "$pds/xrpc/com.atproto.repo.listRecords?repo=$handle&collection=$1"`
|
||||||
|
echo $t|jq .
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
col=(
|
||||||
|
ai.syui.game
|
||||||
|
ai.syui.system
|
||||||
|
)
|
||||||
|
e=${col[@]: -1}
|
||||||
|
for i in $col; do
|
||||||
|
t=`curl -sL "$pds/xrpc/com.atproto.repo.listRecords?repo=$handle&collection=$i"`
|
||||||
|
echo $t|jq .
|
||||||
|
done
|
||||||
|
}
|
@ -37,3 +37,34 @@ 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 )
|
||||||
|
|
||||||
|
character=(
|
||||||
|
ai
|
||||||
|
manny
|
||||||
|
quinn
|
||||||
|
chinese
|
||||||
|
kirin
|
||||||
|
leviathan
|
||||||
|
phoenix
|
||||||
|
wyvern
|
||||||
|
cerberus
|
||||||
|
dragon
|
||||||
|
kitsune
|
||||||
|
pegasus
|
||||||
|
)
|
||||||
|
|
||||||
|
character_img=(
|
||||||
|
bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
||||||
|
bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
||||||
|
bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
||||||
|
bafkreidlealfybajqzwv5eoz4jshnsijc2vnktlhpw4ph47krwj6aigqby
|
||||||
|
bafkreiegpqedlrfa4ljhssdnkrr5hyd5huy2xhh2zszj5wq2wuuzejggmq
|
||||||
|
bafkreig6vszkx3c4dcortjwfsz6sa6zwqgj7zpxj4lxfrrkwql4xhiu5ou
|
||||||
|
bafkreich7fsumke2yvumvixkruonzrcevk3f6g2cntzfwdn4n2c2vox5dm
|
||||||
|
bafkreiacjvagsekhiiljz3j237b6klrt6pkptxljt7kltprgg5276gv25q
|
||||||
|
bafkreihpni4lp55jysalcntulzal5rbhidtbseanlucpyucagzxmv6xj24
|
||||||
|
bafkreia3huw2gdenqatoobx3hcft74chced46bw4znfgepo5aenegobkri
|
||||||
|
bafkreidy74aieb6ie646xhosginox5zbnbnrtd76cnt4pbn73hrxgfnple
|
||||||
|
bafkreifnbfj27fr6nv7qeqqmwdibf7qrw4lauvzoknw5hexbifmwqt6kmq
|
||||||
|
)
|
||||||
|
193
scpt/src/ue.zsh
Executable file
@ -0,0 +1,193 @@
|
|||||||
|
case $OSTYPE in
|
||||||
|
darwin*)
|
||||||
|
day=`gdate --iso-8601=seconds`
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
day=`date --iso-8601=seconds`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
function get_game_user() {
|
||||||
|
rkey=$did.$pds
|
||||||
|
pds=bsky.social
|
||||||
|
if [ "$1" = "syui" ] || [ "$1" = "ai" ];then
|
||||||
|
rkey=$1
|
||||||
|
fi
|
||||||
|
req=com.atproto.repo.getRecord
|
||||||
|
url="https://$pds/xrpc/$req?rkey=$rkey&repo=$did_yui&collection=ai.syui.game"
|
||||||
|
curl -sL $url|jq .
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_game_user() {
|
||||||
|
rkey=$2
|
||||||
|
if [ -z "$1" ];then
|
||||||
|
col=ai.syui.game
|
||||||
|
else
|
||||||
|
col=$1
|
||||||
|
fi
|
||||||
|
req=com.atproto.repo.DeleteRecord
|
||||||
|
url=https://$pds/xrpc/$req
|
||||||
|
repo=$did
|
||||||
|
#repo=did:plc:6qyecktefllvenje24fcxnie
|
||||||
|
json="{\"collection\":\"$col\", \"rkey\":\"$rkey\", \"repo\":\"$repo\"}"
|
||||||
|
echo $json
|
||||||
|
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url
|
||||||
|
}
|
||||||
|
|
||||||
|
function ue-user() {
|
||||||
|
col=ai.syui.game
|
||||||
|
rkey=$1
|
||||||
|
handle_yui=$handle
|
||||||
|
did_yui=$did
|
||||||
|
pds=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"|cut -d / -f 3`
|
||||||
|
if [ "$pds" != "syu.is" ];then
|
||||||
|
pds=bsky.social
|
||||||
|
fi
|
||||||
|
version=4
|
||||||
|
#rkey=syui
|
||||||
|
req=com.atproto.repo.putRecord
|
||||||
|
url=https://$pds/xrpc/$req
|
||||||
|
|
||||||
|
cname=dragon
|
||||||
|
|
||||||
|
if [ "$rkey" = "ai" ];then
|
||||||
|
cname=$rkey
|
||||||
|
gender=none
|
||||||
|
fi
|
||||||
|
if [ "$rkey" = "syui" ];then
|
||||||
|
cname=chinese
|
||||||
|
did=$did_syui
|
||||||
|
handle=syui.ai
|
||||||
|
gender=male
|
||||||
|
fi
|
||||||
|
if [ "$rkey" = "self" ];then
|
||||||
|
cname=manny
|
||||||
|
unset did handle gender
|
||||||
|
pds=bsky.social
|
||||||
|
plc=plc.directory
|
||||||
|
fi
|
||||||
|
season=1
|
||||||
|
group=test
|
||||||
|
lv=1
|
||||||
|
hp=1
|
||||||
|
exp=0
|
||||||
|
rare=0
|
||||||
|
mode=0
|
||||||
|
attack=0
|
||||||
|
attack_post=0
|
||||||
|
critical=0
|
||||||
|
critical_d=0
|
||||||
|
card=0
|
||||||
|
weapon=0
|
||||||
|
coin=0
|
||||||
|
count=0
|
||||||
|
|
||||||
|
case $cname in
|
||||||
|
ai)
|
||||||
|
group=origin
|
||||||
|
season=0
|
||||||
|
mode=2
|
||||||
|
;;
|
||||||
|
manny|quinn)
|
||||||
|
group=test
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
group=fantasy
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
json_item="
|
||||||
|
\"coin\": [{\"id\": 0, \"cp\": 0, \"rare\": 0, \"count\": 0}],
|
||||||
|
\"card\": [{\"id\": 0, \"cp\": 0, \"rare\": 0, \"count\": 0}],
|
||||||
|
\"weapon\": [{\"id\": 0, \"cp\": 0, \"rare\": 0, \"count\": 0}]
|
||||||
|
"
|
||||||
|
|
||||||
|
json="
|
||||||
|
{
|
||||||
|
\"repo\": \"$handle_yui\",
|
||||||
|
\"did\": \"$did_yui\",
|
||||||
|
\"collection\": \"$col\",
|
||||||
|
\"rkey\": \"$rkey\",
|
||||||
|
\"record\": {
|
||||||
|
\"version\": $version,
|
||||||
|
\"did\": \"$did\",
|
||||||
|
\"handle\": \"$handle\",
|
||||||
|
\"plc\": \"$plc\",
|
||||||
|
\"pds\": \"$pds\",
|
||||||
|
\"player\": {
|
||||||
|
\"limit\": false,
|
||||||
|
\"login\": false,
|
||||||
|
\"ten\": 0,
|
||||||
|
\"gender\": \"$gender\"
|
||||||
|
},
|
||||||
|
\"character\": {
|
||||||
|
$json
|
||||||
|
},
|
||||||
|
\"item\": {
|
||||||
|
$json_item
|
||||||
|
},
|
||||||
|
\"createdAt\": \"${created}\",
|
||||||
|
\"updatedAt\": \"${created}\"
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
|
||||||
|
if echo $json|jq . ;then
|
||||||
|
echo y
|
||||||
|
read y
|
||||||
|
if [ "y" = "$y" ];then
|
||||||
|
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url`
|
||||||
|
echo $t|jq .
|
||||||
|
#f=~/ai/ue/json/v${version}_${rkey}.json
|
||||||
|
#if [ -f $f ];then
|
||||||
|
# get_game_user $rkey >! $f
|
||||||
|
#fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function ue-system() {
|
||||||
|
col=ai.syui.system
|
||||||
|
rkey=self
|
||||||
|
did=$did
|
||||||
|
handle=$handle
|
||||||
|
pds=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"|cut -d / -f 3`
|
||||||
|
if [ "$pds" != "syu.is" ];then
|
||||||
|
pds=bsky.social
|
||||||
|
fi
|
||||||
|
version=1
|
||||||
|
#rkey=syui
|
||||||
|
req=com.atproto.repo.putRecord
|
||||||
|
url=https://$pds/xrpc/$req
|
||||||
|
imgurl=https://git.syui.ai/ai/ai/raw/branch/main/img/item/card
|
||||||
|
json_card=" \"id\": $id, \"name\": \"$name\", \"img\": \"${imgurl}/${id}.webp\""
|
||||||
|
json_card=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/card.json|jq ".[]"`
|
||||||
|
json_weapon=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/weapon.json|jq ".[]"`
|
||||||
|
json_system=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/system.json|jq ".[]"`
|
||||||
|
json_character=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/character.json|jq ".[]"`
|
||||||
|
json_ability=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/ability.json|jq ".[]"`
|
||||||
|
json="
|
||||||
|
{
|
||||||
|
\"repo\": \"$handle\",
|
||||||
|
\"did\": \"$did\",
|
||||||
|
\"collection\": \"$col\",
|
||||||
|
\"rkey\": \"$rkey\",
|
||||||
|
\"record\": {
|
||||||
|
\"card\": ${json_card},
|
||||||
|
\"weapon\": ${json_weapon},
|
||||||
|
\"system\": ${json_system},
|
||||||
|
\"character\": ${json_character},
|
||||||
|
\"ability\": ${json_ability},
|
||||||
|
\"createdAt\": \"${created}\",
|
||||||
|
\"updatedAt\": \"${created}\"
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
|
||||||
|
if echo $json|jq . ;then
|
||||||
|
echo y
|
||||||
|
read y
|
||||||
|
if [ "y" = "$y" ];then
|
||||||
|
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url`
|
||||||
|
echo $t|jq .
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|