@whyour/qinglong 2.21.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/.dockerignore +13 -0
  2. package/.env.example +7 -0
  3. package/AGENTS.md +2 -2
  4. package/README-en.md +24 -0
  5. package/README.md +24 -0
  6. package/back/protos/api.proto +9 -1
  7. package/back/protos/cron.proto +4 -1
  8. package/deploy/kubernetes/README.md +81 -0
  9. package/deploy/kubernetes/base/kustomization.yaml +5 -0
  10. package/deploy/kubernetes/base/qinglong.yaml +95 -0
  11. package/deploy/kubernetes/overlays/example/kustomization.yaml +10 -0
  12. package/docker/Dockerfile +31 -12
  13. package/docker/Dockerfile.310 +31 -12
  14. package/docker/Dockerfile.debian +22 -14
  15. package/docker/Dockerfile.debian310 +24 -14
  16. package/docker/build-manifest.cjs +28 -0
  17. package/docker/verify-build.cjs +49 -0
  18. package/docs/releases/2.22.0-validation.md +49 -0
  19. package/docs/releases/2.22.0.md +54 -0
  20. package/ecosystem.config.js +10 -1
  21. package/package.json +11 -6
  22. package/sample/config.sample.sh +17 -2
  23. package/sample/notify.js +118 -0
  24. package/sample/notify.py +93 -0
  25. package/scripts/benchmark-execution.cjs +96 -0
  26. package/scripts/write-build-info.cjs +27 -0
  27. package/shell/api.sh +41 -14
  28. package/shell/check.sh +59 -19
  29. package/shell/lang/en.sh +6 -0
  30. package/shell/lang/zh.sh +6 -0
  31. package/shell/node_path_cache.sh +128 -0
  32. package/shell/otask.sh +10 -1
  33. package/shell/preload/sitecustomize.js +5 -1
  34. package/shell/share.sh +26 -9
  35. package/shell/start.sh +6 -3
  36. package/shell/task.sh +13 -3
  37. package/shell/update.sh +65 -4
  38. package/static/build/api/clientIp.js +42 -0
  39. package/static/build/api/config.js +8 -16
  40. package/static/build/api/cron.js +39 -3
  41. package/static/build/api/dashboard.js +50 -6
  42. package/static/build/api/env.js +2 -2
  43. package/static/build/api/health.js +2 -2
  44. package/static/build/api/index.js +4 -0
  45. package/static/build/api/log.js +39 -19
  46. package/static/build/api/retention.js +63 -0
  47. package/static/build/api/script.js +23 -22
  48. package/static/build/api/subscription.js +16 -2
  49. package/static/build/api/system.js +31 -9
  50. package/static/build/api/user.js +75 -15
  51. package/static/build/app.js +63 -54
  52. package/static/build/bootstrap/database.js +51 -0
  53. package/static/build/config/const.js +2 -0
  54. package/static/build/config/grpcCerts.js +4 -4
  55. package/static/build/config/index.js +0 -4
  56. package/static/build/config/share.js +5 -4
  57. package/static/build/config/util.js +136 -41
  58. package/static/build/data/cron.js +1 -0
  59. package/static/build/data/notify.js +18 -1
  60. package/static/build/data/sock.js +1 -0
  61. package/static/build/loaders/app.js +8 -6
  62. package/static/build/loaders/db.js +5 -35
  63. package/static/build/loaders/deps.js +30 -22
  64. package/static/build/loaders/express.js +44 -32
  65. package/static/build/loaders/initData.js +10 -7
  66. package/static/build/loaders/initFile.js +1 -1
  67. package/static/build/loaders/initTask.js +3 -2
  68. package/static/build/loaders/server.js +1 -1
  69. package/static/build/loaders/sock.js +72 -6
  70. package/static/build/middlewares/monitoring.js +12 -33
  71. package/static/build/middlewares/protectedPathCase.js +17 -0
  72. package/static/build/protos/api.js +78 -2
  73. package/static/build/protos/cron.js +21 -4
  74. package/static/build/protos/health.js +1 -1
  75. package/static/build/schedule/addCron.js +76 -10
  76. package/static/build/schedule/api.js +5 -2
  77. package/static/build/schedule/client.js +38 -6
  78. package/static/build/schedule/delCron.js +11 -1
  79. package/static/build/schedule/health.js +72 -7
  80. package/static/build/services/config.js +5 -42
  81. package/static/build/services/cron.js +353 -164
  82. package/static/build/services/dependence.js +66 -18
  83. package/static/build/services/grpc.js +2 -2
  84. package/static/build/services/health.js +4 -7
  85. package/static/build/services/http.js +9 -3
  86. package/static/build/services/log.js +2 -3
  87. package/static/build/services/metrics.js +46 -14
  88. package/static/build/services/notify.js +73 -5
  89. package/static/build/services/retention.js +123 -0
  90. package/static/build/services/schedule.js +57 -33
  91. package/static/build/services/script.js +4 -5
  92. package/static/build/services/subscription.js +57 -34
  93. package/static/build/services/system.js +49 -11
  94. package/static/build/services/user.js +244 -31
  95. package/static/build/shared/auth.js +22 -3
  96. package/static/build/shared/authMutation.js +17 -0
  97. package/static/build/shared/childProcess.js +82 -0
  98. package/static/build/shared/clientIp.js +27 -0
  99. package/static/build/shared/errors.js +9 -0
  100. package/static/build/shared/fileAccess.js +60 -0
  101. package/static/build/shared/i18n.js +62 -4
  102. package/static/build/shared/logReader.js +85 -0
  103. package/static/build/shared/logStreamManager.js +80 -60
  104. package/static/build/shared/pLimit.js +3 -2
  105. package/static/build/shared/password.js +30 -0
  106. package/static/build/shared/retention.js +58 -0
  107. package/static/build/shared/runCron.js +28 -15
  108. package/static/build/shared/schedulerMutationLock.js +44 -0
  109. package/static/build/shared/schedulerReadiness.js +82 -0
  110. package/static/build/shared/schemaMigrations.js +58 -0
  111. package/static/build/shared/startupProcess.js +48 -0
  112. package/static/build/shared/store.js +7 -0
  113. package/static/build/shared/trustProxy.js +119 -0
  114. package/static/build/validation/schedule.js +12 -3
  115. package/static/dist/{1885.e1ea09f6.async.js → 1885.b8f427bf.async.js} +1 -1
  116. package/static/dist/2031.6af40025.async.js +1 -0
  117. package/static/dist/2693.51c2636b.async.js +1 -0
  118. package/static/dist/{2890.9e373f5b.async.js → 2890.add55e85.async.js} +1 -1
  119. package/static/dist/2901.2ca95295.async.js +1 -0
  120. package/static/dist/445.a65ff63b.async.js +1 -0
  121. package/static/dist/4736.1d2b5cb6.async.js +1 -0
  122. package/static/dist/{4859.6592cebb.async.js → 4859.97d6653c.async.js} +1 -1
  123. package/static/dist/{6013.4e38de36.async.js → 6013.db535339.async.js} +1 -1
  124. package/static/dist/6212.9e6d9913.async.js +1 -0
  125. package/static/dist/{6339.ab305e96.async.js → 6431.4603ad0e.async.js} +1 -1
  126. package/static/dist/{6872.42f939f1.async.js → 6872.a503ef55.async.js} +1 -1
  127. package/static/dist/7231.f7e5b668.async.js +1 -0
  128. package/static/dist/{7355.f9f263d8.async.js → 7355.fca746f5.async.js} +1 -1
  129. package/static/dist/{7508.7dcee91c.async.js → 7508.d90eac63.async.js} +1 -1
  130. package/static/dist/{7984.594296a5.async.js → 7984.eaac7402.async.js} +1 -1
  131. package/static/dist/8844.a0fef08e.async.js +1 -0
  132. package/static/dist/index.html +2 -2
  133. package/static/dist/layouts__index.633d3553.async.js +1 -0
  134. package/static/dist/preload_helper.cf7de3fa.js +1 -0
  135. package/static/dist/{src__pages__config__index.a22ff7dc.async.js → src__pages__config__index.9aba4054.async.js} +1 -1
  136. package/static/dist/src__pages__crontab__detail.86b2eebb.async.js +1 -0
  137. package/static/dist/src__pages__crontab__index.ae4e06f2.async.js +1 -0
  138. package/static/dist/{src__pages__crontab__logModal.0b8cce8c.async.js → src__pages__crontab__logModal.930535e2.async.js} +1 -1
  139. package/static/dist/src__pages__crontab__modal.a2c8fdcc.async.js +1 -0
  140. package/static/dist/src__pages__crontab__viewCreateModal.7b4f9cbe.async.js +1 -0
  141. package/static/dist/src__pages__crontab__viewManageModal.cd454ea0.async.js +1 -0
  142. package/static/dist/src__pages__dashboard__index.243c5a35.async.js +1 -0
  143. package/static/dist/src__pages__dashboard__taskResultModal.7795d6e1.async.js +1 -0
  144. package/static/dist/src__pages__dependence__index.874d501f.async.js +1 -0
  145. package/static/dist/src__pages__dependence__logModal.154efe7a.async.js +1 -0
  146. package/static/dist/src__pages__dependence__modal.a29c1a0f.async.js +1 -0
  147. package/static/dist/{src__pages__diff__index.013b7c75.async.js → src__pages__diff__index.1714b941.async.js} +1 -1
  148. package/static/dist/src__pages__env__editNameModal.c13d47d2.async.js +1 -0
  149. package/static/dist/src__pages__env__index.fd6fd2b0.async.js +1 -0
  150. package/static/dist/src__pages__env__modal.4d71adb3.async.js +1 -0
  151. package/static/dist/src__pages__error__index.aae50c94.async.js +1 -0
  152. package/static/dist/src__pages__initialization__index.82a2e967.async.js +1 -0
  153. package/static/dist/src__pages__log__index.71250e0d.async.js +1 -0
  154. package/static/dist/{src__pages__login__index.8c813eb1.async.js → src__pages__login__index.a0fd5ed8.async.js} +1 -1
  155. package/static/dist/src__pages__script__editModal.22acdf7c.async.js +1 -0
  156. package/static/dist/src__pages__script__editNameModal.1a521cc0.async.js +1 -0
  157. package/static/dist/src__pages__script__index.a18b2692.async.js +1 -0
  158. package/static/dist/src__pages__script__renameModal.0ab029e7.async.js +1 -0
  159. package/static/dist/src__pages__script__saveModal.8965b74c.async.js +1 -0
  160. package/static/dist/src__pages__script__setting.35ad4f02.async.js +1 -0
  161. package/static/dist/src__pages__setting__appModal.7eaeb9d3.async.js +1 -0
  162. package/static/dist/src__pages__setting__checkUpdate.d175b154.async.js +1 -0
  163. package/static/dist/src__pages__setting__clientIp.3a8711ed.async.js +1 -0
  164. package/static/dist/src__pages__setting__dependence.9c0f749b.async.js +1 -0
  165. package/static/dist/src__pages__setting__index.cb397741.async.js +1 -0
  166. package/static/dist/src__pages__setting__loginLog.e0a1f54d.async.js +1 -0
  167. package/static/dist/src__pages__setting__notification.2ffe4e5a.async.js +1 -0
  168. package/static/dist/src__pages__setting__other.3d0b8492.async.js +1 -0
  169. package/static/dist/{src__pages__setting__progress.8823ac90.async.js → src__pages__setting__progress.2ccae3d7.async.js} +1 -1
  170. package/static/dist/src__pages__setting__security.e2d71ebb.async.js +1 -0
  171. package/static/dist/src__pages__setting__systemLog.b3046955.async.js +1 -0
  172. package/static/dist/src__pages__subscription__index.43086a06.async.js +1 -0
  173. package/static/dist/src__pages__subscription__logModal.cdba5139.async.js +1 -0
  174. package/static/dist/src__pages__subscription__modal.38991e1e.async.js +1 -0
  175. package/static/dist/{umi.ca04a019.js → umi.fc019050.js} +1 -1
  176. package/test/back/auth-security.test.cjs +74 -0
  177. package/test/back/build-provenance.test.cjs +150 -0
  178. package/test/back/cron-log-name.test.cjs +110 -0
  179. package/test/back/cron-validation.test.cjs +45 -0
  180. package/test/back/dashboard-failures.test.cjs +173 -0
  181. package/test/back/database-bootstrap.test.cjs +193 -0
  182. package/test/back/dependence-cache-status.test.cjs +125 -0
  183. package/test/back/deprecated-file-routes.test.cjs +82 -0
  184. package/test/back/ecosystem.test.cjs +28 -0
  185. package/test/back/env-name-parsing.test.cjs +96 -0
  186. package/test/back/execution-lifecycle.test.cjs +236 -0
  187. package/test/back/file-access-security.test.cjs +47 -0
  188. package/test/back/fileTreeListing.test.cjs +57 -0
  189. package/test/back/grpc-cron-response.test.cjs +60 -0
  190. package/test/back/http-exclusive-listen.test.cjs +31 -0
  191. package/test/back/http-security.test.cjs +213 -0
  192. package/test/back/listen-security.test.cjs +67 -0
  193. package/test/back/log-path-security.test.cjs +158 -0
  194. package/test/back/logReader.test.cjs +72 -0
  195. package/test/back/manual-execution.test.cjs +85 -0
  196. package/test/back/manual-stop-claim.test.cjs +220 -0
  197. package/test/back/metrics.test.cjs +34 -0
  198. package/test/back/monitoring.test.cjs +73 -0
  199. package/test/back/node-path-cache.test.cjs +173 -0
  200. package/test/back/node-path-lock.test.cjs +178 -0
  201. package/test/back/npm-publication.test.cjs +70 -0
  202. package/test/back/primary-apm.test.cjs +24 -0
  203. package/test/back/process-exit-state.test.cjs +81 -0
  204. package/test/back/process-stop-signal.test.cjs +77 -0
  205. package/test/back/protected-path-case.test.cjs +58 -0
  206. package/test/back/qlServiceLogCommand.test.cjs +128 -0
  207. package/test/back/retention.test.cjs +131 -0
  208. package/test/back/role-loading.test.cjs +118 -0
  209. package/test/back/schedule-health.test.cjs +86 -0
  210. package/test/back/scheduler-file-lock.test.cjs +51 -0
  211. package/test/back/scheduler-mutation.test.cjs +312 -0
  212. package/test/back/scheduler-readiness.test.cjs +85 -0
  213. package/test/back/scheduler-reconciliation.test.cjs +152 -0
  214. package/test/back/scheduler-rpc-timeout.test.cjs +49 -0
  215. package/test/back/schema-migrations.test.cjs +127 -0
  216. package/test/back/shell-api-parsing.test.cjs +184 -0
  217. package/test/back/sock-polling.test.cjs +297 -0
  218. package/test/back/sock-security.test.cjs +72 -0
  219. package/test/back/start-env-preservation.test.cjs +53 -0
  220. package/test/back/stop-failure-feedback.test.cjs +158 -0
  221. package/test/back/stop-race.test.cjs +167 -0
  222. package/test/back/subscription-cleanup.test.cjs +53 -0
  223. package/test/back/subscription-stop-state.test.cjs +66 -0
  224. package/test/back/system-dependence-cache.test.cjs +126 -0
  225. package/test/back/task-time.test.cjs +116 -0
  226. package/test/back/user-api.test.cjs +99 -0
  227. package/test/back/user-security.test.cjs +248 -0
  228. package/test/back/worker-apm.test.cjs +84 -0
  229. package/test/back/wpush-grpc.test.cjs +115 -0
  230. package/test/front/cron-log-pagination.test.cjs +214 -0
  231. package/test/front/http-auth.test.cjs +152 -0
  232. package/test/front/http-error.test.cjs +29 -0
  233. package/test/helpers/load-security-module.cjs +42 -0
  234. package/version.yaml +19 -34
  235. package/CLAUDE.md +0 -43
  236. package/static/dist/1147.c420132e.async.js +0 -1
  237. package/static/dist/134.54df9e38.async.js +0 -1
  238. package/static/dist/2208.f7ba3dfa.async.js +0 -1
  239. package/static/dist/2286.164bb089.async.js +0 -1
  240. package/static/dist/3191.63263871.async.js +0 -1
  241. package/static/dist/4902.555f92ab.async.js +0 -1
  242. package/static/dist/5520.ff2cfd6b.async.js +0 -1
  243. package/static/dist/6431.c50479be.async.js +0 -1
  244. package/static/dist/8826.2447a104.async.js +0 -1
  245. package/static/dist/layouts__index.a7a2bfe0.async.js +0 -1
  246. package/static/dist/preload_helper.0431c0f3.js +0 -1
  247. package/static/dist/src__pages__crontab__detail.b9c36808.async.js +0 -1
  248. package/static/dist/src__pages__crontab__index.fed99fd0.async.js +0 -1
  249. package/static/dist/src__pages__crontab__modal.f7041c7c.async.js +0 -1
  250. package/static/dist/src__pages__crontab__viewCreateModal.4d589f66.async.js +0 -1
  251. package/static/dist/src__pages__crontab__viewManageModal.0e317746.async.js +0 -1
  252. package/static/dist/src__pages__dashboard__index.b30f2f47.async.js +0 -1
  253. package/static/dist/src__pages__dependence__index.3d87ceac.async.js +0 -1
  254. package/static/dist/src__pages__dependence__logModal.0681830b.async.js +0 -1
  255. package/static/dist/src__pages__dependence__modal.11124896.async.js +0 -1
  256. package/static/dist/src__pages__env__editNameModal.5d264b25.async.js +0 -1
  257. package/static/dist/src__pages__env__index.baa27d4e.async.js +0 -1
  258. package/static/dist/src__pages__env__modal.7f2ef1bc.async.js +0 -1
  259. package/static/dist/src__pages__error__index.f156b45e.async.js +0 -1
  260. package/static/dist/src__pages__initialization__index.e96d4ba8.async.js +0 -1
  261. package/static/dist/src__pages__log__index.e0978bae.async.js +0 -1
  262. package/static/dist/src__pages__script__editModal.cbf4ec0e.async.js +0 -1
  263. package/static/dist/src__pages__script__editNameModal.3e7e100d.async.js +0 -1
  264. package/static/dist/src__pages__script__index.2765d1b8.async.js +0 -1
  265. package/static/dist/src__pages__script__renameModal.5e987ef5.async.js +0 -1
  266. package/static/dist/src__pages__script__saveModal.3f9d23d6.async.js +0 -1
  267. package/static/dist/src__pages__script__setting.a535793a.async.js +0 -1
  268. package/static/dist/src__pages__setting__appModal.251cd14f.async.js +0 -1
  269. package/static/dist/src__pages__setting__checkUpdate.46efe057.async.js +0 -1
  270. package/static/dist/src__pages__setting__dependence.8a7a9529.async.js +0 -1
  271. package/static/dist/src__pages__setting__index.cc85fdfb.async.js +0 -1
  272. package/static/dist/src__pages__setting__loginLog.cea6056c.async.js +0 -1
  273. package/static/dist/src__pages__setting__notification.390fc905.async.js +0 -1
  274. package/static/dist/src__pages__setting__other.b22d2165.async.js +0 -1
  275. package/static/dist/src__pages__setting__security.598720a8.async.js +0 -1
  276. package/static/dist/src__pages__setting__systemLog.67406721.async.js +0 -1
  277. package/static/dist/src__pages__subscription__index.d0ab2abc.async.js +0 -1
  278. package/static/dist/src__pages__subscription__logModal.3864b37f.async.js +0 -1
  279. package/static/dist/src__pages__subscription__modal.3562c670.async.js +0 -1
