artalk 2.7.2 → 2.8.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/LICENSE +21 -0
- package/dist/Artalk.cjs +11 -0
- package/dist/Artalk.cjs.map +1 -0
- package/dist/Artalk.css +1 -1
- package/dist/Artalk.iife.js +10 -1
- package/dist/Artalk.iife.js.map +1 -1
- package/dist/Artalk.js +10 -1
- package/dist/Artalk.js.map +1 -1
- package/dist/{Artalk.es.js → Artalk.mjs} +2552 -1857
- package/dist/Artalk.mjs.map +1 -0
- package/dist/ArtalkLite.cjs +11 -0
- package/dist/ArtalkLite.cjs.map +1 -0
- package/dist/ArtalkLite.css +1 -1
- package/dist/ArtalkLite.iife.js +10 -1
- package/dist/ArtalkLite.iife.js.map +1 -1
- package/dist/ArtalkLite.js +10 -1
- package/dist/ArtalkLite.js.map +1 -1
- package/dist/{ArtalkLite.es.js → ArtalkLite.mjs} +2150 -1261
- package/dist/ArtalkLite.mjs.map +1 -0
- package/dist/i18n/jp.cjs +1 -0
- package/dist/i18n/jp.d.cts +3 -0
- package/dist/i18n/jp.d.ts +3 -0
- package/dist/i18n/jp.js +1 -1
- package/dist/i18n/jp.mjs +94 -0
- package/dist/i18n/zh-TW.cjs +1 -0
- package/dist/i18n/zh-TW.d.cts +3 -0
- package/dist/i18n/zh-TW.d.ts +3 -0
- package/dist/i18n/zh-TW.js +1 -1
- package/dist/i18n/zh-TW.mjs +94 -0
- package/dist/main.d.cts +2812 -0
- package/dist/main.d.ts +2812 -0
- package/package.json +62 -30
- package/dist/Artalk.es.js.map +0 -1
- package/dist/ArtalkLite.es.js.map +0 -1
- package/dist/src/api/_base.d.ts +0 -17
- package/dist/src/api/_options.d.ts +0 -24
- package/dist/src/api/_request.d.ts +0 -12
- package/dist/src/api/admin.d.ts +0 -10
- package/dist/src/api/captcha.d.ts +0 -14
- package/dist/src/api/comment.d.ts +0 -29
- package/dist/src/api/index.d.ts +0 -29
- package/dist/src/api/page.d.ts +0 -22
- package/dist/src/api/site.d.ts +0 -17
- package/dist/src/api/system.d.ts +0 -33
- package/dist/src/api/upload.d.ts +0 -11
- package/dist/src/api/user.d.ts +0 -42
- package/dist/src/artalk.d.ts +0 -35
- package/dist/src/comment/actions.d.ts +0 -17
- package/dist/src/comment/comment.d.ts +0 -66
- package/dist/src/comment/height-limit.d.ts +0 -30
- package/dist/src/comment/index.d.ts +0 -2
- package/dist/src/comment/render.d.ts +0 -46
- package/dist/src/comment/renders/actions.d.ts +0 -5
- package/dist/src/comment/renders/avatar.d.ts +0 -5
- package/dist/src/comment/renders/content.d.ts +0 -5
- package/dist/src/comment/renders/header.d.ts +0 -5
- package/dist/src/comment/renders/index.d.ts +0 -2
- package/dist/src/comment/renders/pending.d.ts +0 -5
- package/dist/src/comment/renders/reply-at.d.ts +0 -5
- package/dist/src/comment/renders/reply-to.d.ts +0 -5
- package/dist/src/components/action-btn.d.ts +0 -50
- package/dist/src/components/checker/admin.d.ts +0 -3
- package/dist/src/components/checker/captcha-renders.d.ts +0 -5
- package/dist/src/components/checker/captcha.d.ts +0 -3
- package/dist/src/components/checker/index.d.ts +0 -53
- package/dist/src/components/dialog.d.ts +0 -16
- package/dist/src/components/error-dialog.d.ts +0 -8
- package/dist/src/components/pagination.d.ts +0 -31
- package/dist/src/components/read-more-btn.d.ts +0 -33
- package/dist/src/config.d.ts +0 -24
- package/dist/src/context.d.ts +0 -45
- package/dist/src/data.d.ts +0 -27
- package/dist/src/defaults.d.ts +0 -3
- package/dist/src/editor/editor.d.ts +0 -31
- package/dist/src/editor/state.d.ts +0 -20
- package/dist/src/editor/ui.d.ts +0 -25
- package/dist/src/i18n/en.d.ts +0 -73
- package/dist/src/i18n/external.d.ts +0 -74
- package/dist/src/i18n/index.d.ts +0 -236
- package/dist/src/i18n/jp.d.ts +0 -73
- package/dist/src/i18n/zh-CN.d.ts +0 -3
- package/dist/src/i18n/zh-TW.d.ts +0 -73
- package/dist/src/layer/index.d.ts +0 -4
- package/dist/src/layer/layer-manager.d.ts +0 -9
- package/dist/src/layer/layer.d.ts +0 -12
- package/dist/src/layer/scrollbar-helper.d.ts +0 -5
- package/dist/src/layer/sidebar-layer.d.ts +0 -20
- package/dist/src/layer/wrap.d.ts +0 -13
- package/dist/src/lib/component.d.ts +0 -7
- package/dist/src/lib/detect.d.ts +0 -10
- package/dist/src/lib/event-manager.d.ts +0 -28
- package/dist/src/lib/highlight.d.ts +0 -1
- package/dist/src/lib/marked-renderer.d.ts +0 -4
- package/dist/src/lib/marked.d.ts +0 -11
- package/dist/src/lib/sanitizer.d.ts +0 -1
- package/dist/src/lib/ui.d.ts +0 -24
- package/dist/src/lib/user.d.ts +0 -21
- package/dist/src/lib/utils.d.ts +0 -41
- package/dist/src/list/comment.d.ts +0 -3
- package/dist/src/list/layout.d.ts +0 -23
- package/dist/src/list/list.d.ts +0 -14
- package/dist/src/list/nest.d.ts +0 -10
- package/dist/src/list/page.d.ts +0 -2
- package/dist/src/list/paginator/index.d.ts +0 -25
- package/dist/src/list/paginator/read-more.d.ts +0 -18
- package/dist/src/list/paginator/up-down.d.ts +0 -14
- package/dist/src/main.d.ts +0 -7
- package/dist/src/plugins/admin-only-elem.d.ts +0 -2
- package/dist/src/plugins/conf-remoter.d.ts +0 -2
- package/dist/src/plugins/dark-mode.d.ts +0 -2
- package/dist/src/plugins/editor/_kit.d.ts +0 -33
- package/dist/src/plugins/editor/_plug.d.ts +0 -29
- package/dist/src/plugins/editor/_sample.d.ts +0 -5
- package/dist/src/plugins/editor/closable.d.ts +0 -7
- package/dist/src/plugins/editor/emoticons.d.ts +0 -30
- package/dist/src/plugins/editor/header-event.d.ts +0 -6
- package/dist/src/plugins/editor/header-link.d.ts +0 -6
- package/dist/src/plugins/editor/header-user.d.ts +0 -16
- package/dist/src/plugins/editor/index.d.ts +0 -6
- package/dist/src/plugins/editor/local-storage.d.ts +0 -6
- package/dist/src/plugins/editor/mover.d.ts +0 -6
- package/dist/src/plugins/editor/preview.d.ts +0 -7
- package/dist/src/plugins/editor/state-edit.d.ts +0 -11
- package/dist/src/plugins/editor/state-reply.d.ts +0 -8
- package/dist/src/plugins/editor/submit-add.d.ts +0 -18
- package/dist/src/plugins/editor/submit-btn.d.ts +0 -5
- package/dist/src/plugins/editor/submit.d.ts +0 -17
- package/dist/src/plugins/editor/textarea.d.ts +0 -8
- package/dist/src/plugins/editor/upload.d.ts +0 -9
- package/dist/src/plugins/editor-kit.d.ts +0 -42
- package/dist/src/plugins/index.d.ts +0 -2
- package/dist/src/plugins/list/copyright.d.ts +0 -2
- package/dist/src/plugins/list/count.d.ts +0 -2
- package/dist/src/plugins/list/dropdown.d.ts +0 -2
- package/dist/src/plugins/list/error-dialog.d.ts +0 -2
- package/dist/src/plugins/list/fetch.d.ts +0 -2
- package/dist/src/plugins/list/goto-first.d.ts +0 -3
- package/dist/src/plugins/list/goto.d.ts +0 -2
- package/dist/src/plugins/list/index.d.ts +0 -3
- package/dist/src/plugins/list/loading.d.ts +0 -2
- package/dist/src/plugins/list/no-comment.d.ts +0 -2
- package/dist/src/plugins/list/reach-bottom.d.ts +0 -2
- package/dist/src/plugins/list/sidebar-btn.d.ts +0 -2
- package/dist/src/plugins/list/time-ticking.d.ts +0 -3
- package/dist/src/plugins/list/unread-badge.d.ts +0 -2
- package/dist/src/plugins/list/unread.d.ts +0 -2
- package/dist/src/plugins/list/with-editor.d.ts +0 -2
- package/dist/src/plugins/markdown.d.ts +0 -2
- package/dist/src/plugins/stat.d.ts +0 -13
- package/dist/src/plugins/version-check.d.ts +0 -2
- package/dist/src/service.d.ts +0 -36
- package/dist/tests/e2e/comment-add.spec.d.ts +0 -1
- package/dist/types/config.d.ts +0 -110
- package/dist/types/context.d.ts +0 -62
- package/dist/types/data.d.ts +0 -194
- package/dist/types/editor.d.ts +0 -76
- package/dist/types/event.d.ts +0 -39
- package/dist/types/global.d.ts +0 -1
- package/dist/types/index.d.ts +0 -7
- package/dist/types/plugin.d.ts +0 -2
- package/dist/types/sidebar.d.ts +0 -3
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,2812 @@
|
|
|
1
|
+
import { marked } from 'marked';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 通用操作按钮
|
|
5
|
+
*/
|
|
6
|
+
declare class ActionBtn {
|
|
7
|
+
private opts;
|
|
8
|
+
$el: HTMLElement;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
msgRecTimer?: number;
|
|
11
|
+
msgRecTimerFunc?: Function;
|
|
12
|
+
get isMessaging(): boolean;
|
|
13
|
+
isConfirming: boolean;
|
|
14
|
+
confirmRecTimer?: number;
|
|
15
|
+
/** 构造函数 */
|
|
16
|
+
constructor(opts: ActionBtnOptions | string | (() => string));
|
|
17
|
+
/** 将按钮装载到指定元素 */
|
|
18
|
+
appendTo(dom: HTMLElement): this;
|
|
19
|
+
/** 获取按钮文字(动态/静态) */
|
|
20
|
+
private getText;
|
|
21
|
+
/** 设置点击事件 */
|
|
22
|
+
setClick(func: Function): void;
|
|
23
|
+
/** 文字刷新(动态/静态) */
|
|
24
|
+
updateText(text?: (() => string) | string): void;
|
|
25
|
+
/** 设置加载状态 */
|
|
26
|
+
setLoading(value: boolean, loadingText?: string): void;
|
|
27
|
+
/** 错误消息 */
|
|
28
|
+
setError(text: string): void;
|
|
29
|
+
/** 警告消息 */
|
|
30
|
+
setWarn(text: string): void;
|
|
31
|
+
/** 成功消息 */
|
|
32
|
+
setSuccess(text: string): void;
|
|
33
|
+
/** 设置消息 */
|
|
34
|
+
setMsg(text: string, className?: string, duringTime?: number, after?: Function): void;
|
|
35
|
+
/** 设置消息复原操作定时器 */
|
|
36
|
+
private setMsgRecTimer;
|
|
37
|
+
/** 立刻触发器复原定时器 */
|
|
38
|
+
private fireMsgRecTimer;
|
|
39
|
+
/** 仅清除 timer */
|
|
40
|
+
private clearMsgRecTimer;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare interface ActionBtnOptions {
|
|
44
|
+
/** 按钮文字 (动态/静态) */
|
|
45
|
+
text: (() => string) | string;
|
|
46
|
+
/** 仅管理员可用 */
|
|
47
|
+
adminOnly?: boolean;
|
|
48
|
+
/** 确认操作 */
|
|
49
|
+
confirm?: boolean;
|
|
50
|
+
/** 确认时提示文字 */
|
|
51
|
+
confirmText?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare class Api extends Api_2<void> {
|
|
55
|
+
private _opts;
|
|
56
|
+
constructor(opts: ApiOptions);
|
|
57
|
+
/**
|
|
58
|
+
* Get user info as params for request
|
|
59
|
+
*
|
|
60
|
+
* @returns Request params with user info
|
|
61
|
+
*/
|
|
62
|
+
getUserFields(): {
|
|
63
|
+
name: string;
|
|
64
|
+
email: string;
|
|
65
|
+
} | undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @title Artalk API
|
|
70
|
+
* @version 2.0
|
|
71
|
+
* @license MIT (https://github.com/ArtalkJS/Artalk/blob/master/LICENSE)
|
|
72
|
+
* @baseUrl /api/v2
|
|
73
|
+
* @contact API Support <artalkjs@gmail.com> (https://artalk.js.org)
|
|
74
|
+
*
|
|
75
|
+
* Artalk is a modern comment system based on Golang.
|
|
76
|
+
*/
|
|
77
|
+
declare class Api_2<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
78
|
+
cache: {
|
|
79
|
+
/**
|
|
80
|
+
* @description Flush all cache on the server
|
|
81
|
+
*
|
|
82
|
+
* @tags Cache
|
|
83
|
+
* @name FlushCache
|
|
84
|
+
* @summary Flush Cache
|
|
85
|
+
* @request POST:/cache/flush
|
|
86
|
+
* @secure
|
|
87
|
+
* @response `200` `(HandlerMap & {
|
|
88
|
+
msg?: string,
|
|
89
|
+
|
|
90
|
+
})` OK
|
|
91
|
+
* @response `400` `(HandlerMap & {
|
|
92
|
+
msg?: string,
|
|
93
|
+
|
|
94
|
+
})` Bad Request
|
|
95
|
+
* @response `403` `(HandlerMap & {
|
|
96
|
+
msg?: string,
|
|
97
|
+
|
|
98
|
+
})` Forbidden
|
|
99
|
+
*/
|
|
100
|
+
flushCache: (params?: RequestParams) => Promise<HttpResponse<HandlerMap & {
|
|
101
|
+
msg?: string | undefined;
|
|
102
|
+
}, HandlerMap & {
|
|
103
|
+
msg?: string | undefined;
|
|
104
|
+
}>>;
|
|
105
|
+
/**
|
|
106
|
+
* @description Cache warming helps you to pre-load the cache to improve the performance of the first request
|
|
107
|
+
*
|
|
108
|
+
* @tags Cache
|
|
109
|
+
* @name WarmUpCache
|
|
110
|
+
* @summary Warm-Up Cache
|
|
111
|
+
* @request POST:/cache/warm_up
|
|
112
|
+
* @secure
|
|
113
|
+
* @response `200` `(HandlerMap & {
|
|
114
|
+
msg?: string,
|
|
115
|
+
|
|
116
|
+
})` OK
|
|
117
|
+
* @response `400` `(HandlerMap & {
|
|
118
|
+
msg?: string,
|
|
119
|
+
|
|
120
|
+
})` Bad Request
|
|
121
|
+
* @response `403` `(HandlerMap & {
|
|
122
|
+
msg?: string,
|
|
123
|
+
|
|
124
|
+
})` Forbidden
|
|
125
|
+
*/
|
|
126
|
+
warmUpCache: (params?: RequestParams) => Promise<HttpResponse<HandlerMap & {
|
|
127
|
+
msg?: string | undefined;
|
|
128
|
+
}, HandlerMap & {
|
|
129
|
+
msg?: string | undefined;
|
|
130
|
+
}>>;
|
|
131
|
+
};
|
|
132
|
+
captcha: {
|
|
133
|
+
/**
|
|
134
|
+
* @description Get a base64 encoded captcha image or a HTML page to verify for user
|
|
135
|
+
*
|
|
136
|
+
* @tags Captcha
|
|
137
|
+
* @name GetCaptcha
|
|
138
|
+
* @summary Get Captcha
|
|
139
|
+
* @request GET:/captcha
|
|
140
|
+
* @response `200` `HandlerResponseCaptchaGet` OK
|
|
141
|
+
* @response `500` `(HandlerMap & {
|
|
142
|
+
msg?: string,
|
|
143
|
+
|
|
144
|
+
})` Internal Server Error
|
|
145
|
+
*/
|
|
146
|
+
getCaptcha: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseCaptchaGet, HandlerMap & {
|
|
147
|
+
msg?: string | undefined;
|
|
148
|
+
}>>;
|
|
149
|
+
/**
|
|
150
|
+
* @description Get the status of the user's captcha verification
|
|
151
|
+
*
|
|
152
|
+
* @tags Captcha
|
|
153
|
+
* @name GetCaptchaStatus
|
|
154
|
+
* @summary Get Captcha Status
|
|
155
|
+
* @request GET:/captcha/status
|
|
156
|
+
* @response `200` `HandlerResponseCaptchaStatus` OK
|
|
157
|
+
*/
|
|
158
|
+
getCaptchaStatus: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseCaptchaStatus, any>>;
|
|
159
|
+
/**
|
|
160
|
+
* @description Verify user enters correct captcha code
|
|
161
|
+
*
|
|
162
|
+
* @tags Captcha
|
|
163
|
+
* @name VerifyCaptcha
|
|
164
|
+
* @summary Verify Captcha
|
|
165
|
+
* @request POST:/captcha/verify
|
|
166
|
+
* @response `200` `HandlerMap` OK
|
|
167
|
+
* @response `403` `(HandlerMap & {
|
|
168
|
+
img_data?: string,
|
|
169
|
+
|
|
170
|
+
})` Forbidden
|
|
171
|
+
*/
|
|
172
|
+
verifyCaptcha: (data: HandlerParamsCaptchaVerify, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
173
|
+
img_data?: string | undefined;
|
|
174
|
+
}>>;
|
|
175
|
+
};
|
|
176
|
+
comments: {
|
|
177
|
+
/**
|
|
178
|
+
* @description Get a list of comments by some conditions
|
|
179
|
+
*
|
|
180
|
+
* @tags Comment
|
|
181
|
+
* @name GetComments
|
|
182
|
+
* @summary Get Comment List
|
|
183
|
+
* @request GET:/comments
|
|
184
|
+
* @secure
|
|
185
|
+
* @response `200` `HandlerResponseCommentList` OK
|
|
186
|
+
* @response `500` `(HandlerMap & {
|
|
187
|
+
msg?: string,
|
|
188
|
+
|
|
189
|
+
})` Internal Server Error
|
|
190
|
+
*/
|
|
191
|
+
getComments: (query: {
|
|
192
|
+
/** The user email */
|
|
193
|
+
email?: string;
|
|
194
|
+
/** Enable flat_mode */
|
|
195
|
+
flat_mode?: boolean;
|
|
196
|
+
/** The limit for pagination */
|
|
197
|
+
limit?: number;
|
|
198
|
+
/** The username */
|
|
199
|
+
name?: string;
|
|
200
|
+
/** The offset for pagination */
|
|
201
|
+
offset?: number;
|
|
202
|
+
/** The comment page_key */
|
|
203
|
+
page_key: string;
|
|
204
|
+
/** The scope of comments */
|
|
205
|
+
scope?: 'page' | 'user' | 'site';
|
|
206
|
+
/** Search keywords */
|
|
207
|
+
search?: string;
|
|
208
|
+
/** The site name of your content scope */
|
|
209
|
+
site_name?: string;
|
|
210
|
+
/** Sort by condition */
|
|
211
|
+
sort_by?: 'date_asc' | 'date_desc' | 'vote';
|
|
212
|
+
/** Message center show type */
|
|
213
|
+
type?: 'all' | 'mentions' | 'mine' | 'pending';
|
|
214
|
+
/** Only show comments by admin */
|
|
215
|
+
view_only_admin?: boolean;
|
|
216
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentList, HandlerMap & {
|
|
217
|
+
msg?: string | undefined;
|
|
218
|
+
}>>;
|
|
219
|
+
/**
|
|
220
|
+
* @description Create a new comment
|
|
221
|
+
*
|
|
222
|
+
* @tags Comment
|
|
223
|
+
* @name CreateComment
|
|
224
|
+
* @summary Create Comment
|
|
225
|
+
* @request POST:/comments
|
|
226
|
+
* @secure
|
|
227
|
+
* @response `200` `HandlerResponseCommentCreate` OK
|
|
228
|
+
* @response `400` `(HandlerMap & {
|
|
229
|
+
msg?: string,
|
|
230
|
+
|
|
231
|
+
})` Bad Request
|
|
232
|
+
* @response `500` `(HandlerMap & {
|
|
233
|
+
msg?: string,
|
|
234
|
+
|
|
235
|
+
})` Internal Server Error
|
|
236
|
+
*/
|
|
237
|
+
createComment: (comment: HandlerParamsCommentCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentCreate, HandlerMap & {
|
|
238
|
+
msg?: string | undefined;
|
|
239
|
+
}>>;
|
|
240
|
+
/**
|
|
241
|
+
* @description Update a specific comment
|
|
242
|
+
*
|
|
243
|
+
* @tags Comment
|
|
244
|
+
* @name UpdateComment
|
|
245
|
+
* @summary Update Comment
|
|
246
|
+
* @request PUT:/comments/{id}
|
|
247
|
+
* @secure
|
|
248
|
+
* @response `200` `HandlerResponseCommentUpdate` OK
|
|
249
|
+
* @response `400` `(HandlerMap & {
|
|
250
|
+
msg?: string,
|
|
251
|
+
|
|
252
|
+
})` Bad Request
|
|
253
|
+
* @response `403` `(HandlerMap & {
|
|
254
|
+
msg?: string,
|
|
255
|
+
|
|
256
|
+
})` Forbidden
|
|
257
|
+
* @response `404` `(HandlerMap & {
|
|
258
|
+
msg?: string,
|
|
259
|
+
|
|
260
|
+
})` Not Found
|
|
261
|
+
* @response `500` `(HandlerMap & {
|
|
262
|
+
msg?: string,
|
|
263
|
+
|
|
264
|
+
})` Internal Server Error
|
|
265
|
+
*/
|
|
266
|
+
updateComment: (id: number, comment: HandlerParamsCommentUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentUpdate, HandlerMap & {
|
|
267
|
+
msg?: string | undefined;
|
|
268
|
+
}>>;
|
|
269
|
+
/**
|
|
270
|
+
* @description Delete a specific comment
|
|
271
|
+
*
|
|
272
|
+
* @tags Comment
|
|
273
|
+
* @name DeleteComment
|
|
274
|
+
* @summary Delete Comment
|
|
275
|
+
* @request DELETE:/comments/{id}
|
|
276
|
+
* @secure
|
|
277
|
+
* @response `200` `HandlerMap` OK
|
|
278
|
+
* @response `403` `(HandlerMap & {
|
|
279
|
+
msg?: string,
|
|
280
|
+
|
|
281
|
+
})` Forbidden
|
|
282
|
+
* @response `404` `(HandlerMap & {
|
|
283
|
+
msg?: string,
|
|
284
|
+
|
|
285
|
+
})` Not Found
|
|
286
|
+
* @response `500` `(HandlerMap & {
|
|
287
|
+
msg?: string,
|
|
288
|
+
|
|
289
|
+
})` Internal Server Error
|
|
290
|
+
*/
|
|
291
|
+
deleteComment: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
292
|
+
msg?: string | undefined;
|
|
293
|
+
}>>;
|
|
294
|
+
};
|
|
295
|
+
conf: {
|
|
296
|
+
/**
|
|
297
|
+
* @description Get System Configs for UI
|
|
298
|
+
*
|
|
299
|
+
* @tags System
|
|
300
|
+
* @name Conf
|
|
301
|
+
* @summary Get System Configs
|
|
302
|
+
* @request GET:/conf
|
|
303
|
+
* @response `200` `CommonConfData` OK
|
|
304
|
+
*/
|
|
305
|
+
conf: (params?: RequestParams) => Promise<HttpResponse<CommonConfData, any>>;
|
|
306
|
+
};
|
|
307
|
+
notifies: {
|
|
308
|
+
/**
|
|
309
|
+
* @description Get a list of notifies for user
|
|
310
|
+
*
|
|
311
|
+
* @tags Notify
|
|
312
|
+
* @name GetNotifies
|
|
313
|
+
* @summary Get Notifies
|
|
314
|
+
* @request GET:/notifies
|
|
315
|
+
* @response `200` `HandlerResponseNotifyList` OK
|
|
316
|
+
* @response `400` `(HandlerMap & {
|
|
317
|
+
msg?: string,
|
|
318
|
+
|
|
319
|
+
})` Bad Request
|
|
320
|
+
* @response `500` `(HandlerMap & {
|
|
321
|
+
msg?: string,
|
|
322
|
+
|
|
323
|
+
})` Internal Server Error
|
|
324
|
+
*/
|
|
325
|
+
getNotifies: (query: {
|
|
326
|
+
/** The user email */
|
|
327
|
+
email: string;
|
|
328
|
+
/** The user name */
|
|
329
|
+
name: string;
|
|
330
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseNotifyList, HandlerMap & {
|
|
331
|
+
msg?: string | undefined;
|
|
332
|
+
}>>;
|
|
333
|
+
/**
|
|
334
|
+
* @description Mark all notifies as read for user
|
|
335
|
+
*
|
|
336
|
+
* @tags Notify
|
|
337
|
+
* @name MarkAllNotifyRead
|
|
338
|
+
* @summary Mark All Notifies as Read
|
|
339
|
+
* @request POST:/notifies/read
|
|
340
|
+
* @response `200` `HandlerMap` OK
|
|
341
|
+
* @response `400` `(HandlerMap & {
|
|
342
|
+
msg?: string,
|
|
343
|
+
|
|
344
|
+
})` Bad Request
|
|
345
|
+
* @response `500` `(HandlerMap & {
|
|
346
|
+
msg?: string,
|
|
347
|
+
|
|
348
|
+
})` Internal Server Error
|
|
349
|
+
*/
|
|
350
|
+
markAllNotifyRead: (options: HandlerParamsNotifyReadAll, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
351
|
+
msg?: string | undefined;
|
|
352
|
+
}>>;
|
|
353
|
+
/**
|
|
354
|
+
* @description Mark specific notification as read for user
|
|
355
|
+
*
|
|
356
|
+
* @tags Notify
|
|
357
|
+
* @name MarkNotifyRead
|
|
358
|
+
* @summary Mark Notify as Read
|
|
359
|
+
* @request POST:/notifies/{comment_id}/{notify_key}
|
|
360
|
+
* @response `200` `HandlerMap` OK
|
|
361
|
+
* @response `400` `(HandlerMap & {
|
|
362
|
+
msg?: string,
|
|
363
|
+
|
|
364
|
+
})` Bad Request
|
|
365
|
+
* @response `404` `(HandlerMap & {
|
|
366
|
+
msg?: string,
|
|
367
|
+
|
|
368
|
+
})` Not Found
|
|
369
|
+
* @response `500` `(HandlerMap & {
|
|
370
|
+
msg?: string,
|
|
371
|
+
|
|
372
|
+
})` Internal Server Error
|
|
373
|
+
*/
|
|
374
|
+
markNotifyRead: (commentId: number, notifyKey: string, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
375
|
+
msg?: string | undefined;
|
|
376
|
+
}>>;
|
|
377
|
+
};
|
|
378
|
+
pages: {
|
|
379
|
+
/**
|
|
380
|
+
* @description Get a list of pages by some conditions
|
|
381
|
+
*
|
|
382
|
+
* @tags Page
|
|
383
|
+
* @name GetPages
|
|
384
|
+
* @summary Get Page List
|
|
385
|
+
* @request GET:/pages
|
|
386
|
+
* @secure
|
|
387
|
+
* @response `200` `HandlerResponsePageList` OK
|
|
388
|
+
* @response `403` `(HandlerMap & {
|
|
389
|
+
msg?: string,
|
|
390
|
+
|
|
391
|
+
})` Forbidden
|
|
392
|
+
*/
|
|
393
|
+
getPages: (query?: {
|
|
394
|
+
/** The limit for pagination */
|
|
395
|
+
limit?: number;
|
|
396
|
+
/** The offset for pagination */
|
|
397
|
+
offset?: number;
|
|
398
|
+
/** The site name of your content scope */
|
|
399
|
+
site_name?: string;
|
|
400
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageList, HandlerMap & {
|
|
401
|
+
msg?: string | undefined;
|
|
402
|
+
}>>;
|
|
403
|
+
/**
|
|
404
|
+
* @description Fetch the data of all pages
|
|
405
|
+
*
|
|
406
|
+
* @tags Page
|
|
407
|
+
* @name FetchAllPages
|
|
408
|
+
* @summary Fetch All Pages Data
|
|
409
|
+
* @request POST:/pages/fetch
|
|
410
|
+
* @secure
|
|
411
|
+
* @response `200` `HandlerMap` OK
|
|
412
|
+
* @response `400` `(HandlerMap & {
|
|
413
|
+
msg?: string,
|
|
414
|
+
|
|
415
|
+
})` Bad Request
|
|
416
|
+
* @response `500` `(HandlerMap & {
|
|
417
|
+
msg?: string,
|
|
418
|
+
|
|
419
|
+
})` Internal Server Error
|
|
420
|
+
*/
|
|
421
|
+
fetchAllPages: (options: HandlerParamsPageFetchAll, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
422
|
+
msg?: string | undefined;
|
|
423
|
+
}>>;
|
|
424
|
+
/**
|
|
425
|
+
* @description Get the status of the task of fetching all pages
|
|
426
|
+
*
|
|
427
|
+
* @tags Page
|
|
428
|
+
* @name GetPageFetchStatus
|
|
429
|
+
* @summary Get Pages Fetch Status
|
|
430
|
+
* @request GET:/pages/fetch/status
|
|
431
|
+
* @secure
|
|
432
|
+
* @response `200` `HandlerResponsePageFetchStatus` OK
|
|
433
|
+
*/
|
|
434
|
+
getPageFetchStatus: (params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageFetchStatus, any>>;
|
|
435
|
+
/**
|
|
436
|
+
* @description Increase and get the number of page views
|
|
437
|
+
*
|
|
438
|
+
* @tags Page
|
|
439
|
+
* @name LogPv
|
|
440
|
+
* @summary Increase Page Views (PV)
|
|
441
|
+
* @request POST:/pages/pv
|
|
442
|
+
* @response `200` `HandlerResponsePagePV` OK
|
|
443
|
+
*/
|
|
444
|
+
logPv: (page: HandlerParamsPagePV, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePagePV, any>>;
|
|
445
|
+
/**
|
|
446
|
+
* @description Update a specific page
|
|
447
|
+
*
|
|
448
|
+
* @tags Page
|
|
449
|
+
* @name UpdatePage
|
|
450
|
+
* @summary Update Page
|
|
451
|
+
* @request PUT:/pages/{id}
|
|
452
|
+
* @secure
|
|
453
|
+
* @response `200` `HandlerResponsePageUpdate` OK
|
|
454
|
+
* @response `400` `(HandlerMap & {
|
|
455
|
+
msg?: string,
|
|
456
|
+
|
|
457
|
+
})` Bad Request
|
|
458
|
+
* @response `403` `(HandlerMap & {
|
|
459
|
+
msg?: string,
|
|
460
|
+
|
|
461
|
+
})` Forbidden
|
|
462
|
+
* @response `404` `(HandlerMap & {
|
|
463
|
+
msg?: string,
|
|
464
|
+
|
|
465
|
+
})` Not Found
|
|
466
|
+
* @response `500` `(HandlerMap & {
|
|
467
|
+
msg?: string,
|
|
468
|
+
|
|
469
|
+
})` Internal Server Error
|
|
470
|
+
*/
|
|
471
|
+
updatePage: (id: number, page: HandlerParamsPageUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageUpdate, HandlerMap & {
|
|
472
|
+
msg?: string | undefined;
|
|
473
|
+
}>>;
|
|
474
|
+
/**
|
|
475
|
+
* @description Delete a specific page
|
|
476
|
+
*
|
|
477
|
+
* @tags Page
|
|
478
|
+
* @name DeletePage
|
|
479
|
+
* @summary Delete Page
|
|
480
|
+
* @request DELETE:/pages/{id}
|
|
481
|
+
* @secure
|
|
482
|
+
* @response `200` `HandlerMap` OK
|
|
483
|
+
* @response `403` `(HandlerMap & {
|
|
484
|
+
msg?: string,
|
|
485
|
+
|
|
486
|
+
})` Forbidden
|
|
487
|
+
* @response `404` `(HandlerMap & {
|
|
488
|
+
msg?: string,
|
|
489
|
+
|
|
490
|
+
})` Not Found
|
|
491
|
+
* @response `500` `(HandlerMap & {
|
|
492
|
+
msg?: string,
|
|
493
|
+
|
|
494
|
+
})` Internal Server Error
|
|
495
|
+
*/
|
|
496
|
+
deletePage: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
497
|
+
msg?: string | undefined;
|
|
498
|
+
}>>;
|
|
499
|
+
/**
|
|
500
|
+
* @description Fetch the data of a specific page
|
|
501
|
+
*
|
|
502
|
+
* @tags Page
|
|
503
|
+
* @name FetchPage
|
|
504
|
+
* @summary Fetch Page Data
|
|
505
|
+
* @request POST:/pages/{id}/fetch
|
|
506
|
+
* @secure
|
|
507
|
+
* @response `200` `HandlerResponsePageFetch` OK
|
|
508
|
+
* @response `404` `(HandlerMap & {
|
|
509
|
+
msg?: string,
|
|
510
|
+
|
|
511
|
+
})` Not Found
|
|
512
|
+
* @response `500` `(HandlerMap & {
|
|
513
|
+
msg?: string,
|
|
514
|
+
|
|
515
|
+
})` Internal Server Error
|
|
516
|
+
*/
|
|
517
|
+
fetchPage: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageFetch, HandlerMap & {
|
|
518
|
+
msg?: string | undefined;
|
|
519
|
+
}>>;
|
|
520
|
+
};
|
|
521
|
+
sendEmail: {
|
|
522
|
+
/**
|
|
523
|
+
* @description Send an email to test the email sender
|
|
524
|
+
*
|
|
525
|
+
* @tags System
|
|
526
|
+
* @name SendEmail
|
|
527
|
+
* @summary Send Email
|
|
528
|
+
* @request POST:/send_email
|
|
529
|
+
* @secure
|
|
530
|
+
* @response `200` `HandlerMap` OK
|
|
531
|
+
* @response `403` `(HandlerMap & {
|
|
532
|
+
msg?: string,
|
|
533
|
+
|
|
534
|
+
})` Forbidden
|
|
535
|
+
* @response `500` `HandlerMap` Internal Server Error
|
|
536
|
+
*/
|
|
537
|
+
sendEmail: (email: HandlerParamsEmailSend, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap | (HandlerMap & {
|
|
538
|
+
msg?: string | undefined;
|
|
539
|
+
})>>;
|
|
540
|
+
};
|
|
541
|
+
settings: {
|
|
542
|
+
/**
|
|
543
|
+
* @description Get settings from app config file
|
|
544
|
+
*
|
|
545
|
+
* @tags System
|
|
546
|
+
* @name GetSettings
|
|
547
|
+
* @summary Get Settings
|
|
548
|
+
* @request GET:/settings
|
|
549
|
+
* @secure
|
|
550
|
+
* @response `200` `HandlerResponseSettingGet` OK
|
|
551
|
+
* @response `403` `(HandlerMap & {
|
|
552
|
+
msg?: string,
|
|
553
|
+
|
|
554
|
+
})` Forbidden
|
|
555
|
+
* @response `500` `(HandlerMap & {
|
|
556
|
+
msg?: string,
|
|
557
|
+
|
|
558
|
+
})` Internal Server Error
|
|
559
|
+
*/
|
|
560
|
+
getSettings: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseSettingGet, HandlerMap & {
|
|
561
|
+
msg?: string | undefined;
|
|
562
|
+
}>>;
|
|
563
|
+
/**
|
|
564
|
+
* @description Apply settings and restart the server
|
|
565
|
+
*
|
|
566
|
+
* @tags System
|
|
567
|
+
* @name ApplySettings
|
|
568
|
+
* @summary Save and apply Settings
|
|
569
|
+
* @request PUT:/settings
|
|
570
|
+
* @secure
|
|
571
|
+
* @response `200` `HandlerMap` OK
|
|
572
|
+
* @response `403` `(HandlerMap & {
|
|
573
|
+
msg?: string,
|
|
574
|
+
|
|
575
|
+
})` Forbidden
|
|
576
|
+
* @response `500` `(HandlerMap & {
|
|
577
|
+
msg?: string,
|
|
578
|
+
|
|
579
|
+
})` Internal Server Error
|
|
580
|
+
*/
|
|
581
|
+
applySettings: (settings: HandlerParamsSettingApply, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
582
|
+
msg?: string | undefined;
|
|
583
|
+
}>>;
|
|
584
|
+
/**
|
|
585
|
+
* @description Get config templates in different languages for rendering the settings page in the frontend
|
|
586
|
+
*
|
|
587
|
+
* @tags System
|
|
588
|
+
* @name GetSettingsTemplate
|
|
589
|
+
* @summary Get Settings Template
|
|
590
|
+
* @request GET:/settings/template/{locale}
|
|
591
|
+
* @secure
|
|
592
|
+
* @response `200` `HandlerResponseSettingTemplate` OK
|
|
593
|
+
*/
|
|
594
|
+
getSettingsTemplate: (locale: string, params?: RequestParams) => Promise<HttpResponse<HandlerResponseSettingTemplate, any>>;
|
|
595
|
+
};
|
|
596
|
+
sites: {
|
|
597
|
+
/**
|
|
598
|
+
* @description Get a list of sites by some conditions
|
|
599
|
+
*
|
|
600
|
+
* @tags Site
|
|
601
|
+
* @name GetSites
|
|
602
|
+
* @summary Get Site List
|
|
603
|
+
* @request GET:/sites
|
|
604
|
+
* @secure
|
|
605
|
+
* @response `200` `HandlerResponseSiteList` OK
|
|
606
|
+
*/
|
|
607
|
+
getSites: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseSiteList, any>>;
|
|
608
|
+
/**
|
|
609
|
+
* @description Create a new site
|
|
610
|
+
*
|
|
611
|
+
* @tags Site
|
|
612
|
+
* @name CreateSite
|
|
613
|
+
* @summary Create Site
|
|
614
|
+
* @request POST:/sites
|
|
615
|
+
* @secure
|
|
616
|
+
* @response `200` `HandlerResponseSiteCreate` OK
|
|
617
|
+
* @response `400` `(HandlerMap & {
|
|
618
|
+
msg?: string,
|
|
619
|
+
|
|
620
|
+
})` Bad Request
|
|
621
|
+
* @response `403` `(HandlerMap & {
|
|
622
|
+
msg?: string,
|
|
623
|
+
|
|
624
|
+
})` Forbidden
|
|
625
|
+
* @response `500` `(HandlerMap & {
|
|
626
|
+
msg?: string,
|
|
627
|
+
|
|
628
|
+
})` Internal Server Error
|
|
629
|
+
*/
|
|
630
|
+
createSite: (site: HandlerParamsSiteCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseSiteCreate, HandlerMap & {
|
|
631
|
+
msg?: string | undefined;
|
|
632
|
+
}>>;
|
|
633
|
+
/**
|
|
634
|
+
* @description Update a specific site
|
|
635
|
+
*
|
|
636
|
+
* @tags Site
|
|
637
|
+
* @name UpdateSite
|
|
638
|
+
* @summary Update Site
|
|
639
|
+
* @request PUT:/sites/{id}
|
|
640
|
+
* @secure
|
|
641
|
+
* @response `200` `HandlerResponseSiteUpdate` OK
|
|
642
|
+
*/
|
|
643
|
+
updateSite: (id: number, site: HandlerParamsSiteUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseSiteUpdate, any>>;
|
|
644
|
+
/**
|
|
645
|
+
* @description Delete a specific site
|
|
646
|
+
*
|
|
647
|
+
* @tags Site
|
|
648
|
+
* @name DeleteSite
|
|
649
|
+
* @summary Site Delete
|
|
650
|
+
* @request DELETE:/sites/{id}
|
|
651
|
+
* @secure
|
|
652
|
+
* @response `200` `HandlerMap` OK
|
|
653
|
+
* @response `403` `(HandlerMap & {
|
|
654
|
+
msg?: string,
|
|
655
|
+
|
|
656
|
+
})` Forbidden
|
|
657
|
+
* @response `404` `(HandlerMap & {
|
|
658
|
+
msg?: string,
|
|
659
|
+
|
|
660
|
+
})` Not Found
|
|
661
|
+
* @response `500` `(HandlerMap & {
|
|
662
|
+
msg?: string,
|
|
663
|
+
|
|
664
|
+
})` Internal Server Error
|
|
665
|
+
*/
|
|
666
|
+
deleteSite: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
667
|
+
msg?: string | undefined;
|
|
668
|
+
}>>;
|
|
669
|
+
};
|
|
670
|
+
stats: {
|
|
671
|
+
/**
|
|
672
|
+
* @description Get the statistics of various data analysis
|
|
673
|
+
*
|
|
674
|
+
* @tags Statistic
|
|
675
|
+
* @name GetStats
|
|
676
|
+
* @summary Statistic
|
|
677
|
+
* @request GET:/stats/{type}
|
|
678
|
+
* @response `200` `CommonJSONResult` OK
|
|
679
|
+
* @response `400` `(HandlerMap & {
|
|
680
|
+
msg?: string,
|
|
681
|
+
|
|
682
|
+
})` Bad Request
|
|
683
|
+
* @response `403` `(HandlerMap & {
|
|
684
|
+
msg?: string,
|
|
685
|
+
|
|
686
|
+
})` Forbidden
|
|
687
|
+
* @response `404` `(HandlerMap & {
|
|
688
|
+
msg?: string,
|
|
689
|
+
|
|
690
|
+
})` Not Found
|
|
691
|
+
* @response `500` `(HandlerMap & {
|
|
692
|
+
msg?: string,
|
|
693
|
+
|
|
694
|
+
})` Internal Server Error
|
|
695
|
+
*/
|
|
696
|
+
getStats: (type: 'latest_comments' | 'latest_pages' | 'pv_most_pages' | 'comment_most_pages' | 'page_pv' | 'site_pv' | 'page_comment' | 'site_comment' | 'rand_comments' | 'rand_pages', query?: {
|
|
697
|
+
/** The limit for pagination */
|
|
698
|
+
limit?: number;
|
|
699
|
+
/** multiple page keys separated by commas */
|
|
700
|
+
page_keys?: string;
|
|
701
|
+
/** The site name of your content scope */
|
|
702
|
+
site_name?: string;
|
|
703
|
+
}, params?: RequestParams) => Promise<HttpResponse<CommonJSONResult, HandlerMap & {
|
|
704
|
+
msg?: string | undefined;
|
|
705
|
+
}>>;
|
|
706
|
+
};
|
|
707
|
+
transfer: {
|
|
708
|
+
/**
|
|
709
|
+
* @description Export data from Artalk
|
|
710
|
+
*
|
|
711
|
+
* @tags Transfer
|
|
712
|
+
* @name ExportArtrans
|
|
713
|
+
* @summary Export Artrans
|
|
714
|
+
* @request GET:/transfer/export
|
|
715
|
+
* @secure
|
|
716
|
+
* @response `200` `HandlerResponseTransferExport` OK
|
|
717
|
+
* @response `500` `(HandlerMap & {
|
|
718
|
+
msg?: string,
|
|
719
|
+
|
|
720
|
+
})` Internal Server Error
|
|
721
|
+
*/
|
|
722
|
+
exportArtrans: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseTransferExport, HandlerMap & {
|
|
723
|
+
msg?: string | undefined;
|
|
724
|
+
}>>;
|
|
725
|
+
/**
|
|
726
|
+
* @description Import data to Artalk
|
|
727
|
+
*
|
|
728
|
+
* @tags Transfer
|
|
729
|
+
* @name ImportArtrans
|
|
730
|
+
* @summary Import Artrans
|
|
731
|
+
* @request POST:/transfer/import
|
|
732
|
+
* @secure
|
|
733
|
+
* @response `200` `string` OK
|
|
734
|
+
*/
|
|
735
|
+
importArtrans: (data: HandlerParamsTransferImport, params?: RequestParams) => Promise<HttpResponse<string, any>>;
|
|
736
|
+
/**
|
|
737
|
+
* @description Upload a file to prepare to import
|
|
738
|
+
*
|
|
739
|
+
* @tags Transfer
|
|
740
|
+
* @name UploadArtrans
|
|
741
|
+
* @summary Upload Artrans
|
|
742
|
+
* @request POST:/transfer/upload
|
|
743
|
+
* @secure
|
|
744
|
+
* @response `200` `(HandlerResponseTransferUpload & {
|
|
745
|
+
filename?: string,
|
|
746
|
+
|
|
747
|
+
})` OK
|
|
748
|
+
* @response `500` `(HandlerMap & {
|
|
749
|
+
msg?: string,
|
|
750
|
+
|
|
751
|
+
})` Internal Server Error
|
|
752
|
+
*/
|
|
753
|
+
uploadArtrans: (data: {
|
|
754
|
+
/**
|
|
755
|
+
* Upload file in preparation for import task
|
|
756
|
+
* @format binary
|
|
757
|
+
*/
|
|
758
|
+
file: File;
|
|
759
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseTransferUpload & {
|
|
760
|
+
filename?: string | undefined;
|
|
761
|
+
}, HandlerMap & {
|
|
762
|
+
msg?: string | undefined;
|
|
763
|
+
}>>;
|
|
764
|
+
};
|
|
765
|
+
upload: {
|
|
766
|
+
/**
|
|
767
|
+
* @description Upload file from this endpoint
|
|
768
|
+
*
|
|
769
|
+
* @tags Upload
|
|
770
|
+
* @name Upload
|
|
771
|
+
* @summary Upload
|
|
772
|
+
* @request POST:/upload
|
|
773
|
+
* @secure
|
|
774
|
+
* @response `200` `HandlerResponseUpload` OK
|
|
775
|
+
* @response `400` `(HandlerMap & {
|
|
776
|
+
msg?: string,
|
|
777
|
+
|
|
778
|
+
})` Bad Request
|
|
779
|
+
* @response `403` `(HandlerMap & {
|
|
780
|
+
msg?: string,
|
|
781
|
+
|
|
782
|
+
})` Forbidden
|
|
783
|
+
* @response `500` `(HandlerMap & {
|
|
784
|
+
msg?: string,
|
|
785
|
+
|
|
786
|
+
})` Internal Server Error
|
|
787
|
+
*/
|
|
788
|
+
upload: (data: {
|
|
789
|
+
/**
|
|
790
|
+
* Upload file
|
|
791
|
+
* @format binary
|
|
792
|
+
*/
|
|
793
|
+
file: File;
|
|
794
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUpload, HandlerMap & {
|
|
795
|
+
msg?: string | undefined;
|
|
796
|
+
}>>;
|
|
797
|
+
};
|
|
798
|
+
user: {
|
|
799
|
+
/**
|
|
800
|
+
* @description Get user info to prepare for login or check current user status
|
|
801
|
+
*
|
|
802
|
+
* @tags Account
|
|
803
|
+
* @name GetUser
|
|
804
|
+
* @summary Get User Info
|
|
805
|
+
* @request GET:/user
|
|
806
|
+
* @secure
|
|
807
|
+
* @response `200` `HandlerResponseUserInfo` OK
|
|
808
|
+
* @response `400` `(HandlerMap & {
|
|
809
|
+
msg?: string,
|
|
810
|
+
|
|
811
|
+
})` Bad Request
|
|
812
|
+
*/
|
|
813
|
+
getUser: (query?: {
|
|
814
|
+
/** The user email */
|
|
815
|
+
email?: string;
|
|
816
|
+
/** The username */
|
|
817
|
+
name?: string;
|
|
818
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserInfo, HandlerMap & {
|
|
819
|
+
msg?: string | undefined;
|
|
820
|
+
}>>;
|
|
821
|
+
/**
|
|
822
|
+
* @description Login user by name or email
|
|
823
|
+
*
|
|
824
|
+
* @tags Account
|
|
825
|
+
* @name Login
|
|
826
|
+
* @summary Get Access Token
|
|
827
|
+
* @request POST:/user/access_token
|
|
828
|
+
* @response `200` `HandlerResponseUserLogin` OK
|
|
829
|
+
* @response `400` `(HandlerMap & {
|
|
830
|
+
" data"?: {
|
|
831
|
+
need_name_select?: (string)[],
|
|
832
|
+
|
|
833
|
+
},
|
|
834
|
+
msg?: string,
|
|
835
|
+
|
|
836
|
+
})` Multiple users with the same email address are matched
|
|
837
|
+
* @response `403` `(HandlerMap & {
|
|
838
|
+
msg?: string,
|
|
839
|
+
|
|
840
|
+
})` Forbidden
|
|
841
|
+
* @response `500` `(HandlerMap & {
|
|
842
|
+
msg?: string,
|
|
843
|
+
|
|
844
|
+
})` Internal Server Error
|
|
845
|
+
*/
|
|
846
|
+
login: (user: HandlerParamsUserLogin, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserLogin, (HandlerMap & {
|
|
847
|
+
' data'?: {
|
|
848
|
+
need_name_select?: string[] | undefined;
|
|
849
|
+
} | undefined;
|
|
850
|
+
msg?: string | undefined;
|
|
851
|
+
}) | (HandlerMap & {
|
|
852
|
+
msg?: string | undefined;
|
|
853
|
+
})>>;
|
|
854
|
+
/**
|
|
855
|
+
* @description Get user login status by header Authorization
|
|
856
|
+
*
|
|
857
|
+
* @tags Account
|
|
858
|
+
* @name GetUserStatus
|
|
859
|
+
* @summary Get Login Status
|
|
860
|
+
* @request GET:/user/status
|
|
861
|
+
* @secure
|
|
862
|
+
* @response `200` `HandlerResponseUserStatus` OK
|
|
863
|
+
*/
|
|
864
|
+
getUserStatus: (query?: {
|
|
865
|
+
/** The user email */
|
|
866
|
+
email?: string;
|
|
867
|
+
/** The username */
|
|
868
|
+
name?: string;
|
|
869
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserStatus, any>>;
|
|
870
|
+
};
|
|
871
|
+
users: {
|
|
872
|
+
/**
|
|
873
|
+
* @description Create a new user
|
|
874
|
+
*
|
|
875
|
+
* @tags User
|
|
876
|
+
* @name CreateUser
|
|
877
|
+
* @summary Create User
|
|
878
|
+
* @request POST:/users
|
|
879
|
+
* @secure
|
|
880
|
+
* @response `200` `HandlerResponseUserCreate` OK
|
|
881
|
+
* @response `400` `(HandlerMap & {
|
|
882
|
+
msg?: string,
|
|
883
|
+
|
|
884
|
+
})` Bad Request
|
|
885
|
+
* @response `403` `(HandlerMap & {
|
|
886
|
+
msg?: string,
|
|
887
|
+
|
|
888
|
+
})` Forbidden
|
|
889
|
+
* @response `500` `(HandlerMap & {
|
|
890
|
+
msg?: string,
|
|
891
|
+
|
|
892
|
+
})` Internal Server Error
|
|
893
|
+
*/
|
|
894
|
+
createUser: (user: HandlerParamsUserCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserCreate, HandlerMap & {
|
|
895
|
+
msg?: string | undefined;
|
|
896
|
+
}>>;
|
|
897
|
+
/**
|
|
898
|
+
* @description Update a specific user
|
|
899
|
+
*
|
|
900
|
+
* @tags User
|
|
901
|
+
* @name UpdateUser
|
|
902
|
+
* @summary Update User
|
|
903
|
+
* @request PUT:/users/{id}
|
|
904
|
+
* @secure
|
|
905
|
+
* @response `200` `HandlerResponseUserUpdate` OK
|
|
906
|
+
* @response `400` `(HandlerMap & {
|
|
907
|
+
msg?: string,
|
|
908
|
+
|
|
909
|
+
})` Bad Request
|
|
910
|
+
* @response `403` `(HandlerMap & {
|
|
911
|
+
msg?: string,
|
|
912
|
+
|
|
913
|
+
})` Forbidden
|
|
914
|
+
* @response `404` `(HandlerMap & {
|
|
915
|
+
msg?: string,
|
|
916
|
+
|
|
917
|
+
})` Not Found
|
|
918
|
+
* @response `500` `(HandlerMap & {
|
|
919
|
+
msg?: string,
|
|
920
|
+
|
|
921
|
+
})` Internal Server Error
|
|
922
|
+
*/
|
|
923
|
+
updateUser: (id: number, user: HandlerParamsUserUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserUpdate, HandlerMap & {
|
|
924
|
+
msg?: string | undefined;
|
|
925
|
+
}>>;
|
|
926
|
+
/**
|
|
927
|
+
* @description Delete a specific user
|
|
928
|
+
*
|
|
929
|
+
* @tags User
|
|
930
|
+
* @name DeleteUser
|
|
931
|
+
* @summary Delete User
|
|
932
|
+
* @request DELETE:/users/{id}
|
|
933
|
+
* @secure
|
|
934
|
+
* @response `200` `HandlerMap` OK
|
|
935
|
+
* @response `403` `(HandlerMap & {
|
|
936
|
+
msg?: string,
|
|
937
|
+
|
|
938
|
+
})` Forbidden
|
|
939
|
+
* @response `404` `(HandlerMap & {
|
|
940
|
+
msg?: string,
|
|
941
|
+
|
|
942
|
+
})` Not Found
|
|
943
|
+
* @response `500` `(HandlerMap & {
|
|
944
|
+
msg?: string,
|
|
945
|
+
|
|
946
|
+
})` Internal Server Error
|
|
947
|
+
*/
|
|
948
|
+
deleteUser: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
949
|
+
msg?: string | undefined;
|
|
950
|
+
}>>;
|
|
951
|
+
/**
|
|
952
|
+
* @description Get a list of users by some conditions
|
|
953
|
+
*
|
|
954
|
+
* @tags User
|
|
955
|
+
* @name GetUsers
|
|
956
|
+
* @summary Get User List
|
|
957
|
+
* @request GET:/users/{type}
|
|
958
|
+
* @secure
|
|
959
|
+
* @response `200` `HandlerResponseAdminUserList` OK
|
|
960
|
+
* @response `403` `(HandlerMap & {
|
|
961
|
+
msg?: string,
|
|
962
|
+
|
|
963
|
+
})` Forbidden
|
|
964
|
+
*/
|
|
965
|
+
getUsers: (type?: 'all' | 'admin' | 'in_conf', query?: {
|
|
966
|
+
/** The limit for pagination */
|
|
967
|
+
limit?: number;
|
|
968
|
+
/** The offset for pagination */
|
|
969
|
+
offset?: number;
|
|
970
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseAdminUserList, HandlerMap & {
|
|
971
|
+
msg?: string | undefined;
|
|
972
|
+
}>>;
|
|
973
|
+
};
|
|
974
|
+
version: {
|
|
975
|
+
/**
|
|
976
|
+
* @description Get the version of Artalk
|
|
977
|
+
*
|
|
978
|
+
* @tags System
|
|
979
|
+
* @name GetVersion
|
|
980
|
+
* @summary Get Version Info
|
|
981
|
+
* @request GET:/version
|
|
982
|
+
* @response `200` `CommonApiVersionData` OK
|
|
983
|
+
*/
|
|
984
|
+
getVersion: (params?: RequestParams) => Promise<HttpResponse<CommonApiVersionData, any>>;
|
|
985
|
+
};
|
|
986
|
+
votes: {
|
|
987
|
+
/**
|
|
988
|
+
* @description Sync the number of votes in the `comments` or `pages` data tables to keep them the same as the `votes` table
|
|
989
|
+
*
|
|
990
|
+
* @tags Vote
|
|
991
|
+
* @name SyncVotes
|
|
992
|
+
* @summary Sync Vote Data
|
|
993
|
+
* @request POST:/votes/sync
|
|
994
|
+
* @secure
|
|
995
|
+
* @response `200` `HandlerMap` OK
|
|
996
|
+
* @response `403` `(HandlerMap & {
|
|
997
|
+
msg?: string,
|
|
998
|
+
|
|
999
|
+
})` Forbidden
|
|
1000
|
+
*/
|
|
1001
|
+
syncVotes: (params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
1002
|
+
msg?: string | undefined;
|
|
1003
|
+
}>>;
|
|
1004
|
+
/**
|
|
1005
|
+
* @description Vote for a specific comment or page
|
|
1006
|
+
*
|
|
1007
|
+
* @tags Vote
|
|
1008
|
+
* @name Vote
|
|
1009
|
+
* @summary Vote
|
|
1010
|
+
* @request POST:/votes/{type}/{target_id}
|
|
1011
|
+
* @response `200` `HandlerResponseVote` OK
|
|
1012
|
+
* @response `403` `(HandlerMap & {
|
|
1013
|
+
msg?: string,
|
|
1014
|
+
|
|
1015
|
+
})` Forbidden
|
|
1016
|
+
* @response `404` `(HandlerMap & {
|
|
1017
|
+
msg?: string,
|
|
1018
|
+
|
|
1019
|
+
})` Not Found
|
|
1020
|
+
* @response `500` `(HandlerMap & {
|
|
1021
|
+
msg?: string,
|
|
1022
|
+
|
|
1023
|
+
})` Internal Server Error
|
|
1024
|
+
*/
|
|
1025
|
+
vote: (type: 'comment_up' | 'comment_down' | 'page_up' | 'page_down', targetId: number, vote: HandlerParamsVote, params?: RequestParams) => Promise<HttpResponse<HandlerResponseVote, HandlerMap & {
|
|
1026
|
+
msg?: string | undefined;
|
|
1027
|
+
}>>;
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
declare interface ApiConfig<SecurityDataType = unknown> {
|
|
1032
|
+
baseUrl?: string;
|
|
1033
|
+
baseApiParams?: Omit<RequestParams, 'baseUrl' | 'cancelToken' | 'signal'>;
|
|
1034
|
+
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
|
|
1035
|
+
customFetch?: typeof fetch;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
declare interface ApiOptions {
|
|
1039
|
+
baseURL: string;
|
|
1040
|
+
siteName: string;
|
|
1041
|
+
pageKey: string;
|
|
1042
|
+
pageTitle: string;
|
|
1043
|
+
timeout?: number;
|
|
1044
|
+
getApiToken?: () => string | undefined;
|
|
1045
|
+
userInfo?: {
|
|
1046
|
+
name: string;
|
|
1047
|
+
email: string;
|
|
1048
|
+
};
|
|
1049
|
+
onNeedCheckCaptcha?: (payload: {
|
|
1050
|
+
data: {
|
|
1051
|
+
imgData?: string;
|
|
1052
|
+
iframe?: string;
|
|
1053
|
+
};
|
|
1054
|
+
}) => Promise<void>;
|
|
1055
|
+
onNeedCheckAdmin?: (payload: {}) => Promise<void>;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
export declare interface ApiVersionData {
|
|
1059
|
+
/** API 程序名 */
|
|
1060
|
+
app: string;
|
|
1061
|
+
/** API 程序版本号 */
|
|
1062
|
+
version: string;
|
|
1063
|
+
/** API 程序 CommitHash */
|
|
1064
|
+
commit_hash: string;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* Artalk
|
|
1069
|
+
*
|
|
1070
|
+
* @see https://artalk.js.org
|
|
1071
|
+
*/
|
|
1072
|
+
declare class Artalk {
|
|
1073
|
+
ctx: ContextApi;
|
|
1074
|
+
/** Plugins */
|
|
1075
|
+
protected plugins: ArtalkPlugin[];
|
|
1076
|
+
constructor(conf: Partial<ArtalkConfig>);
|
|
1077
|
+
/** Get the config of Artalk */
|
|
1078
|
+
getConf(): ArtalkConfig;
|
|
1079
|
+
/** Get the root element of Artalk */
|
|
1080
|
+
getEl(): HTMLElement;
|
|
1081
|
+
/** Update config of Artalk */
|
|
1082
|
+
update(conf: Partial<ArtalkConfig>): this;
|
|
1083
|
+
/** Reload comment list of Artalk */
|
|
1084
|
+
reload(): void;
|
|
1085
|
+
/** Destroy instance of Artalk */
|
|
1086
|
+
destroy(): void;
|
|
1087
|
+
/** Add an event listener */
|
|
1088
|
+
on<K extends keyof EventPayloadMap>(name: K, handler: EventHandler<EventPayloadMap[K]>): void;
|
|
1089
|
+
/** Remove an event listener */
|
|
1090
|
+
off<K extends keyof EventPayloadMap>(name: K, handler: EventHandler<EventPayloadMap[K]>): void;
|
|
1091
|
+
/** Trigger an event */
|
|
1092
|
+
trigger<K extends keyof EventPayloadMap>(name: K, payload?: EventPayloadMap[K]): void;
|
|
1093
|
+
/** Set dark mode */
|
|
1094
|
+
setDarkMode(darkMode: boolean): void;
|
|
1095
|
+
/** Init Artalk */
|
|
1096
|
+
static init(conf: Partial<ArtalkConfig>): Artalk;
|
|
1097
|
+
/** Use plugin, the plugin will be used when Artalk.init */
|
|
1098
|
+
static use(plugin: ArtalkPlugin): void;
|
|
1099
|
+
/** Load count widget */
|
|
1100
|
+
static loadCountWidget(c: Partial<ArtalkConfig>): void;
|
|
1101
|
+
/** @deprecated Please use `getEl()` instead */
|
|
1102
|
+
get $root(): HTMLElement;
|
|
1103
|
+
/** @description Please use `getConf()` instead */
|
|
1104
|
+
get conf(): ArtalkConfig;
|
|
1105
|
+
}
|
|
1106
|
+
export default Artalk;
|
|
1107
|
+
|
|
1108
|
+
export declare interface ArtalkConfig {
|
|
1109
|
+
/** 装载元素 */
|
|
1110
|
+
el: string | HTMLElement;
|
|
1111
|
+
/** 页面唯一标识(完整 URL) */
|
|
1112
|
+
pageKey: string;
|
|
1113
|
+
/** 页面标题 */
|
|
1114
|
+
pageTitle: string;
|
|
1115
|
+
/** 服务器地址 */
|
|
1116
|
+
server: string;
|
|
1117
|
+
/** 站点名 */
|
|
1118
|
+
site: string;
|
|
1119
|
+
/** 评论框占位字符 */
|
|
1120
|
+
placeholder: string;
|
|
1121
|
+
/** 评论为空时显示字符 */
|
|
1122
|
+
noComment: string;
|
|
1123
|
+
/** 发送按钮文字 */
|
|
1124
|
+
sendBtn: string;
|
|
1125
|
+
/** 评论框穿梭(显示在待回复评论后面) */
|
|
1126
|
+
editorTravel: boolean;
|
|
1127
|
+
/** 表情包 */
|
|
1128
|
+
emoticons: object | any[] | string | false;
|
|
1129
|
+
/** Gravatar 头像 */
|
|
1130
|
+
gravatar: {
|
|
1131
|
+
/** API 地址 */
|
|
1132
|
+
mirror: string;
|
|
1133
|
+
/** API 参数 */
|
|
1134
|
+
params: string;
|
|
1135
|
+
};
|
|
1136
|
+
/** 头像链接生成器 */
|
|
1137
|
+
avatarURLBuilder?: (comment: CommentData) => string;
|
|
1138
|
+
/** 分页配置 */
|
|
1139
|
+
pagination: {
|
|
1140
|
+
/** 每次请求获取数量 */
|
|
1141
|
+
pageSize: number;
|
|
1142
|
+
/** 阅读更多模式 */
|
|
1143
|
+
readMore: boolean;
|
|
1144
|
+
/** 滚动到底部自动加载 */
|
|
1145
|
+
autoLoad: boolean;
|
|
1146
|
+
};
|
|
1147
|
+
/** 内容限高 */
|
|
1148
|
+
heightLimit: {
|
|
1149
|
+
/** 评论内容限高 */
|
|
1150
|
+
content: number;
|
|
1151
|
+
/** 子评论区域限高 */
|
|
1152
|
+
children: number;
|
|
1153
|
+
/** 滚动限高 */
|
|
1154
|
+
scrollable: boolean;
|
|
1155
|
+
};
|
|
1156
|
+
/** 评论投票按钮 */
|
|
1157
|
+
vote: boolean;
|
|
1158
|
+
/** 评论投票反对按钮 */
|
|
1159
|
+
voteDown: boolean;
|
|
1160
|
+
/** 评论预览功能 */
|
|
1161
|
+
preview: boolean;
|
|
1162
|
+
/** 评论数绑定元素 Selector */
|
|
1163
|
+
countEl: string;
|
|
1164
|
+
/** PV 数绑定元素 Selector */
|
|
1165
|
+
pvEl: string;
|
|
1166
|
+
/** 夜间模式 */
|
|
1167
|
+
darkMode: boolean | 'auto';
|
|
1168
|
+
/** 请求超时(单位:秒) */
|
|
1169
|
+
reqTimeout: number;
|
|
1170
|
+
/** 平铺模式 */
|
|
1171
|
+
flatMode: boolean | 'auto';
|
|
1172
|
+
/** 嵌套模式 · 最大层数 */
|
|
1173
|
+
nestMax: number;
|
|
1174
|
+
/** 嵌套模式 · 排序方式 */
|
|
1175
|
+
nestSort: 'DATE_ASC' | 'DATE_DESC';
|
|
1176
|
+
/** 显示 UA 徽标 */
|
|
1177
|
+
uaBadge: boolean;
|
|
1178
|
+
/** 评论列表排序功能 (显示 Dropdown) */
|
|
1179
|
+
listSort: boolean;
|
|
1180
|
+
/** 图片上传功能 */
|
|
1181
|
+
imgUpload: boolean;
|
|
1182
|
+
/** 图片上传器 */
|
|
1183
|
+
imgUploader?: (file: File) => Promise<string>;
|
|
1184
|
+
/** 版本检测 */
|
|
1185
|
+
versionCheck: boolean;
|
|
1186
|
+
/** 引用后端配置 */
|
|
1187
|
+
useBackendConf: boolean;
|
|
1188
|
+
/** 语言本地化 */
|
|
1189
|
+
locale: I18n | string;
|
|
1190
|
+
/** 后端版本 (系统数据,用户不允许更改) */
|
|
1191
|
+
apiVersion?: string;
|
|
1192
|
+
/** Replacer for marked */
|
|
1193
|
+
markedReplacers?: ((raw: string) => string)[];
|
|
1194
|
+
/** 列表请求参数修改器 */
|
|
1195
|
+
listFetchParamsModifier?: (params: any) => void;
|
|
1196
|
+
remoteConfModifier?: (conf: Partial<ArtalkConfig>) => void;
|
|
1197
|
+
listUnreadHighlight?: boolean;
|
|
1198
|
+
scrollRelativeTo?: () => HTMLElement;
|
|
1199
|
+
immediateFetch?: boolean;
|
|
1200
|
+
pvAdd?: boolean;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
export declare type ArtalkPlugin = (ctx: ContextApi) => void;
|
|
1204
|
+
|
|
1205
|
+
declare namespace ArtalkType {
|
|
1206
|
+
export {
|
|
1207
|
+
I18n,
|
|
1208
|
+
I18nKeys,
|
|
1209
|
+
ArtalkConfig,
|
|
1210
|
+
LocalUser,
|
|
1211
|
+
CommentData,
|
|
1212
|
+
ListData,
|
|
1213
|
+
PageData,
|
|
1214
|
+
SiteData,
|
|
1215
|
+
UserData,
|
|
1216
|
+
UserDataForAdmin,
|
|
1217
|
+
NotifyData,
|
|
1218
|
+
EmoticonGrpData,
|
|
1219
|
+
EmoticonListData,
|
|
1220
|
+
ApiVersionData,
|
|
1221
|
+
ListFetchParams,
|
|
1222
|
+
ListLastFetchData,
|
|
1223
|
+
DataManagerApi,
|
|
1224
|
+
NotifyLevel,
|
|
1225
|
+
UserInfoApiResponseData,
|
|
1226
|
+
FetchError,
|
|
1227
|
+
ContextApi,
|
|
1228
|
+
EditorState,
|
|
1229
|
+
EditorApi,
|
|
1230
|
+
EventPayloadMap,
|
|
1231
|
+
ArtalkPlugin,
|
|
1232
|
+
SidebarShowPayload
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
export { ArtalkType }
|
|
1236
|
+
|
|
1237
|
+
declare type CancelToken = Symbol | string | number;
|
|
1238
|
+
|
|
1239
|
+
declare interface Checker<T = any> {
|
|
1240
|
+
el?: HTMLElement;
|
|
1241
|
+
inputType?: 'password' | 'text';
|
|
1242
|
+
body: (checker: CheckerCtx) => HTMLElement;
|
|
1243
|
+
request: (checker: CheckerCtx, inputVal: string) => Promise<T>;
|
|
1244
|
+
onSuccess?: (checker: CheckerCtx, respData: T, inputVal: string, formEl: HTMLElement) => void;
|
|
1245
|
+
onError?: (checker: CheckerCtx, errData: any, inputVal: string, formEl: HTMLElement) => void;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
declare interface CheckerCaptchaPayload extends CheckerPayload {
|
|
1249
|
+
imgData?: string;
|
|
1250
|
+
iframe?: string;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
declare interface CheckerCtx {
|
|
1254
|
+
get<K extends keyof CheckerStore>(key: K): CheckerStore[K];
|
|
1255
|
+
set<K extends keyof CheckerStore>(key: K, val: CheckerStore[K]): void;
|
|
1256
|
+
getOpts(): CheckerLauncherOptions;
|
|
1257
|
+
getApi(): Api;
|
|
1258
|
+
getUser(): User;
|
|
1259
|
+
hideInteractInput(): void;
|
|
1260
|
+
triggerSuccess(): void;
|
|
1261
|
+
cancel(): void;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
/**
|
|
1265
|
+
* Checker 发射台
|
|
1266
|
+
*/
|
|
1267
|
+
declare class CheckerLauncher {
|
|
1268
|
+
private opts;
|
|
1269
|
+
constructor(opts: CheckerLauncherOptions);
|
|
1270
|
+
checkCaptcha: ((payload: CheckerCaptchaPayload) => Promise<void>);
|
|
1271
|
+
checkAdmin: ((payload: CheckerPayload) => Promise<void>);
|
|
1272
|
+
fire(checker: Checker, payload: CheckerPayload, postFire?: (c: CheckerCtx) => void): void;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
declare interface CheckerLauncherOptions {
|
|
1276
|
+
getCtx: () => ContextApi;
|
|
1277
|
+
getApi: () => Api;
|
|
1278
|
+
getCaptchaIframeURL: () => string;
|
|
1279
|
+
onReload: () => void;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
declare interface CheckerPayload {
|
|
1283
|
+
onSuccess?: () => void;
|
|
1284
|
+
onMount?: (dialogEl: HTMLElement) => void;
|
|
1285
|
+
onCancel?: () => void;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
declare interface CheckerStore {
|
|
1289
|
+
val?: string;
|
|
1290
|
+
img_data?: string;
|
|
1291
|
+
iframe?: string;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
declare class CommentActions {
|
|
1295
|
+
private comment;
|
|
1296
|
+
private get ctx();
|
|
1297
|
+
private get data();
|
|
1298
|
+
private get cConf();
|
|
1299
|
+
constructor(comment: CommentNode);
|
|
1300
|
+
/** 投票操作 */
|
|
1301
|
+
vote(type: 'up' | 'down'): void;
|
|
1302
|
+
/** 管理员 - 评论状态修改 */
|
|
1303
|
+
adminEdit(type: 'collapsed' | 'pending' | 'pinned', btnElem: ActionBtn): void;
|
|
1304
|
+
/** 管理员 - 评论删除 */
|
|
1305
|
+
adminDelete(btnElem: ActionBtn): void;
|
|
1306
|
+
/** 快速跳转到该评论 */
|
|
1307
|
+
goToReplyComment(): void;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
declare interface CommentConf {
|
|
1311
|
+
isUnread?: boolean;
|
|
1312
|
+
openURL?: string;
|
|
1313
|
+
isFlatMode: boolean;
|
|
1314
|
+
replyTo?: CommentData;
|
|
1315
|
+
afterRender?: () => void;
|
|
1316
|
+
openEvt?: () => void;
|
|
1317
|
+
onReplyBtnClick?: Function;
|
|
1318
|
+
onDelete?: Function;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
export declare interface CommentData {
|
|
1322
|
+
/** 评论 ID */
|
|
1323
|
+
id: number;
|
|
1324
|
+
/** 评论正文 */
|
|
1325
|
+
content: string;
|
|
1326
|
+
/** 用户昵称 */
|
|
1327
|
+
nick: string;
|
|
1328
|
+
/** 用户邮箱 (该字段仅管理员可见) */
|
|
1329
|
+
email?: string;
|
|
1330
|
+
/** 用户邮箱(已加密) */
|
|
1331
|
+
email_encrypted: string;
|
|
1332
|
+
/** 用户链接 */
|
|
1333
|
+
link: string;
|
|
1334
|
+
/** 回复目标评论 ID */
|
|
1335
|
+
rid: number;
|
|
1336
|
+
/** User Agent */
|
|
1337
|
+
ua: string;
|
|
1338
|
+
/** 评论日期 */
|
|
1339
|
+
date: string;
|
|
1340
|
+
/** 是否折叠 */
|
|
1341
|
+
is_collapsed: boolean;
|
|
1342
|
+
/** 是否待审 */
|
|
1343
|
+
is_pending: boolean;
|
|
1344
|
+
/** 是否置顶 */
|
|
1345
|
+
is_pinned: boolean;
|
|
1346
|
+
/** 徽章文字 */
|
|
1347
|
+
badge_name?: string;
|
|
1348
|
+
/** 徽章颜色 */
|
|
1349
|
+
badge_color?: string;
|
|
1350
|
+
/** IP 归属地 */
|
|
1351
|
+
ip_region?: string;
|
|
1352
|
+
/** 是否允许回复 */
|
|
1353
|
+
is_allow_reply: boolean;
|
|
1354
|
+
/** 评论页面 key */
|
|
1355
|
+
page_key: string;
|
|
1356
|
+
/** 评论页面 url */
|
|
1357
|
+
page_url?: string;
|
|
1358
|
+
/** 是否可见 */
|
|
1359
|
+
visible: boolean;
|
|
1360
|
+
/** 站点名(用于隔离) */
|
|
1361
|
+
site_name: string;
|
|
1362
|
+
/** 赞同数 */
|
|
1363
|
+
vote_up: number;
|
|
1364
|
+
/** 反对数 */
|
|
1365
|
+
vote_down: number;
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
declare class CommentNode extends Component {
|
|
1369
|
+
private renderInstance;
|
|
1370
|
+
private actionInstance;
|
|
1371
|
+
private data;
|
|
1372
|
+
private cConf;
|
|
1373
|
+
private parent;
|
|
1374
|
+
private children;
|
|
1375
|
+
private nestCurt;
|
|
1376
|
+
private nestMax;
|
|
1377
|
+
constructor(ctx: ContextApi, data: CommentData, conf: CommentConf);
|
|
1378
|
+
/** 渲染 UI */
|
|
1379
|
+
render(): void;
|
|
1380
|
+
/** 获取评论操作实例对象 */
|
|
1381
|
+
getActions(): CommentActions;
|
|
1382
|
+
/** 获取评论渲染器实例对象 */
|
|
1383
|
+
getRender(): Render;
|
|
1384
|
+
/** 获取评论数据 */
|
|
1385
|
+
getData(): CommentData;
|
|
1386
|
+
/** 设置数据 */
|
|
1387
|
+
setData(data: CommentData): void;
|
|
1388
|
+
/** 获取父评论 */
|
|
1389
|
+
getParent(): CommentNode | null;
|
|
1390
|
+
/** 获取所有子评论 */
|
|
1391
|
+
getChildren(): CommentNode[];
|
|
1392
|
+
/** 获取当前嵌套层数 */
|
|
1393
|
+
getNestCurt(): number;
|
|
1394
|
+
/** 判断是否为根评论 */
|
|
1395
|
+
getIsRoot(): boolean;
|
|
1396
|
+
/** 获取评论 ID */
|
|
1397
|
+
getID(): number;
|
|
1398
|
+
/** 置入子评论 */
|
|
1399
|
+
putChild(childC: CommentNode, insertMode?: 'append' | 'prepend'): void;
|
|
1400
|
+
/** 获取存放子评论的元素对象 */
|
|
1401
|
+
getChildrenEl(): HTMLElement;
|
|
1402
|
+
/** 获取所有父评论 */
|
|
1403
|
+
getParents(): CommentNode[];
|
|
1404
|
+
/** 获取评论元素对象 */
|
|
1405
|
+
getEl(): HTMLElement;
|
|
1406
|
+
/** 获取 Gravatar 头像 URL */
|
|
1407
|
+
getGravatarURL(): string;
|
|
1408
|
+
/** 获取评论 markdown 解析后的内容 */
|
|
1409
|
+
getContentMarked(): string;
|
|
1410
|
+
/** 获取格式化后的日期 */
|
|
1411
|
+
getDateFormatted(): any;
|
|
1412
|
+
/** 获取用户 UserAgent 信息 */
|
|
1413
|
+
getUserUA(): {
|
|
1414
|
+
browser: string;
|
|
1415
|
+
os: string;
|
|
1416
|
+
};
|
|
1417
|
+
/** 获取配置 */
|
|
1418
|
+
getConf(): CommentConf;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
declare type CommentNode_2 = {
|
|
1422
|
+
id: number;
|
|
1423
|
+
comment: CommentData;
|
|
1424
|
+
children: CommentNode_2[];
|
|
1425
|
+
parent?: CommentNode_2;
|
|
1426
|
+
level: number;
|
|
1427
|
+
};
|
|
1428
|
+
|
|
1429
|
+
declare interface CommonApiVersionData {
|
|
1430
|
+
app: string;
|
|
1431
|
+
commit_hash: string;
|
|
1432
|
+
version: string;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
declare interface CommonConfData {
|
|
1436
|
+
frontend_conf: CommonMap;
|
|
1437
|
+
version: CommonApiVersionData;
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
declare interface CommonJSONResult {
|
|
1441
|
+
/** Data */
|
|
1442
|
+
data: any;
|
|
1443
|
+
/** Message */
|
|
1444
|
+
msg: string;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
declare type CommonMap = Record<string, any>;
|
|
1448
|
+
|
|
1449
|
+
declare abstract class Component {
|
|
1450
|
+
ctx: ContextApi;
|
|
1451
|
+
$el: HTMLElement;
|
|
1452
|
+
get conf(): ArtalkConfig;
|
|
1453
|
+
constructor(ctx: ContextApi);
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
declare enum ContentType {
|
|
1457
|
+
Json = "application/json",
|
|
1458
|
+
FormData = "multipart/form-data",
|
|
1459
|
+
UrlEncoded = "application/x-www-form-urlencoded",
|
|
1460
|
+
Text = "text/plain"
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
/**
|
|
1464
|
+
* Artalk Context
|
|
1465
|
+
*/
|
|
1466
|
+
export declare interface ContextApi extends EventManagerFuncs<EventPayloadMap> {
|
|
1467
|
+
/** Artalk 根元素对象 */
|
|
1468
|
+
$root: HTMLElement;
|
|
1469
|
+
/** 依赖注入函数 */
|
|
1470
|
+
inject<K extends keyof TInjectedServices>(depName: K, obj: TInjectedServices[K]): void;
|
|
1471
|
+
/** 获取依赖对象 */
|
|
1472
|
+
get<K extends keyof TInjectedServices>(depName: K): TInjectedServices[K];
|
|
1473
|
+
/** 配置对象 */
|
|
1474
|
+
conf: ArtalkConfig;
|
|
1475
|
+
/** marked 依赖对象 */
|
|
1476
|
+
getMarked(): TMarked | undefined;
|
|
1477
|
+
/** 获取 API 以供 HTTP 请求 */
|
|
1478
|
+
getApi(): Api;
|
|
1479
|
+
/** 获取数据管理器对象 */
|
|
1480
|
+
getData(): DataManagerApi;
|
|
1481
|
+
/** 评论回复 */
|
|
1482
|
+
replyComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
1483
|
+
/** 编辑评论 */
|
|
1484
|
+
editComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
1485
|
+
/** 获取评论数据 */
|
|
1486
|
+
fetch(params: Partial<ListFetchParams>): void;
|
|
1487
|
+
/** 重载评论数据 */
|
|
1488
|
+
reload(): void;
|
|
1489
|
+
/** 列表滚动到第一个评论的位置 */
|
|
1490
|
+
listGotoFirst(): void;
|
|
1491
|
+
/** Get the comment data list */
|
|
1492
|
+
getComments(): CommentData[];
|
|
1493
|
+
/** Get the comment node list */
|
|
1494
|
+
getCommentNodes(): CommentNode[];
|
|
1495
|
+
/**
|
|
1496
|
+
* Get the comment data list
|
|
1497
|
+
* @deprecated Use `getComments()` instead
|
|
1498
|
+
*/
|
|
1499
|
+
getCommentDataList(): CommentData[];
|
|
1500
|
+
/**
|
|
1501
|
+
* Get the comment node list
|
|
1502
|
+
* @deprecated Use `getCommentNodes()` instead
|
|
1503
|
+
*/
|
|
1504
|
+
getCommentList(): CommentNode[];
|
|
1505
|
+
/** 显示侧边栏 */
|
|
1506
|
+
showSidebar(payload?: SidebarShowPayload): void;
|
|
1507
|
+
/** 隐藏侧边栏 */
|
|
1508
|
+
hideSidebar(): void;
|
|
1509
|
+
/** 编辑器 - 显示加载 */
|
|
1510
|
+
editorShowLoading(): void;
|
|
1511
|
+
/** 编辑器 - 隐藏加载 */
|
|
1512
|
+
editorHideLoading(): void;
|
|
1513
|
+
/** 编辑器 - 显示提示消息 */
|
|
1514
|
+
editorShowNotify(msg: string, type: NotifyLevel): void;
|
|
1515
|
+
/** 评论框 - 复原状态 */
|
|
1516
|
+
editorResetState(): void;
|
|
1517
|
+
/** 验证码检测 */
|
|
1518
|
+
checkCaptcha(payload: CheckerCaptchaPayload): Promise<void>;
|
|
1519
|
+
/** 管理员检测 */
|
|
1520
|
+
checkAdmin(payload: CheckerPayload): Promise<void>;
|
|
1521
|
+
/** i18n 翻译 */
|
|
1522
|
+
$t(key: keyof I18n, args?: {
|
|
1523
|
+
[key: string]: string;
|
|
1524
|
+
}): string;
|
|
1525
|
+
/** 设置夜间模式 */
|
|
1526
|
+
setDarkMode(darkMode: boolean | 'auto'): void;
|
|
1527
|
+
/** 获取配置 */
|
|
1528
|
+
getConf(): ArtalkConfig;
|
|
1529
|
+
/** 获取挂载元素 */
|
|
1530
|
+
getEl(): HTMLElement;
|
|
1531
|
+
/** 更新配置 */
|
|
1532
|
+
updateConf(conf: Partial<ArtalkConfig>): void;
|
|
1533
|
+
/** 监听配置更新 */
|
|
1534
|
+
watchConf<T extends (keyof ArtalkConfig)[]>(keys: T, effect: (val: Pick<ArtalkConfig, T[number]>) => void): void;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
export declare interface DataManagerApi {
|
|
1538
|
+
getLoading(): boolean;
|
|
1539
|
+
setLoading(val: boolean): void;
|
|
1540
|
+
getListLastFetch(): ListLastFetchData | undefined;
|
|
1541
|
+
setListLastFetch(val: ListLastFetchData): void;
|
|
1542
|
+
getComments(): CommentData[];
|
|
1543
|
+
findComment(id: number): CommentData | undefined;
|
|
1544
|
+
fetchComments(params: Partial<ListFetchParams>): void;
|
|
1545
|
+
loadComments(comments: CommentData[]): void;
|
|
1546
|
+
clearComments(): void;
|
|
1547
|
+
insertComment(comment: CommentData): void;
|
|
1548
|
+
updateComment(comment: CommentData): void;
|
|
1549
|
+
deleteComment(id: number): void;
|
|
1550
|
+
getNotifies(): NotifyData[];
|
|
1551
|
+
updateNotifies(notifies: NotifyData[]): void;
|
|
1552
|
+
getPage(): PageData | undefined;
|
|
1553
|
+
updatePage(pageData: PageData): void;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
declare class Editor extends Component implements EditorApi {
|
|
1557
|
+
private ui;
|
|
1558
|
+
private state;
|
|
1559
|
+
getUI(): EditorUI;
|
|
1560
|
+
getPlugs(): PlugManager | undefined;
|
|
1561
|
+
getState(): EditorState;
|
|
1562
|
+
constructor(ctx: ContextApi);
|
|
1563
|
+
getHeaderInputEls(): {
|
|
1564
|
+
nick: HTMLInputElement;
|
|
1565
|
+
email: HTMLInputElement;
|
|
1566
|
+
link: HTMLInputElement;
|
|
1567
|
+
};
|
|
1568
|
+
getContentFinal(): string;
|
|
1569
|
+
getContentRaw(): string;
|
|
1570
|
+
getContentMarked(): string;
|
|
1571
|
+
setContent(val: string): void;
|
|
1572
|
+
insertContent(val: string): void;
|
|
1573
|
+
focus(): void;
|
|
1574
|
+
reset(): void;
|
|
1575
|
+
resetState(): void;
|
|
1576
|
+
setReply(comment: CommentData, $comment: HTMLElement): void;
|
|
1577
|
+
setEditComment(comment: CommentData, $comment: HTMLElement): void;
|
|
1578
|
+
showNotify(msg: string, type: any): void;
|
|
1579
|
+
showLoading(): void;
|
|
1580
|
+
hideLoading(): void;
|
|
1581
|
+
submit(): void;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
export declare interface EditorApi extends Component {
|
|
1585
|
+
getUI(): EditorUI;
|
|
1586
|
+
/**
|
|
1587
|
+
* Get the header input elements
|
|
1588
|
+
*/
|
|
1589
|
+
getHeaderInputEls(): Record<string, HTMLInputElement>;
|
|
1590
|
+
/**
|
|
1591
|
+
* Set content
|
|
1592
|
+
*/
|
|
1593
|
+
setContent(val: string): void;
|
|
1594
|
+
/**
|
|
1595
|
+
* Insert content
|
|
1596
|
+
*/
|
|
1597
|
+
insertContent(val: string): void;
|
|
1598
|
+
/**
|
|
1599
|
+
* Get the final content
|
|
1600
|
+
*
|
|
1601
|
+
* This function returns the raw content or the content transformed through a plugin hook.
|
|
1602
|
+
*/
|
|
1603
|
+
getContentFinal(): string;
|
|
1604
|
+
/**
|
|
1605
|
+
* Get the raw content which is inputed by user
|
|
1606
|
+
*/
|
|
1607
|
+
getContentRaw(): string;
|
|
1608
|
+
/**
|
|
1609
|
+
* Get the HTML format content which is rendered by marked (a markdown parser)
|
|
1610
|
+
*/
|
|
1611
|
+
getContentMarked(): string;
|
|
1612
|
+
/**
|
|
1613
|
+
* Get editor current state
|
|
1614
|
+
*/
|
|
1615
|
+
getState(): EditorState;
|
|
1616
|
+
/**
|
|
1617
|
+
* Focus editor
|
|
1618
|
+
*/
|
|
1619
|
+
focus(): void;
|
|
1620
|
+
/**
|
|
1621
|
+
* Reset editor
|
|
1622
|
+
*/
|
|
1623
|
+
reset(): void;
|
|
1624
|
+
/**
|
|
1625
|
+
* Reset editor UI
|
|
1626
|
+
*
|
|
1627
|
+
* call it will move editor to the initial position
|
|
1628
|
+
*/
|
|
1629
|
+
resetState(): void;
|
|
1630
|
+
/**
|
|
1631
|
+
* Submit comment
|
|
1632
|
+
*/
|
|
1633
|
+
submit(): void;
|
|
1634
|
+
/**
|
|
1635
|
+
* Show notification message
|
|
1636
|
+
*/
|
|
1637
|
+
showNotify(msg: string, type: NotifyLevel): void;
|
|
1638
|
+
/**
|
|
1639
|
+
* Show loading on editor
|
|
1640
|
+
*/
|
|
1641
|
+
showLoading(): void;
|
|
1642
|
+
/**
|
|
1643
|
+
* Hide loading on editor
|
|
1644
|
+
*/
|
|
1645
|
+
hideLoading(): void;
|
|
1646
|
+
/**
|
|
1647
|
+
* Start replaying a comment
|
|
1648
|
+
*/
|
|
1649
|
+
setReply(commentData: CommentData, $comment: HTMLElement, scroll?: boolean): void;
|
|
1650
|
+
/**
|
|
1651
|
+
* Start editing a comment
|
|
1652
|
+
*/
|
|
1653
|
+
setEditComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
declare interface EditorEventPayloadMap {
|
|
1657
|
+
'mounted': undefined;
|
|
1658
|
+
'unmounted': undefined;
|
|
1659
|
+
'header-input': {
|
|
1660
|
+
field: string;
|
|
1661
|
+
$input: HTMLInputElement;
|
|
1662
|
+
};
|
|
1663
|
+
'header-change': {
|
|
1664
|
+
field: string;
|
|
1665
|
+
$input: HTMLInputElement;
|
|
1666
|
+
};
|
|
1667
|
+
'content-updated': string;
|
|
1668
|
+
'panel-show': EditorPlug;
|
|
1669
|
+
'panel-hide': EditorPlug;
|
|
1670
|
+
'panel-close': undefined;
|
|
1671
|
+
'editor-close': undefined;
|
|
1672
|
+
'editor-open': undefined;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
/**
|
|
1676
|
+
* Editor 插件
|
|
1677
|
+
*/
|
|
1678
|
+
declare interface EditorPlug {
|
|
1679
|
+
$btn?: HTMLElement;
|
|
1680
|
+
$panel?: HTMLElement;
|
|
1681
|
+
contentTransformer?(rawContent: string): string;
|
|
1682
|
+
editorStateEffectWhen?: EditorState;
|
|
1683
|
+
editorStateEffect?(comment: CommentData): () => void;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
declare class EditorPlug {
|
|
1687
|
+
protected kit: PlugKit;
|
|
1688
|
+
constructor(kit: PlugKit);
|
|
1689
|
+
/** Use plug btn will add a btn on the bottom of editor */
|
|
1690
|
+
useBtn(html?: string): HTMLElement;
|
|
1691
|
+
/** Use plug panel will show the panel when btn is clicked */
|
|
1692
|
+
usePanel(html?: string): HTMLElement;
|
|
1693
|
+
/** Use the content transformer to handle the content of the last submit by the editor */
|
|
1694
|
+
useContentTransformer(func: (raw: string) => string): void;
|
|
1695
|
+
/** Listen the event of panel show */
|
|
1696
|
+
usePanelShow(func: () => void): void;
|
|
1697
|
+
/** Listen the event of panel hide */
|
|
1698
|
+
usePanelHide(func: () => void): void;
|
|
1699
|
+
/** Use editor state modifier */
|
|
1700
|
+
useEditorStateEffect(stateName: EditorState, effectFn: (comment: CommentData) => () => void): void;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
export declare type EditorState = 'reply' | 'edit' | 'normal';
|
|
1704
|
+
|
|
1705
|
+
declare interface EditorUI extends Record<keyof typeof Sel, HTMLElement> {
|
|
1706
|
+
$el: HTMLElement;
|
|
1707
|
+
$nick: HTMLInputElement;
|
|
1708
|
+
$email: HTMLInputElement;
|
|
1709
|
+
$link: HTMLInputElement;
|
|
1710
|
+
$textarea: HTMLTextAreaElement;
|
|
1711
|
+
$submitBtn: HTMLButtonElement;
|
|
1712
|
+
$sendReply?: HTMLElement;
|
|
1713
|
+
$editCancelBtn?: HTMLElement;
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
export declare type EmoticonGrpData = {
|
|
1717
|
+
name: string;
|
|
1718
|
+
type: 'emoticon' | 'image' | 'emoji';
|
|
1719
|
+
items: {
|
|
1720
|
+
key: string;
|
|
1721
|
+
val: string;
|
|
1722
|
+
}[];
|
|
1723
|
+
};
|
|
1724
|
+
|
|
1725
|
+
export declare type EmoticonListData = EmoticonGrpData[];
|
|
1726
|
+
|
|
1727
|
+
declare const en: {
|
|
1728
|
+
placeholder: string;
|
|
1729
|
+
noComment: string;
|
|
1730
|
+
send: string;
|
|
1731
|
+
save: string;
|
|
1732
|
+
nick: string;
|
|
1733
|
+
email: string;
|
|
1734
|
+
link: string;
|
|
1735
|
+
emoticon: string;
|
|
1736
|
+
preview: string;
|
|
1737
|
+
image: string;
|
|
1738
|
+
uploadFail: string;
|
|
1739
|
+
commentFail: string;
|
|
1740
|
+
restoredMsg: string;
|
|
1741
|
+
onlyAdminCanReply: string;
|
|
1742
|
+
uploadLoginMsg: string;
|
|
1743
|
+
counter: string;
|
|
1744
|
+
sortLatest: string;
|
|
1745
|
+
sortOldest: string;
|
|
1746
|
+
sortBest: string;
|
|
1747
|
+
sortAuthor: string;
|
|
1748
|
+
openComment: string;
|
|
1749
|
+
closeComment: string;
|
|
1750
|
+
listLoadFailMsg: string;
|
|
1751
|
+
listRetry: string;
|
|
1752
|
+
loadMore: string;
|
|
1753
|
+
admin: string;
|
|
1754
|
+
reply: string;
|
|
1755
|
+
voteUp: string;
|
|
1756
|
+
voteDown: string;
|
|
1757
|
+
voteFail: string;
|
|
1758
|
+
readMore: string;
|
|
1759
|
+
actionConfirm: string;
|
|
1760
|
+
collapse: string;
|
|
1761
|
+
collapsed: string;
|
|
1762
|
+
collapsedMsg: string;
|
|
1763
|
+
expand: string;
|
|
1764
|
+
approved: string;
|
|
1765
|
+
pending: string;
|
|
1766
|
+
pendingMsg: string;
|
|
1767
|
+
edit: string;
|
|
1768
|
+
editCancel: string;
|
|
1769
|
+
delete: string;
|
|
1770
|
+
deleteConfirm: string;
|
|
1771
|
+
pin: string;
|
|
1772
|
+
unpin: string;
|
|
1773
|
+
seconds: string;
|
|
1774
|
+
minutes: string;
|
|
1775
|
+
hours: string;
|
|
1776
|
+
days: string;
|
|
1777
|
+
now: string;
|
|
1778
|
+
adminCheck: string;
|
|
1779
|
+
captchaCheck: string;
|
|
1780
|
+
confirm: string;
|
|
1781
|
+
cancel: string;
|
|
1782
|
+
msgCenter: string;
|
|
1783
|
+
ctrlCenter: string;
|
|
1784
|
+
frontend: string;
|
|
1785
|
+
backend: string;
|
|
1786
|
+
loading: string;
|
|
1787
|
+
loadFail: string;
|
|
1788
|
+
editing: string;
|
|
1789
|
+
editFail: string;
|
|
1790
|
+
deleting: string;
|
|
1791
|
+
deleteFail: string;
|
|
1792
|
+
reqGot: string;
|
|
1793
|
+
reqAborted: string;
|
|
1794
|
+
updateMsg: string;
|
|
1795
|
+
currentVersion: string;
|
|
1796
|
+
ignore: string;
|
|
1797
|
+
open: string;
|
|
1798
|
+
openName: string;
|
|
1799
|
+
};
|
|
1800
|
+
|
|
1801
|
+
declare interface EntityCookedComment {
|
|
1802
|
+
badge_color: string;
|
|
1803
|
+
badge_name: string;
|
|
1804
|
+
content: string;
|
|
1805
|
+
content_marked: string;
|
|
1806
|
+
date: string;
|
|
1807
|
+
email_encrypted: string;
|
|
1808
|
+
id: number;
|
|
1809
|
+
ip_region: string;
|
|
1810
|
+
is_allow_reply: boolean;
|
|
1811
|
+
is_collapsed: boolean;
|
|
1812
|
+
is_pending: boolean;
|
|
1813
|
+
is_pinned: boolean;
|
|
1814
|
+
link: string;
|
|
1815
|
+
nick: string;
|
|
1816
|
+
page_key: string;
|
|
1817
|
+
page_url: string;
|
|
1818
|
+
rid: number;
|
|
1819
|
+
site_name: string;
|
|
1820
|
+
ua: string;
|
|
1821
|
+
user_id: number;
|
|
1822
|
+
visible: boolean;
|
|
1823
|
+
vote_down: number;
|
|
1824
|
+
vote_up: number;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
declare interface EntityCookedNotify {
|
|
1828
|
+
comment_id: number;
|
|
1829
|
+
id: number;
|
|
1830
|
+
is_emailed: boolean;
|
|
1831
|
+
is_read: boolean;
|
|
1832
|
+
read_link: string;
|
|
1833
|
+
user_id: number;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
declare interface EntityCookedPage {
|
|
1837
|
+
admin_only: boolean;
|
|
1838
|
+
id: number;
|
|
1839
|
+
key: string;
|
|
1840
|
+
pv: number;
|
|
1841
|
+
site_name: string;
|
|
1842
|
+
title: string;
|
|
1843
|
+
url: string;
|
|
1844
|
+
vote_down: number;
|
|
1845
|
+
vote_up: number;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
declare interface EntityCookedSite {
|
|
1849
|
+
first_url: string;
|
|
1850
|
+
id: number;
|
|
1851
|
+
name: string;
|
|
1852
|
+
urls: string[];
|
|
1853
|
+
urls_raw: string;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
declare interface EntityCookedUser {
|
|
1857
|
+
badge_color: string;
|
|
1858
|
+
badge_name: string;
|
|
1859
|
+
email: string;
|
|
1860
|
+
id: number;
|
|
1861
|
+
is_admin: boolean;
|
|
1862
|
+
link: string;
|
|
1863
|
+
name: string;
|
|
1864
|
+
receive_email: boolean;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
declare interface EntityCookedUserForAdmin {
|
|
1868
|
+
badge_color: string;
|
|
1869
|
+
badge_name: string;
|
|
1870
|
+
comment_count: number;
|
|
1871
|
+
email: string;
|
|
1872
|
+
id: number;
|
|
1873
|
+
is_admin: boolean;
|
|
1874
|
+
is_in_conf: boolean;
|
|
1875
|
+
last_ip: string;
|
|
1876
|
+
last_ua: string;
|
|
1877
|
+
link: string;
|
|
1878
|
+
name: string;
|
|
1879
|
+
receive_email: boolean;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
declare interface ErrorData {
|
|
1883
|
+
msg: string;
|
|
1884
|
+
data?: any;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
declare type EventHandler<T> = (payload: T) => void;
|
|
1888
|
+
|
|
1889
|
+
declare class EventManager<PayloadMap> implements EventManagerFuncs<PayloadMap> {
|
|
1890
|
+
private events;
|
|
1891
|
+
/**
|
|
1892
|
+
* Add an event listener for a specific event name
|
|
1893
|
+
*/
|
|
1894
|
+
on<K extends keyof PayloadMap>(name: K, handler: EventHandler<PayloadMap[K]>, opts?: EventOptions): void;
|
|
1895
|
+
/**
|
|
1896
|
+
* Remove an event listener for a specific event name and handler
|
|
1897
|
+
*/
|
|
1898
|
+
off<K extends keyof PayloadMap>(name: K, handler: EventHandler<PayloadMap[K]>): void;
|
|
1899
|
+
/**
|
|
1900
|
+
* Trigger an event with an optional payload
|
|
1901
|
+
*/
|
|
1902
|
+
trigger<K extends keyof PayloadMap>(name: K, payload?: PayloadMap[K]): void;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
declare interface EventManagerFuncs<PayloadMap> {
|
|
1906
|
+
on<K extends keyof PayloadMap>(name: K, handler: EventHandler<PayloadMap[K]>, opts?: EventOptions): void;
|
|
1907
|
+
off<K extends keyof PayloadMap>(name: K, handler: EventHandler<PayloadMap[K]>): void;
|
|
1908
|
+
trigger<K extends keyof PayloadMap>(name: K, payload?: PayloadMap[K]): void;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
declare interface EventOptions {
|
|
1912
|
+
once?: boolean;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
/** EventName to EventPayload Type */
|
|
1916
|
+
export declare interface EventPayloadMap {
|
|
1917
|
+
'created': undefined;
|
|
1918
|
+
'mounted': undefined;
|
|
1919
|
+
'updated': ArtalkConfig;
|
|
1920
|
+
'unmounted': undefined;
|
|
1921
|
+
'conf-fetch': undefined;
|
|
1922
|
+
'list-fetch': Partial<ListFetchParams>;
|
|
1923
|
+
'list-fetched': ListFetchedArgs;
|
|
1924
|
+
'list-load': CommentData[];
|
|
1925
|
+
'list-loaded': CommentData[];
|
|
1926
|
+
'list-failed': ErrorData;
|
|
1927
|
+
'list-goto-first': undefined;
|
|
1928
|
+
'list-reach-bottom': undefined;
|
|
1929
|
+
'comment-inserted': CommentData;
|
|
1930
|
+
'comment-updated': CommentData;
|
|
1931
|
+
'comment-deleted': CommentData;
|
|
1932
|
+
'comment-rendered': CommentNode;
|
|
1933
|
+
'notifies-updated': NotifyData[];
|
|
1934
|
+
'list-goto': number;
|
|
1935
|
+
'page-loaded': PageData;
|
|
1936
|
+
'editor-submit': undefined;
|
|
1937
|
+
'editor-submitted': undefined;
|
|
1938
|
+
'user-changed': LocalUser;
|
|
1939
|
+
'sidebar-show': undefined;
|
|
1940
|
+
'sidebar-hide': undefined;
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
export declare interface FetchError extends Error {
|
|
1944
|
+
code: number;
|
|
1945
|
+
message: string;
|
|
1946
|
+
data?: any;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
declare interface FullRequestParams extends Omit<RequestInit, 'body'> {
|
|
1950
|
+
/** set parameter to `true` for call `securityWorker` for this request */
|
|
1951
|
+
secure?: boolean;
|
|
1952
|
+
/** request path */
|
|
1953
|
+
path: string;
|
|
1954
|
+
/** content type of request body */
|
|
1955
|
+
type?: ContentType;
|
|
1956
|
+
/** query params */
|
|
1957
|
+
query?: QueryParamsType;
|
|
1958
|
+
/** format of response (i.e. response.json() -> format: "json") */
|
|
1959
|
+
format?: ResponseFormat;
|
|
1960
|
+
/** request body */
|
|
1961
|
+
body?: unknown;
|
|
1962
|
+
/** base url */
|
|
1963
|
+
baseUrl?: string;
|
|
1964
|
+
/** request cancellation token */
|
|
1965
|
+
cancelToken?: CancelToken;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
declare type HandlerMap = Record<string, any>;
|
|
1969
|
+
|
|
1970
|
+
declare interface HandlerParamsCaptchaVerify {
|
|
1971
|
+
/** The captcha value to check */
|
|
1972
|
+
value: string;
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
declare interface HandlerParamsCommentCreate {
|
|
1976
|
+
/** The comment content */
|
|
1977
|
+
content: string;
|
|
1978
|
+
/** The comment email */
|
|
1979
|
+
email: string;
|
|
1980
|
+
/** The comment link */
|
|
1981
|
+
link?: string;
|
|
1982
|
+
/** The comment name */
|
|
1983
|
+
name: string;
|
|
1984
|
+
/** The comment page_key */
|
|
1985
|
+
page_key: string;
|
|
1986
|
+
/** The comment page_title */
|
|
1987
|
+
page_title?: string;
|
|
1988
|
+
/** The comment rid */
|
|
1989
|
+
rid?: number;
|
|
1990
|
+
/** The site name of your content scope */
|
|
1991
|
+
site_name: string;
|
|
1992
|
+
/** The comment ua */
|
|
1993
|
+
ua?: string;
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
declare interface HandlerParamsCommentUpdate {
|
|
1997
|
+
/** The comment content */
|
|
1998
|
+
content: string;
|
|
1999
|
+
/** The comment email */
|
|
2000
|
+
email?: string;
|
|
2001
|
+
/** The comment ip */
|
|
2002
|
+
ip?: string;
|
|
2003
|
+
/** The comment is_collapsed */
|
|
2004
|
+
is_collapsed: boolean;
|
|
2005
|
+
/** The comment is_pending */
|
|
2006
|
+
is_pending: boolean;
|
|
2007
|
+
/** The comment is_pinned */
|
|
2008
|
+
is_pinned: boolean;
|
|
2009
|
+
/** The comment link */
|
|
2010
|
+
link?: string;
|
|
2011
|
+
/** The comment nick */
|
|
2012
|
+
nick?: string;
|
|
2013
|
+
/** The comment page_key */
|
|
2014
|
+
page_key: string;
|
|
2015
|
+
/** The comment rid */
|
|
2016
|
+
rid: number;
|
|
2017
|
+
/** The site name of your content scope */
|
|
2018
|
+
site_name: string;
|
|
2019
|
+
/** The comment ua */
|
|
2020
|
+
ua: string;
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
declare interface HandlerParamsEmailSend {
|
|
2024
|
+
/** The body of email */
|
|
2025
|
+
body: string;
|
|
2026
|
+
/** The subject of email */
|
|
2027
|
+
subject: string;
|
|
2028
|
+
/** The email address of the receiver */
|
|
2029
|
+
to_addr: string;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
declare interface HandlerParamsNotifyReadAll {
|
|
2033
|
+
/** The user email */
|
|
2034
|
+
email: string;
|
|
2035
|
+
/** The username */
|
|
2036
|
+
name: string;
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
declare interface HandlerParamsPageFetchAll {
|
|
2040
|
+
/** If not empty, only fetch pages of this site */
|
|
2041
|
+
site_name?: string;
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
declare interface HandlerParamsPagePV {
|
|
2045
|
+
/** The page key */
|
|
2046
|
+
page_key: string;
|
|
2047
|
+
/** The page title */
|
|
2048
|
+
page_title?: string;
|
|
2049
|
+
/** The site name of your content scope */
|
|
2050
|
+
site_name?: string;
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
declare interface HandlerParamsPageUpdate {
|
|
2054
|
+
/** Updated page admin_only option */
|
|
2055
|
+
admin_only: boolean;
|
|
2056
|
+
/** Updated page key */
|
|
2057
|
+
key: string;
|
|
2058
|
+
/** The site name of your content scope */
|
|
2059
|
+
site_name: string;
|
|
2060
|
+
/** Updated page title */
|
|
2061
|
+
title: string;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
declare interface HandlerParamsSettingApply {
|
|
2065
|
+
/** The content of the config file in YAML format */
|
|
2066
|
+
yaml: string;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
declare interface HandlerParamsSiteCreate {
|
|
2070
|
+
/** The site name */
|
|
2071
|
+
name: string;
|
|
2072
|
+
/** The site urls */
|
|
2073
|
+
urls: string[];
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
declare interface HandlerParamsSiteUpdate {
|
|
2077
|
+
/** Updated site name */
|
|
2078
|
+
name: string;
|
|
2079
|
+
/** Updated site urls */
|
|
2080
|
+
urls: string[];
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
declare interface HandlerParamsTransferImport {
|
|
2084
|
+
/** Automatically answer yes for all questions. */
|
|
2085
|
+
assumeyes?: boolean;
|
|
2086
|
+
/** The JSON data */
|
|
2087
|
+
json_data?: string;
|
|
2088
|
+
/** The JSON file path */
|
|
2089
|
+
json_file?: string;
|
|
2090
|
+
/** The target site name */
|
|
2091
|
+
target_site_name?: string;
|
|
2092
|
+
/** The target site url */
|
|
2093
|
+
target_site_url?: string;
|
|
2094
|
+
/** Enable URL resolver */
|
|
2095
|
+
url_resolver?: boolean;
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
declare interface HandlerParamsUserCreate {
|
|
2099
|
+
/** The user badge color (hex format) */
|
|
2100
|
+
badge_color?: string;
|
|
2101
|
+
/** The user badge name */
|
|
2102
|
+
badge_name?: string;
|
|
2103
|
+
/** The user email */
|
|
2104
|
+
email: string;
|
|
2105
|
+
/** The user is an admin */
|
|
2106
|
+
is_admin: boolean;
|
|
2107
|
+
/** The user link */
|
|
2108
|
+
link?: string;
|
|
2109
|
+
/** The user name */
|
|
2110
|
+
name: string;
|
|
2111
|
+
/** The user password */
|
|
2112
|
+
password?: string;
|
|
2113
|
+
/** The user receive email */
|
|
2114
|
+
receive_email: boolean;
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
declare interface HandlerParamsUserLogin {
|
|
2118
|
+
/** The user email */
|
|
2119
|
+
email: string;
|
|
2120
|
+
/** The username */
|
|
2121
|
+
name?: string;
|
|
2122
|
+
/** The user password */
|
|
2123
|
+
password: string;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
declare interface HandlerParamsUserUpdate {
|
|
2127
|
+
/** The user badge color (hex format) */
|
|
2128
|
+
badge_color?: string;
|
|
2129
|
+
/** The user badge name */
|
|
2130
|
+
badge_name?: string;
|
|
2131
|
+
/** The user email */
|
|
2132
|
+
email: string;
|
|
2133
|
+
/** The user is an admin */
|
|
2134
|
+
is_admin: boolean;
|
|
2135
|
+
/** The user link */
|
|
2136
|
+
link?: string;
|
|
2137
|
+
/** The user name */
|
|
2138
|
+
name: string;
|
|
2139
|
+
/** The user password */
|
|
2140
|
+
password?: string;
|
|
2141
|
+
/** The user receive email */
|
|
2142
|
+
receive_email: boolean;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
declare interface HandlerParamsVote {
|
|
2146
|
+
/** The user email */
|
|
2147
|
+
email?: string;
|
|
2148
|
+
/** The username */
|
|
2149
|
+
name?: string;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
declare interface HandlerResponseAdminUserList {
|
|
2153
|
+
count: number;
|
|
2154
|
+
users: EntityCookedUserForAdmin[];
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
declare interface HandlerResponseCaptchaGet {
|
|
2158
|
+
img_data: string;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
declare interface HandlerResponseCaptchaStatus {
|
|
2162
|
+
is_pass: boolean;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
declare interface HandlerResponseCommentCreate {
|
|
2166
|
+
badge_color: string;
|
|
2167
|
+
badge_name: string;
|
|
2168
|
+
content: string;
|
|
2169
|
+
content_marked: string;
|
|
2170
|
+
date: string;
|
|
2171
|
+
email_encrypted: string;
|
|
2172
|
+
id: number;
|
|
2173
|
+
ip_region: string;
|
|
2174
|
+
is_allow_reply: boolean;
|
|
2175
|
+
is_collapsed: boolean;
|
|
2176
|
+
is_pending: boolean;
|
|
2177
|
+
is_pinned: boolean;
|
|
2178
|
+
link: string;
|
|
2179
|
+
nick: string;
|
|
2180
|
+
page_key: string;
|
|
2181
|
+
page_url: string;
|
|
2182
|
+
rid: number;
|
|
2183
|
+
site_name: string;
|
|
2184
|
+
ua: string;
|
|
2185
|
+
user_id: number;
|
|
2186
|
+
visible: boolean;
|
|
2187
|
+
vote_down: number;
|
|
2188
|
+
vote_up: number;
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
declare interface HandlerResponseCommentList {
|
|
2192
|
+
comments: EntityCookedComment[];
|
|
2193
|
+
count: number;
|
|
2194
|
+
page: EntityCookedPage;
|
|
2195
|
+
roots_count: number;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
declare interface HandlerResponseCommentUpdate {
|
|
2199
|
+
badge_color: string;
|
|
2200
|
+
badge_name: string;
|
|
2201
|
+
content: string;
|
|
2202
|
+
content_marked: string;
|
|
2203
|
+
date: string;
|
|
2204
|
+
email_encrypted: string;
|
|
2205
|
+
id: number;
|
|
2206
|
+
ip_region: string;
|
|
2207
|
+
is_allow_reply: boolean;
|
|
2208
|
+
is_collapsed: boolean;
|
|
2209
|
+
is_pending: boolean;
|
|
2210
|
+
is_pinned: boolean;
|
|
2211
|
+
link: string;
|
|
2212
|
+
nick: string;
|
|
2213
|
+
page_key: string;
|
|
2214
|
+
page_url: string;
|
|
2215
|
+
rid: number;
|
|
2216
|
+
site_name: string;
|
|
2217
|
+
ua: string;
|
|
2218
|
+
user_id: number;
|
|
2219
|
+
visible: boolean;
|
|
2220
|
+
vote_down: number;
|
|
2221
|
+
vote_up: number;
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
declare interface HandlerResponseNotifyList {
|
|
2225
|
+
count: number;
|
|
2226
|
+
notifies: EntityCookedNotify[];
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
declare interface HandlerResponsePageFetch {
|
|
2230
|
+
admin_only: boolean;
|
|
2231
|
+
id: number;
|
|
2232
|
+
key: string;
|
|
2233
|
+
pv: number;
|
|
2234
|
+
site_name: string;
|
|
2235
|
+
title: string;
|
|
2236
|
+
url: string;
|
|
2237
|
+
vote_down: number;
|
|
2238
|
+
vote_up: number;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
declare interface HandlerResponsePageFetchStatus {
|
|
2242
|
+
/** The number of pages that have been fetched */
|
|
2243
|
+
done: number;
|
|
2244
|
+
/** If the task is in progress */
|
|
2245
|
+
is_progress: boolean;
|
|
2246
|
+
/** The message of the task status */
|
|
2247
|
+
msg: string;
|
|
2248
|
+
/** The total number of pages */
|
|
2249
|
+
total: number;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
declare interface HandlerResponsePageList {
|
|
2253
|
+
count: number;
|
|
2254
|
+
pages: EntityCookedPage[];
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
declare interface HandlerResponsePagePV {
|
|
2258
|
+
pv: number;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
declare interface HandlerResponsePageUpdate {
|
|
2262
|
+
admin_only: boolean;
|
|
2263
|
+
id: number;
|
|
2264
|
+
key: string;
|
|
2265
|
+
pv: number;
|
|
2266
|
+
site_name: string;
|
|
2267
|
+
title: string;
|
|
2268
|
+
url: string;
|
|
2269
|
+
vote_down: number;
|
|
2270
|
+
vote_up: number;
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
declare interface HandlerResponseSettingGet {
|
|
2274
|
+
yaml: string;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
declare interface HandlerResponseSettingTemplate {
|
|
2278
|
+
yaml: string;
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
declare interface HandlerResponseSiteCreate {
|
|
2282
|
+
first_url: string;
|
|
2283
|
+
id: number;
|
|
2284
|
+
name: string;
|
|
2285
|
+
urls: string[];
|
|
2286
|
+
urls_raw: string;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
declare interface HandlerResponseSiteList {
|
|
2290
|
+
count: number;
|
|
2291
|
+
sites: EntityCookedSite[];
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
declare interface HandlerResponseSiteUpdate {
|
|
2295
|
+
first_url: string;
|
|
2296
|
+
id: number;
|
|
2297
|
+
name: string;
|
|
2298
|
+
urls: string[];
|
|
2299
|
+
urls_raw: string;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
declare interface HandlerResponseTransferExport {
|
|
2303
|
+
/** The exported data which is a JSON string */
|
|
2304
|
+
artrans: string;
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
declare interface HandlerResponseTransferUpload {
|
|
2308
|
+
/** The uploaded file name which can be used to import */
|
|
2309
|
+
filename: string;
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
declare interface HandlerResponseUpload {
|
|
2313
|
+
file_name: string;
|
|
2314
|
+
file_type: string;
|
|
2315
|
+
public_url: string;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
declare interface HandlerResponseUserCreate {
|
|
2319
|
+
badge_color: string;
|
|
2320
|
+
badge_name: string;
|
|
2321
|
+
comment_count: number;
|
|
2322
|
+
email: string;
|
|
2323
|
+
id: number;
|
|
2324
|
+
is_admin: boolean;
|
|
2325
|
+
is_in_conf: boolean;
|
|
2326
|
+
last_ip: string;
|
|
2327
|
+
last_ua: string;
|
|
2328
|
+
link: string;
|
|
2329
|
+
name: string;
|
|
2330
|
+
receive_email: boolean;
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
declare interface HandlerResponseUserInfo {
|
|
2334
|
+
is_login: boolean;
|
|
2335
|
+
notifies: EntityCookedNotify[];
|
|
2336
|
+
notifies_count: number;
|
|
2337
|
+
user: EntityCookedUser;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
declare interface HandlerResponseUserLogin {
|
|
2341
|
+
token: string;
|
|
2342
|
+
user: EntityCookedUser;
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
declare interface HandlerResponseUserStatus {
|
|
2346
|
+
is_admin: boolean;
|
|
2347
|
+
is_login: boolean;
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
declare interface HandlerResponseUserUpdate {
|
|
2351
|
+
badge_color: string;
|
|
2352
|
+
badge_name: string;
|
|
2353
|
+
comment_count: number;
|
|
2354
|
+
email: string;
|
|
2355
|
+
id: number;
|
|
2356
|
+
is_admin: boolean;
|
|
2357
|
+
is_in_conf: boolean;
|
|
2358
|
+
last_ip: string;
|
|
2359
|
+
last_ua: string;
|
|
2360
|
+
link: string;
|
|
2361
|
+
name: string;
|
|
2362
|
+
receive_email: boolean;
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
declare interface HandlerResponseVote {
|
|
2366
|
+
down: number;
|
|
2367
|
+
up: number;
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
declare class HttpClient<SecurityDataType = unknown> {
|
|
2371
|
+
baseUrl: string;
|
|
2372
|
+
private securityData;
|
|
2373
|
+
private securityWorker?;
|
|
2374
|
+
private abortControllers;
|
|
2375
|
+
private customFetch;
|
|
2376
|
+
private baseApiParams;
|
|
2377
|
+
constructor(apiConfig?: ApiConfig<SecurityDataType>);
|
|
2378
|
+
setSecurityData: (data: SecurityDataType | null) => void;
|
|
2379
|
+
protected encodeQueryParam(key: string, value: any): string;
|
|
2380
|
+
protected addQueryParam(query: QueryParamsType, key: string): string;
|
|
2381
|
+
protected addArrayQueryParam(query: QueryParamsType, key: string): any;
|
|
2382
|
+
protected toQueryString(rawQuery?: QueryParamsType): string;
|
|
2383
|
+
protected addQueryParams(rawQuery?: QueryParamsType): string;
|
|
2384
|
+
private contentFormatters;
|
|
2385
|
+
protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams;
|
|
2386
|
+
protected createAbortSignal: (cancelToken: CancelToken) => AbortSignal | undefined;
|
|
2387
|
+
abortRequest: (cancelToken: CancelToken) => void;
|
|
2388
|
+
request: <T = any, E = any>({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams) => Promise<HttpResponse<T, E>>;
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
declare interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
|
|
2392
|
+
data: D;
|
|
2393
|
+
error: E;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
export declare type I18n = typeof en;
|
|
2397
|
+
|
|
2398
|
+
export declare type I18nKeys = keyof I18n;
|
|
2399
|
+
|
|
2400
|
+
export declare const init: typeof Artalk.init;
|
|
2401
|
+
|
|
2402
|
+
declare class Layer {
|
|
2403
|
+
private $el;
|
|
2404
|
+
private opts;
|
|
2405
|
+
private allowMaskClose;
|
|
2406
|
+
private onAfterHide?;
|
|
2407
|
+
constructor($el: HTMLElement, opts: LayerOptions);
|
|
2408
|
+
setOnAfterHide(func: () => void): void;
|
|
2409
|
+
setAllowMaskClose(allow: boolean): void;
|
|
2410
|
+
getAllowMaskClose(): boolean;
|
|
2411
|
+
getEl(): HTMLElement;
|
|
2412
|
+
show(): void;
|
|
2413
|
+
hide(): Promise<void>;
|
|
2414
|
+
destroy(): Promise<void>;
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
declare class LayerManager {
|
|
2418
|
+
private wrap;
|
|
2419
|
+
constructor(ctx: ContextApi);
|
|
2420
|
+
getEl(): HTMLElement;
|
|
2421
|
+
create(name: string, el?: HTMLElement): Layer;
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
declare interface LayerOptions {
|
|
2425
|
+
onShow: () => void;
|
|
2426
|
+
onHide: () => void;
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
declare interface LayoutOptions {
|
|
2430
|
+
$commentsWrap: HTMLElement;
|
|
2431
|
+
nestSortBy: ListNest.SortByType;
|
|
2432
|
+
nestMax: number;
|
|
2433
|
+
flatMode: boolean;
|
|
2434
|
+
createCommentNode(comment: CommentData, ctxComments: CommentData[]): CommentNode;
|
|
2435
|
+
findCommentNode(id: number): CommentNode | undefined;
|
|
2436
|
+
getCommentDataList(): CommentData[];
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
declare class List extends Component {
|
|
2440
|
+
/** 列表评论集区域元素 */
|
|
2441
|
+
$commentsWrap: HTMLElement;
|
|
2442
|
+
getCommentsWrapEl(): HTMLElement;
|
|
2443
|
+
protected commentNodes: CommentNode[];
|
|
2444
|
+
getCommentNodes(): CommentNode[];
|
|
2445
|
+
constructor(ctx: ContextApi);
|
|
2446
|
+
getListLayout(): ListLayout;
|
|
2447
|
+
private initCrudEvents;
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
export declare interface ListData {
|
|
2451
|
+
/** 评论数据 */
|
|
2452
|
+
comments: CommentData[];
|
|
2453
|
+
/** 根评论总数 */
|
|
2454
|
+
roots_count: number;
|
|
2455
|
+
/** 评论总数(包括所有子评论) */
|
|
2456
|
+
count: number;
|
|
2457
|
+
/** 页面信息 */
|
|
2458
|
+
page: PageData;
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
declare interface ListFetchedArgs {
|
|
2462
|
+
params: Partial<ListFetchParams>;
|
|
2463
|
+
data?: ListData;
|
|
2464
|
+
error?: ErrorData;
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
export declare interface ListFetchParams {
|
|
2468
|
+
offset: number;
|
|
2469
|
+
limit: number;
|
|
2470
|
+
flatMode: boolean;
|
|
2471
|
+
paramsModifier?: (p: any) => void;
|
|
2472
|
+
onSuccess?: (data: ListData) => void;
|
|
2473
|
+
onError?: (err: any) => void;
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
export declare interface ListLastFetchData {
|
|
2477
|
+
params: ListFetchParams;
|
|
2478
|
+
data?: ListData;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
declare class ListLayout {
|
|
2482
|
+
private options;
|
|
2483
|
+
constructor(options: LayoutOptions);
|
|
2484
|
+
import(comments: CommentData[]): void;
|
|
2485
|
+
insert(comment: CommentData): void;
|
|
2486
|
+
private importCommentsNestMode;
|
|
2487
|
+
/** 导入评论 · 平铺模式 */
|
|
2488
|
+
private putCommentFlatMode;
|
|
2489
|
+
private insertCommentNest;
|
|
2490
|
+
private insertCommentFlatMode;
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
declare namespace ListNest {
|
|
2494
|
+
export {
|
|
2495
|
+
makeNestCommentNodeList,
|
|
2496
|
+
CommentNode_2 as CommentNode,
|
|
2497
|
+
SortByType
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
export declare const loadCountWidget: typeof Artalk.loadCountWidget;
|
|
2502
|
+
|
|
2503
|
+
/**
|
|
2504
|
+
* 本地持久化用户数据
|
|
2505
|
+
* @note 始终保持一层结构,不支持多层结构
|
|
2506
|
+
*/
|
|
2507
|
+
export declare interface LocalUser {
|
|
2508
|
+
/** 昵称 */
|
|
2509
|
+
nick: string;
|
|
2510
|
+
/** 邮箱 */
|
|
2511
|
+
email: string;
|
|
2512
|
+
/** 链接 */
|
|
2513
|
+
link: string;
|
|
2514
|
+
/** TOKEN */
|
|
2515
|
+
token: string;
|
|
2516
|
+
/** 是否为管理员 */
|
|
2517
|
+
isAdmin: boolean;
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
declare function makeNestCommentNodeList(srcData: CommentData[], sortBy?: SortByType, nestMax?: number): CommentNode_2[];
|
|
2521
|
+
|
|
2522
|
+
export declare interface NotifyData {
|
|
2523
|
+
/** 通知 ID */
|
|
2524
|
+
id: number;
|
|
2525
|
+
/** 用户 ID */
|
|
2526
|
+
user_id: number;
|
|
2527
|
+
/** 评论 ID */
|
|
2528
|
+
comment_id: number;
|
|
2529
|
+
/** 是否已读 */
|
|
2530
|
+
is_read: boolean;
|
|
2531
|
+
/** 是否已发送邮件通知 */
|
|
2532
|
+
is_emailed: boolean;
|
|
2533
|
+
/** 标为已读地址 */
|
|
2534
|
+
read_link: string;
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
export declare type NotifyLevel = "i" | "s" | "w" | "e";
|
|
2538
|
+
|
|
2539
|
+
export declare interface PageData {
|
|
2540
|
+
/** 页面 ID */
|
|
2541
|
+
id: number;
|
|
2542
|
+
/** 页面唯一标识符 */
|
|
2543
|
+
key: string;
|
|
2544
|
+
/** 页面标题 */
|
|
2545
|
+
title: string;
|
|
2546
|
+
/** 页面 url */
|
|
2547
|
+
url: string;
|
|
2548
|
+
/** 仅管理员可评 */
|
|
2549
|
+
admin_only: boolean;
|
|
2550
|
+
/** 站点名(用于隔离) */
|
|
2551
|
+
site_name: string;
|
|
2552
|
+
/** 赞同数 */
|
|
2553
|
+
vote_up: number;
|
|
2554
|
+
/** 反对数 */
|
|
2555
|
+
vote_down: number;
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
/**
|
|
2559
|
+
* PlugKit provides a set of methods to help you develop editor plug
|
|
2560
|
+
*/
|
|
2561
|
+
declare class PlugKit {
|
|
2562
|
+
private plugs;
|
|
2563
|
+
constructor(plugs: PlugManager);
|
|
2564
|
+
/** Use the editor */
|
|
2565
|
+
useEditor(): EditorApi;
|
|
2566
|
+
/**
|
|
2567
|
+
* Use the context of global
|
|
2568
|
+
*
|
|
2569
|
+
* @deprecated The calls to this function should be reduced as much as possible
|
|
2570
|
+
*/
|
|
2571
|
+
useGlobalCtx(): ContextApi;
|
|
2572
|
+
/** Use the config of Artalk */
|
|
2573
|
+
useConf(): ArtalkConfig;
|
|
2574
|
+
/** Use the http api client */
|
|
2575
|
+
useApi(): Api;
|
|
2576
|
+
/** Use the user manager */
|
|
2577
|
+
useUser(): User;
|
|
2578
|
+
/** Use the ui of editor */
|
|
2579
|
+
useUI(): EditorUI;
|
|
2580
|
+
/** Use the events in editor scope */
|
|
2581
|
+
useEvents(): EventManager<EditorEventPayloadMap>;
|
|
2582
|
+
/** Listen the event when plug is mounted */
|
|
2583
|
+
useMounted(func: () => void): void;
|
|
2584
|
+
/** Listen the event when plug is unmounted */
|
|
2585
|
+
useUnmounted(func: () => void): void;
|
|
2586
|
+
/** Use the deps of other plug */
|
|
2587
|
+
useDeps<T extends typeof EditorPlug>(plug: T): InstanceType<T> | undefined;
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
declare class PlugManager {
|
|
2591
|
+
editor: EditorApi;
|
|
2592
|
+
private plugs;
|
|
2593
|
+
private openedPlug;
|
|
2594
|
+
private events;
|
|
2595
|
+
getPlugs(): EditorPlug[];
|
|
2596
|
+
getEvents(): EventManager<EditorEventPayloadMap>;
|
|
2597
|
+
private clear;
|
|
2598
|
+
constructor(editor: EditorApi);
|
|
2599
|
+
private loadPluginUI;
|
|
2600
|
+
/** Load the plug btn and plug panel on editor ui */
|
|
2601
|
+
private loadPluginItem;
|
|
2602
|
+
get<T extends typeof EditorPlug>(plug: T): InstanceType<T> | undefined;
|
|
2603
|
+
/** Open the editor plug panel */
|
|
2604
|
+
openPlugPanel(plug: EditorPlug): void;
|
|
2605
|
+
/** Close the editor plug panel */
|
|
2606
|
+
closePlugPanel(): void;
|
|
2607
|
+
/** Get the content which is transformed by plugs */
|
|
2608
|
+
getTransformedContent(rawContent: string): string;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
declare type QueryParamsType = Record<string | number, any>;
|
|
2612
|
+
|
|
2613
|
+
declare class Render {
|
|
2614
|
+
comment: CommentNode;
|
|
2615
|
+
get ctx(): ContextApi;
|
|
2616
|
+
get data(): CommentData;
|
|
2617
|
+
get conf(): ArtalkConfig;
|
|
2618
|
+
get cConf(): CommentConf;
|
|
2619
|
+
$el: HTMLElement;
|
|
2620
|
+
$main: HTMLElement;
|
|
2621
|
+
$header: HTMLElement;
|
|
2622
|
+
$headerNick: HTMLElement;
|
|
2623
|
+
$headerBadgeWrap: HTMLElement;
|
|
2624
|
+
$body: HTMLElement;
|
|
2625
|
+
$content: HTMLElement;
|
|
2626
|
+
$childrenWrap: HTMLElement | null;
|
|
2627
|
+
$actions: HTMLElement;
|
|
2628
|
+
voteBtnUp?: ActionBtn;
|
|
2629
|
+
voteBtnDown?: ActionBtn;
|
|
2630
|
+
$replyTo?: HTMLElement;
|
|
2631
|
+
$replyAt?: HTMLElement;
|
|
2632
|
+
constructor(comment: CommentNode);
|
|
2633
|
+
render(): HTMLElement;
|
|
2634
|
+
/** 内容限高检测 */
|
|
2635
|
+
checkHeightLimit(): void;
|
|
2636
|
+
/** 子评论区域移除限高 */
|
|
2637
|
+
heightLimitRemoveForChildren(): void;
|
|
2638
|
+
/** 渐出动画 */
|
|
2639
|
+
playFadeAnim(): void;
|
|
2640
|
+
/** 渐出动画 · 评论内容区域 */
|
|
2641
|
+
playFadeAnimForBody(): void;
|
|
2642
|
+
/** 获取子评论 Wrap */
|
|
2643
|
+
getChildrenWrap(): HTMLElement | null;
|
|
2644
|
+
/** 初始化子评论区域 Wrap */
|
|
2645
|
+
renderChildrenWrap(): HTMLElement;
|
|
2646
|
+
/** 恢复原有的子评论区域 Wrap */
|
|
2647
|
+
recoveryChildrenWrap(): void;
|
|
2648
|
+
/** 设置已读 */
|
|
2649
|
+
setUnread(val: boolean): void;
|
|
2650
|
+
/** 设置为可点击的评论 */
|
|
2651
|
+
setOpenable(val: boolean): void;
|
|
2652
|
+
/** 设置点击评论打开置顶 URL */
|
|
2653
|
+
setOpenURL(url: string): void;
|
|
2654
|
+
/** 设置点击评论时的操作 */
|
|
2655
|
+
setOpenAction(action: () => void): void;
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
declare type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
|
|
2659
|
+
|
|
2660
|
+
declare type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
|
|
2661
|
+
|
|
2662
|
+
declare const Sel: {
|
|
2663
|
+
$header: string;
|
|
2664
|
+
$nick: string;
|
|
2665
|
+
$email: string;
|
|
2666
|
+
$link: string;
|
|
2667
|
+
$textareaWrap: string;
|
|
2668
|
+
$textarea: string;
|
|
2669
|
+
$bottom: string;
|
|
2670
|
+
$submitBtn: string;
|
|
2671
|
+
$notifyWrap: string;
|
|
2672
|
+
$plugBtnWrap: string;
|
|
2673
|
+
$plugPanelWrap: string;
|
|
2674
|
+
};
|
|
2675
|
+
|
|
2676
|
+
/**
|
|
2677
|
+
* Services
|
|
2678
|
+
*
|
|
2679
|
+
* @description Call these services by `ctx.get('serviceName')` or `ctx.serviceName`
|
|
2680
|
+
*/
|
|
2681
|
+
declare const services: {
|
|
2682
|
+
i18n(ctx: ContextApi): void;
|
|
2683
|
+
user(ctx: ContextApi): User;
|
|
2684
|
+
layerManager(ctx: ContextApi): LayerManager;
|
|
2685
|
+
checkerLauncher(ctx: ContextApi): CheckerLauncher;
|
|
2686
|
+
editor(ctx: ContextApi): Editor;
|
|
2687
|
+
list(ctx: ContextApi): List;
|
|
2688
|
+
sidebarLayer(ctx: ContextApi): SidebarLayer;
|
|
2689
|
+
editorPlugs(): PlugManager | undefined;
|
|
2690
|
+
};
|
|
2691
|
+
|
|
2692
|
+
declare class SidebarLayer extends Component {
|
|
2693
|
+
layer?: Layer;
|
|
2694
|
+
$header: HTMLElement;
|
|
2695
|
+
$closeBtn: HTMLElement;
|
|
2696
|
+
$iframeWrap: HTMLElement;
|
|
2697
|
+
$iframe?: HTMLIFrameElement;
|
|
2698
|
+
constructor(ctx: ContextApi);
|
|
2699
|
+
/** Refresh iFrame on show */
|
|
2700
|
+
private refreshOnShow;
|
|
2701
|
+
/** Animation timer */
|
|
2702
|
+
private animTimer?;
|
|
2703
|
+
/** 显示 */
|
|
2704
|
+
show(conf?: SidebarShowPayload): Promise<void>;
|
|
2705
|
+
/** 隐藏 */
|
|
2706
|
+
hide(): void;
|
|
2707
|
+
private authCheck;
|
|
2708
|
+
private initLayer;
|
|
2709
|
+
private createIframe;
|
|
2710
|
+
private iframeLoad;
|
|
2711
|
+
}
|
|
2712
|
+
|
|
2713
|
+
export declare interface SidebarShowPayload {
|
|
2714
|
+
view?: 'comments' | 'sites' | 'pages' | 'transfer';
|
|
2715
|
+
}
|
|
2716
|
+
|
|
2717
|
+
export declare interface SiteData {
|
|
2718
|
+
/** 站点 ID */
|
|
2719
|
+
id: number;
|
|
2720
|
+
/** 站点名 */
|
|
2721
|
+
name: string;
|
|
2722
|
+
/** 站点 URLs */
|
|
2723
|
+
urls: string[];
|
|
2724
|
+
/** 站点 URLs(原始字符串) */
|
|
2725
|
+
urls_raw: string;
|
|
2726
|
+
/** 站点主 URL */
|
|
2727
|
+
first_url: string;
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
declare type SortByType = 'DATE_DESC' | 'DATE_ASC' | 'SRC_INDEX' | 'VOTE_UP_DESC';
|
|
2731
|
+
|
|
2732
|
+
declare type TInjectedServices = {
|
|
2733
|
+
[K in keyof TServiceInjectors]: ReturnType<TServiceInjectors[K]>;
|
|
2734
|
+
};
|
|
2735
|
+
|
|
2736
|
+
declare type TKeysOnlyReturn<T extends TObjectWithFuncs, V> = {
|
|
2737
|
+
[K in keyof T]: ReturnType<T[K]> extends V ? K : never;
|
|
2738
|
+
}[keyof T];
|
|
2739
|
+
|
|
2740
|
+
declare type TMarked = typeof marked;
|
|
2741
|
+
|
|
2742
|
+
declare type TObjectWithFuncs = {
|
|
2743
|
+
[k: string]: (...args: any) => any;
|
|
2744
|
+
};
|
|
2745
|
+
|
|
2746
|
+
declare type TOmitConditions = TKeysOnlyReturn<TServiceImps, void>;
|
|
2747
|
+
|
|
2748
|
+
declare type TServiceImps = typeof services;
|
|
2749
|
+
|
|
2750
|
+
declare type TServiceInjectors = Omit<TServiceImps, TOmitConditions>;
|
|
2751
|
+
|
|
2752
|
+
export declare const use: typeof Artalk.use;
|
|
2753
|
+
|
|
2754
|
+
declare class User {
|
|
2755
|
+
private opts;
|
|
2756
|
+
private data;
|
|
2757
|
+
constructor(opts: UserOpts);
|
|
2758
|
+
getData(): LocalUser;
|
|
2759
|
+
/** Update user data and save to localStorage */
|
|
2760
|
+
update(obj?: Partial<LocalUser>): void;
|
|
2761
|
+
/**
|
|
2762
|
+
* Logout
|
|
2763
|
+
*
|
|
2764
|
+
* @description Logout will clear login status, but not clear user data (nick, email, link)
|
|
2765
|
+
*/
|
|
2766
|
+
logout(): void;
|
|
2767
|
+
/** Check if user has filled basic data */
|
|
2768
|
+
checkHasBasicUserInfo(): boolean;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
export declare interface UserData {
|
|
2772
|
+
/** 用户 ID */
|
|
2773
|
+
id: number;
|
|
2774
|
+
/** 用户名 */
|
|
2775
|
+
name: string;
|
|
2776
|
+
/** 邮箱 */
|
|
2777
|
+
email: string;
|
|
2778
|
+
/** 链接 */
|
|
2779
|
+
link: string;
|
|
2780
|
+
/** 徽章名称 */
|
|
2781
|
+
badge_name: string;
|
|
2782
|
+
/** 徽章颜色 */
|
|
2783
|
+
badge_color: string;
|
|
2784
|
+
/** 是否属于管理员 */
|
|
2785
|
+
is_admin: boolean;
|
|
2786
|
+
/** 是否允许接收邮件通知 */
|
|
2787
|
+
receive_email: boolean;
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2790
|
+
export declare interface UserDataForAdmin extends UserData {
|
|
2791
|
+
/** 最后一次操作 IP */
|
|
2792
|
+
last_ip: string;
|
|
2793
|
+
/** 最后一次操作 UA */
|
|
2794
|
+
last_ua: string;
|
|
2795
|
+
/** 是否存在于配置文件中 */
|
|
2796
|
+
is_in_conf: boolean;
|
|
2797
|
+
/** 评论数 */
|
|
2798
|
+
comment_count: number;
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
export declare interface UserInfoApiResponseData {
|
|
2802
|
+
user?: UserData;
|
|
2803
|
+
is_login: boolean;
|
|
2804
|
+
notifies: NotifyData[];
|
|
2805
|
+
notifies_count: number;
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2808
|
+
declare interface UserOpts {
|
|
2809
|
+
onUserChanged?: (user: LocalUser) => void;
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
export { }
|