@esershnr/artalk 2.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/Artalk.cjs +11 -0
- package/dist/Artalk.cjs.map +1 -0
- package/dist/Artalk.css +1 -0
- package/dist/Artalk.iife.js +11 -0
- package/dist/Artalk.iife.js.map +1 -0
- package/dist/Artalk.js +11 -0
- package/dist/Artalk.js.map +1 -0
- package/dist/Artalk.mjs +9803 -0
- 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 -0
- package/dist/ArtalkLite.iife.js +11 -0
- package/dist/ArtalkLite.iife.js.map +1 -0
- package/dist/ArtalkLite.js +11 -0
- package/dist/ArtalkLite.js.map +1 -0
- package/dist/ArtalkLite.mjs +7738 -0
- package/dist/ArtalkLite.mjs.map +1 -0
- package/dist/i18n/fr.cjs +1 -0
- package/dist/i18n/fr.d.cts +3 -0
- package/dist/i18n/fr.d.ts +3 -0
- package/dist/i18n/fr.js +1 -0
- package/dist/i18n/fr.mjs +123 -0
- package/dist/i18n/ja.cjs +1 -0
- package/dist/i18n/ja.d.cts +3 -0
- package/dist/i18n/ja.d.ts +3 -0
- package/dist/i18n/ja.js +1 -0
- package/dist/i18n/ja.mjs +123 -0
- package/dist/i18n/ko.cjs +1 -0
- package/dist/i18n/ko.d.cts +3 -0
- package/dist/i18n/ko.d.ts +3 -0
- package/dist/i18n/ko.js +1 -0
- package/dist/i18n/ko.mjs +123 -0
- package/dist/i18n/ru.cjs +1 -0
- package/dist/i18n/ru.d.cts +3 -0
- package/dist/i18n/ru.d.ts +3 -0
- package/dist/i18n/ru.js +1 -0
- package/dist/i18n/ru.mjs +123 -0
- package/dist/i18n/tr.cjs +1 -0
- package/dist/i18n/tr.d.cts +3 -0
- package/dist/i18n/tr.d.ts +3 -0
- package/dist/i18n/tr.js +1 -0
- package/dist/i18n/tr.mjs +123 -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 -0
- package/dist/i18n/zh-TW.mjs +115 -0
- package/dist/main.d.cts +3225 -0
- package/dist/main.d.ts +3225 -0
- package/package.json +182 -0
package/dist/main.d.cts
ADDED
|
@@ -0,0 +1,3225 @@
|
|
|
1
|
+
import { Marked } from 'marked';
|
|
2
|
+
import { MarkedOptions } from 'marked';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 通用操作按钮
|
|
6
|
+
*/
|
|
7
|
+
declare class ActionBtn {
|
|
8
|
+
private opts;
|
|
9
|
+
$el: HTMLElement;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
msgRecTimer?: number;
|
|
12
|
+
msgRecTimerFunc?: () => void;
|
|
13
|
+
get isMessaging(): boolean;
|
|
14
|
+
isConfirming: boolean;
|
|
15
|
+
confirmRecTimer?: number;
|
|
16
|
+
/** 构造函数 */
|
|
17
|
+
constructor(opts: ActionBtnOptions | string | (() => string));
|
|
18
|
+
/** 将按钮装载到指定元素 */
|
|
19
|
+
appendTo(dom: HTMLElement): this;
|
|
20
|
+
/** 获取按钮文字(动态/静态) */
|
|
21
|
+
private getText;
|
|
22
|
+
/** 设置点击事件 */
|
|
23
|
+
setClick(func: () => void): void;
|
|
24
|
+
/** 文字刷新(动态/静态) */
|
|
25
|
+
updateText(text?: (() => string) | string): void;
|
|
26
|
+
/** 设置加载状态 */
|
|
27
|
+
setLoading(value: boolean, loadingText?: string): void;
|
|
28
|
+
/** 错误消息 */
|
|
29
|
+
setError(text: string): void;
|
|
30
|
+
/** 警告消息 */
|
|
31
|
+
setWarn(text: string): void;
|
|
32
|
+
/** 成功消息 */
|
|
33
|
+
setSuccess(text: string): void;
|
|
34
|
+
/** 设置消息 */
|
|
35
|
+
setMsg(text: string, className?: string, duringTime?: number, after?: () => void): void;
|
|
36
|
+
/** 设置消息复原操作定时器 */
|
|
37
|
+
private setMsgRecTimer;
|
|
38
|
+
/** 立刻触发器复原定时器 */
|
|
39
|
+
private fireMsgRecTimer;
|
|
40
|
+
/** 仅清除 timer */
|
|
41
|
+
private clearMsgRecTimer;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare interface ActionBtnOptions {
|
|
45
|
+
/** 按钮文字 (动态/静态) */
|
|
46
|
+
text: (() => string) | string;
|
|
47
|
+
/** 仅管理员可用 */
|
|
48
|
+
adminOnly?: boolean;
|
|
49
|
+
/** 确认操作 */
|
|
50
|
+
confirm?: boolean;
|
|
51
|
+
/** 确认时提示文字 */
|
|
52
|
+
confirmText?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export declare class Api extends Api_2<void> {
|
|
56
|
+
private _opts;
|
|
57
|
+
constructor(opts: ApiOptions);
|
|
58
|
+
/**
|
|
59
|
+
* Get user info as params for request
|
|
60
|
+
*
|
|
61
|
+
* @returns Request params with user info
|
|
62
|
+
*/
|
|
63
|
+
getUserFields(): {
|
|
64
|
+
name: string;
|
|
65
|
+
email: string;
|
|
66
|
+
} | undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @title Artalk API
|
|
71
|
+
* @version 2.0
|
|
72
|
+
* @license MIT (https://github.com/ArtalkJS/Artalk/blob/master/LICENSE)
|
|
73
|
+
* @baseUrl /api/v2
|
|
74
|
+
* @contact API Support <artalkjs@gmail.com> (https://artalk.js.org)
|
|
75
|
+
*
|
|
76
|
+
* Artalk is a modern comment system based on Golang.
|
|
77
|
+
*/
|
|
78
|
+
declare class Api_2<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
79
|
+
auth: {
|
|
80
|
+
/**
|
|
81
|
+
* @description Login by email with verify code (Need send email verify code first) or password
|
|
82
|
+
*
|
|
83
|
+
* @tags Auth
|
|
84
|
+
* @name LoginByEmail
|
|
85
|
+
* @summary Login by email
|
|
86
|
+
* @request POST:/auth/email/login
|
|
87
|
+
* @response `200` `HandlerResponseUserLogin` OK
|
|
88
|
+
* @response `400` `(HandlerMap & {
|
|
89
|
+
msg?: string,
|
|
90
|
+
|
|
91
|
+
})` Bad Request
|
|
92
|
+
* @response `500` `(HandlerMap & {
|
|
93
|
+
msg?: string,
|
|
94
|
+
|
|
95
|
+
})` Internal Server Error
|
|
96
|
+
*/
|
|
97
|
+
loginByEmail: (data: HandlerRequestAuthEmailLogin, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserLogin, HandlerMap & {
|
|
98
|
+
msg?: string;
|
|
99
|
+
}>>;
|
|
100
|
+
/**
|
|
101
|
+
* @description Register by email and verify code (if user exists, will update user, like forget or change password. Need send email verify code first)
|
|
102
|
+
*
|
|
103
|
+
* @tags Auth
|
|
104
|
+
* @name RegisterByEmail
|
|
105
|
+
* @summary Register by email
|
|
106
|
+
* @request POST:/auth/email/register
|
|
107
|
+
* @response `200` `HandlerResponseUserLogin` OK
|
|
108
|
+
* @response `400` `(HandlerMap & {
|
|
109
|
+
msg?: string,
|
|
110
|
+
|
|
111
|
+
})` Bad Request
|
|
112
|
+
* @response `500` `(HandlerMap & {
|
|
113
|
+
msg?: string,
|
|
114
|
+
|
|
115
|
+
})` Internal Server Error
|
|
116
|
+
*/
|
|
117
|
+
registerByEmail: (data: HandlerRequestAuthEmailRegister, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserLogin, HandlerMap & {
|
|
118
|
+
msg?: string;
|
|
119
|
+
}>>;
|
|
120
|
+
/**
|
|
121
|
+
* @description Send email including verify code to user
|
|
122
|
+
*
|
|
123
|
+
* @tags Auth
|
|
124
|
+
* @name SendVerifyEmail
|
|
125
|
+
* @summary Send verify email
|
|
126
|
+
* @request POST:/auth/email/send
|
|
127
|
+
* @response `200` `(HandlerMap & {
|
|
128
|
+
msg?: string,
|
|
129
|
+
|
|
130
|
+
})` OK
|
|
131
|
+
* @response `400` `(HandlerMap & {
|
|
132
|
+
msg?: string,
|
|
133
|
+
|
|
134
|
+
})` Bad Request
|
|
135
|
+
* @response `500` `(HandlerMap & {
|
|
136
|
+
msg?: string,
|
|
137
|
+
|
|
138
|
+
})` Internal Server Error
|
|
139
|
+
*/
|
|
140
|
+
sendVerifyEmail: (data: HandlerRequestAuthEmailSend, params?: RequestParams) => Promise<HttpResponse<HandlerMap & {
|
|
141
|
+
msg?: string;
|
|
142
|
+
}, HandlerMap & {
|
|
143
|
+
msg?: string;
|
|
144
|
+
}>>;
|
|
145
|
+
/**
|
|
146
|
+
* @description Get all users with same email, if there are more than one user with same email, need merge
|
|
147
|
+
*
|
|
148
|
+
* @tags Auth
|
|
149
|
+
* @name CheckDataMerge
|
|
150
|
+
* @summary Check data merge
|
|
151
|
+
* @request GET:/auth/merge
|
|
152
|
+
* @secure
|
|
153
|
+
* @response `200` `HandlerResponseAuthDataMergeCheck` OK
|
|
154
|
+
* @response `400` `(HandlerMap & {
|
|
155
|
+
msg?: string,
|
|
156
|
+
|
|
157
|
+
})` Bad Request
|
|
158
|
+
* @response `500` `(HandlerMap & {
|
|
159
|
+
msg?: string,
|
|
160
|
+
|
|
161
|
+
})` Internal Server Error
|
|
162
|
+
*/
|
|
163
|
+
checkDataMerge: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseAuthDataMergeCheck, HandlerMap & {
|
|
164
|
+
msg?: string;
|
|
165
|
+
}>>;
|
|
166
|
+
/**
|
|
167
|
+
* @description This function is to solve the problem of multiple users with the same email address, should be called after user login and then check, and perform data merge.
|
|
168
|
+
*
|
|
169
|
+
* @tags Auth
|
|
170
|
+
* @name ApplyDataMerge
|
|
171
|
+
* @summary Apply data merge
|
|
172
|
+
* @request POST:/auth/merge
|
|
173
|
+
* @secure
|
|
174
|
+
* @response `200` `HandlerResponseAuthDataMergeApply` OK
|
|
175
|
+
* @response `400` `(HandlerMap & {
|
|
176
|
+
msg?: string,
|
|
177
|
+
|
|
178
|
+
})` Bad Request
|
|
179
|
+
* @response `500` `(HandlerMap & {
|
|
180
|
+
msg?: string,
|
|
181
|
+
|
|
182
|
+
})` Internal Server Error
|
|
183
|
+
*/
|
|
184
|
+
applyDataMerge: (data: HandlerRequestAuthDataMergeApply, params?: RequestParams) => Promise<HttpResponse<HandlerResponseAuthDataMergeApply, HandlerMap & {
|
|
185
|
+
msg?: string;
|
|
186
|
+
}>>;
|
|
187
|
+
};
|
|
188
|
+
cache: {
|
|
189
|
+
/**
|
|
190
|
+
* @description Flush all cache on the server
|
|
191
|
+
*
|
|
192
|
+
* @tags Cache
|
|
193
|
+
* @name FlushCache
|
|
194
|
+
* @summary Flush Cache
|
|
195
|
+
* @request POST:/cache/flush
|
|
196
|
+
* @secure
|
|
197
|
+
* @response `200` `(HandlerMap & {
|
|
198
|
+
msg?: string,
|
|
199
|
+
|
|
200
|
+
})` OK
|
|
201
|
+
* @response `400` `(HandlerMap & {
|
|
202
|
+
msg?: string,
|
|
203
|
+
|
|
204
|
+
})` Bad Request
|
|
205
|
+
* @response `403` `(HandlerMap & {
|
|
206
|
+
msg?: string,
|
|
207
|
+
|
|
208
|
+
})` Forbidden
|
|
209
|
+
*/
|
|
210
|
+
flushCache: (params?: RequestParams) => Promise<HttpResponse<HandlerMap & {
|
|
211
|
+
msg?: string;
|
|
212
|
+
}, HandlerMap & {
|
|
213
|
+
msg?: string;
|
|
214
|
+
}>>;
|
|
215
|
+
/**
|
|
216
|
+
* @description Cache warming helps you to pre-load the cache to improve the performance of the first request
|
|
217
|
+
*
|
|
218
|
+
* @tags Cache
|
|
219
|
+
* @name WarmUpCache
|
|
220
|
+
* @summary Warm-Up Cache
|
|
221
|
+
* @request POST:/cache/warm_up
|
|
222
|
+
* @secure
|
|
223
|
+
* @response `200` `(HandlerMap & {
|
|
224
|
+
msg?: string,
|
|
225
|
+
|
|
226
|
+
})` OK
|
|
227
|
+
* @response `400` `(HandlerMap & {
|
|
228
|
+
msg?: string,
|
|
229
|
+
|
|
230
|
+
})` Bad Request
|
|
231
|
+
* @response `403` `(HandlerMap & {
|
|
232
|
+
msg?: string,
|
|
233
|
+
|
|
234
|
+
})` Forbidden
|
|
235
|
+
*/
|
|
236
|
+
warmUpCache: (params?: RequestParams) => Promise<HttpResponse<HandlerMap & {
|
|
237
|
+
msg?: string;
|
|
238
|
+
}, HandlerMap & {
|
|
239
|
+
msg?: string;
|
|
240
|
+
}>>;
|
|
241
|
+
};
|
|
242
|
+
captcha: {
|
|
243
|
+
/**
|
|
244
|
+
* @description Get a base64 encoded captcha image or a HTML page to verify for user
|
|
245
|
+
*
|
|
246
|
+
* @tags Captcha
|
|
247
|
+
* @name GetCaptcha
|
|
248
|
+
* @summary Get Captcha
|
|
249
|
+
* @request GET:/captcha
|
|
250
|
+
* @response `200` `HandlerResponseCaptchaGet` OK
|
|
251
|
+
* @response `500` `(HandlerMap & {
|
|
252
|
+
msg?: string,
|
|
253
|
+
|
|
254
|
+
})` Internal Server Error
|
|
255
|
+
*/
|
|
256
|
+
getCaptcha: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseCaptchaGet, HandlerMap & {
|
|
257
|
+
msg?: string;
|
|
258
|
+
}>>;
|
|
259
|
+
/**
|
|
260
|
+
* @description Get the status of the user's captcha verification
|
|
261
|
+
*
|
|
262
|
+
* @tags Captcha
|
|
263
|
+
* @name GetCaptchaStatus
|
|
264
|
+
* @summary Get Captcha Status
|
|
265
|
+
* @request GET:/captcha/status
|
|
266
|
+
* @response `200` `HandlerResponseCaptchaStatus` OK
|
|
267
|
+
*/
|
|
268
|
+
getCaptchaStatus: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseCaptchaStatus, any>>;
|
|
269
|
+
/**
|
|
270
|
+
* @description Verify user enters correct captcha code
|
|
271
|
+
*
|
|
272
|
+
* @tags Captcha
|
|
273
|
+
* @name VerifyCaptcha
|
|
274
|
+
* @summary Verify Captcha
|
|
275
|
+
* @request POST:/captcha/verify
|
|
276
|
+
* @response `200` `HandlerMap` OK
|
|
277
|
+
* @response `403` `(HandlerMap & {
|
|
278
|
+
img_data?: string,
|
|
279
|
+
|
|
280
|
+
})` Forbidden
|
|
281
|
+
*/
|
|
282
|
+
verifyCaptcha: (data: HandlerParamsCaptchaVerify, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
283
|
+
img_data?: string;
|
|
284
|
+
}>>;
|
|
285
|
+
};
|
|
286
|
+
comments: {
|
|
287
|
+
/**
|
|
288
|
+
* @description Get a list of comments by some conditions
|
|
289
|
+
*
|
|
290
|
+
* @tags Comment
|
|
291
|
+
* @name GetComments
|
|
292
|
+
* @summary Get Comment List
|
|
293
|
+
* @request GET:/comments
|
|
294
|
+
* @secure
|
|
295
|
+
* @response `200` `HandlerResponseCommentList` OK
|
|
296
|
+
* @response `500` `(HandlerMap & {
|
|
297
|
+
msg?: string,
|
|
298
|
+
|
|
299
|
+
})` Internal Server Error
|
|
300
|
+
*/
|
|
301
|
+
getComments: (query: {
|
|
302
|
+
/** The user email */
|
|
303
|
+
email?: string;
|
|
304
|
+
/** Enable flat_mode */
|
|
305
|
+
flat_mode?: boolean;
|
|
306
|
+
/** The limit for pagination */
|
|
307
|
+
limit?: number;
|
|
308
|
+
/** The username */
|
|
309
|
+
name?: string;
|
|
310
|
+
/** The offset for pagination */
|
|
311
|
+
offset?: number;
|
|
312
|
+
/** The comment page_key */
|
|
313
|
+
page_key: string;
|
|
314
|
+
/** The scope of comments */
|
|
315
|
+
scope?: "page" | "user" | "site";
|
|
316
|
+
/** Search keywords */
|
|
317
|
+
search?: string;
|
|
318
|
+
/** The site name of your content scope */
|
|
319
|
+
site_name?: string;
|
|
320
|
+
/** Sort by condition */
|
|
321
|
+
sort_by?: "date_asc" | "date_desc" | "vote";
|
|
322
|
+
/** Message center show type */
|
|
323
|
+
type?: "all" | "mentions" | "mine" | "pending";
|
|
324
|
+
/** Only show comments by admin */
|
|
325
|
+
view_only_admin?: boolean;
|
|
326
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentList, HandlerMap & {
|
|
327
|
+
msg?: string;
|
|
328
|
+
}>>;
|
|
329
|
+
/**
|
|
330
|
+
* @description Create a new comment
|
|
331
|
+
*
|
|
332
|
+
* @tags Comment
|
|
333
|
+
* @name CreateComment
|
|
334
|
+
* @summary Create Comment
|
|
335
|
+
* @request POST:/comments
|
|
336
|
+
* @secure
|
|
337
|
+
* @response `200` `HandlerResponseCommentCreate` OK
|
|
338
|
+
* @response `400` `(HandlerMap & {
|
|
339
|
+
msg?: string,
|
|
340
|
+
|
|
341
|
+
})` Bad Request
|
|
342
|
+
* @response `500` `(HandlerMap & {
|
|
343
|
+
msg?: string,
|
|
344
|
+
|
|
345
|
+
})` Internal Server Error
|
|
346
|
+
*/
|
|
347
|
+
createComment: (comment: HandlerParamsCommentCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentCreate, HandlerMap & {
|
|
348
|
+
msg?: string;
|
|
349
|
+
}>>;
|
|
350
|
+
/**
|
|
351
|
+
* @description Get the detail of a comment by comment id
|
|
352
|
+
*
|
|
353
|
+
* @tags Comment
|
|
354
|
+
* @name GetComment
|
|
355
|
+
* @summary Get a comment
|
|
356
|
+
* @request GET:/comments/{id}
|
|
357
|
+
* @response `200` `HandlerResponseCommentGet` OK
|
|
358
|
+
* @response `404` `(HandlerMap & {
|
|
359
|
+
msg?: string,
|
|
360
|
+
|
|
361
|
+
})` Not Found
|
|
362
|
+
* @response `500` `(HandlerMap & {
|
|
363
|
+
msg?: string,
|
|
364
|
+
|
|
365
|
+
})` Internal Server Error
|
|
366
|
+
*/
|
|
367
|
+
getComment: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentGet, HandlerMap & {
|
|
368
|
+
msg?: string;
|
|
369
|
+
}>>;
|
|
370
|
+
/**
|
|
371
|
+
* @description Update a specific comment
|
|
372
|
+
*
|
|
373
|
+
* @tags Comment
|
|
374
|
+
* @name UpdateComment
|
|
375
|
+
* @summary Update Comment
|
|
376
|
+
* @request PUT:/comments/{id}
|
|
377
|
+
* @secure
|
|
378
|
+
* @response `200` `HandlerResponseCommentUpdate` OK
|
|
379
|
+
* @response `400` `(HandlerMap & {
|
|
380
|
+
msg?: string,
|
|
381
|
+
|
|
382
|
+
})` Bad Request
|
|
383
|
+
* @response `403` `(HandlerMap & {
|
|
384
|
+
msg?: string,
|
|
385
|
+
|
|
386
|
+
})` Forbidden
|
|
387
|
+
* @response `404` `(HandlerMap & {
|
|
388
|
+
msg?: string,
|
|
389
|
+
|
|
390
|
+
})` Not Found
|
|
391
|
+
* @response `500` `(HandlerMap & {
|
|
392
|
+
msg?: string,
|
|
393
|
+
|
|
394
|
+
})` Internal Server Error
|
|
395
|
+
*/
|
|
396
|
+
updateComment: (id: number, comment: HandlerParamsCommentUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentUpdate, HandlerMap & {
|
|
397
|
+
msg?: string;
|
|
398
|
+
}>>;
|
|
399
|
+
/**
|
|
400
|
+
* @description Delete a specific comment
|
|
401
|
+
*
|
|
402
|
+
* @tags Comment
|
|
403
|
+
* @name DeleteComment
|
|
404
|
+
* @summary Delete Comment
|
|
405
|
+
* @request DELETE:/comments/{id}
|
|
406
|
+
* @secure
|
|
407
|
+
* @response `200` `HandlerMap` OK
|
|
408
|
+
* @response `403` `(HandlerMap & {
|
|
409
|
+
msg?: string,
|
|
410
|
+
|
|
411
|
+
})` Forbidden
|
|
412
|
+
* @response `404` `(HandlerMap & {
|
|
413
|
+
msg?: string,
|
|
414
|
+
|
|
415
|
+
})` Not Found
|
|
416
|
+
* @response `500` `(HandlerMap & {
|
|
417
|
+
msg?: string,
|
|
418
|
+
|
|
419
|
+
})` Internal Server Error
|
|
420
|
+
*/
|
|
421
|
+
deleteComment: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
422
|
+
msg?: string;
|
|
423
|
+
}>>;
|
|
424
|
+
};
|
|
425
|
+
conf: {
|
|
426
|
+
/**
|
|
427
|
+
* @description Get System Configs for UI
|
|
428
|
+
*
|
|
429
|
+
* @tags System
|
|
430
|
+
* @name Conf
|
|
431
|
+
* @summary Get System Configs
|
|
432
|
+
* @request GET:/conf
|
|
433
|
+
* @response `200` `CommonConfData` OK
|
|
434
|
+
*/
|
|
435
|
+
conf: (params?: RequestParams) => Promise<HttpResponse<CommonConfData, any>>;
|
|
436
|
+
/**
|
|
437
|
+
* @description Get social login providers
|
|
438
|
+
*
|
|
439
|
+
* @tags System
|
|
440
|
+
* @name GetSocialLoginProviders
|
|
441
|
+
* @summary Get Social Login Providers
|
|
442
|
+
* @request GET:/conf/auth/providers
|
|
443
|
+
* @response `200` `HandlerResponseConfAuthProviders` OK
|
|
444
|
+
* @response `404` `(HandlerMap & {
|
|
445
|
+
msg?: string,
|
|
446
|
+
|
|
447
|
+
})` Not Found
|
|
448
|
+
*/
|
|
449
|
+
getSocialLoginProviders: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseConfAuthProviders, HandlerMap & {
|
|
450
|
+
msg?: string;
|
|
451
|
+
}>>;
|
|
452
|
+
/**
|
|
453
|
+
* @description Get Domain Info
|
|
454
|
+
*
|
|
455
|
+
* @tags System
|
|
456
|
+
* @name GetDomain
|
|
457
|
+
* @summary Get Domain Info
|
|
458
|
+
* @request GET:/conf/domain
|
|
459
|
+
* @response `200` `HandlerResponseConfDomain` OK
|
|
460
|
+
*/
|
|
461
|
+
getDomain: (query?: {
|
|
462
|
+
/** Domain URL */
|
|
463
|
+
url?: string;
|
|
464
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseConfDomain, any>>;
|
|
465
|
+
};
|
|
466
|
+
notifies: {
|
|
467
|
+
/**
|
|
468
|
+
* @description Get a list of notifies for user
|
|
469
|
+
*
|
|
470
|
+
* @tags Notify
|
|
471
|
+
* @name GetNotifies
|
|
472
|
+
* @summary Get Notifies
|
|
473
|
+
* @request GET:/notifies
|
|
474
|
+
* @response `200` `HandlerResponseNotifyList` OK
|
|
475
|
+
* @response `400` `(HandlerMap & {
|
|
476
|
+
msg?: string,
|
|
477
|
+
|
|
478
|
+
})` Bad Request
|
|
479
|
+
* @response `500` `(HandlerMap & {
|
|
480
|
+
msg?: string,
|
|
481
|
+
|
|
482
|
+
})` Internal Server Error
|
|
483
|
+
*/
|
|
484
|
+
getNotifies: (query: {
|
|
485
|
+
/** The user email */
|
|
486
|
+
email: string;
|
|
487
|
+
/** The user name */
|
|
488
|
+
name: string;
|
|
489
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseNotifyList, HandlerMap & {
|
|
490
|
+
msg?: string;
|
|
491
|
+
}>>;
|
|
492
|
+
/**
|
|
493
|
+
* @description Mark all notifies as read for user
|
|
494
|
+
*
|
|
495
|
+
* @tags Notify
|
|
496
|
+
* @name MarkAllNotifyRead
|
|
497
|
+
* @summary Mark All Notifies as Read
|
|
498
|
+
* @request POST:/notifies/read
|
|
499
|
+
* @response `200` `HandlerMap` OK
|
|
500
|
+
* @response `400` `(HandlerMap & {
|
|
501
|
+
msg?: string,
|
|
502
|
+
|
|
503
|
+
})` Bad Request
|
|
504
|
+
* @response `500` `(HandlerMap & {
|
|
505
|
+
msg?: string,
|
|
506
|
+
|
|
507
|
+
})` Internal Server Error
|
|
508
|
+
*/
|
|
509
|
+
markAllNotifyRead: (options: HandlerParamsNotifyReadAll, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
510
|
+
msg?: string;
|
|
511
|
+
}>>;
|
|
512
|
+
/**
|
|
513
|
+
* @description Mark specific notification as read for user
|
|
514
|
+
*
|
|
515
|
+
* @tags Notify
|
|
516
|
+
* @name MarkNotifyRead
|
|
517
|
+
* @summary Mark Notify as Read
|
|
518
|
+
* @request POST:/notifies/{comment_id}/{notify_key}
|
|
519
|
+
* @response `200` `HandlerMap` OK
|
|
520
|
+
* @response `400` `(HandlerMap & {
|
|
521
|
+
msg?: string,
|
|
522
|
+
|
|
523
|
+
})` Bad Request
|
|
524
|
+
* @response `404` `(HandlerMap & {
|
|
525
|
+
msg?: string,
|
|
526
|
+
|
|
527
|
+
})` Not Found
|
|
528
|
+
* @response `500` `(HandlerMap & {
|
|
529
|
+
msg?: string,
|
|
530
|
+
|
|
531
|
+
})` Internal Server Error
|
|
532
|
+
*/
|
|
533
|
+
markNotifyRead: (commentId: number, notifyKey: string, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
534
|
+
msg?: string;
|
|
535
|
+
}>>;
|
|
536
|
+
};
|
|
537
|
+
pages: {
|
|
538
|
+
/**
|
|
539
|
+
* @description Get a list of pages by some conditions
|
|
540
|
+
*
|
|
541
|
+
* @tags Page
|
|
542
|
+
* @name GetPages
|
|
543
|
+
* @summary Get Page List
|
|
544
|
+
* @request GET:/pages
|
|
545
|
+
* @secure
|
|
546
|
+
* @response `200` `HandlerResponsePageList` OK
|
|
547
|
+
* @response `403` `(HandlerMap & {
|
|
548
|
+
msg?: string,
|
|
549
|
+
|
|
550
|
+
})` Forbidden
|
|
551
|
+
*/
|
|
552
|
+
getPages: (query?: {
|
|
553
|
+
/** The limit for pagination */
|
|
554
|
+
limit?: number;
|
|
555
|
+
/** The offset for pagination */
|
|
556
|
+
offset?: number;
|
|
557
|
+
/** Search keywords */
|
|
558
|
+
search?: string;
|
|
559
|
+
/** The site name of your content scope */
|
|
560
|
+
site_name?: string;
|
|
561
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageList, HandlerMap & {
|
|
562
|
+
msg?: string;
|
|
563
|
+
}>>;
|
|
564
|
+
/**
|
|
565
|
+
* @description Fetch the data of all pages
|
|
566
|
+
*
|
|
567
|
+
* @tags Page
|
|
568
|
+
* @name FetchAllPages
|
|
569
|
+
* @summary Fetch All Pages Data
|
|
570
|
+
* @request POST:/pages/fetch
|
|
571
|
+
* @secure
|
|
572
|
+
* @response `200` `HandlerMap` OK
|
|
573
|
+
* @response `400` `(HandlerMap & {
|
|
574
|
+
msg?: string,
|
|
575
|
+
|
|
576
|
+
})` Bad Request
|
|
577
|
+
* @response `500` `(HandlerMap & {
|
|
578
|
+
msg?: string,
|
|
579
|
+
|
|
580
|
+
})` Internal Server Error
|
|
581
|
+
*/
|
|
582
|
+
fetchAllPages: (options: HandlerParamsPageFetchAll, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
583
|
+
msg?: string;
|
|
584
|
+
}>>;
|
|
585
|
+
/**
|
|
586
|
+
* @description Get the status of the task of fetching all pages
|
|
587
|
+
*
|
|
588
|
+
* @tags Page
|
|
589
|
+
* @name GetPageFetchStatus
|
|
590
|
+
* @summary Get Pages Fetch Status
|
|
591
|
+
* @request GET:/pages/fetch/status
|
|
592
|
+
* @secure
|
|
593
|
+
* @response `200` `HandlerResponsePageFetchStatus` OK
|
|
594
|
+
*/
|
|
595
|
+
getPageFetchStatus: (params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageFetchStatus, any>>;
|
|
596
|
+
/**
|
|
597
|
+
* @description Increase and get the number of page views
|
|
598
|
+
*
|
|
599
|
+
* @tags Page
|
|
600
|
+
* @name LogPv
|
|
601
|
+
* @summary Increase Page Views (PV)
|
|
602
|
+
* @request POST:/pages/pv
|
|
603
|
+
* @response `200` `HandlerResponsePagePV` OK
|
|
604
|
+
*/
|
|
605
|
+
logPv: (page: HandlerParamsPagePV, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePagePV, any>>;
|
|
606
|
+
/**
|
|
607
|
+
* @description Update a specific page
|
|
608
|
+
*
|
|
609
|
+
* @tags Page
|
|
610
|
+
* @name UpdatePage
|
|
611
|
+
* @summary Update Page
|
|
612
|
+
* @request PUT:/pages/{id}
|
|
613
|
+
* @secure
|
|
614
|
+
* @response `200` `HandlerResponsePageUpdate` OK
|
|
615
|
+
* @response `400` `(HandlerMap & {
|
|
616
|
+
msg?: string,
|
|
617
|
+
|
|
618
|
+
})` Bad Request
|
|
619
|
+
* @response `403` `(HandlerMap & {
|
|
620
|
+
msg?: string,
|
|
621
|
+
|
|
622
|
+
})` Forbidden
|
|
623
|
+
* @response `404` `(HandlerMap & {
|
|
624
|
+
msg?: string,
|
|
625
|
+
|
|
626
|
+
})` Not Found
|
|
627
|
+
* @response `500` `(HandlerMap & {
|
|
628
|
+
msg?: string,
|
|
629
|
+
|
|
630
|
+
})` Internal Server Error
|
|
631
|
+
*/
|
|
632
|
+
updatePage: (id: number, page: HandlerParamsPageUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageUpdate, HandlerMap & {
|
|
633
|
+
msg?: string;
|
|
634
|
+
}>>;
|
|
635
|
+
/**
|
|
636
|
+
* @description Delete a specific page
|
|
637
|
+
*
|
|
638
|
+
* @tags Page
|
|
639
|
+
* @name DeletePage
|
|
640
|
+
* @summary Delete Page
|
|
641
|
+
* @request DELETE:/pages/{id}
|
|
642
|
+
* @secure
|
|
643
|
+
* @response `200` `HandlerMap` OK
|
|
644
|
+
* @response `403` `(HandlerMap & {
|
|
645
|
+
msg?: string,
|
|
646
|
+
|
|
647
|
+
})` Forbidden
|
|
648
|
+
* @response `404` `(HandlerMap & {
|
|
649
|
+
msg?: string,
|
|
650
|
+
|
|
651
|
+
})` Not Found
|
|
652
|
+
* @response `500` `(HandlerMap & {
|
|
653
|
+
msg?: string,
|
|
654
|
+
|
|
655
|
+
})` Internal Server Error
|
|
656
|
+
*/
|
|
657
|
+
deletePage: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
658
|
+
msg?: string;
|
|
659
|
+
}>>;
|
|
660
|
+
/**
|
|
661
|
+
* @description Fetch the data of a specific page
|
|
662
|
+
*
|
|
663
|
+
* @tags Page
|
|
664
|
+
* @name FetchPage
|
|
665
|
+
* @summary Fetch Page Data
|
|
666
|
+
* @request POST:/pages/{id}/fetch
|
|
667
|
+
* @secure
|
|
668
|
+
* @response `200` `HandlerResponsePageFetch` OK
|
|
669
|
+
* @response `404` `(HandlerMap & {
|
|
670
|
+
msg?: string,
|
|
671
|
+
|
|
672
|
+
})` Not Found
|
|
673
|
+
* @response `500` `(HandlerMap & {
|
|
674
|
+
msg?: string,
|
|
675
|
+
|
|
676
|
+
})` Internal Server Error
|
|
677
|
+
*/
|
|
678
|
+
fetchPage: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageFetch, HandlerMap & {
|
|
679
|
+
msg?: string;
|
|
680
|
+
}>>;
|
|
681
|
+
};
|
|
682
|
+
sendEmail: {
|
|
683
|
+
/**
|
|
684
|
+
* @description Send an email to test the email sender
|
|
685
|
+
*
|
|
686
|
+
* @tags System
|
|
687
|
+
* @name SendEmail
|
|
688
|
+
* @summary Send Email
|
|
689
|
+
* @request POST:/send_email
|
|
690
|
+
* @secure
|
|
691
|
+
* @response `200` `HandlerMap` OK
|
|
692
|
+
* @response `403` `(HandlerMap & {
|
|
693
|
+
msg?: string,
|
|
694
|
+
|
|
695
|
+
})` Forbidden
|
|
696
|
+
* @response `500` `HandlerMap` Internal Server Error
|
|
697
|
+
*/
|
|
698
|
+
sendEmail: (email: HandlerParamsEmailSend, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap | (HandlerMap & {
|
|
699
|
+
msg?: string;
|
|
700
|
+
})>>;
|
|
701
|
+
};
|
|
702
|
+
settings: {
|
|
703
|
+
/**
|
|
704
|
+
* @description Get settings from app config file
|
|
705
|
+
*
|
|
706
|
+
* @tags System
|
|
707
|
+
* @name GetSettings
|
|
708
|
+
* @summary Get Settings
|
|
709
|
+
* @request GET:/settings
|
|
710
|
+
* @secure
|
|
711
|
+
* @response `200` `HandlerResponseSettingGet` OK
|
|
712
|
+
* @response `403` `(HandlerMap & {
|
|
713
|
+
msg?: string,
|
|
714
|
+
|
|
715
|
+
})` Forbidden
|
|
716
|
+
* @response `500` `(HandlerMap & {
|
|
717
|
+
msg?: string,
|
|
718
|
+
|
|
719
|
+
})` Internal Server Error
|
|
720
|
+
*/
|
|
721
|
+
getSettings: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseSettingGet, HandlerMap & {
|
|
722
|
+
msg?: string;
|
|
723
|
+
}>>;
|
|
724
|
+
/**
|
|
725
|
+
* @description Apply settings and restart the server
|
|
726
|
+
*
|
|
727
|
+
* @tags System
|
|
728
|
+
* @name ApplySettings
|
|
729
|
+
* @summary Save and apply Settings
|
|
730
|
+
* @request PUT:/settings
|
|
731
|
+
* @secure
|
|
732
|
+
* @response `200` `HandlerMap` OK
|
|
733
|
+
* @response `403` `(HandlerMap & {
|
|
734
|
+
msg?: string,
|
|
735
|
+
|
|
736
|
+
})` Forbidden
|
|
737
|
+
* @response `500` `(HandlerMap & {
|
|
738
|
+
msg?: string,
|
|
739
|
+
|
|
740
|
+
})` Internal Server Error
|
|
741
|
+
*/
|
|
742
|
+
applySettings: (settings: HandlerParamsSettingApply, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
743
|
+
msg?: string;
|
|
744
|
+
}>>;
|
|
745
|
+
/**
|
|
746
|
+
* @description Get config templates in different languages for rendering the settings page in the frontend
|
|
747
|
+
*
|
|
748
|
+
* @tags System
|
|
749
|
+
* @name GetSettingsTemplate
|
|
750
|
+
* @summary Get Settings Template
|
|
751
|
+
* @request GET:/settings/template/{locale}
|
|
752
|
+
* @secure
|
|
753
|
+
* @response `200` `HandlerResponseSettingTemplate` OK
|
|
754
|
+
*/
|
|
755
|
+
getSettingsTemplate: (locale: string, params?: RequestParams) => Promise<HttpResponse<HandlerResponseSettingTemplate, any>>;
|
|
756
|
+
};
|
|
757
|
+
sites: {
|
|
758
|
+
/**
|
|
759
|
+
* @description Get a list of sites by some conditions
|
|
760
|
+
*
|
|
761
|
+
* @tags Site
|
|
762
|
+
* @name GetSites
|
|
763
|
+
* @summary Get Site List
|
|
764
|
+
* @request GET:/sites
|
|
765
|
+
* @secure
|
|
766
|
+
* @response `200` `HandlerResponseSiteList` OK
|
|
767
|
+
*/
|
|
768
|
+
getSites: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseSiteList, any>>;
|
|
769
|
+
/**
|
|
770
|
+
* @description Create a new site
|
|
771
|
+
*
|
|
772
|
+
* @tags Site
|
|
773
|
+
* @name CreateSite
|
|
774
|
+
* @summary Create Site
|
|
775
|
+
* @request POST:/sites
|
|
776
|
+
* @secure
|
|
777
|
+
* @response `200` `HandlerResponseSiteCreate` OK
|
|
778
|
+
* @response `400` `(HandlerMap & {
|
|
779
|
+
msg?: string,
|
|
780
|
+
|
|
781
|
+
})` Bad Request
|
|
782
|
+
* @response `403` `(HandlerMap & {
|
|
783
|
+
msg?: string,
|
|
784
|
+
|
|
785
|
+
})` Forbidden
|
|
786
|
+
* @response `500` `(HandlerMap & {
|
|
787
|
+
msg?: string,
|
|
788
|
+
|
|
789
|
+
})` Internal Server Error
|
|
790
|
+
*/
|
|
791
|
+
createSite: (site: HandlerParamsSiteCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseSiteCreate, HandlerMap & {
|
|
792
|
+
msg?: string;
|
|
793
|
+
}>>;
|
|
794
|
+
/**
|
|
795
|
+
* @description Update a specific site
|
|
796
|
+
*
|
|
797
|
+
* @tags Site
|
|
798
|
+
* @name UpdateSite
|
|
799
|
+
* @summary Update Site
|
|
800
|
+
* @request PUT:/sites/{id}
|
|
801
|
+
* @secure
|
|
802
|
+
* @response `200` `HandlerResponseSiteUpdate` OK
|
|
803
|
+
*/
|
|
804
|
+
updateSite: (id: number, site: HandlerParamsSiteUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseSiteUpdate, any>>;
|
|
805
|
+
/**
|
|
806
|
+
* @description Delete a specific site
|
|
807
|
+
*
|
|
808
|
+
* @tags Site
|
|
809
|
+
* @name DeleteSite
|
|
810
|
+
* @summary Site Delete
|
|
811
|
+
* @request DELETE:/sites/{id}
|
|
812
|
+
* @secure
|
|
813
|
+
* @response `200` `HandlerMap` OK
|
|
814
|
+
* @response `403` `(HandlerMap & {
|
|
815
|
+
msg?: string,
|
|
816
|
+
|
|
817
|
+
})` Forbidden
|
|
818
|
+
* @response `404` `(HandlerMap & {
|
|
819
|
+
msg?: string,
|
|
820
|
+
|
|
821
|
+
})` Not Found
|
|
822
|
+
* @response `500` `(HandlerMap & {
|
|
823
|
+
msg?: string,
|
|
824
|
+
|
|
825
|
+
})` Internal Server Error
|
|
826
|
+
*/
|
|
827
|
+
deleteSite: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
828
|
+
msg?: string;
|
|
829
|
+
}>>;
|
|
830
|
+
};
|
|
831
|
+
stats: {
|
|
832
|
+
/**
|
|
833
|
+
* @description Get the statistics of various data analysis
|
|
834
|
+
*
|
|
835
|
+
* @tags Statistic
|
|
836
|
+
* @name GetStats
|
|
837
|
+
* @summary Statistic
|
|
838
|
+
* @request GET:/stats/{type}
|
|
839
|
+
* @response `200` `CommonJSONResult` OK
|
|
840
|
+
* @response `400` `(HandlerMap & {
|
|
841
|
+
msg?: string,
|
|
842
|
+
|
|
843
|
+
})` Bad Request
|
|
844
|
+
* @response `403` `(HandlerMap & {
|
|
845
|
+
msg?: string,
|
|
846
|
+
|
|
847
|
+
})` Forbidden
|
|
848
|
+
* @response `404` `(HandlerMap & {
|
|
849
|
+
msg?: string,
|
|
850
|
+
|
|
851
|
+
})` Not Found
|
|
852
|
+
* @response `500` `(HandlerMap & {
|
|
853
|
+
msg?: string,
|
|
854
|
+
|
|
855
|
+
})` Internal Server Error
|
|
856
|
+
*/
|
|
857
|
+
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?: {
|
|
858
|
+
/** The limit for pagination */
|
|
859
|
+
limit?: number;
|
|
860
|
+
/** multiple page keys separated by commas */
|
|
861
|
+
page_keys?: string;
|
|
862
|
+
/** The site name of your content scope */
|
|
863
|
+
site_name?: string;
|
|
864
|
+
}, params?: RequestParams) => Promise<HttpResponse<CommonJSONResult, HandlerMap & {
|
|
865
|
+
msg?: string;
|
|
866
|
+
}>>;
|
|
867
|
+
};
|
|
868
|
+
transfer: {
|
|
869
|
+
/**
|
|
870
|
+
* @description Export data from Artalk
|
|
871
|
+
*
|
|
872
|
+
* @tags Transfer
|
|
873
|
+
* @name ExportArtrans
|
|
874
|
+
* @summary Export Artrans
|
|
875
|
+
* @request GET:/transfer/export
|
|
876
|
+
* @secure
|
|
877
|
+
* @response `200` `HandlerResponseTransferExport` OK
|
|
878
|
+
* @response `500` `(HandlerMap & {
|
|
879
|
+
msg?: string,
|
|
880
|
+
|
|
881
|
+
})` Internal Server Error
|
|
882
|
+
*/
|
|
883
|
+
exportArtrans: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseTransferExport, HandlerMap & {
|
|
884
|
+
msg?: string;
|
|
885
|
+
}>>;
|
|
886
|
+
/**
|
|
887
|
+
* @description Import data to Artalk
|
|
888
|
+
*
|
|
889
|
+
* @tags Transfer
|
|
890
|
+
* @name ImportArtrans
|
|
891
|
+
* @summary Import Artrans
|
|
892
|
+
* @request POST:/transfer/import
|
|
893
|
+
* @secure
|
|
894
|
+
* @response `200` `string` OK
|
|
895
|
+
*/
|
|
896
|
+
importArtrans: (data: HandlerParamsTransferImport, params?: RequestParams) => Promise<HttpResponse<string, any>>;
|
|
897
|
+
/**
|
|
898
|
+
* @description Upload a file to prepare to import
|
|
899
|
+
*
|
|
900
|
+
* @tags Transfer
|
|
901
|
+
* @name UploadArtrans
|
|
902
|
+
* @summary Upload Artrans
|
|
903
|
+
* @request POST:/transfer/upload
|
|
904
|
+
* @secure
|
|
905
|
+
* @response `200` `(HandlerResponseTransferUpload & {
|
|
906
|
+
filename?: string,
|
|
907
|
+
|
|
908
|
+
})` OK
|
|
909
|
+
* @response `500` `(HandlerMap & {
|
|
910
|
+
msg?: string,
|
|
911
|
+
|
|
912
|
+
})` Internal Server Error
|
|
913
|
+
*/
|
|
914
|
+
uploadArtrans: (data: {
|
|
915
|
+
/**
|
|
916
|
+
* Upload file in preparation for import task
|
|
917
|
+
* @format binary
|
|
918
|
+
*/
|
|
919
|
+
file: File;
|
|
920
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseTransferUpload & {
|
|
921
|
+
filename?: string;
|
|
922
|
+
}, HandlerMap & {
|
|
923
|
+
msg?: string;
|
|
924
|
+
}>>;
|
|
925
|
+
};
|
|
926
|
+
upload: {
|
|
927
|
+
/**
|
|
928
|
+
* @description Upload file from this endpoint
|
|
929
|
+
*
|
|
930
|
+
* @tags Upload
|
|
931
|
+
* @name Upload
|
|
932
|
+
* @summary Upload
|
|
933
|
+
* @request POST:/upload
|
|
934
|
+
* @secure
|
|
935
|
+
* @response `200` `HandlerResponseUpload` OK
|
|
936
|
+
* @response `400` `(HandlerMap & {
|
|
937
|
+
msg?: string,
|
|
938
|
+
|
|
939
|
+
})` Bad Request
|
|
940
|
+
* @response `403` `(HandlerMap & {
|
|
941
|
+
msg?: string,
|
|
942
|
+
|
|
943
|
+
})` Forbidden
|
|
944
|
+
* @response `500` `(HandlerMap & {
|
|
945
|
+
msg?: string,
|
|
946
|
+
|
|
947
|
+
})` Internal Server Error
|
|
948
|
+
*/
|
|
949
|
+
upload: (data: {
|
|
950
|
+
/**
|
|
951
|
+
* Upload file
|
|
952
|
+
* @format binary
|
|
953
|
+
*/
|
|
954
|
+
file: File;
|
|
955
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUpload, HandlerMap & {
|
|
956
|
+
msg?: string;
|
|
957
|
+
}>>;
|
|
958
|
+
};
|
|
959
|
+
user: {
|
|
960
|
+
/**
|
|
961
|
+
* @description Get user info to prepare for login or check current user status
|
|
962
|
+
*
|
|
963
|
+
* @tags Auth
|
|
964
|
+
* @name GetUser
|
|
965
|
+
* @summary Get User Info
|
|
966
|
+
* @request GET:/user
|
|
967
|
+
* @secure
|
|
968
|
+
* @response `200` `HandlerResponseUserInfo` OK
|
|
969
|
+
* @response `400` `(HandlerMap & {
|
|
970
|
+
msg?: string,
|
|
971
|
+
|
|
972
|
+
})` Bad Request
|
|
973
|
+
*/
|
|
974
|
+
getUser: (query?: {
|
|
975
|
+
/** The user email */
|
|
976
|
+
email?: string;
|
|
977
|
+
/** The username */
|
|
978
|
+
name?: string;
|
|
979
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserInfo, HandlerMap & {
|
|
980
|
+
msg?: string;
|
|
981
|
+
}>>;
|
|
982
|
+
/**
|
|
983
|
+
* @description Update user profile when user is logged in
|
|
984
|
+
*
|
|
985
|
+
* @tags Auth
|
|
986
|
+
* @name UpdateProfile
|
|
987
|
+
* @summary Update user profile
|
|
988
|
+
* @request POST:/user
|
|
989
|
+
* @secure
|
|
990
|
+
* @response `200` `HandlerResponseUserInfoUpdate` OK
|
|
991
|
+
* @response `400` `(HandlerMap & {
|
|
992
|
+
msg?: string,
|
|
993
|
+
|
|
994
|
+
})` Bad Request
|
|
995
|
+
* @response `500` `(HandlerMap & {
|
|
996
|
+
msg?: string,
|
|
997
|
+
|
|
998
|
+
})` Internal Server Error
|
|
999
|
+
*/
|
|
1000
|
+
updateProfile: (data: HandlerRequestUserInfoUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserInfoUpdate, HandlerMap & {
|
|
1001
|
+
msg?: string;
|
|
1002
|
+
}>>;
|
|
1003
|
+
/**
|
|
1004
|
+
* @description Login user by name or email
|
|
1005
|
+
*
|
|
1006
|
+
* @tags Auth
|
|
1007
|
+
* @name Login
|
|
1008
|
+
* @summary Get Access Token
|
|
1009
|
+
* @request POST:/user/access_token
|
|
1010
|
+
* @response `200` `HandlerResponseUserLogin` OK
|
|
1011
|
+
* @response `400` `(HandlerMap & {
|
|
1012
|
+
data?: {
|
|
1013
|
+
need_name_select?: (string)[],
|
|
1014
|
+
|
|
1015
|
+
},
|
|
1016
|
+
msg?: string,
|
|
1017
|
+
|
|
1018
|
+
})` Multiple users with the same email address are matched
|
|
1019
|
+
* @response `401` `(HandlerMap & {
|
|
1020
|
+
msg?: string,
|
|
1021
|
+
|
|
1022
|
+
})` Unauthorized
|
|
1023
|
+
* @response `500` `(HandlerMap & {
|
|
1024
|
+
msg?: string,
|
|
1025
|
+
|
|
1026
|
+
})` Internal Server Error
|
|
1027
|
+
*/
|
|
1028
|
+
login: (user: HandlerParamsUserLogin, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserLogin, (HandlerMap & {
|
|
1029
|
+
data?: {
|
|
1030
|
+
need_name_select?: string[];
|
|
1031
|
+
};
|
|
1032
|
+
msg?: string;
|
|
1033
|
+
}) | (HandlerMap & {
|
|
1034
|
+
msg?: string;
|
|
1035
|
+
})>>;
|
|
1036
|
+
/**
|
|
1037
|
+
* @description Get user login status by header Authorization
|
|
1038
|
+
*
|
|
1039
|
+
* @tags Auth
|
|
1040
|
+
* @name GetUserStatus
|
|
1041
|
+
* @summary Get Login Status
|
|
1042
|
+
* @request GET:/user/status
|
|
1043
|
+
* @secure
|
|
1044
|
+
* @response `200` `HandlerResponseUserStatus` OK
|
|
1045
|
+
*/
|
|
1046
|
+
getUserStatus: (query?: {
|
|
1047
|
+
/** The user email */
|
|
1048
|
+
email?: string;
|
|
1049
|
+
/** The username */
|
|
1050
|
+
name?: string;
|
|
1051
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserStatus, any>>;
|
|
1052
|
+
};
|
|
1053
|
+
users: {
|
|
1054
|
+
/**
|
|
1055
|
+
* @description Create a new user
|
|
1056
|
+
*
|
|
1057
|
+
* @tags User
|
|
1058
|
+
* @name CreateUser
|
|
1059
|
+
* @summary Create User
|
|
1060
|
+
* @request POST:/users
|
|
1061
|
+
* @secure
|
|
1062
|
+
* @response `200` `HandlerResponseUserCreate` OK
|
|
1063
|
+
* @response `400` `(HandlerMap & {
|
|
1064
|
+
msg?: string,
|
|
1065
|
+
|
|
1066
|
+
})` Bad Request
|
|
1067
|
+
* @response `403` `(HandlerMap & {
|
|
1068
|
+
msg?: string,
|
|
1069
|
+
|
|
1070
|
+
})` Forbidden
|
|
1071
|
+
* @response `500` `(HandlerMap & {
|
|
1072
|
+
msg?: string,
|
|
1073
|
+
|
|
1074
|
+
})` Internal Server Error
|
|
1075
|
+
*/
|
|
1076
|
+
createUser: (user: HandlerParamsUserCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserCreate, HandlerMap & {
|
|
1077
|
+
msg?: string;
|
|
1078
|
+
}>>;
|
|
1079
|
+
/**
|
|
1080
|
+
* @description Update a specific user
|
|
1081
|
+
*
|
|
1082
|
+
* @tags User
|
|
1083
|
+
* @name UpdateUser
|
|
1084
|
+
* @summary Update User
|
|
1085
|
+
* @request PUT:/users/{id}
|
|
1086
|
+
* @secure
|
|
1087
|
+
* @response `200` `HandlerResponseUserUpdate` OK
|
|
1088
|
+
* @response `400` `(HandlerMap & {
|
|
1089
|
+
msg?: string,
|
|
1090
|
+
|
|
1091
|
+
})` Bad Request
|
|
1092
|
+
* @response `403` `(HandlerMap & {
|
|
1093
|
+
msg?: string,
|
|
1094
|
+
|
|
1095
|
+
})` Forbidden
|
|
1096
|
+
* @response `404` `(HandlerMap & {
|
|
1097
|
+
msg?: string,
|
|
1098
|
+
|
|
1099
|
+
})` Not Found
|
|
1100
|
+
* @response `500` `(HandlerMap & {
|
|
1101
|
+
msg?: string,
|
|
1102
|
+
|
|
1103
|
+
})` Internal Server Error
|
|
1104
|
+
*/
|
|
1105
|
+
updateUser: (id: number, user: HandlerParamsUserUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserUpdate, HandlerMap & {
|
|
1106
|
+
msg?: string;
|
|
1107
|
+
}>>;
|
|
1108
|
+
/**
|
|
1109
|
+
* @description Delete a specific user
|
|
1110
|
+
*
|
|
1111
|
+
* @tags User
|
|
1112
|
+
* @name DeleteUser
|
|
1113
|
+
* @summary Delete User
|
|
1114
|
+
* @request DELETE:/users/{id}
|
|
1115
|
+
* @secure
|
|
1116
|
+
* @response `200` `HandlerMap` OK
|
|
1117
|
+
* @response `403` `(HandlerMap & {
|
|
1118
|
+
msg?: string,
|
|
1119
|
+
|
|
1120
|
+
})` Forbidden
|
|
1121
|
+
* @response `404` `(HandlerMap & {
|
|
1122
|
+
msg?: string,
|
|
1123
|
+
|
|
1124
|
+
})` Not Found
|
|
1125
|
+
* @response `500` `(HandlerMap & {
|
|
1126
|
+
msg?: string,
|
|
1127
|
+
|
|
1128
|
+
})` Internal Server Error
|
|
1129
|
+
*/
|
|
1130
|
+
deleteUser: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
1131
|
+
msg?: string;
|
|
1132
|
+
}>>;
|
|
1133
|
+
/**
|
|
1134
|
+
* @description Get a list of users by some conditions
|
|
1135
|
+
*
|
|
1136
|
+
* @tags User
|
|
1137
|
+
* @name GetUsers
|
|
1138
|
+
* @summary Get User List
|
|
1139
|
+
* @request GET:/users/{type}
|
|
1140
|
+
* @secure
|
|
1141
|
+
* @response `200` `HandlerResponseAdminUserList` OK
|
|
1142
|
+
* @response `403` `(HandlerMap & {
|
|
1143
|
+
msg?: string,
|
|
1144
|
+
|
|
1145
|
+
})` Forbidden
|
|
1146
|
+
*/
|
|
1147
|
+
getUsers: (type?: "all" | "admin" | "in_conf", query?: {
|
|
1148
|
+
/** The limit for pagination */
|
|
1149
|
+
limit?: number;
|
|
1150
|
+
/** The offset for pagination */
|
|
1151
|
+
offset?: number;
|
|
1152
|
+
/** Search keywords */
|
|
1153
|
+
search?: string;
|
|
1154
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseAdminUserList, HandlerMap & {
|
|
1155
|
+
msg?: string;
|
|
1156
|
+
}>>;
|
|
1157
|
+
};
|
|
1158
|
+
version: {
|
|
1159
|
+
/**
|
|
1160
|
+
* @description Get the version of Artalk
|
|
1161
|
+
*
|
|
1162
|
+
* @tags System
|
|
1163
|
+
* @name GetVersion
|
|
1164
|
+
* @summary Get Version Info
|
|
1165
|
+
* @request GET:/version
|
|
1166
|
+
* @response `200` `CommonApiVersionData` OK
|
|
1167
|
+
*/
|
|
1168
|
+
getVersion: (params?: RequestParams) => Promise<HttpResponse<CommonApiVersionData, any>>;
|
|
1169
|
+
};
|
|
1170
|
+
votes: {
|
|
1171
|
+
/**
|
|
1172
|
+
* @description Sync the number of votes in the `comments` or `pages` data tables to keep them the same as the `votes` table
|
|
1173
|
+
*
|
|
1174
|
+
* @tags Vote
|
|
1175
|
+
* @name SyncVotes
|
|
1176
|
+
* @summary Sync Vote Data
|
|
1177
|
+
* @request POST:/votes/sync
|
|
1178
|
+
* @secure
|
|
1179
|
+
* @response `200` `HandlerMap` OK
|
|
1180
|
+
* @response `403` `(HandlerMap & {
|
|
1181
|
+
msg?: string,
|
|
1182
|
+
|
|
1183
|
+
})` Forbidden
|
|
1184
|
+
*/
|
|
1185
|
+
syncVotes: (params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
1186
|
+
msg?: string;
|
|
1187
|
+
}>>;
|
|
1188
|
+
/**
|
|
1189
|
+
* @description Get vote status for a specific comment or page
|
|
1190
|
+
*
|
|
1191
|
+
* @tags Vote
|
|
1192
|
+
* @name GetVote
|
|
1193
|
+
* @summary Get Vote Status
|
|
1194
|
+
* @request GET:/votes/{target_name}/{target_id}
|
|
1195
|
+
* @response `200` `HandlerResponseVote` OK
|
|
1196
|
+
* @response `403` `(HandlerMap & {
|
|
1197
|
+
msg?: string,
|
|
1198
|
+
|
|
1199
|
+
})` Forbidden
|
|
1200
|
+
* @response `404` `(HandlerMap & {
|
|
1201
|
+
msg?: string,
|
|
1202
|
+
|
|
1203
|
+
})` Not Found
|
|
1204
|
+
* @response `500` `(HandlerMap & {
|
|
1205
|
+
msg?: string,
|
|
1206
|
+
|
|
1207
|
+
})` Internal Server Error
|
|
1208
|
+
*/
|
|
1209
|
+
getVote: (targetName: "comment" | "page", targetId: number, params?: RequestParams) => Promise<HttpResponse<HandlerResponseVote, HandlerMap & {
|
|
1210
|
+
msg?: string;
|
|
1211
|
+
}>>;
|
|
1212
|
+
/**
|
|
1213
|
+
* @description Create a new vote for a specific comment or page
|
|
1214
|
+
*
|
|
1215
|
+
* @tags Vote
|
|
1216
|
+
* @name CreateVote
|
|
1217
|
+
* @summary Create Vote
|
|
1218
|
+
* @request POST:/votes/{target_name}/{target_id}/{choice}
|
|
1219
|
+
* @response `200` `HandlerResponseVote` OK
|
|
1220
|
+
* @response `403` `(HandlerMap & {
|
|
1221
|
+
msg?: string,
|
|
1222
|
+
|
|
1223
|
+
})` Forbidden
|
|
1224
|
+
* @response `404` `(HandlerMap & {
|
|
1225
|
+
msg?: string,
|
|
1226
|
+
|
|
1227
|
+
})` Not Found
|
|
1228
|
+
* @response `500` `(HandlerMap & {
|
|
1229
|
+
msg?: string,
|
|
1230
|
+
|
|
1231
|
+
})` Internal Server Error
|
|
1232
|
+
*/
|
|
1233
|
+
createVote: (targetName: "comment" | "page", targetId: number, choice: "up" | "down", vote: HandlerParamsVoteCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseVote, HandlerMap & {
|
|
1234
|
+
msg?: string;
|
|
1235
|
+
}>>;
|
|
1236
|
+
};
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
declare interface ApiConfig<SecurityDataType = unknown> {
|
|
1240
|
+
baseUrl?: string;
|
|
1241
|
+
baseApiParams?: Omit<RequestParams, 'baseUrl' | 'cancelToken' | 'signal'>;
|
|
1242
|
+
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
|
|
1243
|
+
customFetch?: typeof fetch;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
declare interface ApiHandler<T extends PayloadKey = PayloadKey> {
|
|
1247
|
+
action: T;
|
|
1248
|
+
handler: (data: ApiHandlerPayload[T]) => Promise<void>;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
declare interface ApiHandlerPayload {
|
|
1252
|
+
need_captcha: {
|
|
1253
|
+
img_data?: string;
|
|
1254
|
+
iframe?: string;
|
|
1255
|
+
};
|
|
1256
|
+
need_login: object;
|
|
1257
|
+
need_auth_login: object;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
export declare interface ApiHandlers {
|
|
1261
|
+
add: <T extends PayloadKey>(action: T, handler: (data: ApiHandlerPayload[T]) => Promise<void>) => void;
|
|
1262
|
+
remove: (action: PayloadKey) => void;
|
|
1263
|
+
get: () => ApiHandler[];
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
declare interface ApiOptions {
|
|
1267
|
+
baseURL: string;
|
|
1268
|
+
siteName: string;
|
|
1269
|
+
pageKey: string;
|
|
1270
|
+
pageTitle: string;
|
|
1271
|
+
timeout?: number;
|
|
1272
|
+
getApiToken?: () => string | undefined;
|
|
1273
|
+
userInfo?: {
|
|
1274
|
+
name: string;
|
|
1275
|
+
email: string;
|
|
1276
|
+
};
|
|
1277
|
+
handlers?: ApiHandlers;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
export declare interface ApiVersionData {
|
|
1281
|
+
/** API 程序名 */
|
|
1282
|
+
app: string;
|
|
1283
|
+
/** API 程序版本号 */
|
|
1284
|
+
version: string;
|
|
1285
|
+
/** API 程序 CommitHash */
|
|
1286
|
+
commit_hash: string;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
/**
|
|
1290
|
+
* Artalk
|
|
1291
|
+
*
|
|
1292
|
+
* @see https://artalk.js.org
|
|
1293
|
+
*/
|
|
1294
|
+
declare class Artalk {
|
|
1295
|
+
ctx: Context;
|
|
1296
|
+
constructor(conf: ConfigPartial);
|
|
1297
|
+
/** Get the config of Artalk */
|
|
1298
|
+
getConf(): Config;
|
|
1299
|
+
/** Get the root element of Artalk */
|
|
1300
|
+
getEl(): HTMLElement;
|
|
1301
|
+
/** Update config of Artalk */
|
|
1302
|
+
update(conf: ConfigPartial): void;
|
|
1303
|
+
/** Reload comment list of Artalk */
|
|
1304
|
+
reload(): void;
|
|
1305
|
+
/** Destroy instance of Artalk */
|
|
1306
|
+
destroy(): void;
|
|
1307
|
+
/** Add an event listener */
|
|
1308
|
+
on<K extends keyof EventPayloadMap>(name: K, handler: EventHandler<EventPayloadMap[K]>): void;
|
|
1309
|
+
/** Remove an event listener */
|
|
1310
|
+
off<K extends keyof EventPayloadMap>(name: K, handler: EventHandler<EventPayloadMap[K]>): void;
|
|
1311
|
+
/** Trigger an event */
|
|
1312
|
+
trigger<K extends keyof EventPayloadMap>(name: K, payload?: EventPayloadMap[K]): void;
|
|
1313
|
+
/** Set dark mode */
|
|
1314
|
+
setDarkMode(darkMode: boolean): void;
|
|
1315
|
+
/** Init Artalk */
|
|
1316
|
+
static init(conf: ConfigPartial): Artalk;
|
|
1317
|
+
/** Use plugin, the plugin will be used when Artalk.init */
|
|
1318
|
+
static use<T = any>(plugin: ArtalkPlugin<T>, options?: T): void;
|
|
1319
|
+
/** Load count widget */
|
|
1320
|
+
static loadCountWidget(c: ConfigPartial): void;
|
|
1321
|
+
/** @deprecated Please use `getEl()` instead */
|
|
1322
|
+
get $root(): HTMLElement;
|
|
1323
|
+
/** @description Please use `getConf()` instead */
|
|
1324
|
+
get conf(): Config;
|
|
1325
|
+
}
|
|
1326
|
+
export default Artalk;
|
|
1327
|
+
|
|
1328
|
+
export declare type ArtalkConfig = Config;
|
|
1329
|
+
|
|
1330
|
+
export declare type ArtalkPlugin<T = any> = (ctx: Context, options?: T) => void;
|
|
1331
|
+
|
|
1332
|
+
declare namespace ArtalkType {
|
|
1333
|
+
export {
|
|
1334
|
+
I18n,
|
|
1335
|
+
I18nKeys,
|
|
1336
|
+
Api,
|
|
1337
|
+
ApiHandlers,
|
|
1338
|
+
Config,
|
|
1339
|
+
ConfigPartial,
|
|
1340
|
+
ArtalkConfig,
|
|
1341
|
+
ConfigManager,
|
|
1342
|
+
CommentData,
|
|
1343
|
+
ListData,
|
|
1344
|
+
PageData,
|
|
1345
|
+
SiteData,
|
|
1346
|
+
UserData,
|
|
1347
|
+
UserDataForAdmin,
|
|
1348
|
+
NotifyData,
|
|
1349
|
+
EmoticonGrpData,
|
|
1350
|
+
EmoticonListData,
|
|
1351
|
+
ApiVersionData,
|
|
1352
|
+
ListFetchParams,
|
|
1353
|
+
ListLastFetchData,
|
|
1354
|
+
DataManager,
|
|
1355
|
+
NotifyLevel,
|
|
1356
|
+
UserInfoApiResponseData,
|
|
1357
|
+
FetchError,
|
|
1358
|
+
Context,
|
|
1359
|
+
LocalUser,
|
|
1360
|
+
UserManager,
|
|
1361
|
+
List,
|
|
1362
|
+
ListLayout,
|
|
1363
|
+
EditorState,
|
|
1364
|
+
Editor,
|
|
1365
|
+
EditorPluginManager,
|
|
1366
|
+
ListErrorData,
|
|
1367
|
+
ListFetchedArgs,
|
|
1368
|
+
EventPayloadMap,
|
|
1369
|
+
EventHandler,
|
|
1370
|
+
Event_2 as Event,
|
|
1371
|
+
EventOptions,
|
|
1372
|
+
EventManager,
|
|
1373
|
+
ArtalkPlugin,
|
|
1374
|
+
SidebarLayer,
|
|
1375
|
+
SidebarShowPayload,
|
|
1376
|
+
Layer,
|
|
1377
|
+
LayerManager,
|
|
1378
|
+
CheckerManager,
|
|
1379
|
+
Services
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
export { ArtalkType }
|
|
1383
|
+
|
|
1384
|
+
declare interface AuthAuthProviderInfo {
|
|
1385
|
+
icon: string;
|
|
1386
|
+
label: string;
|
|
1387
|
+
name: string;
|
|
1388
|
+
path?: string;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
declare type CancelToken = Symbol | string | number;
|
|
1392
|
+
|
|
1393
|
+
declare interface Checker<T = any> {
|
|
1394
|
+
el?: HTMLElement;
|
|
1395
|
+
inputType?: 'password' | 'text';
|
|
1396
|
+
body: (checker: CheckerCtx) => HTMLElement;
|
|
1397
|
+
request: (checker: CheckerCtx, inputVal: string) => Promise<T>;
|
|
1398
|
+
onSuccess?: (checker: CheckerCtx, respData: T, inputVal: string, formEl: HTMLElement) => void;
|
|
1399
|
+
onError?: (checker: CheckerCtx, errData: any, inputVal: string, formEl: HTMLElement) => void;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
declare interface CheckerCaptchaPayload extends CheckerPayload {
|
|
1403
|
+
img_data?: string;
|
|
1404
|
+
iframe?: string;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
declare interface CheckerCtx {
|
|
1408
|
+
get<K extends keyof CheckerStore>(key: K): CheckerStore[K];
|
|
1409
|
+
set<K extends keyof CheckerStore>(key: K, val: CheckerStore[K]): void;
|
|
1410
|
+
getOpts(): CheckerLauncherOptions;
|
|
1411
|
+
getApi(): Api;
|
|
1412
|
+
getUser(): UserManager;
|
|
1413
|
+
hideInteractInput(): void;
|
|
1414
|
+
triggerSuccess(): void;
|
|
1415
|
+
cancel(): void;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
declare interface CheckerLauncherOptions {
|
|
1419
|
+
getApi: () => Api;
|
|
1420
|
+
getLayers: () => LayerManager;
|
|
1421
|
+
getUser: () => UserManager;
|
|
1422
|
+
getCaptchaIframeURL: () => string;
|
|
1423
|
+
onReload: () => void;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
export declare interface CheckerManager {
|
|
1427
|
+
checkCaptcha: (payload: CheckerCaptchaPayload) => Promise<void>;
|
|
1428
|
+
checkAdmin: (payload: CheckerPayload) => Promise<void>;
|
|
1429
|
+
check: (checker: Checker, payload: CheckerPayload, beforeCheck?: (c: CheckerCtx) => void) => void;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
declare interface CheckerPayload {
|
|
1433
|
+
onSuccess?: () => void;
|
|
1434
|
+
onMount?: (dialogEl: HTMLElement) => void;
|
|
1435
|
+
onCancel?: () => void;
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
declare interface CheckerStore {
|
|
1439
|
+
val?: string;
|
|
1440
|
+
img_data?: string;
|
|
1441
|
+
iframe?: string;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
declare class CommentActions {
|
|
1445
|
+
private comment;
|
|
1446
|
+
private get data();
|
|
1447
|
+
private get opts();
|
|
1448
|
+
private getApi;
|
|
1449
|
+
constructor(comment: CommentNode);
|
|
1450
|
+
/** 投票操作 */
|
|
1451
|
+
vote(choice: 'up' | 'down'): void;
|
|
1452
|
+
/** 管理员 - 评论状态修改 */
|
|
1453
|
+
adminEdit(type: 'collapsed' | 'pending' | 'pinned', btnElem: ActionBtn): void;
|
|
1454
|
+
/** 管理员 - 评论删除 */
|
|
1455
|
+
adminDelete(btnElem: ActionBtn): void;
|
|
1456
|
+
/** 快速跳转到该评论 */
|
|
1457
|
+
goToReplyComment(): void;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
export declare interface CommentData {
|
|
1461
|
+
/** 评论 ID */
|
|
1462
|
+
id: number;
|
|
1463
|
+
/** 评论正文 */
|
|
1464
|
+
content: string;
|
|
1465
|
+
/** 用户昵称 */
|
|
1466
|
+
nick: string;
|
|
1467
|
+
/** 用户邮箱 (该字段仅管理员可见) */
|
|
1468
|
+
email?: string;
|
|
1469
|
+
/** 用户邮箱(已加密) */
|
|
1470
|
+
email_encrypted: string;
|
|
1471
|
+
/** 用户链接 */
|
|
1472
|
+
link: string;
|
|
1473
|
+
/** 回复目标评论 ID */
|
|
1474
|
+
rid: number;
|
|
1475
|
+
/** User Agent */
|
|
1476
|
+
ua: string;
|
|
1477
|
+
/** 评论日期 */
|
|
1478
|
+
date: string;
|
|
1479
|
+
/** 是否折叠 */
|
|
1480
|
+
is_collapsed: boolean;
|
|
1481
|
+
/** 是否待审 */
|
|
1482
|
+
is_pending: boolean;
|
|
1483
|
+
/** 是否置顶 */
|
|
1484
|
+
is_pinned: boolean;
|
|
1485
|
+
/** 是否已验证 */
|
|
1486
|
+
is_verified: boolean;
|
|
1487
|
+
/** 徽章文字 */
|
|
1488
|
+
badge_name?: string;
|
|
1489
|
+
/** 徽章颜色 */
|
|
1490
|
+
badge_color?: string;
|
|
1491
|
+
/** IP 属地 */
|
|
1492
|
+
ip_region?: string;
|
|
1493
|
+
/** 是否允许回复 */
|
|
1494
|
+
is_allow_reply: boolean;
|
|
1495
|
+
/** 评论页面 key */
|
|
1496
|
+
page_key: string;
|
|
1497
|
+
/** 评论页面 url */
|
|
1498
|
+
page_url?: string;
|
|
1499
|
+
/** 是否可见 */
|
|
1500
|
+
visible: boolean;
|
|
1501
|
+
/** 站点名(用于隔离) */
|
|
1502
|
+
site_name: string;
|
|
1503
|
+
/** 赞同数 */
|
|
1504
|
+
vote_up: number;
|
|
1505
|
+
/** 反对数 */
|
|
1506
|
+
vote_down: number;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
declare class CommentNode {
|
|
1510
|
+
$el?: HTMLElement;
|
|
1511
|
+
private renderInstance;
|
|
1512
|
+
private actionInstance;
|
|
1513
|
+
private data;
|
|
1514
|
+
private opts;
|
|
1515
|
+
private parent;
|
|
1516
|
+
private children;
|
|
1517
|
+
private nestCurt;
|
|
1518
|
+
constructor(data: CommentData, opts: CommentOptions);
|
|
1519
|
+
/** 渲染 UI */
|
|
1520
|
+
render(): void;
|
|
1521
|
+
/** 获取评论操作实例对象 */
|
|
1522
|
+
getActions(): CommentActions;
|
|
1523
|
+
/** 获取评论渲染器实例对象 */
|
|
1524
|
+
getRender(): Render;
|
|
1525
|
+
/** 获取评论数据 */
|
|
1526
|
+
getData(): CommentData;
|
|
1527
|
+
/** 设置数据 */
|
|
1528
|
+
setData(data: CommentData): void;
|
|
1529
|
+
/** 获取父评论 */
|
|
1530
|
+
getParent(): CommentNode | null;
|
|
1531
|
+
/** 获取所有子评论 */
|
|
1532
|
+
getChildren(): CommentNode[];
|
|
1533
|
+
/** 获取当前嵌套层数 */
|
|
1534
|
+
getNestCurt(): number;
|
|
1535
|
+
/** 判断是否为根评论 */
|
|
1536
|
+
getIsRoot(): boolean;
|
|
1537
|
+
/** 获取评论 ID */
|
|
1538
|
+
getID(): number;
|
|
1539
|
+
/** 置入子评论 */
|
|
1540
|
+
putChild(childNode: CommentNode, insertMode?: 'append' | 'prepend'): void;
|
|
1541
|
+
/** 获取存放子评论的元素对象 */
|
|
1542
|
+
getChildrenWrapEl(): HTMLElement;
|
|
1543
|
+
/** 获取所有父评论 */
|
|
1544
|
+
getParents(): CommentNode[];
|
|
1545
|
+
/**
|
|
1546
|
+
* Get the element of the comment
|
|
1547
|
+
*
|
|
1548
|
+
* The `getEl()` will always return the latest $el after calling `render()`.
|
|
1549
|
+
* Please be aware of the memory leak if you use the $el reference directly.
|
|
1550
|
+
*/
|
|
1551
|
+
getEl(): HTMLElement;
|
|
1552
|
+
/**
|
|
1553
|
+
* Focus on the comment
|
|
1554
|
+
*
|
|
1555
|
+
* Scroll to the comment and perform flash animation
|
|
1556
|
+
*/
|
|
1557
|
+
focus(): void;
|
|
1558
|
+
scrollIntoView(): void;
|
|
1559
|
+
/**
|
|
1560
|
+
* Remove the comment node
|
|
1561
|
+
*/
|
|
1562
|
+
remove(): void;
|
|
1563
|
+
/** 获取 Gravatar 头像 URL */
|
|
1564
|
+
getGravatarURL(): string;
|
|
1565
|
+
/** 获取评论 markdown 解析后的内容 */
|
|
1566
|
+
getContentMarked(): string;
|
|
1567
|
+
/** 获取格式化后的日期 */
|
|
1568
|
+
getDateFormatted(): any;
|
|
1569
|
+
/** 获取用户 UserAgent 信息 */
|
|
1570
|
+
getUserUA(): {
|
|
1571
|
+
browser: string;
|
|
1572
|
+
os: string;
|
|
1573
|
+
};
|
|
1574
|
+
/** 获取配置 */
|
|
1575
|
+
getOpts(): CommentOptions;
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
declare interface CommentOptions {
|
|
1579
|
+
onAfterRender?: () => void;
|
|
1580
|
+
onDelete?: (c: CommentNode) => void;
|
|
1581
|
+
/** The comment being replied to (linked comment) */
|
|
1582
|
+
replyTo?: CommentData;
|
|
1583
|
+
flatMode: boolean;
|
|
1584
|
+
vote: boolean;
|
|
1585
|
+
voteDown: boolean;
|
|
1586
|
+
uaBadge: boolean;
|
|
1587
|
+
nestMax: number;
|
|
1588
|
+
gravatar: Config['gravatar'];
|
|
1589
|
+
heightLimit: Config['heightLimit'];
|
|
1590
|
+
avatarURLBuilder: Config['avatarURLBuilder'];
|
|
1591
|
+
scrollRelativeTo: Config['scrollRelativeTo'];
|
|
1592
|
+
dateFormatter: Config['dateFormatter'];
|
|
1593
|
+
getApi: () => Api;
|
|
1594
|
+
replyComment: Context['replyComment'];
|
|
1595
|
+
editComment: Context['editComment'];
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
declare interface CommonApiVersionData {
|
|
1599
|
+
app: string;
|
|
1600
|
+
commit_hash: string;
|
|
1601
|
+
version: string;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
declare interface CommonConfData {
|
|
1605
|
+
frontend_conf: CommonMap;
|
|
1606
|
+
version: CommonApiVersionData;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
declare interface CommonJSONResult {
|
|
1610
|
+
/** Data */
|
|
1611
|
+
data: any;
|
|
1612
|
+
/** Message */
|
|
1613
|
+
msg: string;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
declare type CommonMap = Record<string, any>;
|
|
1617
|
+
|
|
1618
|
+
export declare interface Config {
|
|
1619
|
+
/** Element selector or Element to mount the Artalk */
|
|
1620
|
+
el: string | HTMLElement;
|
|
1621
|
+
/** Unique page identifier */
|
|
1622
|
+
pageKey: string;
|
|
1623
|
+
/** Title of the page */
|
|
1624
|
+
pageTitle: string;
|
|
1625
|
+
/** Server address */
|
|
1626
|
+
server: string;
|
|
1627
|
+
/** Site name */
|
|
1628
|
+
site: string;
|
|
1629
|
+
/** Placeholder text for the comment input box */
|
|
1630
|
+
placeholder: string;
|
|
1631
|
+
/** Text to display when there are no comments */
|
|
1632
|
+
noComment: string;
|
|
1633
|
+
/** Text for the send button */
|
|
1634
|
+
sendBtn: string;
|
|
1635
|
+
/** Movable comment box (display below the comment to be replied) */
|
|
1636
|
+
editorTravel: boolean;
|
|
1637
|
+
/** Emoticons settings */
|
|
1638
|
+
emoticons: object | any[] | string | false;
|
|
1639
|
+
/** Gravatar avatar settings */
|
|
1640
|
+
gravatar: {
|
|
1641
|
+
/** API endpoint */
|
|
1642
|
+
mirror: string;
|
|
1643
|
+
/** API parameters */
|
|
1644
|
+
params: string;
|
|
1645
|
+
};
|
|
1646
|
+
/** Avatar URL generator function */
|
|
1647
|
+
avatarURLBuilder?: (comment: CommentData) => string;
|
|
1648
|
+
/** Pagination settings */
|
|
1649
|
+
pagination: {
|
|
1650
|
+
/** Number of comments to fetch per request */
|
|
1651
|
+
pageSize: number;
|
|
1652
|
+
/** "Read more" mode */
|
|
1653
|
+
readMore: boolean;
|
|
1654
|
+
/** Automatically load more comments when scrolled to the bottom */
|
|
1655
|
+
autoLoad: boolean;
|
|
1656
|
+
};
|
|
1657
|
+
/** Height limit configuration */
|
|
1658
|
+
heightLimit: {
|
|
1659
|
+
/** Maximum height for comment content */
|
|
1660
|
+
content: number;
|
|
1661
|
+
/** Maximum height for child comments */
|
|
1662
|
+
children: number;
|
|
1663
|
+
/** Whether the content is scrollable */
|
|
1664
|
+
scrollable: boolean;
|
|
1665
|
+
};
|
|
1666
|
+
/** Voting feature for comments */
|
|
1667
|
+
vote: boolean;
|
|
1668
|
+
/** Downvote button for comments */
|
|
1669
|
+
voteDown: boolean;
|
|
1670
|
+
/** Page Vote Widget */
|
|
1671
|
+
pageVote: {
|
|
1672
|
+
/** Up Vote Button Selector */
|
|
1673
|
+
upBtnEl: string;
|
|
1674
|
+
/** Down Vote Button Selector */
|
|
1675
|
+
downBtnEl: string;
|
|
1676
|
+
/** Up Vote Count Selector */
|
|
1677
|
+
upCountEl: string;
|
|
1678
|
+
/** Down Vote Count Selector */
|
|
1679
|
+
downCountEl: string;
|
|
1680
|
+
/** Active class name if the vote is already cast */
|
|
1681
|
+
activeClass: string;
|
|
1682
|
+
} | boolean;
|
|
1683
|
+
/** Preview feature for comments */
|
|
1684
|
+
preview: boolean;
|
|
1685
|
+
/** Selector for the element binding to the comment count */
|
|
1686
|
+
countEl: string;
|
|
1687
|
+
/** Selector for the element binding to the page views (PV) count */
|
|
1688
|
+
pvEl: string;
|
|
1689
|
+
/** Attribute name for the PageKey in statistics components */
|
|
1690
|
+
statPageKeyAttr: string;
|
|
1691
|
+
/** Dark mode settings */
|
|
1692
|
+
darkMode: boolean | 'auto';
|
|
1693
|
+
/** Request timeout (in seconds) */
|
|
1694
|
+
reqTimeout: number;
|
|
1695
|
+
/** Flat mode for comment display */
|
|
1696
|
+
flatMode: boolean | 'auto';
|
|
1697
|
+
/** Maximum number of levels for nested comments */
|
|
1698
|
+
nestMax: number;
|
|
1699
|
+
/** Sorting order for nested comments */
|
|
1700
|
+
nestSort: 'DATE_ASC' | 'DATE_DESC';
|
|
1701
|
+
/** Display UA badge (user agent badge) */
|
|
1702
|
+
uaBadge: boolean;
|
|
1703
|
+
/** Show sorting dropdown for comment list */
|
|
1704
|
+
listSort: boolean;
|
|
1705
|
+
/** Enable image upload feature */
|
|
1706
|
+
imgUpload: boolean;
|
|
1707
|
+
/** Image uploader function */
|
|
1708
|
+
imgUploader?: (file: File) => Promise<string>;
|
|
1709
|
+
/** Image lazy load mode */
|
|
1710
|
+
imgLazyLoad: false | 'native' | 'data-src';
|
|
1711
|
+
/** Enable version check */
|
|
1712
|
+
versionCheck: boolean;
|
|
1713
|
+
/**
|
|
1714
|
+
* Use remote configuration (from the backend server)
|
|
1715
|
+
*
|
|
1716
|
+
* @deprecated
|
|
1717
|
+
* The `useBackendConf` is always `true` and planned to be removed in the future.
|
|
1718
|
+
*
|
|
1719
|
+
* Please use `preferRemoteConf` to control the priority of the remote and local configuration.
|
|
1720
|
+
*
|
|
1721
|
+
* @default true
|
|
1722
|
+
*/
|
|
1723
|
+
useBackendConf: boolean;
|
|
1724
|
+
/**
|
|
1725
|
+
* Prefer to use the local configuration if available
|
|
1726
|
+
*
|
|
1727
|
+
* @note
|
|
1728
|
+
* If `true`, the local config will be used as a fallback (remote config first).
|
|
1729
|
+
*
|
|
1730
|
+
* If `false`, the local config will override the remote config (local config first).
|
|
1731
|
+
*
|
|
1732
|
+
* @default false
|
|
1733
|
+
*/
|
|
1734
|
+
preferRemoteConf: boolean;
|
|
1735
|
+
/** Localization settings */
|
|
1736
|
+
locale: I18n | string;
|
|
1737
|
+
/** Backend API version (system data, not allowed for user modification) */
|
|
1738
|
+
apiVersion: string;
|
|
1739
|
+
/** URLs for plugin scripts */
|
|
1740
|
+
pluginURLs?: string[];
|
|
1741
|
+
/** Replacers for the marked (Markdown parser) */
|
|
1742
|
+
markedReplacers?: ((raw: string) => string)[];
|
|
1743
|
+
/** Options for the marked (Markdown parser) */
|
|
1744
|
+
markedOptions?: MarkedOptions;
|
|
1745
|
+
/** Modifier for list fetch request parameters */
|
|
1746
|
+
listFetchParamsModifier?: (params: any) => void;
|
|
1747
|
+
/**
|
|
1748
|
+
* Custom date formatter
|
|
1749
|
+
* @param date - The Date object to format
|
|
1750
|
+
* @returns Formatted date string
|
|
1751
|
+
*/
|
|
1752
|
+
dateFormatter?: (date: Date) => string;
|
|
1753
|
+
/** List unread highlight (enable by default in artalk-sidebar) */
|
|
1754
|
+
listUnreadHighlight: boolean;
|
|
1755
|
+
/** The relative element for scrolling (useful if artalk is in a scrollable container) */
|
|
1756
|
+
scrollRelativeTo?: () => HTMLElement;
|
|
1757
|
+
/** Page view increment when comment list is loaded */
|
|
1758
|
+
pvAdd: boolean;
|
|
1759
|
+
/** Immediately fetch comments when Artalk instance is initialized */
|
|
1760
|
+
fetchCommentsOnInit: boolean;
|
|
1761
|
+
/** Callback before submitting a comment */
|
|
1762
|
+
beforeSubmit?: (editor: Editor, next: () => void) => void;
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
export declare interface ConfigManager {
|
|
1766
|
+
watchConf: Context['watchConf'];
|
|
1767
|
+
get: () => Config;
|
|
1768
|
+
update: (conf: ConfigPartial) => void;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
export declare type ConfigPartial = DeepPartial<Config>;
|
|
1772
|
+
|
|
1773
|
+
declare type Constructor<T, S = Services_2, D extends readonly (keyof S)[] = any> = (...args: {
|
|
1774
|
+
[K in keyof D]: D[K] extends keyof S ? S[D[K]] : never;
|
|
1775
|
+
}) => T;
|
|
1776
|
+
|
|
1777
|
+
declare enum ContentType {
|
|
1778
|
+
Json = "application/json",
|
|
1779
|
+
FormData = "multipart/form-data",
|
|
1780
|
+
UrlEncoded = "application/x-www-form-urlencoded",
|
|
1781
|
+
Text = "text/plain"
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
/**
|
|
1785
|
+
* Artalk Context
|
|
1786
|
+
*/
|
|
1787
|
+
export declare interface Context extends EventManager<EventPayloadMap>, DependencyContainer<Services> {
|
|
1788
|
+
/**
|
|
1789
|
+
* The root element of Artalk
|
|
1790
|
+
*
|
|
1791
|
+
* @deprecated Use `getEl()` instead
|
|
1792
|
+
*/
|
|
1793
|
+
$root: HTMLElement;
|
|
1794
|
+
/** Get the root element */
|
|
1795
|
+
getEl(): HTMLElement;
|
|
1796
|
+
/**
|
|
1797
|
+
* Inject a dependency object
|
|
1798
|
+
*
|
|
1799
|
+
* @deprecated Use `inject()` instead
|
|
1800
|
+
*/
|
|
1801
|
+
get<T extends keyof Services>(key: T): Services[T];
|
|
1802
|
+
/**
|
|
1803
|
+
* Get config object
|
|
1804
|
+
*
|
|
1805
|
+
* @deprecated Use `getConf()` and `updateConf()` instead
|
|
1806
|
+
*/
|
|
1807
|
+
conf: Config;
|
|
1808
|
+
/** Get the config */
|
|
1809
|
+
getConf(): Config;
|
|
1810
|
+
/** Update the config */
|
|
1811
|
+
updateConf(conf: ConfigPartial): void;
|
|
1812
|
+
/** Watch the config */
|
|
1813
|
+
watchConf<T extends (keyof Config)[]>(keys: T, effect: (val: Pick<Config, T[number]>) => void): void;
|
|
1814
|
+
/** Get the marked instance */
|
|
1815
|
+
getMarked(): Marked | undefined;
|
|
1816
|
+
/** Set dark mode */
|
|
1817
|
+
setDarkMode(darkMode: boolean | 'auto'): void;
|
|
1818
|
+
/** Translate i18n message */
|
|
1819
|
+
$t(key: keyof I18n, args?: {
|
|
1820
|
+
[key: string]: string;
|
|
1821
|
+
}): string;
|
|
1822
|
+
/** Get HTTP API client */
|
|
1823
|
+
getApi(): Api;
|
|
1824
|
+
/** Get HTTP API handlers */
|
|
1825
|
+
getApiHandlers(): ApiHandlers;
|
|
1826
|
+
/** Get Data Manager */
|
|
1827
|
+
getData(): DataManager;
|
|
1828
|
+
/** Get User Manager */
|
|
1829
|
+
getUser(): UserManager;
|
|
1830
|
+
/** Fetch comments */
|
|
1831
|
+
fetch(params: Partial<ListFetchParams>): void;
|
|
1832
|
+
/** Reload comments */
|
|
1833
|
+
reload(): void;
|
|
1834
|
+
/** Destroy */
|
|
1835
|
+
destroy(): void;
|
|
1836
|
+
/** Goto the first comment of the list */
|
|
1837
|
+
listGotoFirst(): void;
|
|
1838
|
+
/** Get the comment data list */
|
|
1839
|
+
getComments(): CommentData[];
|
|
1840
|
+
/** Get the comment node list */
|
|
1841
|
+
getCommentNodes(): CommentNode[];
|
|
1842
|
+
/**
|
|
1843
|
+
* Get the comment data list
|
|
1844
|
+
* @deprecated Use `getComments()` instead
|
|
1845
|
+
*/
|
|
1846
|
+
getCommentDataList(): CommentData[];
|
|
1847
|
+
/**
|
|
1848
|
+
* Get the comment node list
|
|
1849
|
+
* @deprecated Use `getCommentNodes()` instead
|
|
1850
|
+
*/
|
|
1851
|
+
getCommentList(): CommentNode[];
|
|
1852
|
+
/** Reply to a comment */
|
|
1853
|
+
replyComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
1854
|
+
/** Edit a comment */
|
|
1855
|
+
editComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
1856
|
+
/** Show loading of the editor */
|
|
1857
|
+
editorShowLoading(): void;
|
|
1858
|
+
/** Hide loading of the editor */
|
|
1859
|
+
editorHideLoading(): void;
|
|
1860
|
+
/** Show notify of the editor */
|
|
1861
|
+
editorShowNotify(msg: string, type: NotifyLevel): void;
|
|
1862
|
+
/** Reset the state of the editor */
|
|
1863
|
+
editorResetState(): void;
|
|
1864
|
+
/** Show the sidebar */
|
|
1865
|
+
showSidebar(payload?: SidebarShowPayload): void;
|
|
1866
|
+
/** Hide the sidebar */
|
|
1867
|
+
hideSidebar(): void;
|
|
1868
|
+
/** Check captcha */
|
|
1869
|
+
checkCaptcha(payload: CheckerCaptchaPayload): Promise<void>;
|
|
1870
|
+
/** Check admin */
|
|
1871
|
+
checkAdmin(payload: CheckerPayload): Promise<void>;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
export declare interface DataManager {
|
|
1875
|
+
getLoading(): boolean;
|
|
1876
|
+
setLoading(val: boolean): void;
|
|
1877
|
+
getListLastFetch(): ListLastFetchData | undefined;
|
|
1878
|
+
setListLastFetch(val: ListLastFetchData): void;
|
|
1879
|
+
getComments(): CommentData[];
|
|
1880
|
+
findComment(id: number): CommentData | undefined;
|
|
1881
|
+
fetchComments(params: Partial<ListFetchParams>): void;
|
|
1882
|
+
loadComments(comments: CommentData[]): void;
|
|
1883
|
+
clearComments(): void;
|
|
1884
|
+
insertComment(comment: CommentData): void;
|
|
1885
|
+
updateComment(comment: CommentData): void;
|
|
1886
|
+
deleteComment(id: number): void;
|
|
1887
|
+
getNotifies(): NotifyData[];
|
|
1888
|
+
updateNotifies(notifies: NotifyData[]): void;
|
|
1889
|
+
getPage(): PageData | undefined;
|
|
1890
|
+
updatePage(pageData: PageData): void;
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
declare type DeepPartial<T> = {
|
|
1894
|
+
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
1895
|
+
};
|
|
1896
|
+
|
|
1897
|
+
export declare const Defaults: Readonly<RequiredExcept<Config, ExcludedKeys>>;
|
|
1898
|
+
|
|
1899
|
+
declare interface DependencyContainer<S = Services_2> {
|
|
1900
|
+
provide<K extends keyof S, T extends S[K] = any, D extends readonly (keyof S)[] = any>(key: K, impl: Constructor<T, S, D>, deps?: D, opts?: ProvideFuncOptions): void;
|
|
1901
|
+
inject<T = undefined, K extends keyof S = any>(key: K): T extends undefined ? S[K] : T;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
export declare interface Editor {
|
|
1905
|
+
/**
|
|
1906
|
+
* Get editor options
|
|
1907
|
+
*/
|
|
1908
|
+
getOptions(): EditorOptions;
|
|
1909
|
+
/**
|
|
1910
|
+
* Get the editor element
|
|
1911
|
+
*/
|
|
1912
|
+
getEl(): HTMLElement;
|
|
1913
|
+
/**
|
|
1914
|
+
* Get the editor UI instance
|
|
1915
|
+
*/
|
|
1916
|
+
getUI(): EditorUI;
|
|
1917
|
+
/**
|
|
1918
|
+
* Get the header input elements
|
|
1919
|
+
*/
|
|
1920
|
+
getHeaderInputEls(): Record<string, HTMLInputElement>;
|
|
1921
|
+
/**
|
|
1922
|
+
* Set content
|
|
1923
|
+
*/
|
|
1924
|
+
setContent(val: string): void;
|
|
1925
|
+
/**
|
|
1926
|
+
* Insert content
|
|
1927
|
+
*/
|
|
1928
|
+
insertContent(val: string): void;
|
|
1929
|
+
/**
|
|
1930
|
+
* Get the final content
|
|
1931
|
+
*
|
|
1932
|
+
* This function returns the raw content or the content transformed through a plugin hook.
|
|
1933
|
+
*/
|
|
1934
|
+
getContentFinal(): string;
|
|
1935
|
+
/**
|
|
1936
|
+
* Get the raw content which is inputed by user
|
|
1937
|
+
*/
|
|
1938
|
+
getContentRaw(): string;
|
|
1939
|
+
/**
|
|
1940
|
+
* Get the HTML format content which is rendered by marked (a markdown parser)
|
|
1941
|
+
*/
|
|
1942
|
+
getContentMarked(): string;
|
|
1943
|
+
/**
|
|
1944
|
+
* Get editor current state
|
|
1945
|
+
*/
|
|
1946
|
+
getState(): EditorState;
|
|
1947
|
+
/**
|
|
1948
|
+
* Focus editor
|
|
1949
|
+
*/
|
|
1950
|
+
focus(): void;
|
|
1951
|
+
/**
|
|
1952
|
+
* Reset editor
|
|
1953
|
+
*/
|
|
1954
|
+
reset(): void;
|
|
1955
|
+
/**
|
|
1956
|
+
* Reset editor UI
|
|
1957
|
+
*
|
|
1958
|
+
* call it will move editor to the initial position
|
|
1959
|
+
*/
|
|
1960
|
+
resetState(): void;
|
|
1961
|
+
/**
|
|
1962
|
+
* Submit comment
|
|
1963
|
+
*/
|
|
1964
|
+
submit(): void;
|
|
1965
|
+
/**
|
|
1966
|
+
* Show notification message
|
|
1967
|
+
*/
|
|
1968
|
+
showNotify(msg: string, type: NotifyLevel): void;
|
|
1969
|
+
/**
|
|
1970
|
+
* Show loading on editor
|
|
1971
|
+
*/
|
|
1972
|
+
showLoading(): void;
|
|
1973
|
+
/**
|
|
1974
|
+
* Hide loading on editor
|
|
1975
|
+
*/
|
|
1976
|
+
hideLoading(): void;
|
|
1977
|
+
/**
|
|
1978
|
+
* Start replying a comment
|
|
1979
|
+
*/
|
|
1980
|
+
setReplyComment(commentData: CommentData, $comment: HTMLElement, scroll?: boolean): void;
|
|
1981
|
+
/**
|
|
1982
|
+
* Start editing a comment
|
|
1983
|
+
*/
|
|
1984
|
+
setEditComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
1985
|
+
/**
|
|
1986
|
+
* Get plugin manager
|
|
1987
|
+
*/
|
|
1988
|
+
getPlugins(): PluginManager | undefined;
|
|
1989
|
+
/**
|
|
1990
|
+
* Set plugin manager
|
|
1991
|
+
*/
|
|
1992
|
+
setPlugins(plugins: PluginManager): void;
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
declare interface EditorEventPayloadMap {
|
|
1996
|
+
mounted: undefined;
|
|
1997
|
+
unmounted: undefined;
|
|
1998
|
+
'header-input': {
|
|
1999
|
+
field: string;
|
|
2000
|
+
$input: HTMLInputElement;
|
|
2001
|
+
};
|
|
2002
|
+
'header-change': {
|
|
2003
|
+
field: string;
|
|
2004
|
+
$input: HTMLInputElement;
|
|
2005
|
+
};
|
|
2006
|
+
'content-updated': string;
|
|
2007
|
+
'panel-show': EditorPlugin;
|
|
2008
|
+
'panel-hide': EditorPlugin;
|
|
2009
|
+
'panel-close': undefined;
|
|
2010
|
+
'editor-close': undefined;
|
|
2011
|
+
'editor-open': undefined;
|
|
2012
|
+
'editor-submit': undefined;
|
|
2013
|
+
'editor-submitted': undefined;
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
declare interface EditorOptions {
|
|
2017
|
+
getEvents: () => EventManager;
|
|
2018
|
+
getConf: () => ConfigManager;
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
/**
|
|
2022
|
+
* Editor 插件
|
|
2023
|
+
*/
|
|
2024
|
+
declare class EditorPlugin {
|
|
2025
|
+
protected kit: PlugKit;
|
|
2026
|
+
$btn?: HTMLElement;
|
|
2027
|
+
$panel?: HTMLElement;
|
|
2028
|
+
contentTransformer?(rawContent: string): string;
|
|
2029
|
+
editorStateEffectWhen?: EditorState;
|
|
2030
|
+
editorStateEffect?(comment: CommentData): () => void;
|
|
2031
|
+
constructor(kit: PlugKit);
|
|
2032
|
+
/** Use plug btn will add a btn on the bottom of editor */
|
|
2033
|
+
useBtn(html?: string): HTMLElement;
|
|
2034
|
+
/** Use plug panel will show the panel when btn is clicked */
|
|
2035
|
+
usePanel(html?: string): HTMLElement;
|
|
2036
|
+
/** Use the content transformer to handle the content of the last submit by the editor */
|
|
2037
|
+
useContentTransformer(func: (raw: string) => string): void;
|
|
2038
|
+
/** Listen the event of panel show */
|
|
2039
|
+
usePanelShow(func: () => void): void;
|
|
2040
|
+
/** Listen the event of panel hide */
|
|
2041
|
+
usePanelHide(func: () => void): void;
|
|
2042
|
+
/** Use editor state modifier */
|
|
2043
|
+
useEditorStateEffect(stateName: EditorState, effectFn: (comment: CommentData) => () => void): void;
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
export declare interface EditorPluginManager {
|
|
2047
|
+
getPlugins: () => EditorPlugin[];
|
|
2048
|
+
getEvents: () => EventManager<EditorEventPayloadMap>;
|
|
2049
|
+
getEditor: () => Editor;
|
|
2050
|
+
getOptions: () => PluginManagerOptions;
|
|
2051
|
+
get<T extends typeof EditorPlugin>(plug: T): InstanceType<T> | undefined;
|
|
2052
|
+
openPluginPanel: (plug: EditorPlugin) => void;
|
|
2053
|
+
closePluginPanel: () => void;
|
|
2054
|
+
getTransformedContent: (rawContent: string) => string;
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
export declare type EditorState = 'reply' | 'edit' | 'normal';
|
|
2058
|
+
|
|
2059
|
+
declare interface EditorUI extends Record<keyof typeof Sel, HTMLElement> {
|
|
2060
|
+
$el: HTMLElement;
|
|
2061
|
+
$name: HTMLInputElement;
|
|
2062
|
+
$email: HTMLInputElement;
|
|
2063
|
+
$link: HTMLInputElement;
|
|
2064
|
+
$textarea: HTMLTextAreaElement;
|
|
2065
|
+
$submitBtn: HTMLButtonElement;
|
|
2066
|
+
$sendReplyBtn?: HTMLElement;
|
|
2067
|
+
$editCancelBtn?: HTMLElement;
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
export declare type EmoticonGrpData = {
|
|
2071
|
+
name: string;
|
|
2072
|
+
type: 'emoticon' | 'image' | 'emoji';
|
|
2073
|
+
items: {
|
|
2074
|
+
key: string;
|
|
2075
|
+
val: string;
|
|
2076
|
+
}[];
|
|
2077
|
+
};
|
|
2078
|
+
|
|
2079
|
+
export declare type EmoticonListData = EmoticonGrpData[];
|
|
2080
|
+
|
|
2081
|
+
declare const en: {
|
|
2082
|
+
placeholder: string;
|
|
2083
|
+
noComment: string;
|
|
2084
|
+
send: string;
|
|
2085
|
+
signIn: string;
|
|
2086
|
+
signUp: string;
|
|
2087
|
+
save: string;
|
|
2088
|
+
nick: string;
|
|
2089
|
+
email: string;
|
|
2090
|
+
link: string;
|
|
2091
|
+
emoticon: string;
|
|
2092
|
+
preview: string;
|
|
2093
|
+
uploadImage: string;
|
|
2094
|
+
uploadFail: string;
|
|
2095
|
+
commentFail: string;
|
|
2096
|
+
restoredMsg: string;
|
|
2097
|
+
onlyAdminCanReply: string;
|
|
2098
|
+
uploadLoginMsg: string;
|
|
2099
|
+
counter: string;
|
|
2100
|
+
sortLatest: string;
|
|
2101
|
+
sortOldest: string;
|
|
2102
|
+
sortBest: string;
|
|
2103
|
+
sortAuthor: string;
|
|
2104
|
+
openComment: string;
|
|
2105
|
+
closeComment: string;
|
|
2106
|
+
listLoadFailMsg: string;
|
|
2107
|
+
listRetry: string;
|
|
2108
|
+
loadMore: string;
|
|
2109
|
+
admin: string;
|
|
2110
|
+
reply: string;
|
|
2111
|
+
voteUp: string;
|
|
2112
|
+
voteDown: string;
|
|
2113
|
+
voteFail: string;
|
|
2114
|
+
readMore: string;
|
|
2115
|
+
actionConfirm: string;
|
|
2116
|
+
collapse: string;
|
|
2117
|
+
collapsed: string;
|
|
2118
|
+
collapsedMsg: string;
|
|
2119
|
+
expand: string;
|
|
2120
|
+
approved: string;
|
|
2121
|
+
pending: string;
|
|
2122
|
+
pendingMsg: string;
|
|
2123
|
+
edit: string;
|
|
2124
|
+
editCancel: string;
|
|
2125
|
+
delete: string;
|
|
2126
|
+
deleteConfirm: string;
|
|
2127
|
+
pin: string;
|
|
2128
|
+
unpin: string;
|
|
2129
|
+
seconds: string;
|
|
2130
|
+
minutes: string;
|
|
2131
|
+
hours: string;
|
|
2132
|
+
days: string;
|
|
2133
|
+
now: string;
|
|
2134
|
+
adminCheck: string;
|
|
2135
|
+
captchaCheck: string;
|
|
2136
|
+
confirm: string;
|
|
2137
|
+
cancel: string;
|
|
2138
|
+
msgCenter: string;
|
|
2139
|
+
ctrlCenter: string;
|
|
2140
|
+
userProfile: string;
|
|
2141
|
+
noAccountPrompt: string;
|
|
2142
|
+
haveAccountPrompt: string;
|
|
2143
|
+
forgetPassword: string;
|
|
2144
|
+
resetPassword: string;
|
|
2145
|
+
changePassword: string;
|
|
2146
|
+
confirmPassword: string;
|
|
2147
|
+
passwordMismatch: string;
|
|
2148
|
+
verificationCode: string;
|
|
2149
|
+
verifySend: string;
|
|
2150
|
+
verifyResend: string;
|
|
2151
|
+
waitSeconds: string;
|
|
2152
|
+
emailVerified: string;
|
|
2153
|
+
password: string;
|
|
2154
|
+
username: string;
|
|
2155
|
+
nextStep: string;
|
|
2156
|
+
skipVerify: string;
|
|
2157
|
+
logoutConfirm: string;
|
|
2158
|
+
accountMergeNotice: string;
|
|
2159
|
+
accountMergeSelectOne: string;
|
|
2160
|
+
accountMergeConfirm: string;
|
|
2161
|
+
dismiss: string;
|
|
2162
|
+
merge: string;
|
|
2163
|
+
client: string;
|
|
2164
|
+
server: string;
|
|
2165
|
+
loading: string;
|
|
2166
|
+
loadFail: string;
|
|
2167
|
+
editing: string;
|
|
2168
|
+
editFail: string;
|
|
2169
|
+
deleting: string;
|
|
2170
|
+
deleteFail: string;
|
|
2171
|
+
reqGot: string;
|
|
2172
|
+
reqAborted: string;
|
|
2173
|
+
updateMsg: string;
|
|
2174
|
+
currentVersion: string;
|
|
2175
|
+
ignore: string;
|
|
2176
|
+
open: string;
|
|
2177
|
+
openName: string;
|
|
2178
|
+
};
|
|
2179
|
+
|
|
2180
|
+
declare interface EntityCookedComment {
|
|
2181
|
+
badge_color: string;
|
|
2182
|
+
badge_name: string;
|
|
2183
|
+
content: string;
|
|
2184
|
+
content_marked: string;
|
|
2185
|
+
date: string;
|
|
2186
|
+
email_encrypted: string;
|
|
2187
|
+
id: number;
|
|
2188
|
+
ip_region: string;
|
|
2189
|
+
is_allow_reply: boolean;
|
|
2190
|
+
is_collapsed: boolean;
|
|
2191
|
+
is_pending: boolean;
|
|
2192
|
+
is_pinned: boolean;
|
|
2193
|
+
is_verified: boolean;
|
|
2194
|
+
link: string;
|
|
2195
|
+
nick: string;
|
|
2196
|
+
page_key: string;
|
|
2197
|
+
page_url: string;
|
|
2198
|
+
rid: number;
|
|
2199
|
+
site_name: string;
|
|
2200
|
+
ua: string;
|
|
2201
|
+
user_id: number;
|
|
2202
|
+
visible: boolean;
|
|
2203
|
+
vote_down: number;
|
|
2204
|
+
vote_up: number;
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
declare interface EntityCookedNotify {
|
|
2208
|
+
comment_id: number;
|
|
2209
|
+
id: number;
|
|
2210
|
+
is_emailed: boolean;
|
|
2211
|
+
is_read: boolean;
|
|
2212
|
+
read_link: string;
|
|
2213
|
+
user_id: number;
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
declare interface EntityCookedPage {
|
|
2217
|
+
admin_only: boolean;
|
|
2218
|
+
date: string;
|
|
2219
|
+
id: number;
|
|
2220
|
+
key: string;
|
|
2221
|
+
pv: number;
|
|
2222
|
+
site_name: string;
|
|
2223
|
+
title: string;
|
|
2224
|
+
url: string;
|
|
2225
|
+
vote_down: number;
|
|
2226
|
+
vote_up: number;
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
declare interface EntityCookedSite {
|
|
2230
|
+
first_url: string;
|
|
2231
|
+
id: number;
|
|
2232
|
+
name: string;
|
|
2233
|
+
urls: string[];
|
|
2234
|
+
urls_raw: string;
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
declare interface EntityCookedUser {
|
|
2238
|
+
badge_color: string;
|
|
2239
|
+
badge_name: string;
|
|
2240
|
+
email: string;
|
|
2241
|
+
id: number;
|
|
2242
|
+
is_admin: boolean;
|
|
2243
|
+
link: string;
|
|
2244
|
+
name: string;
|
|
2245
|
+
receive_email: boolean;
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2248
|
+
declare interface EntityCookedUserForAdmin {
|
|
2249
|
+
badge_color: string;
|
|
2250
|
+
badge_name: string;
|
|
2251
|
+
comment_count: number;
|
|
2252
|
+
email: string;
|
|
2253
|
+
id: number;
|
|
2254
|
+
is_admin: boolean;
|
|
2255
|
+
is_in_conf: boolean;
|
|
2256
|
+
last_ip: string;
|
|
2257
|
+
last_ua: string;
|
|
2258
|
+
link: string;
|
|
2259
|
+
name: string;
|
|
2260
|
+
receive_email: boolean;
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
declare interface Event_2<T, K extends keyof T = keyof T> extends EventOptions {
|
|
2264
|
+
name: K;
|
|
2265
|
+
handler: EventHandler<T[K]>;
|
|
2266
|
+
}
|
|
2267
|
+
export { Event_2 as Event }
|
|
2268
|
+
|
|
2269
|
+
export declare type EventHandler<T> = (payload: T) => void;
|
|
2270
|
+
|
|
2271
|
+
export declare interface EventManager<T = EventPayloadMap> {
|
|
2272
|
+
on<K extends keyof T>(name: K, handler: EventHandler<T[K]>, opts?: EventOptions): void;
|
|
2273
|
+
off<K extends keyof T>(name: K, handler: EventHandler<T[K]>): void;
|
|
2274
|
+
trigger<K extends keyof T>(name: K, payload?: T[K]): void;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
declare class EventManager_2<T> implements EventManager<T> {
|
|
2278
|
+
private events;
|
|
2279
|
+
/**
|
|
2280
|
+
* Add an event listener for a specific event name
|
|
2281
|
+
*/
|
|
2282
|
+
on<K extends keyof T>(name: K, handler: EventHandler<T[K]>, opts?: EventOptions): void;
|
|
2283
|
+
/**
|
|
2284
|
+
* Remove an event listener for a specific event name and handler
|
|
2285
|
+
*/
|
|
2286
|
+
off<K extends keyof T>(name: K, handler: EventHandler<T[K]>): void;
|
|
2287
|
+
/**
|
|
2288
|
+
* Trigger an event with an optional payload
|
|
2289
|
+
*/
|
|
2290
|
+
trigger<K extends keyof T>(name: K, payload?: T[K]): void;
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
export declare interface EventOptions {
|
|
2294
|
+
once?: boolean;
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
/** EventName to EventPayload Type */
|
|
2298
|
+
export declare interface EventPayloadMap {
|
|
2299
|
+
created: undefined;
|
|
2300
|
+
mounted: undefined;
|
|
2301
|
+
updated: Config;
|
|
2302
|
+
unmounted: undefined;
|
|
2303
|
+
'list-fetch': Partial<ListFetchParams>;
|
|
2304
|
+
'list-fetched': ListFetchedArgs;
|
|
2305
|
+
'list-load': CommentData[];
|
|
2306
|
+
'list-loaded': CommentData[];
|
|
2307
|
+
'list-failed': ListErrorData;
|
|
2308
|
+
'list-goto-first': undefined;
|
|
2309
|
+
'list-reach-bottom': undefined;
|
|
2310
|
+
'comment-inserted': CommentData;
|
|
2311
|
+
'comment-updated': CommentData;
|
|
2312
|
+
'comment-deleted': CommentData;
|
|
2313
|
+
'comment-rendered': CommentNode;
|
|
2314
|
+
'notifies-updated': NotifyData[];
|
|
2315
|
+
'list-goto': number;
|
|
2316
|
+
'page-loaded': PageData;
|
|
2317
|
+
'editor-submit': undefined;
|
|
2318
|
+
'editor-submitted': undefined;
|
|
2319
|
+
'user-changed': LocalUser;
|
|
2320
|
+
'sidebar-show': undefined;
|
|
2321
|
+
'sidebar-hide': undefined;
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
declare type ExcludedKeys = FunctionKeys<Config>;
|
|
2325
|
+
|
|
2326
|
+
export declare interface FetchError extends Error {
|
|
2327
|
+
code: number;
|
|
2328
|
+
message: string;
|
|
2329
|
+
data?: any;
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
declare interface FullRequestParams extends Omit<RequestInit, 'body'> {
|
|
2333
|
+
/** set parameter to `true` for call `securityWorker` for this request */
|
|
2334
|
+
secure?: boolean;
|
|
2335
|
+
/** request path */
|
|
2336
|
+
path: string;
|
|
2337
|
+
/** content type of request body */
|
|
2338
|
+
type?: ContentType;
|
|
2339
|
+
/** query params */
|
|
2340
|
+
query?: QueryParamsType;
|
|
2341
|
+
/** format of response (i.e. response.json() -> format: "json") */
|
|
2342
|
+
format?: ResponseFormat;
|
|
2343
|
+
/** request body */
|
|
2344
|
+
body?: unknown;
|
|
2345
|
+
/** base url */
|
|
2346
|
+
baseUrl?: string;
|
|
2347
|
+
/** request cancellation token */
|
|
2348
|
+
cancelToken?: CancelToken;
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
declare type FunctionKeys<T> = Exclude<{
|
|
2352
|
+
[K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? K : never;
|
|
2353
|
+
}[keyof T], undefined>;
|
|
2354
|
+
|
|
2355
|
+
declare type HandlerMap = Record<string, any>;
|
|
2356
|
+
|
|
2357
|
+
declare interface HandlerParamsCaptchaVerify {
|
|
2358
|
+
/** The captcha value to check */
|
|
2359
|
+
value: string;
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
declare interface HandlerParamsCommentCreate {
|
|
2363
|
+
/** The comment content */
|
|
2364
|
+
content: string;
|
|
2365
|
+
/** The comment email */
|
|
2366
|
+
email: string;
|
|
2367
|
+
/** The comment link */
|
|
2368
|
+
link?: string;
|
|
2369
|
+
/** The comment name */
|
|
2370
|
+
name: string;
|
|
2371
|
+
/** The comment page_key */
|
|
2372
|
+
page_key: string;
|
|
2373
|
+
/** The comment page_title */
|
|
2374
|
+
page_title?: string;
|
|
2375
|
+
/** The comment rid */
|
|
2376
|
+
rid?: number;
|
|
2377
|
+
/** The site name of your content scope */
|
|
2378
|
+
site_name: string;
|
|
2379
|
+
/** The comment ua */
|
|
2380
|
+
ua?: string;
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
declare interface HandlerParamsCommentUpdate {
|
|
2384
|
+
/** The comment content */
|
|
2385
|
+
content: string;
|
|
2386
|
+
/** The comment email */
|
|
2387
|
+
email?: string;
|
|
2388
|
+
/** The comment ip */
|
|
2389
|
+
ip?: string;
|
|
2390
|
+
/** The comment is_collapsed */
|
|
2391
|
+
is_collapsed: boolean;
|
|
2392
|
+
/** The comment is_pending */
|
|
2393
|
+
is_pending: boolean;
|
|
2394
|
+
/** The comment is_pinned */
|
|
2395
|
+
is_pinned: boolean;
|
|
2396
|
+
/** The comment link */
|
|
2397
|
+
link?: string;
|
|
2398
|
+
/** The comment nick */
|
|
2399
|
+
nick?: string;
|
|
2400
|
+
/** The comment page_key */
|
|
2401
|
+
page_key: string;
|
|
2402
|
+
/** The comment rid */
|
|
2403
|
+
rid: number;
|
|
2404
|
+
/** The site name of your content scope */
|
|
2405
|
+
site_name: string;
|
|
2406
|
+
/** The comment ua */
|
|
2407
|
+
ua?: string;
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
declare interface HandlerParamsEmailSend {
|
|
2411
|
+
/** The body of email */
|
|
2412
|
+
body: string;
|
|
2413
|
+
/** The subject of email */
|
|
2414
|
+
subject: string;
|
|
2415
|
+
/** The email address of the receiver */
|
|
2416
|
+
to_addr: string;
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
declare interface HandlerParamsNotifyReadAll {
|
|
2420
|
+
/** The user email */
|
|
2421
|
+
email: string;
|
|
2422
|
+
/** The username */
|
|
2423
|
+
name: string;
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
declare interface HandlerParamsPageFetchAll {
|
|
2427
|
+
/** If not empty, only fetch pages of this site */
|
|
2428
|
+
site_name?: string;
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
declare interface HandlerParamsPagePV {
|
|
2432
|
+
/** The page key */
|
|
2433
|
+
page_key: string;
|
|
2434
|
+
/** The page title */
|
|
2435
|
+
page_title?: string;
|
|
2436
|
+
/** The site name of your content scope */
|
|
2437
|
+
site_name?: string;
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
declare interface HandlerParamsPageUpdate {
|
|
2441
|
+
/** Updated page admin_only option */
|
|
2442
|
+
admin_only: boolean;
|
|
2443
|
+
/** Updated page key */
|
|
2444
|
+
key: string;
|
|
2445
|
+
/** The site name of your content scope */
|
|
2446
|
+
site_name: string;
|
|
2447
|
+
/** Updated page title */
|
|
2448
|
+
title: string;
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
declare interface HandlerParamsSettingApply {
|
|
2452
|
+
/** The content of the config file in YAML format */
|
|
2453
|
+
yaml: string;
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
declare interface HandlerParamsSiteCreate {
|
|
2457
|
+
/** The site name */
|
|
2458
|
+
name: string;
|
|
2459
|
+
/** The site urls */
|
|
2460
|
+
urls: string[];
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
declare interface HandlerParamsSiteUpdate {
|
|
2464
|
+
/** Updated site name */
|
|
2465
|
+
name: string;
|
|
2466
|
+
/** Updated site urls */
|
|
2467
|
+
urls: string[];
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
declare interface HandlerParamsTransferImport {
|
|
2471
|
+
/** Automatically answer yes for all questions */
|
|
2472
|
+
assumeyes?: boolean;
|
|
2473
|
+
/** The JSON data */
|
|
2474
|
+
json_data?: string;
|
|
2475
|
+
/** The JSON file path */
|
|
2476
|
+
json_file?: string;
|
|
2477
|
+
/** The target site name */
|
|
2478
|
+
target_site_name?: string;
|
|
2479
|
+
/** The target site url */
|
|
2480
|
+
target_site_url?: string;
|
|
2481
|
+
/** Keep domain */
|
|
2482
|
+
url_keep_domain?: boolean;
|
|
2483
|
+
/** Enable URL resolver */
|
|
2484
|
+
url_resolver?: boolean;
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
declare interface HandlerParamsUserCreate {
|
|
2488
|
+
/** The user badge color (hex format) */
|
|
2489
|
+
badge_color?: string;
|
|
2490
|
+
/** The user badge name */
|
|
2491
|
+
badge_name?: string;
|
|
2492
|
+
/** The user email */
|
|
2493
|
+
email: string;
|
|
2494
|
+
/** The user is an admin */
|
|
2495
|
+
is_admin: boolean;
|
|
2496
|
+
/** The user link */
|
|
2497
|
+
link?: string;
|
|
2498
|
+
/** The user name */
|
|
2499
|
+
name: string;
|
|
2500
|
+
/** The user password */
|
|
2501
|
+
password?: string;
|
|
2502
|
+
/** The user receive email */
|
|
2503
|
+
receive_email: boolean;
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
declare interface HandlerParamsUserLogin {
|
|
2507
|
+
/** The user email */
|
|
2508
|
+
email: string;
|
|
2509
|
+
/** The username */
|
|
2510
|
+
name?: string;
|
|
2511
|
+
/** The user password */
|
|
2512
|
+
password: string;
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
declare interface HandlerParamsUserUpdate {
|
|
2516
|
+
/** The user badge color (hex format) */
|
|
2517
|
+
badge_color?: string;
|
|
2518
|
+
/** The user badge name */
|
|
2519
|
+
badge_name?: string;
|
|
2520
|
+
/** The user email */
|
|
2521
|
+
email: string;
|
|
2522
|
+
/** The user is an admin */
|
|
2523
|
+
is_admin: boolean;
|
|
2524
|
+
/** The user link */
|
|
2525
|
+
link?: string;
|
|
2526
|
+
/** The user name */
|
|
2527
|
+
name: string;
|
|
2528
|
+
/** The user password */
|
|
2529
|
+
password?: string;
|
|
2530
|
+
/** The user receive email */
|
|
2531
|
+
receive_email: boolean;
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
declare interface HandlerParamsVoteCreate {
|
|
2535
|
+
/** The user email */
|
|
2536
|
+
email?: string;
|
|
2537
|
+
/** The username */
|
|
2538
|
+
name?: string;
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
declare interface HandlerRequestAuthDataMergeApply {
|
|
2542
|
+
user_name: string;
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
declare interface HandlerRequestAuthEmailLogin {
|
|
2546
|
+
code?: string;
|
|
2547
|
+
email: string;
|
|
2548
|
+
password?: string;
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
declare interface HandlerRequestAuthEmailRegister {
|
|
2552
|
+
code: string;
|
|
2553
|
+
email: string;
|
|
2554
|
+
link?: string;
|
|
2555
|
+
name?: string;
|
|
2556
|
+
password: string;
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
declare interface HandlerRequestAuthEmailSend {
|
|
2560
|
+
email: string;
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
declare interface HandlerRequestUserInfoUpdate {
|
|
2564
|
+
code?: string;
|
|
2565
|
+
email: string;
|
|
2566
|
+
link?: string;
|
|
2567
|
+
name: string;
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
declare interface HandlerResponseAdminUserList {
|
|
2571
|
+
count: number;
|
|
2572
|
+
users: EntityCookedUserForAdmin[];
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
declare interface HandlerResponseAuthDataMergeApply {
|
|
2576
|
+
deleted_user_count: number;
|
|
2577
|
+
update_comments_count: number;
|
|
2578
|
+
update_notifies_count: number;
|
|
2579
|
+
update_votes_count: number;
|
|
2580
|
+
/** Empty if login user is target user no need to re-login */
|
|
2581
|
+
user_token: string;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
declare interface HandlerResponseAuthDataMergeCheck {
|
|
2585
|
+
need_merge: boolean;
|
|
2586
|
+
user_names: string[];
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
declare interface HandlerResponseCaptchaGet {
|
|
2590
|
+
img_data: string;
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
declare interface HandlerResponseCaptchaStatus {
|
|
2594
|
+
is_pass: boolean;
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
declare interface HandlerResponseCommentCreate {
|
|
2598
|
+
badge_color: string;
|
|
2599
|
+
badge_name: string;
|
|
2600
|
+
content: string;
|
|
2601
|
+
content_marked: string;
|
|
2602
|
+
date: string;
|
|
2603
|
+
email_encrypted: string;
|
|
2604
|
+
id: number;
|
|
2605
|
+
ip_region: string;
|
|
2606
|
+
is_allow_reply: boolean;
|
|
2607
|
+
is_collapsed: boolean;
|
|
2608
|
+
is_pending: boolean;
|
|
2609
|
+
is_pinned: boolean;
|
|
2610
|
+
is_verified: boolean;
|
|
2611
|
+
link: string;
|
|
2612
|
+
nick: string;
|
|
2613
|
+
page_key: string;
|
|
2614
|
+
page_url: string;
|
|
2615
|
+
rid: number;
|
|
2616
|
+
site_name: string;
|
|
2617
|
+
ua: string;
|
|
2618
|
+
user_id: number;
|
|
2619
|
+
visible: boolean;
|
|
2620
|
+
vote_down: number;
|
|
2621
|
+
vote_up: number;
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
declare interface HandlerResponseCommentGet {
|
|
2625
|
+
/** The comment detail */
|
|
2626
|
+
comment: EntityCookedComment;
|
|
2627
|
+
/** The reply comment if exists (like reply) */
|
|
2628
|
+
reply_comment: EntityCookedComment;
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
declare interface HandlerResponseCommentList {
|
|
2632
|
+
comments: EntityCookedComment[];
|
|
2633
|
+
count: number;
|
|
2634
|
+
page: EntityCookedPage;
|
|
2635
|
+
roots_count: number;
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
declare interface HandlerResponseCommentUpdate {
|
|
2639
|
+
badge_color: string;
|
|
2640
|
+
badge_name: string;
|
|
2641
|
+
content: string;
|
|
2642
|
+
content_marked: string;
|
|
2643
|
+
date: string;
|
|
2644
|
+
email_encrypted: string;
|
|
2645
|
+
id: number;
|
|
2646
|
+
ip_region: string;
|
|
2647
|
+
is_allow_reply: boolean;
|
|
2648
|
+
is_collapsed: boolean;
|
|
2649
|
+
is_pending: boolean;
|
|
2650
|
+
is_pinned: boolean;
|
|
2651
|
+
is_verified: boolean;
|
|
2652
|
+
link: string;
|
|
2653
|
+
nick: string;
|
|
2654
|
+
page_key: string;
|
|
2655
|
+
page_url: string;
|
|
2656
|
+
rid: number;
|
|
2657
|
+
site_name: string;
|
|
2658
|
+
ua: string;
|
|
2659
|
+
user_id: number;
|
|
2660
|
+
visible: boolean;
|
|
2661
|
+
vote_down: number;
|
|
2662
|
+
vote_up: number;
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
declare interface HandlerResponseConfAuthProviders {
|
|
2666
|
+
anonymous: boolean;
|
|
2667
|
+
providers: AuthAuthProviderInfo[];
|
|
2668
|
+
}
|
|
2669
|
+
|
|
2670
|
+
declare interface HandlerResponseConfDomain {
|
|
2671
|
+
/** Is the domain trusted */
|
|
2672
|
+
is_trusted: boolean;
|
|
2673
|
+
/** The origin of the domain */
|
|
2674
|
+
origin: string;
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
declare interface HandlerResponseNotifyList {
|
|
2678
|
+
count: number;
|
|
2679
|
+
notifies: EntityCookedNotify[];
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
declare interface HandlerResponsePageFetch {
|
|
2683
|
+
admin_only: boolean;
|
|
2684
|
+
date: string;
|
|
2685
|
+
id: number;
|
|
2686
|
+
key: string;
|
|
2687
|
+
pv: number;
|
|
2688
|
+
site_name: string;
|
|
2689
|
+
title: string;
|
|
2690
|
+
url: string;
|
|
2691
|
+
vote_down: number;
|
|
2692
|
+
vote_up: number;
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2695
|
+
declare interface HandlerResponsePageFetchStatus {
|
|
2696
|
+
/** The number of pages that have been fetched */
|
|
2697
|
+
done: number;
|
|
2698
|
+
/** If the task is in progress */
|
|
2699
|
+
is_progress: boolean;
|
|
2700
|
+
/** The message of the task status */
|
|
2701
|
+
msg: string;
|
|
2702
|
+
/** The total number of pages */
|
|
2703
|
+
total: number;
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
declare interface HandlerResponsePageList {
|
|
2707
|
+
count: number;
|
|
2708
|
+
pages: EntityCookedPage[];
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
declare interface HandlerResponsePagePV {
|
|
2712
|
+
pv: number;
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
declare interface HandlerResponsePageUpdate {
|
|
2716
|
+
admin_only: boolean;
|
|
2717
|
+
date: string;
|
|
2718
|
+
id: number;
|
|
2719
|
+
key: string;
|
|
2720
|
+
pv: number;
|
|
2721
|
+
site_name: string;
|
|
2722
|
+
title: string;
|
|
2723
|
+
url: string;
|
|
2724
|
+
vote_down: number;
|
|
2725
|
+
vote_up: number;
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
declare interface HandlerResponseSettingGet {
|
|
2729
|
+
envs: string[];
|
|
2730
|
+
yaml: string;
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
declare interface HandlerResponseSettingTemplate {
|
|
2734
|
+
yaml: string;
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
declare interface HandlerResponseSiteCreate {
|
|
2738
|
+
first_url: string;
|
|
2739
|
+
id: number;
|
|
2740
|
+
name: string;
|
|
2741
|
+
urls: string[];
|
|
2742
|
+
urls_raw: string;
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
declare interface HandlerResponseSiteList {
|
|
2746
|
+
count: number;
|
|
2747
|
+
sites: EntityCookedSite[];
|
|
2748
|
+
}
|
|
2749
|
+
|
|
2750
|
+
declare interface HandlerResponseSiteUpdate {
|
|
2751
|
+
first_url: string;
|
|
2752
|
+
id: number;
|
|
2753
|
+
name: string;
|
|
2754
|
+
urls: string[];
|
|
2755
|
+
urls_raw: string;
|
|
2756
|
+
}
|
|
2757
|
+
|
|
2758
|
+
declare interface HandlerResponseTransferExport {
|
|
2759
|
+
/** The exported data which is a JSON string */
|
|
2760
|
+
artrans: string;
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
declare interface HandlerResponseTransferUpload {
|
|
2764
|
+
/** The uploaded file name which can be used to import */
|
|
2765
|
+
filename: string;
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
declare interface HandlerResponseUpload {
|
|
2769
|
+
file_name: string;
|
|
2770
|
+
file_type: string;
|
|
2771
|
+
public_url: string;
|
|
2772
|
+
}
|
|
2773
|
+
|
|
2774
|
+
declare interface HandlerResponseUserCreate {
|
|
2775
|
+
badge_color: string;
|
|
2776
|
+
badge_name: string;
|
|
2777
|
+
comment_count: number;
|
|
2778
|
+
email: string;
|
|
2779
|
+
id: number;
|
|
2780
|
+
is_admin: boolean;
|
|
2781
|
+
is_in_conf: boolean;
|
|
2782
|
+
last_ip: string;
|
|
2783
|
+
last_ua: string;
|
|
2784
|
+
link: string;
|
|
2785
|
+
name: string;
|
|
2786
|
+
receive_email: boolean;
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
declare interface HandlerResponseUserInfo {
|
|
2790
|
+
is_login: boolean;
|
|
2791
|
+
notifies: EntityCookedNotify[];
|
|
2792
|
+
notifies_count: number;
|
|
2793
|
+
user: EntityCookedUser;
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
declare interface HandlerResponseUserInfoUpdate {
|
|
2797
|
+
user: EntityCookedUser;
|
|
2798
|
+
}
|
|
2799
|
+
|
|
2800
|
+
declare interface HandlerResponseUserLogin {
|
|
2801
|
+
token: string;
|
|
2802
|
+
user: EntityCookedUser;
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
declare interface HandlerResponseUserStatus {
|
|
2806
|
+
is_admin: boolean;
|
|
2807
|
+
is_login: boolean;
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
declare interface HandlerResponseUserUpdate {
|
|
2811
|
+
badge_color: string;
|
|
2812
|
+
badge_name: string;
|
|
2813
|
+
comment_count: number;
|
|
2814
|
+
email: string;
|
|
2815
|
+
id: number;
|
|
2816
|
+
is_admin: boolean;
|
|
2817
|
+
is_in_conf: boolean;
|
|
2818
|
+
last_ip: string;
|
|
2819
|
+
last_ua: string;
|
|
2820
|
+
link: string;
|
|
2821
|
+
name: string;
|
|
2822
|
+
receive_email: boolean;
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
declare interface HandlerResponseVote {
|
|
2826
|
+
down: number;
|
|
2827
|
+
is_down: boolean;
|
|
2828
|
+
is_up: boolean;
|
|
2829
|
+
up: number;
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
declare class HttpClient<SecurityDataType = unknown> {
|
|
2833
|
+
baseUrl: string;
|
|
2834
|
+
private securityData;
|
|
2835
|
+
private securityWorker?;
|
|
2836
|
+
private abortControllers;
|
|
2837
|
+
private customFetch;
|
|
2838
|
+
private baseApiParams;
|
|
2839
|
+
constructor(apiConfig?: ApiConfig<SecurityDataType>);
|
|
2840
|
+
setSecurityData: (data: SecurityDataType | null) => void;
|
|
2841
|
+
protected encodeQueryParam(key: string, value: any): string;
|
|
2842
|
+
protected addQueryParam(query: QueryParamsType, key: string): string;
|
|
2843
|
+
protected addArrayQueryParam(query: QueryParamsType, key: string): any;
|
|
2844
|
+
protected toQueryString(rawQuery?: QueryParamsType): string;
|
|
2845
|
+
protected addQueryParams(rawQuery?: QueryParamsType): string;
|
|
2846
|
+
private contentFormatters;
|
|
2847
|
+
protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams;
|
|
2848
|
+
protected createAbortSignal: (cancelToken: CancelToken) => AbortSignal | undefined;
|
|
2849
|
+
abortRequest: (cancelToken: CancelToken) => void;
|
|
2850
|
+
request: <T = any, E = any>({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams) => Promise<HttpResponse<T, E>>;
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2853
|
+
declare interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
|
|
2854
|
+
data: D;
|
|
2855
|
+
error: E;
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
export declare type I18n = typeof en;
|
|
2859
|
+
|
|
2860
|
+
export declare type I18nKeys = keyof I18n;
|
|
2861
|
+
|
|
2862
|
+
export declare const init: typeof Artalk.init;
|
|
2863
|
+
|
|
2864
|
+
export declare interface Layer {
|
|
2865
|
+
show: () => void;
|
|
2866
|
+
hide: () => void;
|
|
2867
|
+
destroy: () => void;
|
|
2868
|
+
setOnAfterHide(func: () => void): void;
|
|
2869
|
+
setAllowMaskClose(allow: boolean): void;
|
|
2870
|
+
getAllowMaskClose(): boolean;
|
|
2871
|
+
getEl: () => HTMLElement;
|
|
2872
|
+
}
|
|
2873
|
+
|
|
2874
|
+
export declare interface LayerManager {
|
|
2875
|
+
create(name: string, el?: HTMLElement): Layer;
|
|
2876
|
+
destroy(): void;
|
|
2877
|
+
getEl(): HTMLElement;
|
|
2878
|
+
}
|
|
2879
|
+
|
|
2880
|
+
declare type Lifecycle = 'transient' | 'singleton';
|
|
2881
|
+
|
|
2882
|
+
export declare interface List {
|
|
2883
|
+
getEl: () => HTMLElement;
|
|
2884
|
+
getCommentsWrapEl: () => HTMLElement;
|
|
2885
|
+
getLayout: (arg: {
|
|
2886
|
+
forceFlatMode?: boolean;
|
|
2887
|
+
}) => ListLayout;
|
|
2888
|
+
getCommentNodes: () => CommentNode[];
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
export declare interface ListData {
|
|
2892
|
+
/** 评论数据 */
|
|
2893
|
+
comments: CommentData[];
|
|
2894
|
+
/** 根评论总数 */
|
|
2895
|
+
roots_count: number;
|
|
2896
|
+
/** 评论总数(包括所有子评论) */
|
|
2897
|
+
count: number;
|
|
2898
|
+
/** 页面信息 */
|
|
2899
|
+
page: PageData;
|
|
2900
|
+
}
|
|
2901
|
+
|
|
2902
|
+
export declare interface ListErrorData {
|
|
2903
|
+
msg: string;
|
|
2904
|
+
data?: any;
|
|
2905
|
+
}
|
|
2906
|
+
|
|
2907
|
+
export declare interface ListFetchedArgs {
|
|
2908
|
+
params: Partial<ListFetchParams>;
|
|
2909
|
+
data?: ListData;
|
|
2910
|
+
error?: ListErrorData;
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
export declare interface ListFetchParams {
|
|
2914
|
+
offset: number;
|
|
2915
|
+
limit: number;
|
|
2916
|
+
flatMode: boolean;
|
|
2917
|
+
paramsModifier?: (p: any) => void;
|
|
2918
|
+
onSuccess?: (data: ListData) => void;
|
|
2919
|
+
onError?: (err: any) => void;
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
export declare interface ListLastFetchData {
|
|
2923
|
+
params: ListFetchParams;
|
|
2924
|
+
data?: ListData;
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2927
|
+
export declare interface ListLayout {
|
|
2928
|
+
import: (comments: CommentData[]) => void;
|
|
2929
|
+
insert: (comment: CommentData, replyComment?: CommentData) => void;
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
export declare const loadCountWidget: typeof Artalk.loadCountWidget;
|
|
2933
|
+
|
|
2934
|
+
/**
|
|
2935
|
+
* Local User Data (in localStorage)
|
|
2936
|
+
*
|
|
2937
|
+
* @note Keep flat for easy handling
|
|
2938
|
+
*/
|
|
2939
|
+
export declare interface LocalUser {
|
|
2940
|
+
/** Username (aka. Nickname) */
|
|
2941
|
+
name: string;
|
|
2942
|
+
/** Email */
|
|
2943
|
+
email: string;
|
|
2944
|
+
/** Link (aka. Website) */
|
|
2945
|
+
link: string;
|
|
2946
|
+
/** Token (for authorization) */
|
|
2947
|
+
token: string;
|
|
2948
|
+
/** Admin flag */
|
|
2949
|
+
is_admin: boolean;
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2952
|
+
export declare interface NotifyData {
|
|
2953
|
+
/** 通知 ID */
|
|
2954
|
+
id: number;
|
|
2955
|
+
/** 用户 ID */
|
|
2956
|
+
user_id: number;
|
|
2957
|
+
/** 评论 ID */
|
|
2958
|
+
comment_id: number;
|
|
2959
|
+
/** 是否已读 */
|
|
2960
|
+
is_read: boolean;
|
|
2961
|
+
/** 是否已发送邮件通知 */
|
|
2962
|
+
is_emailed: boolean;
|
|
2963
|
+
/** 标为已读地址 */
|
|
2964
|
+
read_link: string;
|
|
2965
|
+
}
|
|
2966
|
+
|
|
2967
|
+
export declare type NotifyLevel = 'i' | 's' | 'w' | 'e';
|
|
2968
|
+
|
|
2969
|
+
export declare interface PageData {
|
|
2970
|
+
/** 页面 ID */
|
|
2971
|
+
id: number;
|
|
2972
|
+
/** 页面唯一标识符 */
|
|
2973
|
+
key: string;
|
|
2974
|
+
/** 页面标题 */
|
|
2975
|
+
title: string;
|
|
2976
|
+
/** 页面 url */
|
|
2977
|
+
url: string;
|
|
2978
|
+
/** 仅管理员可评 */
|
|
2979
|
+
admin_only: boolean;
|
|
2980
|
+
/** 站点名(用于隔离) */
|
|
2981
|
+
site_name: string;
|
|
2982
|
+
/** 赞同数 */
|
|
2983
|
+
vote_up: number;
|
|
2984
|
+
/** 反对数 */
|
|
2985
|
+
vote_down: number;
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
declare type PayloadKey = keyof ApiHandlerPayload;
|
|
2989
|
+
|
|
2990
|
+
declare class PluginManager implements EditorPluginManager {
|
|
2991
|
+
opts: PluginManagerOptions;
|
|
2992
|
+
private plugins;
|
|
2993
|
+
private openedPlug;
|
|
2994
|
+
private events;
|
|
2995
|
+
constructor(opts: PluginManagerOptions);
|
|
2996
|
+
getPlugins(): EditorPlugin[];
|
|
2997
|
+
getEvents(): EventManager_2<EditorEventPayloadMap>;
|
|
2998
|
+
getEditor(): Editor;
|
|
2999
|
+
getOptions(): PluginManagerOptions;
|
|
3000
|
+
private clear;
|
|
3001
|
+
private loadPluginUI;
|
|
3002
|
+
/** Load the plug btn and plug panel on editor ui */
|
|
3003
|
+
private loadPluginItem;
|
|
3004
|
+
get<T extends typeof EditorPlugin>(plug: T): InstanceType<T> | undefined;
|
|
3005
|
+
/** Open the editor plug panel */
|
|
3006
|
+
openPluginPanel(plug: EditorPlugin): void;
|
|
3007
|
+
/** Close the editor plugin panel */
|
|
3008
|
+
closePluginPanel(): void;
|
|
3009
|
+
/** Get the content which is transformed by plugs */
|
|
3010
|
+
getTransformedContent(rawContent: string): string;
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
declare interface PluginManagerOptions {
|
|
3014
|
+
getArtalkRootEl: () => HTMLElement;
|
|
3015
|
+
getEditor: () => Editor;
|
|
3016
|
+
getConf: () => ConfigManager;
|
|
3017
|
+
getUser: () => UserManager;
|
|
3018
|
+
getApi: () => Api;
|
|
3019
|
+
getData: () => DataManager;
|
|
3020
|
+
getCheckers: () => CheckerManager;
|
|
3021
|
+
onSubmitted: () => void;
|
|
3022
|
+
}
|
|
3023
|
+
|
|
3024
|
+
/**
|
|
3025
|
+
* PlugKit provides a set of methods to help you develop editor plug
|
|
3026
|
+
*/
|
|
3027
|
+
declare class PlugKit {
|
|
3028
|
+
private plugins;
|
|
3029
|
+
constructor(plugins: PluginManager);
|
|
3030
|
+
/** Use the editor */
|
|
3031
|
+
useEditor(): Editor;
|
|
3032
|
+
/** Use the config of Artalk */
|
|
3033
|
+
useConf(): Config;
|
|
3034
|
+
/** Use the http api client */
|
|
3035
|
+
useApi(): Api;
|
|
3036
|
+
/** Use the data manager */
|
|
3037
|
+
useData(): DataManager;
|
|
3038
|
+
/** Use the user manager */
|
|
3039
|
+
useUser(): UserManager;
|
|
3040
|
+
/** Use the checkers */
|
|
3041
|
+
useCheckers(): CheckerManager;
|
|
3042
|
+
/** Use the ui of editor */
|
|
3043
|
+
useUI(): EditorUI;
|
|
3044
|
+
/** Use the events in editor scope */
|
|
3045
|
+
useEvents(): EventManager_2<EditorEventPayloadMap>;
|
|
3046
|
+
/** Listen the event when plug is mounted */
|
|
3047
|
+
useMounted(func: () => void): void;
|
|
3048
|
+
/** Listen the event when plug is unmounted */
|
|
3049
|
+
useUnmounted(func: () => void): void;
|
|
3050
|
+
/** Use the deps of other plug */
|
|
3051
|
+
useDeps<T extends typeof EditorPlugin>(plug: T): InstanceType<T> | undefined;
|
|
3052
|
+
/** Use the root element of artalk */
|
|
3053
|
+
useArtalkRootEl(): HTMLElement;
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
declare type PrimitiveKey = string | number | symbol;
|
|
3057
|
+
|
|
3058
|
+
declare interface ProvideFuncOptions {
|
|
3059
|
+
/** Lifecycle (default: 'singleton') */
|
|
3060
|
+
lifecycle?: Lifecycle;
|
|
3061
|
+
}
|
|
3062
|
+
|
|
3063
|
+
declare type QueryParamsType = Record<string | number, any>;
|
|
3064
|
+
|
|
3065
|
+
declare class Render {
|
|
3066
|
+
comment: CommentNode;
|
|
3067
|
+
get data(): CommentData;
|
|
3068
|
+
get opts(): CommentOptions;
|
|
3069
|
+
$el: HTMLElement;
|
|
3070
|
+
$main: HTMLElement;
|
|
3071
|
+
$header: HTMLElement;
|
|
3072
|
+
$headerNick: HTMLElement;
|
|
3073
|
+
$headerBadgeWrap: HTMLElement;
|
|
3074
|
+
$body: HTMLElement;
|
|
3075
|
+
$content: HTMLElement;
|
|
3076
|
+
$childrenWrap: HTMLElement | null;
|
|
3077
|
+
$actions: HTMLElement;
|
|
3078
|
+
voteBtnUp?: ActionBtn;
|
|
3079
|
+
voteBtnDown?: ActionBtn;
|
|
3080
|
+
$replyTo?: HTMLElement;
|
|
3081
|
+
$replyAt?: HTMLElement;
|
|
3082
|
+
constructor(comment: CommentNode);
|
|
3083
|
+
/**
|
|
3084
|
+
* Render the comment ui
|
|
3085
|
+
*
|
|
3086
|
+
* If comment data is updated, call this method to re-render the comment ui.
|
|
3087
|
+
* The method will be called multiple times, so it should be idempotent.
|
|
3088
|
+
*
|
|
3089
|
+
* Renders may add event listeners to the comment ui, so it should be called only once or override the original.
|
|
3090
|
+
* Please be aware of the memory leak caused by the event listener.
|
|
3091
|
+
*/
|
|
3092
|
+
render(): HTMLElement;
|
|
3093
|
+
/** 内容限高检测 */
|
|
3094
|
+
checkHeightLimit(): void;
|
|
3095
|
+
/** 子评论区域移除限高 */
|
|
3096
|
+
heightLimitRemoveForChildren(): void;
|
|
3097
|
+
/** 渐出动画 */
|
|
3098
|
+
playFadeAnim(): void;
|
|
3099
|
+
/** 渐出动画 · 评论内容区域 */
|
|
3100
|
+
playFadeAnimForBody(): void;
|
|
3101
|
+
/** Perform the flash animation */
|
|
3102
|
+
playFlashAnim(): void;
|
|
3103
|
+
/** 获取子评论 Wrap */
|
|
3104
|
+
getChildrenWrap(): HTMLElement;
|
|
3105
|
+
/** 设置已读 */
|
|
3106
|
+
setUnread(val: boolean): void;
|
|
3107
|
+
/** 设置为可点击的评论 */
|
|
3108
|
+
setOpenable(val: boolean): void;
|
|
3109
|
+
/** 设置点击评论打开置顶 URL */
|
|
3110
|
+
setOpenURL(url: string): void;
|
|
3111
|
+
/** 设置点击评论时的操作 */
|
|
3112
|
+
setOpenAction(action: () => void): void;
|
|
3113
|
+
}
|
|
3114
|
+
|
|
3115
|
+
declare type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
|
|
3116
|
+
|
|
3117
|
+
declare type RequiredExcept<T, K extends keyof T> = Required<Omit<T, K>> & Pick<T, K>;
|
|
3118
|
+
|
|
3119
|
+
declare type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
|
|
3120
|
+
|
|
3121
|
+
declare const Sel: {
|
|
3122
|
+
$header: string;
|
|
3123
|
+
$name: string;
|
|
3124
|
+
$email: string;
|
|
3125
|
+
$link: string;
|
|
3126
|
+
$textareaWrap: string;
|
|
3127
|
+
$textarea: string;
|
|
3128
|
+
$bottom: string;
|
|
3129
|
+
$submitBtn: string;
|
|
3130
|
+
$notifyWrap: string;
|
|
3131
|
+
$bottomLeft: string;
|
|
3132
|
+
$stateWrap: string;
|
|
3133
|
+
$plugBtnWrap: string;
|
|
3134
|
+
$plugPanelWrap: string;
|
|
3135
|
+
};
|
|
3136
|
+
|
|
3137
|
+
export declare interface Services {
|
|
3138
|
+
config: ConfigManager;
|
|
3139
|
+
events: EventManager;
|
|
3140
|
+
data: DataManager;
|
|
3141
|
+
api: Api;
|
|
3142
|
+
apiHandlers: ApiHandlers;
|
|
3143
|
+
editor: Editor;
|
|
3144
|
+
editorPlugs: EditorPluginManager | undefined;
|
|
3145
|
+
list: List;
|
|
3146
|
+
sidebar: SidebarLayer;
|
|
3147
|
+
checkers: CheckerManager;
|
|
3148
|
+
layers: LayerManager;
|
|
3149
|
+
user: UserManager;
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
declare type Services_2 = {
|
|
3153
|
+
[key: PrimitiveKey]: any;
|
|
3154
|
+
};
|
|
3155
|
+
|
|
3156
|
+
export declare interface SidebarLayer {
|
|
3157
|
+
onUserChanged: () => void;
|
|
3158
|
+
show: (conf?: SidebarShowPayload) => void;
|
|
3159
|
+
hide: () => void;
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
export declare interface SidebarShowPayload {
|
|
3163
|
+
view?: 'comments' | 'sites' | 'pages' | 'transfer';
|
|
3164
|
+
}
|
|
3165
|
+
|
|
3166
|
+
export declare interface SiteData {
|
|
3167
|
+
/** 站点 ID */
|
|
3168
|
+
id: number;
|
|
3169
|
+
/** 站点名 */
|
|
3170
|
+
name: string;
|
|
3171
|
+
/** 站点 URLs */
|
|
3172
|
+
urls: string[];
|
|
3173
|
+
/** 站点 URLs(原始字符串) */
|
|
3174
|
+
urls_raw: string;
|
|
3175
|
+
/** 站点主 URL */
|
|
3176
|
+
first_url: string;
|
|
3177
|
+
}
|
|
3178
|
+
|
|
3179
|
+
export declare const use: typeof Artalk.use;
|
|
3180
|
+
|
|
3181
|
+
export declare interface UserData {
|
|
3182
|
+
/** 用户 ID */
|
|
3183
|
+
id: number;
|
|
3184
|
+
/** 用户名 */
|
|
3185
|
+
name: string;
|
|
3186
|
+
/** 邮箱 */
|
|
3187
|
+
email: string;
|
|
3188
|
+
/** 链接 */
|
|
3189
|
+
link: string;
|
|
3190
|
+
/** 徽章名称 */
|
|
3191
|
+
badge_name: string;
|
|
3192
|
+
/** 徽章颜色 */
|
|
3193
|
+
badge_color: string;
|
|
3194
|
+
/** 是否属于管理员 */
|
|
3195
|
+
is_admin: boolean;
|
|
3196
|
+
/** 是否允许接收邮件通知 */
|
|
3197
|
+
receive_email: boolean;
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
export declare interface UserDataForAdmin extends UserData {
|
|
3201
|
+
/** 最后一次操作 IP */
|
|
3202
|
+
last_ip: string;
|
|
3203
|
+
/** 最后一次操作 UA */
|
|
3204
|
+
last_ua: string;
|
|
3205
|
+
/** 是否存在于配置文件中 */
|
|
3206
|
+
is_in_conf: boolean;
|
|
3207
|
+
/** 评论数 */
|
|
3208
|
+
comment_count: number;
|
|
3209
|
+
}
|
|
3210
|
+
|
|
3211
|
+
export declare interface UserInfoApiResponseData {
|
|
3212
|
+
user?: UserData;
|
|
3213
|
+
is_login: boolean;
|
|
3214
|
+
notifies: NotifyData[];
|
|
3215
|
+
notifies_count: number;
|
|
3216
|
+
}
|
|
3217
|
+
|
|
3218
|
+
export declare interface UserManager {
|
|
3219
|
+
getData: () => LocalUser;
|
|
3220
|
+
update: (dta: Partial<LocalUser>) => void;
|
|
3221
|
+
logout: () => void;
|
|
3222
|
+
checkHasBasicUserInfo: () => boolean;
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3225
|
+
export { }
|