karin-plugin-qgroup-file2openlist 0.0.1 → 0.0.17

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.
package/README.md CHANGED
@@ -66,106 +66,4 @@ TypeScript 插件开发流程现在更加简单,无需手动克隆模板仓库
66
66
  - `#群同步配置 <群号> 计划 <cron>`:设置定时同步(例:`0 0 3 * * *`)
67
67
  - `#群同步配置 <群号> 时段 00:00-06:00,23:00-23:59`:限制定时同步时间段(空=不限制)
68
68
 
69
- ## 🚀 快速开始
70
-
71
- ```bash
72
- pnpm create karin
73
- ```
74
-
75
- - 按提示选择“ts插件开发模板”即可自动初始化项目。
76
- - 进入新建的项目目录,继续开发。
77
-
78
- ---
79
-
80
- ## 详细开发流程
81
-
82
- 1. **一键创建项目**
83
-
84
- ```bash
85
- pnpm create karin
86
- ```
87
-
88
- - 选择“ts插件开发模板”
89
- - 填写你的插件名称(会自动作为 package.json 的 name)
90
- - 其余信息按提示填写
91
-
92
- 2. **安装依赖**
93
-
94
- ```bash
95
- pnpm install
96
- ```
97
-
98
- 3. **开发与调试**
99
-
100
- - 启动开发命令:
101
- ```bash
102
- pnpm dev
103
- ```
104
- - 编写你的插件代码于 `src/` 目录。
105
- - 编译输出:
106
- ```bash
107
- pnpm build
108
- ```
109
- - 调试编译之后的代码:
110
- ```bash
111
- pnpm app
112
- ```
113
- - 本地调试建议:
114
- - 可用 `pnpm link --global` 进行全局软链测试。
115
- - 或在 karin 根目录用 `pnpm add ../your-plugin-repo -w` 进行本地依赖测试。
116
-
117
- 4. **配置 NPM 秘钥**
118
-
119
- > 用于自动化发布,建议开启 2FA。
120
-
121
- 1. 注册 [npmjs](https://www.npmjs.com/) 账号。
122
- 2. 进入 `Access Tokens`,新建 `Classic Token`,类型选 `Automation`。
123
- 3. 复制生成的 Token。
124
- 4. 打开你的 GitHub 仓库 → Settings → Secrets and variables → Actions。
125
- 5. 新建 `NPM_TOKEN`,粘贴 Token。
126
- 6. 允许 GitHub Actions 创建和批准 PR(Settings → Actions)。
127
-
128
- 5. **设置包信息**
129
-
130
- > 包名必须唯一,建议先在 [npm](https://www.npmjs.com/) 搜索确认。
131
-
132
- - 初始化时填写的插件名会自动作为 package.json 的 name,无需手动修改。
133
- - 其他如 `author`、`description`、`homepage`、`bugs.url`、`repository` 可在 package.json 中补充完善。
134
- - **CI 配置无需再手动修改 package-name,已自动同步。**
135
-
136
- 6. **自动化发布**
137
-
138
- > 推送代码后,GitHub Actions 会自动编译并发布到 npm。
139
-
140
- - 常规开发流程:
141
- 1. `git add . && git commit -m "feat: ..." && git push`
142
- 2. 等待 CI 自动发布
143
- 3. 发布成功后可在 npm 页面看到新版本
144
-
145
- 7. **安装与验证**
146
-
147
- - 在 karin 根目录下安装你的插件:
148
- ```bash
149
- pnpm add your-package-name -w
150
- ```
151
- - 验证插件是否生效,可查看 karin 启动日志或相关功能。
152
-
153
- ---
154
-
155
- ## 💡 常见问题与建议
156
-
157
- - **Q: 发布失败怎么办?**
158
- - 检查 NPM_TOKEN 是否配置正确,权限是否足够。
159
- - 包名是否唯一,未被占用。
160
- - Actions 日志可定位具体报错。
161
- - **Q: 如何本地调试插件?**
162
- - 推荐用 `pnpm link` 或本地依赖安装。
163
- - **Q: 如何贡献代码?**
164
- - 欢迎 PR,建议先提 issue 讨论。
165
-
166
- ---
167
-
168
- ## 贡献与反馈
169
-
170
- - 有任何建议或问题,欢迎在 [Issues](https://github.com/KarinJS/karin-plugin-template-ts/issues) 提出。
171
- - 也可加入官方交流群交流经验。
69
+ ## 🚀 快速开始
@@ -0,0 +1,59 @@
1
+ import {
2
+ dir
3
+ } from "../chunk-IZS467MR.js";
4
+
5
+ // src/apps/help.ts
6
+ import path from "path";
7
+ import { karin, logger, render, segment } from "node-karin";
8
+ var formatDateTime = (date) => {
9
+ try {
10
+ return date.toLocaleString("zh-CN", {
11
+ year: "numeric",
12
+ month: "2-digit",
13
+ day: "2-digit",
14
+ hour: "2-digit",
15
+ minute: "2-digit",
16
+ hour12: false
17
+ });
18
+ } catch {
19
+ return date.toISOString();
20
+ }
21
+ };
22
+ var helpImage = karin.command(/^#?(群文件帮助|同步群文件帮助|openlist帮助)$/i, async (e) => {
23
+ try {
24
+ const html = path.join(dir.defResourcesDir, "template", "help.html");
25
+ const img = await render.render({
26
+ name: "qgroup-help",
27
+ encoding: "base64",
28
+ file: html,
29
+ type: "png",
30
+ data: {
31
+ name: dir.name,
32
+ version: dir.version,
33
+ generatedAt: formatDateTime(/* @__PURE__ */ new Date())
34
+ },
35
+ setViewport: {
36
+ width: 900,
37
+ height: 720,
38
+ deviceScaleFactor: 2
39
+ },
40
+ pageGotoParams: {
41
+ waitUntil: "networkidle2"
42
+ }
43
+ });
44
+ await e.reply(segment.image(`base64://${img}`));
45
+ return true;
46
+ } catch (error) {
47
+ logger.error(error);
48
+ await e.reply(`\u5E2E\u52A9\u56FE\u6E32\u67D3\u5931\u8D25\uFF1A${error?.message ?? String(error)}`);
49
+ return true;
50
+ }
51
+ }, {
52
+ priority: 9999,
53
+ log: true,
54
+ name: "\u7FA4\u6587\u4EF6\u5E2E\u52A9",
55
+ permission: "all"
56
+ });
57
+ export {
58
+ helpImage
59
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karin-plugin-qgroup-file2openlist",
3
- "version": "0.0.1",
3
+ "version": "0.0.17",
4
4
  "author": "429",
5
5
  "type": "module",
6
6
  "description": "karin plugin for QGroupFile backup",
@@ -64,4 +64,4 @@
64
64
  "dependencies": {
65
65
  "@karinjs/plugin-puppeteer": "^1.1.2"
66
66
  }
67
- }
67
+ }
@@ -0,0 +1,204 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>{{name}} 帮助</title>
8
+ <style>
9
+ :root {
10
+ --bg: #ffffff;
11
+ --fg: #0f0f0f;
12
+ --muted: #666666;
13
+ --line: #0f0f0f;
14
+ --soft: #f3f3f3;
15
+ }
16
+
17
+ * {
18
+ box-sizing: border-box;
19
+ }
20
+
21
+ body {
22
+ width: 900px;
23
+ height: 720px;
24
+ margin: 0;
25
+ padding: 0;
26
+ background: var(--bg);
27
+ color: var(--fg);
28
+ font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
29
+ position: relative;
30
+ }
31
+
32
+ .wrap {
33
+ padding: 40px 44px;
34
+ }
35
+
36
+ .header {
37
+ display: flex;
38
+ align-items: baseline;
39
+ justify-content: space-between;
40
+ gap: 16px;
41
+ padding-bottom: 18px;
42
+ border-bottom: 3px solid var(--line);
43
+ }
44
+
45
+ .title {
46
+ font-size: 30px;
47
+ font-weight: 800;
48
+ letter-spacing: 0.3px;
49
+ line-height: 1.1;
50
+ }
51
+
52
+ .meta {
53
+ text-align: right;
54
+ color: var(--muted);
55
+ font-size: 12px;
56
+ line-height: 1.6;
57
+ }
58
+
59
+ .mono {
60
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
61
+ }
62
+
63
+ .section {
64
+ margin-top: 22px;
65
+ padding: 18px;
66
+ background: var(--soft);
67
+ border: 2px solid var(--line);
68
+ }
69
+
70
+ .section-title {
71
+ font-weight: 800;
72
+ font-size: 14px;
73
+ margin: 0 0 12px 0;
74
+ }
75
+
76
+ .cmd {
77
+ display: flex;
78
+ gap: 14px;
79
+ padding: 10px 0;
80
+ border-top: 1px solid rgba(15, 15, 15, 0.15);
81
+ }
82
+
83
+ .cmd:first-of-type {
84
+ border-top: none;
85
+ padding-top: 0;
86
+ }
87
+
88
+ .cmd-key {
89
+ width: 190px;
90
+ flex: 0 0 auto;
91
+ font-weight: 800;
92
+ font-size: 13px;
93
+ white-space: nowrap;
94
+ }
95
+
96
+ .cmd-desc {
97
+ flex: 1 1 auto;
98
+ color: #1c1c1c;
99
+ font-size: 13px;
100
+ line-height: 1.55;
101
+ }
102
+
103
+ .tips {
104
+ margin-top: 16px;
105
+ padding: 0;
106
+ list-style: none;
107
+ color: var(--muted);
108
+ font-size: 12px;
109
+ line-height: 1.7;
110
+ }
111
+
112
+ .tips li {
113
+ display: flex;
114
+ gap: 10px;
115
+ padding: 6px 0;
116
+ border-top: 1px dashed rgba(15, 15, 15, 0.25);
117
+ }
118
+
119
+ .tips li:first-child {
120
+ border-top: none;
121
+ padding-top: 0;
122
+ }
123
+
124
+ .dot {
125
+ width: 10px;
126
+ height: 10px;
127
+ border: 2px solid var(--line);
128
+ margin-top: 4px;
129
+ flex: 0 0 auto;
130
+ }
131
+
132
+ .footer {
133
+ position: absolute;
134
+ left: 44px;
135
+ right: 44px;
136
+ bottom: 26px;
137
+ display: flex;
138
+ justify-content: space-between;
139
+ gap: 12px;
140
+ color: var(--muted);
141
+ font-size: 11px;
142
+ letter-spacing: 0.2px;
143
+ }
144
+
145
+ .badge {
146
+ display: inline-block;
147
+ padding: 4px 8px;
148
+ border: 1px solid rgba(15, 15, 15, 0.35);
149
+ background: #fff;
150
+ color: #111;
151
+ border-radius: 999px;
152
+ }
153
+ </style>
154
+ </head>
155
+
156
+ <body>
157
+ <div class="wrap">
158
+ <div class="header">
159
+ <div>
160
+ <div class="title">群文件同步 · 帮助</div>
161
+ <div class="meta">插件:<span class="mono">{{name}}</span> <span class="badge mono">v{{version}}</span></div>
162
+ </div>
163
+ <div class="meta">
164
+ <div>黑白模式 · 简洁指令卡</div>
165
+ <div>{{generatedAt}}</div>
166
+ </div>
167
+ </div>
168
+
169
+ <div class="section">
170
+ <div class="section-title">常用命令</div>
171
+
172
+ <div class="cmd">
173
+ <div class="cmd-key mono">#同步群文件</div>
174
+ <div class="cmd-desc">把群文件同步到 OpenList(默认增量)。群内建议管理员/群主使用。</div>
175
+ </div>
176
+ <div class="cmd">
177
+ <div class="cmd-key mono">#导出群文件</div>
178
+ <div class="cmd-desc">导出群文件列表(可用于排查缺失/重复)。</div>
179
+ </div>
180
+ <div class="cmd">
181
+ <div class="cmd-key mono">#群同步配置</div>
182
+ <div class="cmd-desc">查看/设置当前群的同步目标目录、模式等参数。</div>
183
+ </div>
184
+ <div class="cmd">
185
+ <div class="cmd-key mono">#群文件帮助</div>
186
+ <div class="cmd-desc">发送本帮助图片。</div>
187
+ </div>
188
+
189
+ <ul class="tips">
190
+ <li><span class="dot"></span><span>试试:<span class="mono">#同步群文件 --help</span> 查看参数说明。</span></li>
191
+ <li><span class="dot"></span><span>全量同步:<span class="mono">#同步群文件 --mode=full</span>(文件多时更慢)。</span></li>
192
+ <li><span class="dot"></span><span>自定义目标目录:<span class="mono">#同步群文件 --to=/qq/群号</span></span></li>
193
+ <li><span class="dot"></span><span>只想先验证连通性:先少量同步或先跑导出。</span></li>
194
+ </ul>
195
+ </div>
196
+ </div>
197
+
198
+ <div class="footer">
199
+ <div>提示:此图由前端模板渲染生成</div>
200
+ <div class="mono">#群文件帮助</div>
201
+ </div>
202
+ </body>
203
+
204
+ </html>