Skip to content

Commit 4822784

Browse files
PIKACHUIMSuyunmeng
andauthored
fix(driver): 123 official app url error (#80)
* fix(driver): 123 official app url error * fix(driver): support 123cloud token refresh via renewapi * fix(scripts): escape cloud123_url sed replacement value * fix(gitignore): add dist/ to .gitignore --------- Co-authored-by: Suyunmeng <Susus0175@proton.me>
1 parent 745fed4 commit 4822784

18 files changed

Lines changed: 198 additions & 31 deletions

.env.example

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,9 @@ dropboxs_key=
3434

3535
# Quark配置
3636
quarkpan_uid=
37-
quarkpan_key=
37+
quarkpan_key=
38+
39+
# 123云盘配置
40+
cloud123_uid=
41+
cloud123_key=
42+
cloud123_url=

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ wrangler.encrypt.jsonc
1919
.edgeone/*
2020
!.edgeone/project.json
2121
.tef_dist/*
22+
dist/

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ docker run -d --name oplist-api-server \
6161
-e OPLIST_DROPBOXS_KEY= `#optional` \
6262
-e OPLIST_QUARKPAN_UID= `#optional` \
6363
-e OPLIST_QUARKPAN_KEY= `#optional` \
64+
-e OPLIST_CLOUD123_UID= `#optional` \
65+
-e OPLIST_CLOUD123_KEY= `#optional` \
66+
-e OPLIST_CLOUD123_URL= `#optional` \
6467
openlistteam/openlist_api_server:latest
6568
```
6669
- 可以替换镜像为ghcr:
@@ -92,6 +95,9 @@ docker run -d --name oplist-api-server \
9295
| `OPLIST_DROPBOXS_KEY` || string | Dropbox应用密钥 |
9396
| `OPLIST_QUARKPAN_UID` || string | 夸克云盘x应用ID |
9497
| `OPLIST_QUARKPAN_KEY` || string | 夸克云盘应用密钥 |
98+
| `OPLIST_CLOUD123_UID` || string | 123云盘客户端ID |
99+
| `OPLIST_CLOUD123_KEY` || string | 123云盘客户端密钥 |
100+
| `OPLIST_CLOUD123_URL` || string | 123云盘API地址 |
95101

96102

97103
### 边缘部署
@@ -133,7 +139,10 @@ cp wrangler.example.jsonc wrangler.encrypt.jsonc
133139
"dropboxs_uid": "*****************************",
134140
"dropboxs_key": "*****************************",
135141
"quarkpan_uid": "*****************************",
136-
"quarkpan_key": "*****************************"
142+
"quarkpan_key": "*****************************",
143+
"cloud123_uid": "*****************************",
144+
"cloud123_key": "*****************************",
145+
"cloud123_url": "*****************************"
137146
},
138147
```
139148

@@ -160,6 +169,9 @@ cp wrangler.example.jsonc wrangler.encrypt.jsonc
160169
| `dropboxs_key` || string | Dropbox应用密钥 |
161170
| `quarkpan_uid` || string | 夸克云盘x应用ID |
162171
| `quarkpan_key` || string | 夸克云盘应用密钥 |
172+
| `cloud123_uid` || string | 123云盘客户端ID |
173+
| `cloud123_key` || string | 123云盘客户端密钥 |
174+
| `cloud123_url` || string | 123云盘API地址 |
163175

164176

165177
#### 测试代码

docker-compose.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ services:
2323
- OPLIST_DROPBOXS_UID= #optional
2424
- OPLIST_DROPBOXS_KEY= #optional
2525
- OPLIST_QUARKPAN_UID= #optional
26-
- OPLIST_QUARKPAN_KEY= #optional
26+
- OPLIST_QUARKPAN_KEY= #optional
27+
- OPLIST_CLOUD123_UID= #optional
28+
- OPLIST_CLOUD123_KEY= #optional
29+
- OPLIST_CLOUD123_URL= #optional

entrypoint-lite.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,31 @@ else
152152
sed -i "s|quarkpan_key=.*|quarkpan_key=${OPLIST_QUARKPAN_KEY}|" .env
153153
fi
154154

155+
# 替换.env文件中的cloud123_uid
156+
if [ -z "${OPLIST_CLOUD123_UID}" ]; then
157+
echo "CLOUD123_UID is not set, skipping replacement."
158+
else
159+
echo "Replacing cloud123_uid in .env file..."
160+
sed -i "s|cloud123_uid=.*|cloud123_uid=${OPLIST_CLOUD123_UID}|" .env
161+
fi
162+
163+
# 替换.env文件中的cloud123_key
164+
if [ -z "${OPLIST_CLOUD123_KEY}" ]; then
165+
echo "CLOUD123_KEY is not set, skipping replacement."
166+
else
167+
echo "Replacing cloud123_key in .env file..."
168+
sed -i "s|cloud123_key=.*|cloud123_key=${OPLIST_CLOUD123_KEY}|" .env
169+
fi
170+
171+
# 替换.env文件中的cloud123_url
172+
if [ -z "${OPLIST_CLOUD123_URL}" ]; then
173+
echo "CLOUD123_URL is not set, skipping replacement."
174+
else
175+
echo "Replacing cloud123_url in .env file..."
176+
ESCAPED_CLOUD123_URL=$(printf '%s' "${OPLIST_CLOUD123_URL}" | sed 's/[&|\\]/\\&/g')
177+
sed -i "s|cloud123_url=.*|cloud123_url=${ESCAPED_CLOUD123_URL}|" .env
178+
fi
179+
155180
# 执行npm run dev
156181
echo "Starting wrangler dev..."
157182
npm run build-js && npm run deploy-js

entrypoint.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
# "dropboxs_key": "",
1818
# "quarkpan_uid": "",
1919
# "quarkpan_key": "",
20+
# "cloud123_uid": "",
21+
# "cloud123_key": "",
22+
# "cloud123_url": "",
2023

2124
#替换目录下wrangler文件中的MAIN_URLS
2225
if [ -z "${OPLIST_MAIN_URLS}" ]; then
@@ -151,6 +154,28 @@ else
151154
echo "Replacing quarkpan_key in wrangler file..."
152155
sed -i "s|\"quarkpan_key\":.*|\"quarkpan_key\": \"${OPLIST_QUARKPAN_KEY}\",|" ./wrangler.jsonc
153156
fi
157+
# 替换目录下wrangler文件中的cloud123_uid
158+
if [ -z "${OPLIST_CLOUD123_UID}" ]; then
159+
echo "CLOUD123_UID is not set, skipping replacement."
160+
else
161+
echo "Replacing cloud123_uid in wrangler file..."
162+
sed -i "s|\"cloud123_uid\":.*|\"cloud123_uid\": \"${OPLIST_CLOUD123_UID}\",|" ./wrangler.jsonc
163+
fi
164+
# 替换目录下wrangler文件中的cloud123_key
165+
if [ -z "${OPLIST_CLOUD123_KEY}" ]; then
166+
echo "CLOUD123_KEY is not set, skipping replacement."
167+
else
168+
echo "Replacing cloud123_key in wrangler file..."
169+
sed -i "s|\"cloud123_key\":.*|\"cloud123_key\": \"${OPLIST_CLOUD123_KEY}\",|" ./wrangler.jsonc
170+
fi
171+
# 替换目录下wrangler文件中的cloud123_url
172+
if [ -z "${OPLIST_CLOUD123_URL}" ]; then
173+
echo "CLOUD123_URL is not set, skipping replacement."
174+
else
175+
echo "Replacing cloud123_url in wrangler file..."
176+
ESCAPED_CLOUD123_URL=$(printf '%s' "${OPLIST_CLOUD123_URL}" | sed 's/[&|\\]/\\&/g')
177+
sed -i "s|\"cloud123_url\":.*|\"cloud123_url\": \"${ESCAPED_CLOUD123_URL}\",|" ./wrangler.jsonc
178+
fi
154179

155180

156181
echo "Modified wrangler.jsonc file:"

0 commit comments

Comments
 (0)