package/.dockerignore ADDED
@@ -0,0 +1,13 @@
1
+ .git
2
+ .gitnexus
3
+ .claude
4
+ .codex
5
+ .env*
6
+ node_modules
7
+ data
8
+ audit
9
+ docs
10
+ test
11
+ src/.umi*
12
+ **/__pycache__
13
+ **/*.log
package/.env.example CHANGED
@@ -6,6 +6,13 @@ BACK_PORT=5700
6
6
  # BIND_HOST=0.0.0.0
7
7
  # BIND_HOST_GRPC=0.0.0.0
8
8
 
9
+ # 可信反向代理。未设置时可在「系统设置 → 客户端 IP」中配置和诊断。
10
+ # 环境变量优先级高于系统设置。支持固定层数、IP、CIDR 或逗号分隔列表:
11
+ # QL_TRUST_PROXY=1
12
+ # QL_TRUST_PROXY=loopback,172.18.0.0/16,10.20.0.8/32
13
+ # 仅在面板端口绝对无法绕过代理直接访问时使用 true。
14
+ # QL_TRUST_PROXY=loopback
15
+
9
16
  LOG_LEVEL='info'
10
17
 
11
18
  JWT_SECRET=
package/AGENTS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!-- gitnexus:start -->
2
2
  # GitNexus — Code Intelligence
3
3
 
4
- This project is indexed by GitNexus as **qinglong** (2740 symbols, 6583 relationships, 230 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
4
+ This project is indexed by GitNexus as **qinglong** (2778 symbols, 6698 relationships, 233 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
5
5
 
6
6
  > Index stale? Run `node .gitnexus/run.cjs analyze` from the project root — it auto-selects an available runner. No `.gitnexus/run.cjs` yet? `npx gitnexus analyze` (npm 11 crash → `npm i -g gitnexus`; #1939).
7
7
 
@@ -40,4 +40,4 @@ This project is indexed by GitNexus as **qinglong** (2740 symbols, 6583 relation
40
40
  | Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` |
41
41
  | Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` |
42
42
 
43
- <!-- gitnexus:end -->
43
+ <!-- gitnexus:end -->
package/README-en.md CHANGED
@@ -34,6 +34,7 @@ Timed task management platform supporting Python3, JavaScript, Shell, Typescript
34
34
  - Support system level notification
35
35
  - Support dark mode
36
36
  - Support cell phone operation
37
+ - Manage panels through the [remote CLI and Agent Skill](#remote-cli-and-agent-skill)
37
38
 
38
39
  ## Version
39
40
 
@@ -79,6 +80,29 @@ npm i @whyour/qinglong
79
80
 
80
81
  [View Documentation](https://qinglong.online/guide/user-guide/basic-explanation)
81
82
 
83
+ ## Remote CLI and Agent Skill
84
+
85
+ Use the standalone npm package [@whyour/qinglong-cli](https://www.npmjs.com/package/@whyour/qinglong-cli) to manage a remote QingLong panel from your terminal or automation workflows. Create, update and run tasks and subscriptions, inspect logs, and manage applications, environment variables, scripts, configuration, dependencies and other OpenAPI resources. JSON output supports scripts and AI agents.
86
+
87
+ Requires Node.js >=22.12; Node.js 24 is recommended. Install the package to use `ql`:
88
+
89
+ ```bash
90
+ npm install -g @whyour/qinglong-cli
91
+ ql login --url https://ql.example.com
92
+ ql auth status --json
93
+ ql task list --json
94
+ ql subscription list --json
95
+ ql --help
96
+ ```
97
+
98
+ Create an application in the panel's System Settings → Application Settings and grant the required permissions. Enter its Client ID/Secret when prompted during login. Existing tokens are also supported through `QL_URL` and `QL_ACCESS_TOKEN`. Each command supports `--help`; set `QL_LANG=en` for English help.
99
+
100
+ The npm CLI manages remote panels. The panel's built-in executable is also named `ql`; use a separate installation directory on panel hosts to avoid replacing it. For local script execution and maintenance, see [panel-internal tools](cli/LOCAL.en.md).
101
+
102
+ [CLI guide](cli/README.en.md) · [简体中文](cli/README.md) · [Full command reference](cli/skills/qinglong-cli/references/openapi.md)
103
+
104
+ The package includes a [remote management skill](cli/skills/qinglong-cli/SKILL.md) covering authentication, command selection and result verification for AI agents. Local execution and maintenance have a separate [internal skill](cli/skills/qinglong-local/SKILL.md).
105
+
82
106
  ## Development
83
107
 
84
108
  ```bash
package/README.md CHANGED
@@ -36,6 +36,7 @@ Timed task management platform supporting Python3, JavaScript, Shell, Typescript
36
36
  - 支持系统级通知
37
37
  - 支持暗黑模式
38
38
  - 支持手机端操作
39
+ - 支持通过 [远程 CLI 与 Agent Skill](#远程-cli-与-agent-skill) 管理面板
39
40
 
40
41
  ## 版本
41
42
 
@@ -81,6 +82,29 @@ npm i @whyour/qinglong
81
82
 
82
83
  [查看文档](https://qinglong.online/guide/user-guide/basic-explanation)
83
84
 
85
+ ## 远程 CLI 与 Agent Skill
86
+
87
+ 使用独立 npm 包 [@whyour/qinglong-cli](https://www.npmjs.com/package/@whyour/qinglong-cli),可以从本机终端或自动化流程管理远程青龙面板。支持任务与订阅的创建、修改、运行和日志查看,以及应用、环境变量、脚本、配置、依赖等 OpenAPI 资源;JSON 输出便于脚本和 AI Agent 使用。
88
+
89
+ 需要 Node.js >=22.12,推荐 Node.js 24。安装后使用 `ql` 命令:
90
+
91
+ ```bash
92
+ npm install -g @whyour/qinglong-cli
93
+ ql login --url https://ql.example.com
94
+ ql auth status --json
95
+ ql task list --json
96
+ ql subscription list --json
97
+ ql --help
98
+ ```
99
+
100
+ 在面板「系统设置 → 应用设置」创建应用并授予所需权限,登录时按提示输入 Client ID/Secret;也支持通过 `QL_URL` 和 `QL_ACCESS_TOKEN` 使用已有令牌。各命令支持 `--help`,`QL_LANG=en` 可切换英文帮助。
101
+
102
+ npm CLI 用于远程管理。面板内置 `ql` 同样使用这个命令名,已有面板的机器请使用独立安装目录,避免覆盖内置命令。本机脚本执行和运维见 [面板内部工具](cli/LOCAL.md)。
103
+
104
+ [CLI 中文说明](cli/README.md) · [English guide](cli/README.en.md) · [完整命令参考](cli/skills/qinglong-cli/references/openapi.md)
105
+
106
+ 包内附带 [远程管理 Skill](cli/skills/qinglong-cli/SKILL.md),涵盖认证、命令选择和操作结果检查,可供 AI Agent 使用。本机执行与运维另见 [内部 Skill](cli/skills/qinglong-local/SKILL.md)。
107
+
84
108
  ## 开发
85
109
 
86
110
  ```bash
@@ -151,6 +151,8 @@ enum NotificationMode {
151
151
  chronocat = 18;
152
152
  ntfy = 19;
153
153
  wxPusherBot = 20;
154
+ wxPusherSpt = 21;
155
+ wpush = 22;
154
156
  }
155
157
 
156
158
  message NotificationInfo {
@@ -244,6 +246,12 @@ message NotificationInfo {
244
246
  optional string wxPusherBotAppToken = 66;
245
247
  optional string wxPusherBotTopicIds = 67;
246
248
  optional string wxPusherBotUids = 68;
249
+
250
+ optional string wxPusherSptList = 70;
251
+
252
+ optional string wpushApiKey = 71;
253
+ optional string wpushChannel = 72;
254
+ optional string wpushTopicCode = 73;
247
255
  }
248
256
 
249
257
  message SystemNotifyRequest {
@@ -272,4 +280,4 @@ service Api {
272
280
  rpc EnableCrons(EnableCronsRequest) returns (Response) {}
273
281
  rpc DisableCrons(DisableCronsRequest) returns (Response) {}
274
282
  rpc RunCrons(RunCronsRequest) returns (Response) {}
275
- }
283
+ }
@@ -17,7 +17,10 @@ message ICron {
17
17
  string name = 5;
18
18
  }
19
19
 
20
- message AddCronRequest { repeated ICron crons = 1; }
20
+ message AddCronRequest {
21
+ repeated ICron crons = 1;
22
+ bool replace = 2;
23
+ }
21
24
 
22
25
  message AddCronResponse {}
23
26
 
@@ -0,0 +1,81 @@
1
+ # Kubernetes deployment
2
+
3
+ This deploys Qinglong as a single-replica `StatefulSet` with persistent data at `/ql/data`.
4
+
5
+ ```bash
6
+ kubectl apply -k deploy/kubernetes/overlays/local
7
+ kubectl -n qinglong rollout status statefulset/qinglong
8
+ ```
9
+
10
+ Open the panel locally:
11
+
12
+ ```bash
13
+ kubectl -n qinglong port-forward svc/qinglong 5700:5700
14
+ ```
15
+
16
+ Then visit <http://127.0.0.1:5700>.
17
+
18
+ ## Image registry overlays
19
+
20
+ Use `overlays/example` as the committed template for registry customization:
21
+
22
+ ```yaml
23
+ whyour/qinglong:debian -> registry.example.com/whyour/qinglong:debian
24
+ ```
25
+
26
+ Create `overlays/local/kustomization.yaml` for the actual cluster image. The `local` overlay is ignored by git so private registry names, digests, and credentials-related references stay local.
27
+
28
+ ## Storage
29
+
30
+ The manifest creates a 5 GiB `ReadWriteOnce` PVC from the cluster's default `StorageClass`.
31
+ If your cluster has no default storage class, add `storageClassName` under:
32
+
33
+ ```yaml
34
+ volumeClaimTemplates:
35
+ - metadata:
36
+ name: data
37
+ spec:
38
+ storageClassName: your-storage-class
39
+ ```
40
+
41
+ Keep `replicas: 1`. Qinglong stores state in the persistent data directory, including SQLite files, so multiple replicas should not share the same data volume.
42
+
43
+ ## Ingress example
44
+
45
+ If you expose Qinglong through an Ingress path other than `/`, set `QlBaseUrl` to the same path with leading and trailing slashes.
46
+
47
+ ```yaml
48
+ env:
49
+ - name: QlBaseUrl
50
+ value: "/qinglong/"
51
+ ```
52
+
53
+ Example Ingress:
54
+
55
+ ```yaml
56
+ apiVersion: networking.k8s.io/v1
57
+ kind: Ingress
58
+ metadata:
59
+ name: qinglong
60
+ namespace: qinglong
61
+ spec:
62
+ rules:
63
+ - host: qinglong.example.com
64
+ http:
65
+ paths:
66
+ - path: /
67
+ pathType: Prefix
68
+ backend:
69
+ service:
70
+ name: qinglong
71
+ port:
72
+ number: 5700
73
+ ```
74
+
75
+ ## Maintenance commands
76
+
77
+ ```bash
78
+ kubectl -n qinglong logs -f statefulset/qinglong
79
+ kubectl -n qinglong exec -it statefulset/qinglong -- ql check
80
+ kubectl -n qinglong exec -it statefulset/qinglong -- ql update
81
+ ```
@@ -0,0 +1,5 @@
1
+ apiVersion: kustomize.config.k8s.io/v1beta1
2
+ kind: Kustomization
3
+
4
+ resources:
5
+ - qinglong.yaml
@@ -0,0 +1,95 @@
1
+ apiVersion: v1
2
+ kind: Namespace
3
+ metadata:
4
+ name: qinglong
5
+ ---
6
+ apiVersion: v1
7
+ kind: Service
8
+ metadata:
9
+ name: qinglong
10
+ namespace: qinglong
11
+ labels:
12
+ app.kubernetes.io/name: qinglong
13
+ spec:
14
+ type: ClusterIP
15
+ selector:
16
+ app.kubernetes.io/name: qinglong
17
+ ports:
18
+ - name: http
19
+ port: 5700
20
+ targetPort: http
21
+ ---
22
+ apiVersion: apps/v1
23
+ kind: StatefulSet
24
+ metadata:
25
+ name: qinglong
26
+ namespace: qinglong
27
+ labels:
28
+ app.kubernetes.io/name: qinglong
29
+ spec:
30
+ serviceName: qinglong
31
+ replicas: 1
32
+ selector:
33
+ matchLabels:
34
+ app.kubernetes.io/name: qinglong
35
+ template:
36
+ metadata:
37
+ labels:
38
+ app.kubernetes.io/name: qinglong
39
+ spec:
40
+ securityContext:
41
+ fsGroup: 5432
42
+ fsGroupChangePolicy: OnRootMismatch
43
+ containers:
44
+ - name: qinglong
45
+ image: whyour/qinglong:debian
46
+ imagePullPolicy: IfNotPresent
47
+ env:
48
+ - name: QlBaseUrl
49
+ value: "/"
50
+ - name: TZ
51
+ value: Asia/Shanghai
52
+ ports:
53
+ - name: http
54
+ containerPort: 5700
55
+ readinessProbe:
56
+ httpGet:
57
+ path: /api/health
58
+ port: http
59
+ initialDelaySeconds: 20
60
+ periodSeconds: 10
61
+ timeoutSeconds: 3
62
+ failureThreshold: 6
63
+ livenessProbe:
64
+ httpGet:
65
+ path: /api/health
66
+ port: http
67
+ initialDelaySeconds: 60
68
+ periodSeconds: 20
69
+ timeoutSeconds: 3
70
+ failureThreshold: 6
71
+ startupProbe:
72
+ httpGet:
73
+ path: /api/health
74
+ port: http
75
+ periodSeconds: 5
76
+ timeoutSeconds: 3
77
+ failureThreshold: 60
78
+ resources:
79
+ requests:
80
+ cpu: 100m
81
+ memory: 256Mi
82
+ limits:
83
+ memory: 1Gi
84
+ volumeMounts:
85
+ - name: data
86
+ mountPath: /ql/data
87
+ volumeClaimTemplates:
88
+ - metadata:
89
+ name: data
90
+ spec:
91
+ accessModes:
92
+ - ReadWriteOnce
93
+ resources:
94
+ requests:
95
+ storage: 5Gi
@@ -0,0 +1,10 @@
1
+ apiVersion: kustomize.config.k8s.io/v1beta1
2
+ kind: Kustomization
3
+
4
+ resources:
5
+ - ../../base
6
+
7
+ images:
8
+ - name: whyour/qinglong
9
+ newName: registry.example.com/whyour/qinglong
10
+ newTag: debian
package/docker/Dockerfile CHANGED
@@ -1,11 +1,26 @@
1
- FROM python:3.11-alpine3.18 AS builder
1
+ # Run Node package installation natively on the builder. Node/npm can spin at
2
+ # 100% CPU when Alpine s390x is emulated through QEMU.
3
+ FROM --platform=$BUILDPLATFORM node:18-alpine3.18 AS builder
4
+
5
+ ARG TARGETARCH
6
+ ENV NPM_CONFIG_PREFIX=/opt/node-global
7
+ ENV PATH=/opt/node-global/bin:${PATH}
8
+
2
9
  COPY package.json .npmrc pnpm-lock.yaml /tmp/build/
3
10
  RUN set -x \
4
- && apk update \
5
- && apk add nodejs npm git \
6
- && npm i -g pnpm@8.3.1 pm2 ts-node \
11
+ && apk add --no-cache git \
12
+ && npm i -g pnpm@8.3.1 pm2 ts-node typescript@5 \
7
13
  && cd /tmp/build \
8
- && pnpm install --prod
14
+ && case "${TARGETARCH}" in \
15
+ amd64) NODE_ARCH=x64 ;; \
16
+ 386) NODE_ARCH=ia32 ;; \
17
+ ppc64le) NODE_ARCH=ppc64 ;; \
18
+ *) NODE_ARCH="${TARGETARCH}" ;; \
19
+ esac \
20
+ && npm_config_target_platform=linux \
21
+ npm_config_target_arch="${NODE_ARCH}" \
22
+ npm_config_target_libc=musl \
23
+ pnpm install --prod --frozen-lockfile
9
24
 
10
25
  FROM python:3.11-alpine
11
26
 
@@ -26,8 +41,8 @@ VOLUME /ql/data
26
41
 
27
42
  EXPOSE 5700
28
43
 
29
- COPY --from=builder /usr/local/lib/node_modules/. /usr/local/lib/node_modules/
30
- COPY --from=builder /usr/local/bin/. /usr/local/bin/
44
+ COPY --from=builder /opt/node-global/lib/node_modules/. /usr/local/lib/node_modules/
45
+ COPY --from=builder /opt/node-global/bin/. /usr/local/bin/
31
46
 
32
47
  RUN set -x \
33
48
  && apk update -f \
@@ -58,15 +73,19 @@ RUN set -x \
58
73
  && ulimit -c 0
59
74
 
60
75
  ARG SOURCE_COMMIT
76
+ LABEL org.opencontainers.image.revision=${SOURCE_COMMIT}
61
77
  RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} \
62
78
  && cd ${QL_DIR} \
79
+ && if [ -n "${SOURCE_COMMIT}" ]; then git fetch --depth=1 origin "${SOURCE_COMMIT}" && git reset --hard FETCH_HEAD; fi \
63
80
  && cp -f .env.example .env \
64
81
  && chmod 777 ${QL_DIR}/shell/*.sh \
65
- && chmod 777 ${QL_DIR}/docker/*.sh \
66
- && git clone --depth=1 -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static \
67
- && mkdir -p ${QL_DIR}/static \
68
- && cp -rf /static/* ${QL_DIR}/static \
69
- && rm -rf /static
82
+ && chmod 777 ${QL_DIR}/docker/*.sh
83
+
84
+ # Downloaded by CI from the build-static job in this workflow run.
85
+ COPY static/ /ql/static/
86
+ COPY docker/verify-build.cjs docker/build-manifest.cjs /tmp/
87
+ COPY --from=builder /tmp/build/pnpm-lock.yaml /tmp/dependency-lock.yaml
88
+ RUN cd ${QL_DIR} && node /tmp/verify-build.cjs /tmp/dependency-lock.yaml
70
89
 
71
90
  ENV PNPM_HOME=${QL_DIR}/data/dep_cache/node \
72
91
  PYTHON_HOME=${QL_DIR}/data/dep_cache/python3 \
@@ -1,11 +1,26 @@
1
- FROM python:3.10-alpine3.18 AS builder
1
+ # Run Node package installation natively on the builder. Node/npm can spin at
2
+ # 100% CPU when Alpine s390x is emulated through QEMU.
3
+ FROM --platform=$BUILDPLATFORM node:18-alpine3.18 AS builder
4
+
5
+ ARG TARGETARCH
6
+ ENV NPM_CONFIG_PREFIX=/opt/node-global
7
+ ENV PATH=/opt/node-global/bin:${PATH}
8
+
2
9
  COPY package.json .npmrc pnpm-lock.yaml /tmp/build/
3
10
  RUN set -x \
4
- && apk update \
5
- && apk add nodejs npm git \
6
- && npm i -g pnpm@8.3.1 pm2 ts-node \
11
+ && apk add --no-cache git \
12
+ && npm i -g pnpm@8.3.1 pm2 ts-node typescript@5 \
7
13
  && cd /tmp/build \
8
- && pnpm install --prod
14
+ && case "${TARGETARCH}" in \
15
+ amd64) NODE_ARCH=x64 ;; \
16
+ 386) NODE_ARCH=ia32 ;; \
17
+ ppc64le) NODE_ARCH=ppc64 ;; \
18
+ *) NODE_ARCH="${TARGETARCH}" ;; \
19
+ esac \
20
+ && npm_config_target_platform=linux \
21
+ npm_config_target_arch="${NODE_ARCH}" \
22
+ npm_config_target_libc=musl \
23
+ pnpm install --prod --frozen-lockfile
9
24
 
10
25
  FROM python:3.10-alpine
11
26
 
@@ -26,8 +41,8 @@ VOLUME /ql/data
26
41
 
27
42
  EXPOSE 5700
28
43
 
29
- COPY --from=builder /usr/local/lib/node_modules/. /usr/local/lib/node_modules/
30
- COPY --from=builder /usr/local/bin/. /usr/local/bin/
44
+ COPY --from=builder /opt/node-global/lib/node_modules/. /usr/local/lib/node_modules/
45
+ COPY --from=builder /opt/node-global/bin/. /usr/local/bin/
31
46
 
32
47
  RUN set -x \
33
48
  && apk update -f \
@@ -58,15 +73,19 @@ RUN set -x \
58
73
  && ulimit -c 0
59
74
 
60
75
  ARG SOURCE_COMMIT
76
+ LABEL org.opencontainers.image.revision=${SOURCE_COMMIT}
61
77
  RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} \
62
78
  && cd ${QL_DIR} \
79
+ && if [ -n "${SOURCE_COMMIT}" ]; then git fetch --depth=1 origin "${SOURCE_COMMIT}" && git reset --hard FETCH_HEAD; fi \
63
80
  && cp -f .env.example .env \
64
81
  && chmod 777 ${QL_DIR}/shell/*.sh \
65
- && chmod 777 ${QL_DIR}/docker/*.sh \
66
- && git clone --depth=1 -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static \
67
- && mkdir -p ${QL_DIR}/static \
68
- && cp -rf /static/* ${QL_DIR}/static \
69
- && rm -rf /static
82
+ && chmod 777 ${QL_DIR}/docker/*.sh
83
+
84
+ # Downloaded by CI from the build-static job in this workflow run.
85
+ COPY static/ /ql/static/
86
+ COPY docker/verify-build.cjs docker/build-manifest.cjs /tmp/
87
+ COPY --from=builder /tmp/build/pnpm-lock.yaml /tmp/dependency-lock.yaml
88
+ RUN cd ${QL_DIR} && node /tmp/verify-build.cjs /tmp/dependency-lock.yaml
70
89
 
71
90
  ENV PNPM_HOME=${QL_DIR}/data/dep_cache/node \
72
91
  PYTHON_HOME=${QL_DIR}/data/dep_cache/python3 \
@@ -1,6 +1,8 @@
1
- FROM node:22-slim AS nodebuilder
1
+ # Node 20 Bookworm is the latest official Node image variant that covers the
2
+ # full Debian build matrix, including arm/v7, ppc64le, and s390x.
3
+ FROM node:20-bookworm-slim AS nodebuilder
2
4
 
3
- FROM python:3.11-slim-bookworm AS builder
5
+ FROM python:3.11.14-slim-bookworm AS builder
4
6
  COPY package.json .npmrc pnpm-lock.yaml /tmp/build/
5
7
  COPY --from=nodebuilder /usr/local/bin/node /usr/local/bin/
6
8
  COPY --from=nodebuilder /usr/local/lib/node_modules/. /usr/local/lib/node_modules/
@@ -10,9 +12,9 @@ RUN set -x && \
10
12
  apt-get install --no-install-recommends -y libatomic1 && \
11
13
  npm i -g pnpm@8.3.1 && \
12
14
  cd /tmp/build && \
13
- pnpm install --prod
15
+ pnpm install --prod --frozen-lockfile
14
16
 
15
- FROM python:3.11-slim-bookworm
17
+ FROM python:3.11.14-slim-bookworm
16
18
 
17
19
  ARG QL_MAINTAINER="whyour"
18
20
  LABEL maintainer="${QL_MAINTAINER}"
@@ -67,9 +69,11 @@ RUN set -x && \
67
69
  git config --global user.email "qinglong@users.noreply.github.com" && \
68
70
  git config --global user.name "qinglong" && \
69
71
  git config --global http.postBuffer 524288000 && \
70
- npm install -g pnpm@8.3.1 pm2 ts-node && \
72
+ npm install -g pnpm@8.3.1 pm2 ts-node typescript@5 && \
73
+ npm cache clean --force && \
71
74
  rm -rf /root/.cache && \
72
75
  rm -rf /root/.npm && \
76
+ rm -rf /var/lib/apt/lists/* && \
73
77
  rm -rf /etc/apt/apt.conf.d/docker-clean && \
74
78
  ulimit -c 0
75
79
 
@@ -78,15 +82,19 @@ RUN mkdir -p ${QL_DIR} && \
78
82
 
79
83
  USER qinglong
80
84
  ARG SOURCE_COMMIT
81
- RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} && \
82
- cd ${QL_DIR} && \
83
- cp -f .env.example .env && \
84
- chmod 777 ${QL_DIR}/shell/*.sh && \
85
- chmod 777 ${QL_DIR}/docker/*.sh && \
86
- git clone --depth=1 -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /tmp/static && \
87
- mkdir -p ${QL_DIR}/static && \
88
- cp -rf /tmp/static/* ${QL_DIR}/static && \
89
- rm -rf /tmp/static
85
+ LABEL org.opencontainers.image.revision=${SOURCE_COMMIT}
86
+ RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} \
87
+ && cd ${QL_DIR} \
88
+ && if [ -n "${SOURCE_COMMIT}" ]; then git fetch --depth=1 origin "${SOURCE_COMMIT}" && git reset --hard FETCH_HEAD; fi \
89
+ && cp -f .env.example .env \
90
+ && chmod 777 ${QL_DIR}/shell/*.sh \
91
+ && chmod 777 ${QL_DIR}/docker/*.sh
92
+
93
+ # Downloaded by CI from the build-static job in this workflow run.
94
+ COPY --chown=qinglong:qinglong static/ /ql/static/
95
+ COPY docker/verify-build.cjs docker/build-manifest.cjs /tmp/
96
+ COPY --from=builder /tmp/build/pnpm-lock.yaml /tmp/dependency-lock.yaml
97
+ RUN cd ${QL_DIR} && node /tmp/verify-build.cjs /tmp/dependency-lock.yaml
90
98
 
91
99
  ENV PNPM_HOME=${QL_DIR}/data/dep_cache/node \
92
100
  PYTHON_HOME=${QL_DIR}/data/dep_cache/python3 \
@@ -1,6 +1,10 @@
1
- FROM node:22-slim AS nodebuilder
1
+ # Node 20 Bookworm is the latest official Node image variant that covers the
2
+ # full Debian build matrix, including arm/v7, ppc64le, and s390x.
3
+ FROM node:20-bookworm-slim AS nodebuilder
2
4
 
3
- FROM python:3.10-slim-bookworm AS builder
5
+ # Keep the full release matrix, including s390x, on the same immutable base.
6
+ # The floating 3.10-slim-bookworm tag no longer includes s390x.
7
+ FROM python:3.10.19-slim-bookworm@sha256:23f63358922e79a794f71be8f3723c84e5ccca9638af3f74456dc73d6184499e AS builder
4
8
  COPY package.json .npmrc pnpm-lock.yaml /tmp/build/
5
9
  COPY --from=nodebuilder /usr/local/bin/node /usr/local/bin/
6
10
  COPY --from=nodebuilder /usr/local/lib/node_modules/. /usr/local/lib/node_modules/
@@ -10,9 +14,9 @@ RUN set -x && \
10
14
  apt-get install --no-install-recommends -y libatomic1 && \
11
15
  npm i -g pnpm@8.3.1 && \
12
16
  cd /tmp/build && \
13
- pnpm install --prod
17
+ pnpm install --prod --frozen-lockfile
14
18
 
15
- FROM python:3.10-slim-bookworm
19
+ FROM python:3.10.19-slim-bookworm@sha256:23f63358922e79a794f71be8f3723c84e5ccca9638af3f74456dc73d6184499e
16
20
 
17
21
  ARG QL_MAINTAINER="whyour"
18
22
  LABEL maintainer="${QL_MAINTAINER}"
@@ -66,9 +70,11 @@ RUN set -x && \
66
70
  git config --global user.email "qinglong@users.noreply.github.com" && \
67
71
  git config --global user.name "qinglong" && \
68
72
  git config --global http.postBuffer 524288000 && \
69
- npm install -g pnpm@8.3.1 pm2 ts-node && \
73
+ npm install -g pnpm@8.3.1 pm2 ts-node typescript@5 && \
74
+ npm cache clean --force && \
70
75
  rm -rf /root/.cache && \
71
76
  rm -rf /root/.npm && \
77
+ rm -rf /var/lib/apt/lists/* && \
72
78
  rm -rf /etc/apt/apt.conf.d/docker-clean && \
73
79
  ulimit -c 0
74
80
 
@@ -78,15 +84,19 @@ RUN mkdir -p ${QL_DIR} && \
78
84
  USER qinglong
79
85
 
80
86
  ARG SOURCE_COMMIT
81
- RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} && \
82
- cd ${QL_DIR} && \
83
- cp -f .env.example .env && \
84
- chmod 777 ${QL_DIR}/shell/*.sh && \
85
- chmod 777 ${QL_DIR}/docker/*.sh && \
86
- git clone --depth=1 -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /tmp/static && \
87
- mkdir -p ${QL_DIR}/static && \
88
- cp -rf /tmp/static/* ${QL_DIR}/static && \
89
- rm -rf /tmp/static
87
+ LABEL org.opencontainers.image.revision=${SOURCE_COMMIT}
88
+ RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} \
89
+ && cd ${QL_DIR} \
90
+ && if [ -n "${SOURCE_COMMIT}" ]; then git fetch --depth=1 origin "${SOURCE_COMMIT}" && git reset --hard FETCH_HEAD; fi \
91
+ && cp -f .env.example .env \
92
+ && chmod 777 ${QL_DIR}/shell/*.sh \
93
+ && chmod 777 ${QL_DIR}/docker/*.sh
94
+
95
+ # Downloaded by CI from the build-static job in this workflow run.
96
+ COPY --chown=qinglong:qinglong static/ /ql/static/
97
+ COPY docker/verify-build.cjs docker/build-manifest.cjs /tmp/
98
+ COPY --from=builder /tmp/build/pnpm-lock.yaml /tmp/dependency-lock.yaml
99
+ RUN cd ${QL_DIR} && node /tmp/verify-build.cjs /tmp/dependency-lock.yaml
90
100
 
91
101
  ENV PNPM_HOME=${QL_DIR}/data/dep_cache/node \
92
102
  PYTHON_HOME=${QL_DIR}/data/dep_cache/python3 \
@@ -0,0 +1,28 @@
1
+ const fs = require('node:fs');
2
+ const path = require('node:path');
3
+ const crypto = require('node:crypto');
4
+
5
+ // Include every artifact, including imported backend modules and frontend chunks.
6
+ function collectBuildFiles(root = 'static') {
7
+ const files = {};
8
+ function visit(relative) {
9
+ for (const name of fs.readdirSync(path.join(root, relative)).sort()) {
10
+ const entry = relative ? `${relative}/${name}` : name;
11
+ if (entry === 'build-info.json') continue;
12
+ const file = path.join(root, entry);
13
+ const stat = fs.lstatSync(file);
14
+ if (stat.isSymbolicLink())
15
+ throw new Error(`Build output symlink: ${entry}`);
16
+ if (stat.isDirectory()) visit(entry);
17
+ else if (stat.isFile()) {
18
+ files[entry] = crypto
19
+ .createHash('sha256')
20
+ .update(fs.readFileSync(file))
21
+ .digest('hex');
22
+ } else throw new Error(`Unsupported build output: ${entry}`);
23
+ }
24
+ }
25
+ visit('');
26
+ return files;
27
+ }
28
+ module.exports = { collectBuildFiles };