feat: expand scheduling, notifications, and queue runtime
- add scheduled task plumbing across backend core, CLI, and frontend surfaces - add frontend notification UI and keep service pages using the repaired shared stylesheet - refactor code queue runtime and update baidu netdisk/service integration docs
This commit is contained in:
@@ -40,8 +40,8 @@ from pathlib import Path
|
||||
updates = {
|
||||
"UNIDESK_BAIDU_NETDISK_CLIENT_ID": "paste-baidu-client-id-here",
|
||||
"UNIDESK_BAIDU_NETDISK_CLIENT_SECRET": "paste-baidu-client-secret-here",
|
||||
# Optional. Keep the existing value unless you intentionally want another app-folder name.
|
||||
"UNIDESK_BAIDU_NETDISK_APP_ROOT": "/apps/UniDeskBaiduNetdisk",
|
||||
# Optional. "/" makes UniDesk work at the Baidu Netdisk root; use /apps/<name> to sandbox again.
|
||||
"UNIDESK_BAIDU_NETDISK_APP_ROOT": "/",
|
||||
}
|
||||
|
||||
path = Path(".state/docker-compose.env")
|
||||
@@ -68,7 +68,7 @@ PY
|
||||
cd /root/unidesk
|
||||
export UNIDESK_BAIDU_NETDISK_CLIENT_ID='paste-baidu-client-id-here'
|
||||
export UNIDESK_BAIDU_NETDISK_CLIENT_SECRET='paste-baidu-client-secret-here'
|
||||
export UNIDESK_BAIDU_NETDISK_APP_ROOT='/apps/UniDeskBaiduNetdisk'
|
||||
export UNIDESK_BAIDU_NETDISK_APP_ROOT='/'
|
||||
bun scripts/cli.ts server rebuild baidu-netdisk
|
||||
```
|
||||
|
||||
@@ -101,11 +101,11 @@ bun scripts/cli.ts microservice proxy baidu-netdisk /api/auth/device/start --met
|
||||
|
||||
```bash
|
||||
bun scripts/cli.ts microservice proxy baidu-netdisk '/api/account' --raw
|
||||
bun scripts/cli.ts microservice proxy baidu-netdisk '/api/files?dir=/apps/UniDeskBaiduNetdisk&limit=20' --raw
|
||||
bun scripts/cli.ts microservice proxy baidu-netdisk '/api/files?dir=/&limit=20' --raw
|
||||
bun scripts/cli.ts microservice proxy baidu-netdisk /api/self-test --method POST --raw
|
||||
```
|
||||
|
||||
`/api/files` 首次访问空应用目录时应返回 `ok=true` 和文件数组;如果远端应用目录还不存在,后端会先创建 `UNIDESK_BAIDU_NETDISK_APP_ROOT` 指向的 `/apps/...` 目录。`/api/self-test` 会生成小文本、上传、列表确认、下载并比较 MD5,适合授权完成后的端到端验收。
|
||||
`/api/files` 访问根目录时应返回 `ok=true` 和文件数组;`/api/self-test` 会生成小文本、上传到当前 `UNIDESK_BAIDU_NETDISK_APP_ROOT` 指向的工作目录、列表确认、下载并比较 MD5,适合授权完成后的端到端验收。如果你把 `UNIDESK_BAIDU_NETDISK_APP_ROOT` 改回 `/apps/<name>`,后端会在首次访问时确保该应用目录存在。
|
||||
|
||||
## Token Key 轮换
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ Token handling requirements:
|
||||
- Use a PostgreSQL row lock or advisory lock around refresh to avoid two workers spending the same refresh token concurrently.
|
||||
- Never log tokens or dlinks; health/status endpoints should only expose redacted auth state.
|
||||
|
||||
### Scope and App Folder
|
||||
### Scope and Remote Root
|
||||
|
||||
Use `scope=basic,netdisk`. Official docs describe third-party app data under `/apps/<productName>` and visible to users as `/我的应用数据/<productName>`. The service should default to a configured app root, for example `/apps/UniDeskBaiduNetdisk`, and reject paths outside that root unless the final approved app permission explicitly allows broader access.
|
||||
Use `scope=basic,netdisk`. Official docs for download still describe third-party app data under `/apps/<productName>` and visible to users as `/我的应用数据/<productName>`, but the file-list docs also define `dir` as an absolute path defaulting to `/`. On 2026-05-13, the current UniDesk Baidu application and authorized account were tested directly against the official APIs: listing `/`, uploading a tiny temporary file to `/unidesk-root-probe-*.txt`, obtaining its `dlink`, downloading it back, verifying MD5, and deleting it all succeeded with `errno=0`. Therefore UniDesk now defaults `UNIDESK_BAIDU_NETDISK_APP_ROOT` to `/` and treats it as the remote working root. Operators can still set `UNIDESK_BAIDU_NETDISK_APP_ROOT=/apps/<name>` to re-enable an app-folder sandbox.
|
||||
|
||||
### Browse and Metadata
|
||||
|
||||
@@ -127,7 +127,7 @@ Expose a pure JSON control API first:
|
||||
- `POST /api/auth/refresh`: force token refresh for diagnostics.
|
||||
- `POST /api/auth/logout`: revoke local tokens and stop jobs.
|
||||
- `GET /api/account`: user info and quota.
|
||||
- `GET /api/files?dir=/apps/UniDeskBaiduNetdisk&start=0&limit=100`: directory listing.
|
||||
- `GET /api/files?dir=/&start=0&limit=100`: directory listing under the configured remote working root.
|
||||
- `GET /api/files/meta?fsids=...&dlink=0|1`: metadata, optionally dlink redacted by default.
|
||||
- `POST /api/folders`: create folder through `method=create&isdir=1`.
|
||||
- `POST /api/files/manage`: copy/move/rename/delete using `method=filemanager`.
|
||||
@@ -205,8 +205,8 @@ If deployed on main server, use a Compose service name such as `http://baidu-net
|
||||
Add a dedicated `src/components/frontend/src/baidu-netdisk.tsx` page and route tab:
|
||||
|
||||
- Login panel: QR image from `qrcode_url`, user code, expires timer, poll status, refresh QR and logout buttons.
|
||||
- Account cards: username, UID, quota used/total, VIP state, app root path.
|
||||
- File browser: breadcrumb rooted at `/apps/<appName>`, paginated table, folder creation, rename/delete/move controls.
|
||||
- Account cards: username, UID, quota used/total, VIP state, remote working root path.
|
||||
- File browser: breadcrumb rooted at the configured working root, now `/` by default, paginated table, folder creation, rename/delete/move controls.
|
||||
- Transfer panel: upload-from-path form, download-to-path form, job rows, progress bars, speed, ETA, retry/cancel buttons.
|
||||
- Safety text: private backend mapping, token storage redacted, no direct public Baidu token exposure.
|
||||
- Raw JSON only behind explicit buttons, following existing user-service conventions.
|
||||
@@ -219,7 +219,7 @@ Focused checks after implementation:
|
||||
- `bun scripts/cli.ts microservice health baidu-netdisk` returns `ok=true`, `service=baidu-netdisk`, `storage=postgres` and redacted auth state.
|
||||
- `bun scripts/cli.ts microservice proxy baidu-netdisk /api/auth/device/start --method POST` returns a login session with QR/user-code metadata but no token.
|
||||
- After manual QR authorization, `/api/account` and `/api/files?dir=<root>` return user/quota/list data.
|
||||
- Upload/download tests can use `bun scripts/cli.ts microservice proxy baidu-netdisk /api/self-test --method POST --raw`; the response must include a remote path in the app root, an `fsId`, succeeded upload/download jobs, and matching `expectedMd5`/`downloadedMd5`.
|
||||
- Upload/download tests can use `bun scripts/cli.ts microservice proxy baidu-netdisk /api/self-test --method POST --raw`; the response must include a remote path in the working root, an `fsId`, succeeded upload/download jobs, and matching `expectedMd5`/`downloadedMd5`.
|
||||
- Public port probes must fail for the service port; frontend access only through UniDesk.
|
||||
- Playwright verifies `/app/baidu-netdisk/` renders shell, login card, account/quota, file browser, transfer panel and no naked JSON.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user