@zhin.js/adapter-juejin 0.0.0-stage → 0.1.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.
- package/README.md +145 -2
- package/adapters/juejin/index.js +19 -0
- package/adapters/juejin/index.ts +22 -0
- package/commands/juejin-draft/drop/[id]/index.js +13 -0
- package/commands/juejin-draft/drop/[id]/index.ts +13 -0
- package/commands/juejin-draft/edit/[id]/index.js +16 -0
- package/commands/juejin-draft/edit/[id]/index.ts +15 -0
- package/commands/juejin-draft/list/index.js +12 -0
- package/commands/juejin-draft/list/index.ts +12 -0
- package/commands/juejin-draft/send/[id]/index.js +13 -0
- package/commands/juejin-draft/send/[id]/index.ts +13 -0
- package/commands/juejin-draft/show/[id]/index.js +13 -0
- package/commands/juejin-draft/show/[id]/index.ts +13 -0
- package/commands/juejin-login/status/index.js +12 -0
- package/commands/juejin-login/status/index.ts +12 -0
- package/lib/adapter.d.ts +22 -0
- package/lib/adapter.js +43 -0
- package/lib/client.d.ts +83 -0
- package/lib/client.js +192 -0
- package/lib/console.d.ts +16 -0
- package/lib/console.js +172 -0
- package/lib/drafts.d.ts +50 -0
- package/lib/drafts.js +137 -0
- package/lib/endpoint-directory.d.ts +16 -0
- package/lib/endpoint-directory.js +63 -0
- package/lib/endpoint.d.ts +86 -0
- package/lib/endpoint.js +440 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +11 -0
- package/lib/juejin-runtime-state.d.ts +4 -0
- package/lib/juejin-runtime-state.js +3 -0
- package/lib/login-text.d.ts +5 -0
- package/lib/login-text.js +25 -0
- package/lib/protocol.d.ts +192 -0
- package/lib/protocol.js +214 -0
- package/lib/review.d.ts +29 -0
- package/lib/review.js +156 -0
- package/lib/self-profile.d.ts +9 -0
- package/lib/self-profile.js +14 -0
- package/lib/storage.d.ts +11 -0
- package/lib/storage.js +54 -0
- package/package.json +113 -3
- package/pages/index/CommentReview.js +140 -0
- package/pages/index/CommentReview.tsx +264 -0
- package/pages/index/index.js +18 -0
- package/pages/index/index.tsx +18 -0
- package/pages/index/messages.js +57 -0
- package/pages/index/messages.ts +59 -0
- package/pages/index/rpc.js +31 -0
- package/pages/index/rpc.ts +72 -0
- package/plugin.js +33 -0
- package/schema.json +485 -0
- package/src/adapter.ts +45 -0
- package/src/client.ts +247 -0
- package/src/console.ts +161 -0
- package/src/drafts.ts +180 -0
- package/src/endpoint-directory.ts +64 -0
- package/src/endpoint.ts +504 -0
- package/src/index.ts +50 -0
- package/src/juejin-runtime-state.ts +11 -0
- package/src/login-text.ts +28 -0
- package/src/protocol.ts +377 -0
- package/src/review.ts +149 -0
- package/src/self-profile.ts +20 -0
- package/src/storage.ts +52 -0
package/lib/storage.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本地状态文件(草稿)。
|
|
3
|
+
*
|
|
4
|
+
* - 位置:`<dataDir>/<endpointId>/`,默认 `data/juejin/<id>/`,与 icqq / weixin-ilink 的 data 目录约定一致。
|
|
5
|
+
* - 写入:先写临时文件再 rename,避免进程中途退出留下半个 JSON。
|
|
6
|
+
* - 草稿文件权限 0600;内容永远不进日志、不进 YAML(本 adapter 不落盘凭据,Cookie 只走配置 / 环境变量)。
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from 'node:fs';
|
|
9
|
+
import * as path from 'node:path';
|
|
10
|
+
/** endpoint id → 安全的目录名(只留字母数字和 `_.-`,其余替换成 `_`)。 */
|
|
11
|
+
export function endpointDirectoryName(endpointId) {
|
|
12
|
+
const name = endpointId.replace(/[^A-Za-z0-9_.-]/gu, '_');
|
|
13
|
+
if (!name || /^\.+$/u.test(name))
|
|
14
|
+
throw new TypeError(`Juejin endpoint id "${endpointId}" cannot be used as a data directory name`);
|
|
15
|
+
return name;
|
|
16
|
+
}
|
|
17
|
+
export function writeJsonAtomic(file, value, mode) {
|
|
18
|
+
fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
19
|
+
const temp = `${file}.${process.pid}.${Date.now().toString(36)}.tmp`;
|
|
20
|
+
fs.writeFileSync(temp, `${JSON.stringify(value, null, 2)}\n`, { encoding: 'utf-8', ...(mode === undefined ? {} : { mode }) });
|
|
21
|
+
fs.renameSync(temp, file);
|
|
22
|
+
if (mode !== undefined) {
|
|
23
|
+
try {
|
|
24
|
+
fs.chmodSync(file, mode);
|
|
25
|
+
}
|
|
26
|
+
catch { /* 非 POSIX 文件系统:忽略 */ }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** 读不到、不是 JSON 都返回 undefined;调用方自行校验结构。 */
|
|
30
|
+
export function readJson(file) {
|
|
31
|
+
try {
|
|
32
|
+
if (!fs.existsSync(file))
|
|
33
|
+
return undefined;
|
|
34
|
+
return JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function removeFile(file) {
|
|
41
|
+
try {
|
|
42
|
+
fs.rmSync(file, { force: true });
|
|
43
|
+
}
|
|
44
|
+
catch { /* ignore */ }
|
|
45
|
+
}
|
|
46
|
+
export class JuejinStateFiles {
|
|
47
|
+
directory;
|
|
48
|
+
constructor(rootDir, endpointId) {
|
|
49
|
+
this.directory = path.resolve(rootDir, endpointDirectoryName(endpointId));
|
|
50
|
+
}
|
|
51
|
+
get draftsFile() {
|
|
52
|
+
return path.join(this.directory, 'drafts.json');
|
|
53
|
+
}
|
|
54
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,116 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-juejin",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Zhin.js Juejin (掘金) comment adapter for Plugin Runtime (Experimental; whitelisted article comments, review-then-send with a Console approval page)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./lib/index.js",
|
|
7
|
+
"types": "./lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"import": "./lib/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"zhin",
|
|
16
|
+
"zhin.js",
|
|
17
|
+
"bot",
|
|
18
|
+
"adapter",
|
|
19
|
+
"juejin",
|
|
20
|
+
"comment",
|
|
21
|
+
"chatbot"
|
|
22
|
+
],
|
|
23
|
+
"author": {
|
|
24
|
+
"name": "lc-cn",
|
|
25
|
+
"email": "admin@liucl.cn",
|
|
26
|
+
"url": "https://github.com/lc-cn"
|
|
27
|
+
},
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"url": "git+https://github.com/zhinjs/zhin.git",
|
|
31
|
+
"type": "git",
|
|
32
|
+
"directory": "plugins/adapters/juejin"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"react": "^19.2.8",
|
|
36
|
+
"@zhin.js/adapter": "1.1.27",
|
|
37
|
+
"@zhin.js/console-contract": "1.1.3",
|
|
38
|
+
"@zhin.js/client": "1.1.23",
|
|
39
|
+
"@zhin.js/core": "1.1.55",
|
|
40
|
+
"@zhin.js/im-contract": "1.1.10",
|
|
41
|
+
"@zhin.js/feature-kit": "1.1.11",
|
|
42
|
+
"@zhin.js/logger": "1.1.2",
|
|
43
|
+
"@zhin.js/page": "1.1.13"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"react": "^19.0.0",
|
|
47
|
+
"zhin.js": "^1.1.20",
|
|
48
|
+
"@zhin.js/core": "^1.1.55",
|
|
49
|
+
"@zhin.js/adapter": "^1.1.27",
|
|
50
|
+
"@zhin.js/page": "^1.1.13",
|
|
51
|
+
"@zhin.js/command": "^1.1.13"
|
|
52
|
+
},
|
|
53
|
+
"peerDependenciesMeta": {
|
|
54
|
+
"zhin.js": {
|
|
55
|
+
"optional": true
|
|
56
|
+
},
|
|
57
|
+
"@zhin.js/command": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
60
|
+
"react": {
|
|
61
|
+
"optional": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@types/node": "^26.1.2",
|
|
66
|
+
"@types/react": "^19.2.18",
|
|
67
|
+
"typescript": "^6.0.3",
|
|
68
|
+
"vitest": "^4.1.10",
|
|
69
|
+
"zhin.js": "1.1.20",
|
|
70
|
+
"@zhin.js/pagemanager": "1.1.20"
|
|
71
|
+
},
|
|
72
|
+
"files": [
|
|
73
|
+
"adapters",
|
|
74
|
+
"commands",
|
|
75
|
+
"pages",
|
|
76
|
+
"plugin.js",
|
|
77
|
+
"schema.json",
|
|
78
|
+
"src",
|
|
79
|
+
"lib",
|
|
80
|
+
"README.md"
|
|
81
|
+
],
|
|
82
|
+
"publishConfig": {
|
|
83
|
+
"access": "public",
|
|
84
|
+
"registry": "https://registry.npmjs.org"
|
|
85
|
+
},
|
|
86
|
+
"engines": {
|
|
87
|
+
"node": ">=22.19.0"
|
|
88
|
+
},
|
|
89
|
+
"zhin": {
|
|
90
|
+
"protocol": 1,
|
|
91
|
+
"type": "plugin",
|
|
92
|
+
"entry": "./plugin.js",
|
|
93
|
+
"engine": "^1.0.0",
|
|
94
|
+
"runtime": "trusted",
|
|
95
|
+
"features": [
|
|
96
|
+
{
|
|
97
|
+
"package": "@zhin.js/adapter",
|
|
98
|
+
"api": "^2.1.0"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"package": "@zhin.js/command",
|
|
102
|
+
"api": "^1.0.0"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"package": "@zhin.js/page",
|
|
106
|
+
"api": "^1.0.0"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"plugins": []
|
|
110
|
+
},
|
|
111
|
+
"scripts": {
|
|
112
|
+
"build": "tsc",
|
|
113
|
+
"clean": "rimraf lib",
|
|
114
|
+
"test": "NODE_OPTIONS=--experimental-strip-types vitest run --root ../../.. plugins/adapters/juejin/tests"
|
|
115
|
+
}
|
|
6
116
|
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { adapterConsoleStyles } from '@zhin.js/client';
|
|
5
|
+
import { call } from './rpc';
|
|
6
|
+
import { detectLocale, text } from './messages';
|
|
7
|
+
const COMMENT_LIMIT = 1000;
|
|
8
|
+
function errorMessage(error, locale) {
|
|
9
|
+
if (error instanceof Error && error.message)
|
|
10
|
+
return error.message;
|
|
11
|
+
return text(locale, '操作失败');
|
|
12
|
+
}
|
|
13
|
+
function ago(at, locale) {
|
|
14
|
+
const minutes = Math.floor((Date.now() - at) / 60_000);
|
|
15
|
+
if (minutes < 1)
|
|
16
|
+
return text(locale, '刚刚');
|
|
17
|
+
if (minutes < 60)
|
|
18
|
+
return text(locale, '{0} 分钟前', minutes);
|
|
19
|
+
const hours = Math.floor(minutes / 60);
|
|
20
|
+
if (hours < 24)
|
|
21
|
+
return text(locale, '{0} 小时前', hours);
|
|
22
|
+
return text(locale, '{0} 天前', Math.floor(hours / 24));
|
|
23
|
+
}
|
|
24
|
+
function Badge({ tone, children }) {
|
|
25
|
+
return _jsx("span", { className: `ac-badge ac-badge-${tone}`, children: children });
|
|
26
|
+
}
|
|
27
|
+
function Button({ children, onClick, disabled, variant = 'default', title }) {
|
|
28
|
+
return (_jsx("button", { type: "button", title: title, disabled: disabled, onClick: onClick, className: `ac-button ac-button-${variant}`, children: children }));
|
|
29
|
+
}
|
|
30
|
+
function LoginPanel({ endpoint, locale, onChanged, setNotice }) {
|
|
31
|
+
const [busy, setBusy] = useState(false);
|
|
32
|
+
const { login } = endpoint;
|
|
33
|
+
const recheck = async () => {
|
|
34
|
+
setBusy(true);
|
|
35
|
+
try {
|
|
36
|
+
await call('login-check', { endpoint: endpoint.id, locale });
|
|
37
|
+
onChanged();
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
setNotice({ kind: 'error', message: errorMessage(error, locale) });
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
setBusy(false);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const name = login.userName ? `${login.userName} · uid ${login.userId}` : login.userId ? `uid ${login.userId}` : '';
|
|
47
|
+
return (_jsxs("section", { className: "ac-review-login", children: [_jsxs("div", { className: "ac-actions", children: [login.state === 'ok' ? _jsx(Badge, { tone: "ok", children: text(locale, '已登录') })
|
|
48
|
+
: login.state === 'expired' ? _jsx(Badge, { tone: "warn", children: text(locale, '登录已失效') })
|
|
49
|
+
: _jsx(Badge, { tone: "muted", children: text(locale, '未登录') }), name && _jsx("span", { className: "text-sm", children: name }), login.state !== 'none' && _jsx("span", { className: "text-xs text-muted-foreground", children: text(locale, 'Cookie 来自配置 / 环境变量') }), _jsx(Button, { disabled: busy, onClick: () => void recheck(), children: text(locale, '重新检查登录') })] }), login.state === 'none' && _jsx("p", { className: "text-sm text-muted-foreground", children: text(locale, '未登录时只能读取公开评论,不能发送回复。请用 JUEJIN_COOKIE 环境变量注入 Cookie。') }), login.state === 'expired' && (_jsx("p", { className: "text-sm text-amber-700 dark:text-amber-300", children: text(locale, 'Cookie 已失效,草稿都保留着。更新 JUEJIN_COOKIE 后重启就能继续发送。') })), _jsx("p", { className: "text-xs text-muted-foreground", children: text(locale, 'Cookie 只来自配置 / 环境变量,不会经过这个页面,也不会写进数据目录。') })] }));
|
|
50
|
+
}
|
|
51
|
+
function DraftCard({ draft, endpoint, locale, onChanged, setNotice }) {
|
|
52
|
+
const [editing, setEditing] = useState(false);
|
|
53
|
+
const [value, setValue] = useState(draft.message);
|
|
54
|
+
const [busy, setBusy] = useState('');
|
|
55
|
+
useEffect(() => { if (!editing)
|
|
56
|
+
setValue(draft.message); }, [draft.message, editing]);
|
|
57
|
+
const length = [...value].length;
|
|
58
|
+
const sending = draft.status === 'sending' || busy === 'send';
|
|
59
|
+
const canSend = endpoint.sendMode !== 'off' && endpoint.login.state === 'ok' && !endpoint.circuit;
|
|
60
|
+
const act = async (kind) => {
|
|
61
|
+
if (kind === 'drop' && !window.confirm(text(locale, '确定丢弃这条回复?不会发送。')))
|
|
62
|
+
return;
|
|
63
|
+
setBusy(kind);
|
|
64
|
+
try {
|
|
65
|
+
if (kind === 'save') {
|
|
66
|
+
await call('edit', { id: draft.id, message: value, locale });
|
|
67
|
+
setEditing(false);
|
|
68
|
+
setNotice({ kind: 'ok', message: text(locale, '已保存修改') });
|
|
69
|
+
}
|
|
70
|
+
else if (kind === 'drop') {
|
|
71
|
+
await call('drop', { id: draft.id, locale });
|
|
72
|
+
setNotice({ kind: 'ok', message: text(locale, '已丢弃') });
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
if (editing && value.trim() !== draft.message) {
|
|
76
|
+
await call('edit', { id: draft.id, message: value, locale });
|
|
77
|
+
setEditing(false);
|
|
78
|
+
}
|
|
79
|
+
const result = await call('send', { id: draft.id, locale });
|
|
80
|
+
setNotice({ kind: 'ok', message: text(locale, '已发出'), link: result.url });
|
|
81
|
+
}
|
|
82
|
+
onChanged();
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
setNotice({ kind: 'error', message: errorMessage(error, locale) });
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
setBusy('');
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
return (_jsxs("li", { className: "ac-draft", children: [_jsxs("div", { className: "ac-draft-meta", children: [_jsx("span", { children: text(locale, '文章 {0}', draft.articleId) }), _jsx("span", { children: "\u00B7" }), _jsx("span", { children: ago(draft.createdAt, locale) }), _jsx("a", { href: draft.url, target: "_blank", rel: "noreferrer", className: "underline-offset-2 hover:underline", children: text(locale, '打开文章') })] }), draft.interrupted && (_jsx("p", { className: "ac-warning", children: text(locale, '上次发送的结果未知,这条可能已经发出。请先到掘金文章评论区确认,避免重复回复。') })), draft.original !== undefined && (_jsxs("div", { className: "ac-draft-original", children: [_jsxs("div", { className: "ac-draft-label", children: [text(locale, '原评论'), " \u00B7 ", draft.author] }), _jsx("div", { className: "ac-draft-body", children: draft.original })] })), _jsxs("div", { className: "text-sm", children: [_jsx("div", { className: "ac-draft-label", children: text(locale, '拟回复') }), editing ? (_jsxs(_Fragment, { children: [_jsx("textarea", { "aria-label": text(locale, '拟回复'), autoFocus: true, value: value, onChange: (event) => setValue(event.target.value), rows: 4, className: "w-full rounded-md border bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-primary/30" }), _jsxs("div", { className: `text-right text-xs ${length > COMMENT_LIMIT ? 'text-red-600' : 'text-muted-foreground'}`, children: [text(locale, '{0} 字', length), " / ", COMMENT_LIMIT] })] })) : _jsx("div", { className: "ac-draft-body", children: draft.message })] }), _jsxs("div", { className: "ac-actions", children: [_jsx(Button, { variant: "primary", disabled: !canSend || sending || busy !== '' || !value.trim() || length > COMMENT_LIMIT, onClick: () => act('send'), children: sending ? text(locale, '发送中…') : text(locale, '发送') }), editing
|
|
92
|
+
? _jsx(Button, { disabled: busy !== '' || !value.trim() || length > COMMENT_LIMIT, onClick: () => act('save'), children: text(locale, '保存') })
|
|
93
|
+
: _jsx(Button, { disabled: busy !== '' || sending, onClick: () => setEditing(true), children: text(locale, '修改') }), editing && _jsx(Button, { disabled: busy !== '', onClick: () => { setEditing(false); setValue(draft.message); }, children: text(locale, '取消') }), _jsx(Button, { variant: "danger", disabled: busy !== '' || sending, onClick: () => act('drop'), children: text(locale, '丢弃') })] })] }));
|
|
94
|
+
}
|
|
95
|
+
function EndpointSection({ endpoint, locale, showTitle, onChanged, setNotice }) {
|
|
96
|
+
return (_jsxs("div", { className: "ac-review-endpoint", children: [showTitle && _jsx("h2", { className: "text-lg font-semibold", children: text(locale, '账号 {0}', endpoint.id) }), _jsx(LoginPanel, { endpoint: endpoint, locale: locale, onChanged: onChanged, setNotice: setNotice }), endpoint.circuit && (_jsx("p", { className: "ac-notice ac-notice-error", role: "alert", children: text(locale, '触发了掘金风控或账号异常(错误码 {0}),已暂停轮询和发送。请到网页端确认账号状态,处理后重启。', endpoint.circuit.code) })), endpoint.sendMode === 'off' && _jsx("p", { className: "text-sm text-muted-foreground", children: text(locale, '出站已关闭(sendMode: off),草稿无法发送。') }), _jsxs("section", { className: "ac-review-drafts", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("h3", { className: "font-medium", children: text(locale, '待审回复') }), endpoint.pendingCount > 0 && _jsx(Badge, { tone: "warn", children: endpoint.pendingCount })] }), !endpoint.persistent && _jsx("p", { className: "text-xs text-muted-foreground", children: text(locale, '草稿只存在内存里,重启会丢失。') }), endpoint.drafts.length === 0
|
|
97
|
+
? _jsx("div", { className: "ac-empty", children: _jsx("p", { children: text(locale, '没有待审的回复。新的 AI 回复会自动出现在这里。') }) })
|
|
98
|
+
: (_jsx("ul", { className: "space-y-3", children: endpoint.drafts.map(draft => (_jsx(DraftCard, { draft: draft, endpoint: endpoint, locale: locale, onChanged: onChanged, setNotice: setNotice }, draft.id))) }))] }), _jsxs("section", { className: "ac-review-videos", children: [_jsx("h3", { className: "font-medium", children: text(locale, '管理的文章') }), endpoint.articles.length === 0
|
|
99
|
+
? _jsx("p", { className: "text-sm text-muted-foreground", children: text(locale, '还没有配置文章。要管理哪些文章请在配置的 articles 里填写文章 id 或链接。') })
|
|
100
|
+
: (_jsx("ul", { className: "flex flex-wrap gap-2", children: endpoint.articles.map(article => (_jsx("li", { children: _jsx("a", { href: article.url, target: "_blank", rel: "noreferrer", className: "rounded-md border px-2 py-1 text-sm hover:bg-accent", children: article.id }) }, article.id))) })), _jsx("p", { className: "text-xs text-muted-foreground", children: text(locale, '文章列表来自配置,要增删请改配置文件。') })] })] }));
|
|
101
|
+
}
|
|
102
|
+
export default function CommentReview() {
|
|
103
|
+
const locale = useMemo(detectLocale, []);
|
|
104
|
+
const [status, setStatus] = useState();
|
|
105
|
+
const [loadError, setLoadError] = useState();
|
|
106
|
+
const [notice, setNotice] = useState();
|
|
107
|
+
const timer = useRef(undefined);
|
|
108
|
+
const refresh = useCallback(async () => {
|
|
109
|
+
try {
|
|
110
|
+
const next = await call('status');
|
|
111
|
+
setStatus(next);
|
|
112
|
+
setLoadError(undefined);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
setLoadError(errorMessage(error, locale));
|
|
116
|
+
}
|
|
117
|
+
}, [locale]);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
let cancelled = false;
|
|
120
|
+
const loop = async () => {
|
|
121
|
+
if (cancelled)
|
|
122
|
+
return;
|
|
123
|
+
if (typeof document === 'undefined' || document.visibilityState !== 'hidden')
|
|
124
|
+
await refresh();
|
|
125
|
+
if (!cancelled)
|
|
126
|
+
timer.current = setTimeout(loop, 10_000);
|
|
127
|
+
};
|
|
128
|
+
void loop();
|
|
129
|
+
return () => { cancelled = true; if (timer.current)
|
|
130
|
+
clearTimeout(timer.current); };
|
|
131
|
+
}, [refresh]);
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
if (!notice || notice.kind === 'error')
|
|
134
|
+
return;
|
|
135
|
+
const id = setTimeout(() => setNotice(undefined), 6_000);
|
|
136
|
+
return () => clearTimeout(id);
|
|
137
|
+
}, [notice]);
|
|
138
|
+
const endpoints = status?.endpoints ?? [];
|
|
139
|
+
return (_jsxs("div", { className: "zhin-console-surface zhin-review-page", children: [_jsx("style", { children: adapterConsoleStyles }), _jsxs("header", { className: "ac-header", children: [_jsxs("div", { className: "ac-identity", children: [_jsx("span", { className: "ac-platform-mark", "aria-hidden": "true", children: "\u6398" }), _jsxs("div", { children: [_jsx("h1", { children: text(locale, '掘金评论审批') }), _jsx("p", { children: text(locale, 'AI 写好的掘金评论回复先停在这里,你点「发送」才会真的发出去。') })] })] }), _jsx(Button, { onClick: () => void refresh(), children: text(locale, '刷新') })] }), notice && (_jsxs("div", { role: notice.kind === 'ok' ? 'status' : 'alert', className: `ac-notice ${notice.kind === 'ok' ? '' : 'ac-notice-error'}`, children: [notice.message, notice.link && _jsxs(_Fragment, { children: [" \u00B7 ", _jsx("a", { href: notice.link, target: "_blank", rel: "noreferrer", className: "underline", children: text(locale, '查看') })] })] })), loadError && _jsx("p", { role: "alert", className: "ac-notice ac-notice-error", children: loadError }), !status && !loadError && _jsxs("div", { className: "ac-loading", role: "status", "aria-busy": "true", children: [_jsx("p", { children: text(locale, '加载中…') }), _jsx("span", { "aria-hidden": "true" })] }), status && endpoints.length === 0 && _jsx("div", { className: "ac-empty", children: _jsx("p", { children: text(locale, '掘金适配器还没有启动。请先在配置里添加 juejin 插件和至少一个账号。') }) }), endpoints.map(endpoint => (_jsx(EndpointSection, { endpoint: endpoint, locale: locale, showTitle: endpoints.length > 1, onChanged: () => void refresh(), setNotice: setNotice }, endpoint.id)))] }));
|
|
140
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { adapterConsoleStyles } from '@zhin.js/client';
|
|
3
|
+
import { call, type ReviewDraft, type ReviewEndpoint, type ReviewStatus } from './rpc';
|
|
4
|
+
import { detectLocale, text, type ReviewLocale } from './messages';
|
|
5
|
+
|
|
6
|
+
const COMMENT_LIMIT = 1000;
|
|
7
|
+
|
|
8
|
+
type Notice = { readonly kind: 'ok' | 'error'; readonly message: string; readonly link?: string };
|
|
9
|
+
|
|
10
|
+
function errorMessage(error: unknown, locale: ReviewLocale): string {
|
|
11
|
+
if (error instanceof Error && error.message) return error.message;
|
|
12
|
+
return text(locale, '操作失败');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function ago(at: number, locale: ReviewLocale): string {
|
|
16
|
+
const minutes = Math.floor((Date.now() - at) / 60_000);
|
|
17
|
+
if (minutes < 1) return text(locale, '刚刚');
|
|
18
|
+
if (minutes < 60) return text(locale, '{0} 分钟前', minutes);
|
|
19
|
+
const hours = Math.floor(minutes / 60);
|
|
20
|
+
if (hours < 24) return text(locale, '{0} 小时前', hours);
|
|
21
|
+
return text(locale, '{0} 天前', Math.floor(hours / 24));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function Badge({ tone, children }: { tone: 'ok' | 'warn' | 'muted'; children: React.ReactNode }) {
|
|
25
|
+
return <span className={`ac-badge ac-badge-${tone}`}>{children}</span>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function Button({ children, onClick, disabled, variant = 'default', title }: {
|
|
29
|
+
children: React.ReactNode; onClick?: () => void; disabled?: boolean; variant?: 'default' | 'primary' | 'danger'; title?: string;
|
|
30
|
+
}) {
|
|
31
|
+
return (
|
|
32
|
+
<button type="button" title={title} disabled={disabled} onClick={onClick}
|
|
33
|
+
className={`ac-button ac-button-${variant}`}>
|
|
34
|
+
{children}
|
|
35
|
+
</button>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function LoginPanel({ endpoint, locale, onChanged, setNotice }: {
|
|
40
|
+
endpoint: ReviewEndpoint; locale: ReviewLocale; onChanged: () => void; setNotice: (notice: Notice) => void;
|
|
41
|
+
}) {
|
|
42
|
+
const [busy, setBusy] = useState(false);
|
|
43
|
+
const { login } = endpoint;
|
|
44
|
+
const recheck = async () => {
|
|
45
|
+
setBusy(true);
|
|
46
|
+
try {
|
|
47
|
+
await call('login-check', { endpoint: endpoint.id, locale });
|
|
48
|
+
onChanged();
|
|
49
|
+
} catch (error) {
|
|
50
|
+
setNotice({ kind: 'error', message: errorMessage(error, locale) });
|
|
51
|
+
} finally {
|
|
52
|
+
setBusy(false);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const name = login.userName ? `${login.userName} · uid ${login.userId}` : login.userId ? `uid ${login.userId}` : '';
|
|
56
|
+
return (
|
|
57
|
+
<section className="ac-review-login">
|
|
58
|
+
<div className="ac-actions">
|
|
59
|
+
{login.state === 'ok' ? <Badge tone="ok">{text(locale, '已登录')}</Badge>
|
|
60
|
+
: login.state === 'expired' ? <Badge tone="warn">{text(locale, '登录已失效')}</Badge>
|
|
61
|
+
: <Badge tone="muted">{text(locale, '未登录')}</Badge>}
|
|
62
|
+
{name && <span className="text-sm">{name}</span>}
|
|
63
|
+
{login.state !== 'none' && <span className="text-xs text-muted-foreground">{text(locale, 'Cookie 来自配置 / 环境变量')}</span>}
|
|
64
|
+
<Button disabled={busy} onClick={() => void recheck()}>{text(locale, '重新检查登录')}</Button>
|
|
65
|
+
</div>
|
|
66
|
+
{login.state === 'none' && <p className="text-sm text-muted-foreground">{text(locale, '未登录时只能读取公开评论,不能发送回复。请用 JUEJIN_COOKIE 环境变量注入 Cookie。')}</p>}
|
|
67
|
+
{login.state === 'expired' && (
|
|
68
|
+
<p className="text-sm text-amber-700 dark:text-amber-300">{text(locale, 'Cookie 已失效,草稿都保留着。更新 JUEJIN_COOKIE 后重启就能继续发送。')}</p>
|
|
69
|
+
)}
|
|
70
|
+
<p className="text-xs text-muted-foreground">{text(locale, 'Cookie 只来自配置 / 环境变量,不会经过这个页面,也不会写进数据目录。')}</p>
|
|
71
|
+
</section>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function DraftCard({ draft, endpoint, locale, onChanged, setNotice }: {
|
|
76
|
+
draft: ReviewDraft; endpoint: ReviewEndpoint; locale: ReviewLocale; onChanged: () => void; setNotice: (notice: Notice) => void;
|
|
77
|
+
}) {
|
|
78
|
+
const [editing, setEditing] = useState(false);
|
|
79
|
+
const [value, setValue] = useState(draft.message);
|
|
80
|
+
const [busy, setBusy] = useState<'' | 'send' | 'save' | 'drop'>('');
|
|
81
|
+
useEffect(() => { if (!editing) setValue(draft.message); }, [draft.message, editing]);
|
|
82
|
+
const length = [...value].length;
|
|
83
|
+
const sending = draft.status === 'sending' || busy === 'send';
|
|
84
|
+
const canSend = endpoint.sendMode !== 'off' && endpoint.login.state === 'ok' && !endpoint.circuit;
|
|
85
|
+
|
|
86
|
+
const act = async (kind: 'send' | 'save' | 'drop') => {
|
|
87
|
+
if (kind === 'drop' && !window.confirm(text(locale, '确定丢弃这条回复?不会发送。'))) return;
|
|
88
|
+
setBusy(kind);
|
|
89
|
+
try {
|
|
90
|
+
if (kind === 'save') {
|
|
91
|
+
await call('edit', { id: draft.id, message: value, locale });
|
|
92
|
+
setEditing(false);
|
|
93
|
+
setNotice({ kind: 'ok', message: text(locale, '已保存修改') });
|
|
94
|
+
} else if (kind === 'drop') {
|
|
95
|
+
await call('drop', { id: draft.id, locale });
|
|
96
|
+
setNotice({ kind: 'ok', message: text(locale, '已丢弃') });
|
|
97
|
+
} else {
|
|
98
|
+
if (editing && value.trim() !== draft.message) {
|
|
99
|
+
await call('edit', { id: draft.id, message: value, locale });
|
|
100
|
+
setEditing(false);
|
|
101
|
+
}
|
|
102
|
+
const result = await call<{ url: string }>('send', { id: draft.id, locale });
|
|
103
|
+
setNotice({ kind: 'ok', message: text(locale, '已发出'), link: result.url });
|
|
104
|
+
}
|
|
105
|
+
onChanged();
|
|
106
|
+
} catch (error) {
|
|
107
|
+
setNotice({ kind: 'error', message: errorMessage(error, locale) });
|
|
108
|
+
} finally {
|
|
109
|
+
setBusy('');
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<li className="ac-draft">
|
|
115
|
+
<div className="ac-draft-meta">
|
|
116
|
+
<span>{text(locale, '文章 {0}', draft.articleId)}</span>
|
|
117
|
+
<span>·</span>
|
|
118
|
+
<span>{ago(draft.createdAt, locale)}</span>
|
|
119
|
+
<a href={draft.url} target="_blank" rel="noreferrer" className="underline-offset-2 hover:underline">{text(locale, '打开文章')}</a>
|
|
120
|
+
</div>
|
|
121
|
+
{draft.interrupted && (
|
|
122
|
+
<p className="ac-warning">{text(locale, '上次发送的结果未知,这条可能已经发出。请先到掘金文章评论区确认,避免重复回复。')}</p>
|
|
123
|
+
)}
|
|
124
|
+
{draft.original !== undefined && (
|
|
125
|
+
<div className="ac-draft-original">
|
|
126
|
+
<div className="ac-draft-label">{text(locale, '原评论')} · {draft.author}</div>
|
|
127
|
+
<div className="ac-draft-body">{draft.original}</div>
|
|
128
|
+
</div>
|
|
129
|
+
)}
|
|
130
|
+
<div className="text-sm">
|
|
131
|
+
<div className="ac-draft-label">{text(locale, '拟回复')}</div>
|
|
132
|
+
{editing ? (
|
|
133
|
+
<>
|
|
134
|
+
<textarea aria-label={text(locale, '拟回复')} autoFocus value={value} onChange={(event) => setValue(event.target.value)} rows={4}
|
|
135
|
+
className="w-full rounded-md border bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-primary/30" />
|
|
136
|
+
<div className={`text-right text-xs ${length > COMMENT_LIMIT ? 'text-red-600' : 'text-muted-foreground'}`}>{text(locale, '{0} 字', length)} / {COMMENT_LIMIT}</div>
|
|
137
|
+
</>
|
|
138
|
+
) : <div className="ac-draft-body">{draft.message}</div>}
|
|
139
|
+
</div>
|
|
140
|
+
<div className="ac-actions">
|
|
141
|
+
<Button variant="primary" disabled={!canSend || sending || busy !== '' || !value.trim() || length > COMMENT_LIMIT} onClick={() => act('send')}>
|
|
142
|
+
{sending ? text(locale, '发送中…') : text(locale, '发送')}
|
|
143
|
+
</Button>
|
|
144
|
+
{editing
|
|
145
|
+
? <Button disabled={busy !== '' || !value.trim() || length > COMMENT_LIMIT} onClick={() => act('save')}>{text(locale, '保存')}</Button>
|
|
146
|
+
: <Button disabled={busy !== '' || sending} onClick={() => setEditing(true)}>{text(locale, '修改')}</Button>}
|
|
147
|
+
{editing && <Button disabled={busy !== ''} onClick={() => { setEditing(false); setValue(draft.message); }}>{text(locale, '取消')}</Button>}
|
|
148
|
+
<Button variant="danger" disabled={busy !== '' || sending} onClick={() => act('drop')}>{text(locale, '丢弃')}</Button>
|
|
149
|
+
</div>
|
|
150
|
+
</li>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function EndpointSection({ endpoint, locale, showTitle, onChanged, setNotice }: {
|
|
155
|
+
endpoint: ReviewEndpoint; locale: ReviewLocale; showTitle: boolean; onChanged: () => void; setNotice: (notice: Notice) => void;
|
|
156
|
+
}) {
|
|
157
|
+
return (
|
|
158
|
+
<div className="ac-review-endpoint">
|
|
159
|
+
{showTitle && <h2 className="text-lg font-semibold">{text(locale, '账号 {0}', endpoint.id)}</h2>}
|
|
160
|
+
<LoginPanel endpoint={endpoint} locale={locale} onChanged={onChanged} setNotice={setNotice} />
|
|
161
|
+
{endpoint.circuit && (
|
|
162
|
+
<p className="ac-notice ac-notice-error" role="alert">
|
|
163
|
+
{text(locale, '触发了掘金风控或账号异常(错误码 {0}),已暂停轮询和发送。请到网页端确认账号状态,处理后重启。', endpoint.circuit.code)}
|
|
164
|
+
</p>
|
|
165
|
+
)}
|
|
166
|
+
{endpoint.sendMode === 'off' && <p className="text-sm text-muted-foreground">{text(locale, '出站已关闭(sendMode: off),草稿无法发送。')}</p>}
|
|
167
|
+
|
|
168
|
+
<section className="ac-review-drafts">
|
|
169
|
+
<div className="flex items-center gap-2">
|
|
170
|
+
<h3 className="font-medium">{text(locale, '待审回复')}</h3>
|
|
171
|
+
{endpoint.pendingCount > 0 && <Badge tone="warn">{endpoint.pendingCount}</Badge>}
|
|
172
|
+
</div>
|
|
173
|
+
{!endpoint.persistent && <p className="text-xs text-muted-foreground">{text(locale, '草稿只存在内存里,重启会丢失。')}</p>}
|
|
174
|
+
{endpoint.drafts.length === 0
|
|
175
|
+
? <div className="ac-empty"><p>{text(locale, '没有待审的回复。新的 AI 回复会自动出现在这里。')}</p></div>
|
|
176
|
+
: (
|
|
177
|
+
<ul className="space-y-3">
|
|
178
|
+
{endpoint.drafts.map(draft => (
|
|
179
|
+
<DraftCard key={draft.id} draft={draft} endpoint={endpoint} locale={locale} onChanged={onChanged} setNotice={setNotice} />
|
|
180
|
+
))}
|
|
181
|
+
</ul>
|
|
182
|
+
)}
|
|
183
|
+
</section>
|
|
184
|
+
|
|
185
|
+
<section className="ac-review-videos">
|
|
186
|
+
<h3 className="font-medium">{text(locale, '管理的文章')}</h3>
|
|
187
|
+
{endpoint.articles.length === 0
|
|
188
|
+
? <p className="text-sm text-muted-foreground">{text(locale, '还没有配置文章。要管理哪些文章请在配置的 articles 里填写文章 id 或链接。')}</p>
|
|
189
|
+
: (
|
|
190
|
+
<ul className="flex flex-wrap gap-2">
|
|
191
|
+
{endpoint.articles.map(article => (
|
|
192
|
+
<li key={article.id}>
|
|
193
|
+
<a href={article.url} target="_blank" rel="noreferrer" className="rounded-md border px-2 py-1 text-sm hover:bg-accent">{article.id}</a>
|
|
194
|
+
</li>
|
|
195
|
+
))}
|
|
196
|
+
</ul>
|
|
197
|
+
)}
|
|
198
|
+
<p className="text-xs text-muted-foreground">{text(locale, '文章列表来自配置,要增删请改配置文件。')}</p>
|
|
199
|
+
</section>
|
|
200
|
+
</div>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export default function CommentReview() {
|
|
205
|
+
const locale = useMemo(detectLocale, []);
|
|
206
|
+
const [status, setStatus] = useState<ReviewStatus | undefined>();
|
|
207
|
+
const [loadError, setLoadError] = useState<string | undefined>();
|
|
208
|
+
const [notice, setNotice] = useState<Notice | undefined>();
|
|
209
|
+
const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
210
|
+
|
|
211
|
+
const refresh = useCallback(async () => {
|
|
212
|
+
try {
|
|
213
|
+
const next = await call<ReviewStatus>('status');
|
|
214
|
+
setStatus(next);
|
|
215
|
+
setLoadError(undefined);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
setLoadError(errorMessage(error, locale));
|
|
218
|
+
}
|
|
219
|
+
}, [locale]);
|
|
220
|
+
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
let cancelled = false;
|
|
223
|
+
const loop = async () => {
|
|
224
|
+
if (cancelled) return;
|
|
225
|
+
if (typeof document === 'undefined' || document.visibilityState !== 'hidden') await refresh();
|
|
226
|
+
if (!cancelled) timer.current = setTimeout(loop, 10_000);
|
|
227
|
+
};
|
|
228
|
+
void loop();
|
|
229
|
+
return () => { cancelled = true; if (timer.current) clearTimeout(timer.current); };
|
|
230
|
+
}, [refresh]);
|
|
231
|
+
|
|
232
|
+
useEffect(() => {
|
|
233
|
+
if (!notice || notice.kind === 'error') return;
|
|
234
|
+
const id = setTimeout(() => setNotice(undefined), 6_000);
|
|
235
|
+
return () => clearTimeout(id);
|
|
236
|
+
}, [notice]);
|
|
237
|
+
|
|
238
|
+
const endpoints = status?.endpoints ?? [];
|
|
239
|
+
return (
|
|
240
|
+
<div className="zhin-console-surface zhin-review-page">
|
|
241
|
+
<style>{adapterConsoleStyles}</style>
|
|
242
|
+
<header className="ac-header">
|
|
243
|
+
<div className="ac-identity">
|
|
244
|
+
<span className="ac-platform-mark" aria-hidden="true">掘</span>
|
|
245
|
+
<div><h1>{text(locale, '掘金评论审批')}</h1><p>{text(locale, 'AI 写好的掘金评论回复先停在这里,你点「发送」才会真的发出去。')}</p></div>
|
|
246
|
+
</div>
|
|
247
|
+
<Button onClick={() => void refresh()}>{text(locale, '刷新')}</Button>
|
|
248
|
+
</header>
|
|
249
|
+
{notice && (
|
|
250
|
+
<div role={notice.kind === 'ok' ? 'status' : 'alert'} className={`ac-notice ${notice.kind === 'ok' ? '' : 'ac-notice-error'}`}>
|
|
251
|
+
{notice.message}
|
|
252
|
+
{notice.link && <> · <a href={notice.link} target="_blank" rel="noreferrer" className="underline">{text(locale, '查看')}</a></>}
|
|
253
|
+
</div>
|
|
254
|
+
)}
|
|
255
|
+
{loadError && <p role="alert" className="ac-notice ac-notice-error">{loadError}</p>}
|
|
256
|
+
{!status && !loadError && <div className="ac-loading" role="status" aria-busy="true"><p>{text(locale, '加载中…')}</p><span aria-hidden="true" /></div>}
|
|
257
|
+
{status && endpoints.length === 0 && <div className="ac-empty"><p>{text(locale, '掘金适配器还没有启动。请先在配置里添加 juejin 插件和至少一个账号。')}</p></div>}
|
|
258
|
+
{endpoints.map(endpoint => (
|
|
259
|
+
<EndpointSection key={endpoint.id} endpoint={endpoint} locale={locale} showTitle={endpoints.length > 1}
|
|
260
|
+
onChanged={() => void refresh()} setNotice={setNotice} />
|
|
261
|
+
))}
|
|
262
|
+
</div>
|
|
263
|
+
);
|
|
264
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { definePage } from '@zhin.js/console-contract';
|
|
4
|
+
import CommentReview from './CommentReview';
|
|
5
|
+
export const meta = definePage({
|
|
6
|
+
title: '掘金评论审批',
|
|
7
|
+
titleI18n: { en: 'Juejin comment review' },
|
|
8
|
+
icon: 'MessageSquare',
|
|
9
|
+
order: 41,
|
|
10
|
+
requiredPermissions: ['juejin:read'],
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Convention page entry: `pages/index/index.tsx` → `/<插件路径>`(如 `/juejin`)。
|
|
14
|
+
* 看登录态和白名单文章、审批 AI 写好的掘金评论回复。数据走插件 RPC(plugin.<pluginId>.status / 动作)。
|
|
15
|
+
*/
|
|
16
|
+
export default function JuejinReviewPage() {
|
|
17
|
+
return _jsx(CommentReview, {});
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { definePage } from '@zhin.js/console-contract';
|
|
2
|
+
import CommentReview from './CommentReview';
|
|
3
|
+
|
|
4
|
+
export const meta = definePage({
|
|
5
|
+
title: '掘金评论审批',
|
|
6
|
+
titleI18n: { en: 'Juejin comment review' },
|
|
7
|
+
icon: 'MessageSquare',
|
|
8
|
+
order: 41,
|
|
9
|
+
requiredPermissions: ['juejin:read'],
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Convention page entry: `pages/index/index.tsx` → `/<插件路径>`(如 `/juejin`)。
|
|
14
|
+
* 看登录态和白名单文章、审批 AI 写好的掘金评论回复。数据走插件 RPC(plugin.<pluginId>.status / 动作)。
|
|
15
|
+
*/
|
|
16
|
+
export default function JuejinReviewPage() {
|
|
17
|
+
return <CommentReview />;
|
|
18
|
+
}
|