artalk 2.7.3 → 2.8.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/dist/Artalk.cjs +10 -1
- package/dist/Artalk.cjs.map +1 -1
- package/dist/Artalk.css +1 -1
- package/dist/Artalk.iife.js +10 -1
- package/dist/Artalk.iife.js.map +1 -1
- package/dist/Artalk.js +10 -1
- package/dist/Artalk.js.map +1 -1
- package/dist/Artalk.mjs +2791 -2074
- package/dist/Artalk.mjs.map +1 -1
- package/dist/ArtalkLite.cjs +10 -1
- package/dist/ArtalkLite.cjs.map +1 -1
- package/dist/ArtalkLite.css +1 -1
- package/dist/ArtalkLite.iife.js +10 -1
- package/dist/ArtalkLite.iife.js.map +1 -1
- package/dist/ArtalkLite.js +10 -1
- package/dist/ArtalkLite.js.map +1 -1
- package/dist/ArtalkLite.mjs +2458 -1542
- package/dist/ArtalkLite.mjs.map +1 -1
- package/dist/i18n/jp.cjs +1 -1
- package/dist/i18n/jp.js +1 -1
- package/dist/i18n/jp.mjs +44 -43
- package/dist/i18n/zh-TW.cjs +1 -1
- package/dist/i18n/zh-TW.js +1 -1
- package/dist/i18n/zh-TW.mjs +12 -11
- package/dist/main.d.cts +1788 -395
- package/dist/main.d.ts +1788 -395
- package/package.json +3 -3
package/dist/main.d.cts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { marked } from 'marked';
|
|
2
2
|
|
|
3
|
-
declare type AC = {
|
|
4
|
-
[K in keyof TC]: InstanceType<TC[K]>;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
3
|
/**
|
|
8
4
|
* 通用操作按钮
|
|
9
5
|
*/
|
|
@@ -55,49 +51,1009 @@ declare interface ActionBtnOptions {
|
|
|
55
51
|
confirmText?: string;
|
|
56
52
|
}
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*/
|
|
61
|
-
declare class AdminApi extends ApiBase {
|
|
62
|
-
/** 缓存清除 */
|
|
63
|
-
cacheFlushAll(): Promise<unknown>;
|
|
64
|
-
/** 缓存预热 */
|
|
65
|
-
cacheWarmUp(): Promise<unknown>;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
declare class Api {
|
|
54
|
+
declare class Api extends Api_2<void> {
|
|
55
|
+
private _opts;
|
|
69
56
|
constructor(opts: ApiOptions);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
declare interface Api extends AC {
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
declare abstract class ApiBase {
|
|
76
|
-
protected options: ApiOptions;
|
|
77
|
-
constructor(options: ApiOptions);
|
|
78
|
-
protected POST<T>(path: string, data?: {
|
|
79
|
-
[key: string]: any;
|
|
80
|
-
}): Promise<T>;
|
|
81
|
-
protected Fetch(path: string, init: RequestInit, timeout?: number): Promise<any>;
|
|
82
57
|
/**
|
|
83
|
-
*
|
|
58
|
+
* Get user info as params for request
|
|
84
59
|
*
|
|
85
|
-
* @param params Request params
|
|
86
60
|
* @returns Request params with user info
|
|
87
61
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
62
|
+
getUserFields(): {
|
|
63
|
+
name: string;
|
|
64
|
+
email: string;
|
|
65
|
+
} | undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @title Artalk API
|
|
70
|
+
* @version 2.0
|
|
71
|
+
* @license MIT (https://github.com/ArtalkJS/Artalk/blob/master/LICENSE)
|
|
72
|
+
* @baseUrl /api/v2
|
|
73
|
+
* @contact API Support <artalkjs@gmail.com> (https://artalk.js.org)
|
|
74
|
+
*
|
|
75
|
+
* Artalk is a modern comment system based on Golang.
|
|
76
|
+
*/
|
|
77
|
+
declare class Api_2<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
78
|
+
cache: {
|
|
79
|
+
/**
|
|
80
|
+
* @description Flush all cache on the server
|
|
81
|
+
*
|
|
82
|
+
* @tags Cache
|
|
83
|
+
* @name FlushCache
|
|
84
|
+
* @summary Flush Cache
|
|
85
|
+
* @request POST:/cache/flush
|
|
86
|
+
* @secure
|
|
87
|
+
* @response `200` `(HandlerMap & {
|
|
88
|
+
msg?: string,
|
|
89
|
+
|
|
90
|
+
})` OK
|
|
91
|
+
* @response `400` `(HandlerMap & {
|
|
92
|
+
msg?: string,
|
|
93
|
+
|
|
94
|
+
})` Bad Request
|
|
95
|
+
* @response `403` `(HandlerMap & {
|
|
96
|
+
msg?: string,
|
|
97
|
+
|
|
98
|
+
})` Forbidden
|
|
99
|
+
*/
|
|
100
|
+
flushCache: (params?: RequestParams) => Promise<HttpResponse<HandlerMap & {
|
|
101
|
+
msg?: string | undefined;
|
|
102
|
+
}, HandlerMap & {
|
|
103
|
+
msg?: string | undefined;
|
|
104
|
+
}>>;
|
|
105
|
+
/**
|
|
106
|
+
* @description Cache warming helps you to pre-load the cache to improve the performance of the first request
|
|
107
|
+
*
|
|
108
|
+
* @tags Cache
|
|
109
|
+
* @name WarmUpCache
|
|
110
|
+
* @summary Warm-Up Cache
|
|
111
|
+
* @request POST:/cache/warm_up
|
|
112
|
+
* @secure
|
|
113
|
+
* @response `200` `(HandlerMap & {
|
|
114
|
+
msg?: string,
|
|
115
|
+
|
|
116
|
+
})` OK
|
|
117
|
+
* @response `400` `(HandlerMap & {
|
|
118
|
+
msg?: string,
|
|
119
|
+
|
|
120
|
+
})` Bad Request
|
|
121
|
+
* @response `403` `(HandlerMap & {
|
|
122
|
+
msg?: string,
|
|
123
|
+
|
|
124
|
+
})` Forbidden
|
|
125
|
+
*/
|
|
126
|
+
warmUpCache: (params?: RequestParams) => Promise<HttpResponse<HandlerMap & {
|
|
127
|
+
msg?: string | undefined;
|
|
128
|
+
}, HandlerMap & {
|
|
129
|
+
msg?: string | undefined;
|
|
130
|
+
}>>;
|
|
131
|
+
};
|
|
132
|
+
captcha: {
|
|
133
|
+
/**
|
|
134
|
+
* @description Get a base64 encoded captcha image or a HTML page to verify for user
|
|
135
|
+
*
|
|
136
|
+
* @tags Captcha
|
|
137
|
+
* @name GetCaptcha
|
|
138
|
+
* @summary Get Captcha
|
|
139
|
+
* @request GET:/captcha
|
|
140
|
+
* @response `200` `HandlerResponseCaptchaGet` OK
|
|
141
|
+
* @response `500` `(HandlerMap & {
|
|
142
|
+
msg?: string,
|
|
143
|
+
|
|
144
|
+
})` Internal Server Error
|
|
145
|
+
*/
|
|
146
|
+
getCaptcha: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseCaptchaGet, HandlerMap & {
|
|
147
|
+
msg?: string | undefined;
|
|
148
|
+
}>>;
|
|
149
|
+
/**
|
|
150
|
+
* @description Get the status of the user's captcha verification
|
|
151
|
+
*
|
|
152
|
+
* @tags Captcha
|
|
153
|
+
* @name GetCaptchaStatus
|
|
154
|
+
* @summary Get Captcha Status
|
|
155
|
+
* @request GET:/captcha/status
|
|
156
|
+
* @response `200` `HandlerResponseCaptchaStatus` OK
|
|
157
|
+
*/
|
|
158
|
+
getCaptchaStatus: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseCaptchaStatus, any>>;
|
|
159
|
+
/**
|
|
160
|
+
* @description Verify user enters correct captcha code
|
|
161
|
+
*
|
|
162
|
+
* @tags Captcha
|
|
163
|
+
* @name VerifyCaptcha
|
|
164
|
+
* @summary Verify Captcha
|
|
165
|
+
* @request POST:/captcha/verify
|
|
166
|
+
* @response `200` `HandlerMap` OK
|
|
167
|
+
* @response `403` `(HandlerMap & {
|
|
168
|
+
img_data?: string,
|
|
169
|
+
|
|
170
|
+
})` Forbidden
|
|
171
|
+
*/
|
|
172
|
+
verifyCaptcha: (data: HandlerParamsCaptchaVerify, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
173
|
+
img_data?: string | undefined;
|
|
174
|
+
}>>;
|
|
175
|
+
};
|
|
176
|
+
comments: {
|
|
177
|
+
/**
|
|
178
|
+
* @description Get a list of comments by some conditions
|
|
179
|
+
*
|
|
180
|
+
* @tags Comment
|
|
181
|
+
* @name GetComments
|
|
182
|
+
* @summary Get Comment List
|
|
183
|
+
* @request GET:/comments
|
|
184
|
+
* @secure
|
|
185
|
+
* @response `200` `HandlerResponseCommentList` OK
|
|
186
|
+
* @response `500` `(HandlerMap & {
|
|
187
|
+
msg?: string,
|
|
188
|
+
|
|
189
|
+
})` Internal Server Error
|
|
190
|
+
*/
|
|
191
|
+
getComments: (query: {
|
|
192
|
+
/** The user email */
|
|
193
|
+
email?: string;
|
|
194
|
+
/** Enable flat_mode */
|
|
195
|
+
flat_mode?: boolean;
|
|
196
|
+
/** The limit for pagination */
|
|
197
|
+
limit?: number;
|
|
198
|
+
/** The username */
|
|
199
|
+
name?: string;
|
|
200
|
+
/** The offset for pagination */
|
|
201
|
+
offset?: number;
|
|
202
|
+
/** The comment page_key */
|
|
203
|
+
page_key: string;
|
|
204
|
+
/** The scope of comments */
|
|
205
|
+
scope?: 'page' | 'user' | 'site';
|
|
206
|
+
/** Search keywords */
|
|
207
|
+
search?: string;
|
|
208
|
+
/** The site name of your content scope */
|
|
209
|
+
site_name?: string;
|
|
210
|
+
/** Sort by condition */
|
|
211
|
+
sort_by?: 'date_asc' | 'date_desc' | 'vote';
|
|
212
|
+
/** Message center show type */
|
|
213
|
+
type?: 'all' | 'mentions' | 'mine' | 'pending';
|
|
214
|
+
/** Only show comments by admin */
|
|
215
|
+
view_only_admin?: boolean;
|
|
216
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentList, HandlerMap & {
|
|
217
|
+
msg?: string | undefined;
|
|
218
|
+
}>>;
|
|
219
|
+
/**
|
|
220
|
+
* @description Create a new comment
|
|
221
|
+
*
|
|
222
|
+
* @tags Comment
|
|
223
|
+
* @name CreateComment
|
|
224
|
+
* @summary Create Comment
|
|
225
|
+
* @request POST:/comments
|
|
226
|
+
* @secure
|
|
227
|
+
* @response `200` `HandlerResponseCommentCreate` OK
|
|
228
|
+
* @response `400` `(HandlerMap & {
|
|
229
|
+
msg?: string,
|
|
230
|
+
|
|
231
|
+
})` Bad Request
|
|
232
|
+
* @response `500` `(HandlerMap & {
|
|
233
|
+
msg?: string,
|
|
234
|
+
|
|
235
|
+
})` Internal Server Error
|
|
236
|
+
*/
|
|
237
|
+
createComment: (comment: HandlerParamsCommentCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentCreate, HandlerMap & {
|
|
238
|
+
msg?: string | undefined;
|
|
239
|
+
}>>;
|
|
240
|
+
/**
|
|
241
|
+
* @description Get the detail of a comment by comment id
|
|
242
|
+
*
|
|
243
|
+
* @tags Comment
|
|
244
|
+
* @name GetComment
|
|
245
|
+
* @summary Get a comment
|
|
246
|
+
* @request GET:/comments/{id}
|
|
247
|
+
* @response `200` `HandlerResponseCommentGet` OK
|
|
248
|
+
* @response `404` `(HandlerMap & {
|
|
249
|
+
msg?: string,
|
|
250
|
+
|
|
251
|
+
})` Not Found
|
|
252
|
+
* @response `500` `(HandlerMap & {
|
|
253
|
+
msg?: string,
|
|
254
|
+
|
|
255
|
+
})` Internal Server Error
|
|
256
|
+
*/
|
|
257
|
+
getComment: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentGet, HandlerMap & {
|
|
258
|
+
msg?: string | undefined;
|
|
259
|
+
}>>;
|
|
260
|
+
/**
|
|
261
|
+
* @description Update a specific comment
|
|
262
|
+
*
|
|
263
|
+
* @tags Comment
|
|
264
|
+
* @name UpdateComment
|
|
265
|
+
* @summary Update Comment
|
|
266
|
+
* @request PUT:/comments/{id}
|
|
267
|
+
* @secure
|
|
268
|
+
* @response `200` `HandlerResponseCommentUpdate` OK
|
|
269
|
+
* @response `400` `(HandlerMap & {
|
|
270
|
+
msg?: string,
|
|
271
|
+
|
|
272
|
+
})` Bad Request
|
|
273
|
+
* @response `403` `(HandlerMap & {
|
|
274
|
+
msg?: string,
|
|
275
|
+
|
|
276
|
+
})` Forbidden
|
|
277
|
+
* @response `404` `(HandlerMap & {
|
|
278
|
+
msg?: string,
|
|
279
|
+
|
|
280
|
+
})` Not Found
|
|
281
|
+
* @response `500` `(HandlerMap & {
|
|
282
|
+
msg?: string,
|
|
283
|
+
|
|
284
|
+
})` Internal Server Error
|
|
285
|
+
*/
|
|
286
|
+
updateComment: (id: number, comment: HandlerParamsCommentUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentUpdate, HandlerMap & {
|
|
287
|
+
msg?: string | undefined;
|
|
288
|
+
}>>;
|
|
289
|
+
/**
|
|
290
|
+
* @description Delete a specific comment
|
|
291
|
+
*
|
|
292
|
+
* @tags Comment
|
|
293
|
+
* @name DeleteComment
|
|
294
|
+
* @summary Delete Comment
|
|
295
|
+
* @request DELETE:/comments/{id}
|
|
296
|
+
* @secure
|
|
297
|
+
* @response `200` `HandlerMap` OK
|
|
298
|
+
* @response `403` `(HandlerMap & {
|
|
299
|
+
msg?: string,
|
|
300
|
+
|
|
301
|
+
})` Forbidden
|
|
302
|
+
* @response `404` `(HandlerMap & {
|
|
303
|
+
msg?: string,
|
|
304
|
+
|
|
305
|
+
})` Not Found
|
|
306
|
+
* @response `500` `(HandlerMap & {
|
|
307
|
+
msg?: string,
|
|
308
|
+
|
|
309
|
+
})` Internal Server Error
|
|
310
|
+
*/
|
|
311
|
+
deleteComment: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
312
|
+
msg?: string | undefined;
|
|
313
|
+
}>>;
|
|
314
|
+
};
|
|
315
|
+
conf: {
|
|
316
|
+
/**
|
|
317
|
+
* @description Get System Configs for UI
|
|
318
|
+
*
|
|
319
|
+
* @tags System
|
|
320
|
+
* @name Conf
|
|
321
|
+
* @summary Get System Configs
|
|
322
|
+
* @request GET:/conf
|
|
323
|
+
* @response `200` `CommonConfData` OK
|
|
324
|
+
*/
|
|
325
|
+
conf: (params?: RequestParams) => Promise<HttpResponse<CommonConfData, any>>;
|
|
326
|
+
};
|
|
327
|
+
notifies: {
|
|
328
|
+
/**
|
|
329
|
+
* @description Get a list of notifies for user
|
|
330
|
+
*
|
|
331
|
+
* @tags Notify
|
|
332
|
+
* @name GetNotifies
|
|
333
|
+
* @summary Get Notifies
|
|
334
|
+
* @request GET:/notifies
|
|
335
|
+
* @response `200` `HandlerResponseNotifyList` OK
|
|
336
|
+
* @response `400` `(HandlerMap & {
|
|
337
|
+
msg?: string,
|
|
338
|
+
|
|
339
|
+
})` Bad Request
|
|
340
|
+
* @response `500` `(HandlerMap & {
|
|
341
|
+
msg?: string,
|
|
342
|
+
|
|
343
|
+
})` Internal Server Error
|
|
344
|
+
*/
|
|
345
|
+
getNotifies: (query: {
|
|
346
|
+
/** The user email */
|
|
347
|
+
email: string;
|
|
348
|
+
/** The user name */
|
|
349
|
+
name: string;
|
|
350
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseNotifyList, HandlerMap & {
|
|
351
|
+
msg?: string | undefined;
|
|
352
|
+
}>>;
|
|
353
|
+
/**
|
|
354
|
+
* @description Mark all notifies as read for user
|
|
355
|
+
*
|
|
356
|
+
* @tags Notify
|
|
357
|
+
* @name MarkAllNotifyRead
|
|
358
|
+
* @summary Mark All Notifies as Read
|
|
359
|
+
* @request POST:/notifies/read
|
|
360
|
+
* @response `200` `HandlerMap` OK
|
|
361
|
+
* @response `400` `(HandlerMap & {
|
|
362
|
+
msg?: string,
|
|
363
|
+
|
|
364
|
+
})` Bad Request
|
|
365
|
+
* @response `500` `(HandlerMap & {
|
|
366
|
+
msg?: string,
|
|
367
|
+
|
|
368
|
+
})` Internal Server Error
|
|
369
|
+
*/
|
|
370
|
+
markAllNotifyRead: (options: HandlerParamsNotifyReadAll, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
371
|
+
msg?: string | undefined;
|
|
372
|
+
}>>;
|
|
373
|
+
/**
|
|
374
|
+
* @description Mark specific notification as read for user
|
|
375
|
+
*
|
|
376
|
+
* @tags Notify
|
|
377
|
+
* @name MarkNotifyRead
|
|
378
|
+
* @summary Mark Notify as Read
|
|
379
|
+
* @request POST:/notifies/{comment_id}/{notify_key}
|
|
380
|
+
* @response `200` `HandlerMap` OK
|
|
381
|
+
* @response `400` `(HandlerMap & {
|
|
382
|
+
msg?: string,
|
|
383
|
+
|
|
384
|
+
})` Bad Request
|
|
385
|
+
* @response `404` `(HandlerMap & {
|
|
386
|
+
msg?: string,
|
|
387
|
+
|
|
388
|
+
})` Not Found
|
|
389
|
+
* @response `500` `(HandlerMap & {
|
|
390
|
+
msg?: string,
|
|
391
|
+
|
|
392
|
+
})` Internal Server Error
|
|
393
|
+
*/
|
|
394
|
+
markNotifyRead: (commentId: number, notifyKey: string, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
395
|
+
msg?: string | undefined;
|
|
396
|
+
}>>;
|
|
397
|
+
};
|
|
398
|
+
pages: {
|
|
399
|
+
/**
|
|
400
|
+
* @description Get a list of pages by some conditions
|
|
401
|
+
*
|
|
402
|
+
* @tags Page
|
|
403
|
+
* @name GetPages
|
|
404
|
+
* @summary Get Page List
|
|
405
|
+
* @request GET:/pages
|
|
406
|
+
* @secure
|
|
407
|
+
* @response `200` `HandlerResponsePageList` OK
|
|
408
|
+
* @response `403` `(HandlerMap & {
|
|
409
|
+
msg?: string,
|
|
410
|
+
|
|
411
|
+
})` Forbidden
|
|
412
|
+
*/
|
|
413
|
+
getPages: (query?: {
|
|
414
|
+
/** The limit for pagination */
|
|
415
|
+
limit?: number;
|
|
416
|
+
/** The offset for pagination */
|
|
417
|
+
offset?: number;
|
|
418
|
+
/** The site name of your content scope */
|
|
419
|
+
site_name?: string;
|
|
420
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageList, HandlerMap & {
|
|
421
|
+
msg?: string | undefined;
|
|
422
|
+
}>>;
|
|
423
|
+
/**
|
|
424
|
+
* @description Fetch the data of all pages
|
|
425
|
+
*
|
|
426
|
+
* @tags Page
|
|
427
|
+
* @name FetchAllPages
|
|
428
|
+
* @summary Fetch All Pages Data
|
|
429
|
+
* @request POST:/pages/fetch
|
|
430
|
+
* @secure
|
|
431
|
+
* @response `200` `HandlerMap` OK
|
|
432
|
+
* @response `400` `(HandlerMap & {
|
|
433
|
+
msg?: string,
|
|
434
|
+
|
|
435
|
+
})` Bad Request
|
|
436
|
+
* @response `500` `(HandlerMap & {
|
|
437
|
+
msg?: string,
|
|
438
|
+
|
|
439
|
+
})` Internal Server Error
|
|
440
|
+
*/
|
|
441
|
+
fetchAllPages: (options: HandlerParamsPageFetchAll, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
442
|
+
msg?: string | undefined;
|
|
443
|
+
}>>;
|
|
444
|
+
/**
|
|
445
|
+
* @description Get the status of the task of fetching all pages
|
|
446
|
+
*
|
|
447
|
+
* @tags Page
|
|
448
|
+
* @name GetPageFetchStatus
|
|
449
|
+
* @summary Get Pages Fetch Status
|
|
450
|
+
* @request GET:/pages/fetch/status
|
|
451
|
+
* @secure
|
|
452
|
+
* @response `200` `HandlerResponsePageFetchStatus` OK
|
|
453
|
+
*/
|
|
454
|
+
getPageFetchStatus: (params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageFetchStatus, any>>;
|
|
455
|
+
/**
|
|
456
|
+
* @description Increase and get the number of page views
|
|
457
|
+
*
|
|
458
|
+
* @tags Page
|
|
459
|
+
* @name LogPv
|
|
460
|
+
* @summary Increase Page Views (PV)
|
|
461
|
+
* @request POST:/pages/pv
|
|
462
|
+
* @response `200` `HandlerResponsePagePV` OK
|
|
463
|
+
*/
|
|
464
|
+
logPv: (page: HandlerParamsPagePV, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePagePV, any>>;
|
|
465
|
+
/**
|
|
466
|
+
* @description Update a specific page
|
|
467
|
+
*
|
|
468
|
+
* @tags Page
|
|
469
|
+
* @name UpdatePage
|
|
470
|
+
* @summary Update Page
|
|
471
|
+
* @request PUT:/pages/{id}
|
|
472
|
+
* @secure
|
|
473
|
+
* @response `200` `HandlerResponsePageUpdate` OK
|
|
474
|
+
* @response `400` `(HandlerMap & {
|
|
475
|
+
msg?: string,
|
|
476
|
+
|
|
477
|
+
})` Bad Request
|
|
478
|
+
* @response `403` `(HandlerMap & {
|
|
479
|
+
msg?: string,
|
|
480
|
+
|
|
481
|
+
})` Forbidden
|
|
482
|
+
* @response `404` `(HandlerMap & {
|
|
483
|
+
msg?: string,
|
|
484
|
+
|
|
485
|
+
})` Not Found
|
|
486
|
+
* @response `500` `(HandlerMap & {
|
|
487
|
+
msg?: string,
|
|
488
|
+
|
|
489
|
+
})` Internal Server Error
|
|
490
|
+
*/
|
|
491
|
+
updatePage: (id: number, page: HandlerParamsPageUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageUpdate, HandlerMap & {
|
|
492
|
+
msg?: string | undefined;
|
|
493
|
+
}>>;
|
|
494
|
+
/**
|
|
495
|
+
* @description Delete a specific page
|
|
496
|
+
*
|
|
497
|
+
* @tags Page
|
|
498
|
+
* @name DeletePage
|
|
499
|
+
* @summary Delete Page
|
|
500
|
+
* @request DELETE:/pages/{id}
|
|
501
|
+
* @secure
|
|
502
|
+
* @response `200` `HandlerMap` OK
|
|
503
|
+
* @response `403` `(HandlerMap & {
|
|
504
|
+
msg?: string,
|
|
505
|
+
|
|
506
|
+
})` Forbidden
|
|
507
|
+
* @response `404` `(HandlerMap & {
|
|
508
|
+
msg?: string,
|
|
509
|
+
|
|
510
|
+
})` Not Found
|
|
511
|
+
* @response `500` `(HandlerMap & {
|
|
512
|
+
msg?: string,
|
|
513
|
+
|
|
514
|
+
})` Internal Server Error
|
|
515
|
+
*/
|
|
516
|
+
deletePage: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
517
|
+
msg?: string | undefined;
|
|
518
|
+
}>>;
|
|
519
|
+
/**
|
|
520
|
+
* @description Fetch the data of a specific page
|
|
521
|
+
*
|
|
522
|
+
* @tags Page
|
|
523
|
+
* @name FetchPage
|
|
524
|
+
* @summary Fetch Page Data
|
|
525
|
+
* @request POST:/pages/{id}/fetch
|
|
526
|
+
* @secure
|
|
527
|
+
* @response `200` `HandlerResponsePageFetch` OK
|
|
528
|
+
* @response `404` `(HandlerMap & {
|
|
529
|
+
msg?: string,
|
|
530
|
+
|
|
531
|
+
})` Not Found
|
|
532
|
+
* @response `500` `(HandlerMap & {
|
|
533
|
+
msg?: string,
|
|
534
|
+
|
|
535
|
+
})` Internal Server Error
|
|
536
|
+
*/
|
|
537
|
+
fetchPage: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageFetch, HandlerMap & {
|
|
538
|
+
msg?: string | undefined;
|
|
539
|
+
}>>;
|
|
540
|
+
};
|
|
541
|
+
sendEmail: {
|
|
542
|
+
/**
|
|
543
|
+
* @description Send an email to test the email sender
|
|
544
|
+
*
|
|
545
|
+
* @tags System
|
|
546
|
+
* @name SendEmail
|
|
547
|
+
* @summary Send Email
|
|
548
|
+
* @request POST:/send_email
|
|
549
|
+
* @secure
|
|
550
|
+
* @response `200` `HandlerMap` OK
|
|
551
|
+
* @response `403` `(HandlerMap & {
|
|
552
|
+
msg?: string,
|
|
553
|
+
|
|
554
|
+
})` Forbidden
|
|
555
|
+
* @response `500` `HandlerMap` Internal Server Error
|
|
556
|
+
*/
|
|
557
|
+
sendEmail: (email: HandlerParamsEmailSend, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap | (HandlerMap & {
|
|
558
|
+
msg?: string | undefined;
|
|
559
|
+
})>>;
|
|
560
|
+
};
|
|
561
|
+
settings: {
|
|
562
|
+
/**
|
|
563
|
+
* @description Get settings from app config file
|
|
564
|
+
*
|
|
565
|
+
* @tags System
|
|
566
|
+
* @name GetSettings
|
|
567
|
+
* @summary Get Settings
|
|
568
|
+
* @request GET:/settings
|
|
569
|
+
* @secure
|
|
570
|
+
* @response `200` `HandlerResponseSettingGet` OK
|
|
571
|
+
* @response `403` `(HandlerMap & {
|
|
572
|
+
msg?: string,
|
|
573
|
+
|
|
574
|
+
})` Forbidden
|
|
575
|
+
* @response `500` `(HandlerMap & {
|
|
576
|
+
msg?: string,
|
|
577
|
+
|
|
578
|
+
})` Internal Server Error
|
|
579
|
+
*/
|
|
580
|
+
getSettings: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseSettingGet, HandlerMap & {
|
|
581
|
+
msg?: string | undefined;
|
|
582
|
+
}>>;
|
|
583
|
+
/**
|
|
584
|
+
* @description Apply settings and restart the server
|
|
585
|
+
*
|
|
586
|
+
* @tags System
|
|
587
|
+
* @name ApplySettings
|
|
588
|
+
* @summary Save and apply Settings
|
|
589
|
+
* @request PUT:/settings
|
|
590
|
+
* @secure
|
|
591
|
+
* @response `200` `HandlerMap` OK
|
|
592
|
+
* @response `403` `(HandlerMap & {
|
|
593
|
+
msg?: string,
|
|
594
|
+
|
|
595
|
+
})` Forbidden
|
|
596
|
+
* @response `500` `(HandlerMap & {
|
|
597
|
+
msg?: string,
|
|
598
|
+
|
|
599
|
+
})` Internal Server Error
|
|
600
|
+
*/
|
|
601
|
+
applySettings: (settings: HandlerParamsSettingApply, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
602
|
+
msg?: string | undefined;
|
|
603
|
+
}>>;
|
|
604
|
+
/**
|
|
605
|
+
* @description Get config templates in different languages for rendering the settings page in the frontend
|
|
606
|
+
*
|
|
607
|
+
* @tags System
|
|
608
|
+
* @name GetSettingsTemplate
|
|
609
|
+
* @summary Get Settings Template
|
|
610
|
+
* @request GET:/settings/template/{locale}
|
|
611
|
+
* @secure
|
|
612
|
+
* @response `200` `HandlerResponseSettingTemplate` OK
|
|
613
|
+
*/
|
|
614
|
+
getSettingsTemplate: (locale: string, params?: RequestParams) => Promise<HttpResponse<HandlerResponseSettingTemplate, any>>;
|
|
615
|
+
};
|
|
616
|
+
sites: {
|
|
617
|
+
/**
|
|
618
|
+
* @description Get a list of sites by some conditions
|
|
619
|
+
*
|
|
620
|
+
* @tags Site
|
|
621
|
+
* @name GetSites
|
|
622
|
+
* @summary Get Site List
|
|
623
|
+
* @request GET:/sites
|
|
624
|
+
* @secure
|
|
625
|
+
* @response `200` `HandlerResponseSiteList` OK
|
|
626
|
+
*/
|
|
627
|
+
getSites: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseSiteList, any>>;
|
|
628
|
+
/**
|
|
629
|
+
* @description Create a new site
|
|
630
|
+
*
|
|
631
|
+
* @tags Site
|
|
632
|
+
* @name CreateSite
|
|
633
|
+
* @summary Create Site
|
|
634
|
+
* @request POST:/sites
|
|
635
|
+
* @secure
|
|
636
|
+
* @response `200` `HandlerResponseSiteCreate` OK
|
|
637
|
+
* @response `400` `(HandlerMap & {
|
|
638
|
+
msg?: string,
|
|
639
|
+
|
|
640
|
+
})` Bad Request
|
|
641
|
+
* @response `403` `(HandlerMap & {
|
|
642
|
+
msg?: string,
|
|
643
|
+
|
|
644
|
+
})` Forbidden
|
|
645
|
+
* @response `500` `(HandlerMap & {
|
|
646
|
+
msg?: string,
|
|
647
|
+
|
|
648
|
+
})` Internal Server Error
|
|
649
|
+
*/
|
|
650
|
+
createSite: (site: HandlerParamsSiteCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseSiteCreate, HandlerMap & {
|
|
651
|
+
msg?: string | undefined;
|
|
652
|
+
}>>;
|
|
653
|
+
/**
|
|
654
|
+
* @description Update a specific site
|
|
655
|
+
*
|
|
656
|
+
* @tags Site
|
|
657
|
+
* @name UpdateSite
|
|
658
|
+
* @summary Update Site
|
|
659
|
+
* @request PUT:/sites/{id}
|
|
660
|
+
* @secure
|
|
661
|
+
* @response `200` `HandlerResponseSiteUpdate` OK
|
|
662
|
+
*/
|
|
663
|
+
updateSite: (id: number, site: HandlerParamsSiteUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseSiteUpdate, any>>;
|
|
664
|
+
/**
|
|
665
|
+
* @description Delete a specific site
|
|
666
|
+
*
|
|
667
|
+
* @tags Site
|
|
668
|
+
* @name DeleteSite
|
|
669
|
+
* @summary Site Delete
|
|
670
|
+
* @request DELETE:/sites/{id}
|
|
671
|
+
* @secure
|
|
672
|
+
* @response `200` `HandlerMap` OK
|
|
673
|
+
* @response `403` `(HandlerMap & {
|
|
674
|
+
msg?: string,
|
|
675
|
+
|
|
676
|
+
})` Forbidden
|
|
677
|
+
* @response `404` `(HandlerMap & {
|
|
678
|
+
msg?: string,
|
|
679
|
+
|
|
680
|
+
})` Not Found
|
|
681
|
+
* @response `500` `(HandlerMap & {
|
|
682
|
+
msg?: string,
|
|
683
|
+
|
|
684
|
+
})` Internal Server Error
|
|
685
|
+
*/
|
|
686
|
+
deleteSite: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
687
|
+
msg?: string | undefined;
|
|
688
|
+
}>>;
|
|
689
|
+
};
|
|
690
|
+
stats: {
|
|
691
|
+
/**
|
|
692
|
+
* @description Get the statistics of various data analysis
|
|
693
|
+
*
|
|
694
|
+
* @tags Statistic
|
|
695
|
+
* @name GetStats
|
|
696
|
+
* @summary Statistic
|
|
697
|
+
* @request GET:/stats/{type}
|
|
698
|
+
* @response `200` `CommonJSONResult` OK
|
|
699
|
+
* @response `400` `(HandlerMap & {
|
|
700
|
+
msg?: string,
|
|
701
|
+
|
|
702
|
+
})` Bad Request
|
|
703
|
+
* @response `403` `(HandlerMap & {
|
|
704
|
+
msg?: string,
|
|
705
|
+
|
|
706
|
+
})` Forbidden
|
|
707
|
+
* @response `404` `(HandlerMap & {
|
|
708
|
+
msg?: string,
|
|
709
|
+
|
|
710
|
+
})` Not Found
|
|
711
|
+
* @response `500` `(HandlerMap & {
|
|
712
|
+
msg?: string,
|
|
713
|
+
|
|
714
|
+
})` Internal Server Error
|
|
715
|
+
*/
|
|
716
|
+
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?: {
|
|
717
|
+
/** The limit for pagination */
|
|
718
|
+
limit?: number;
|
|
719
|
+
/** multiple page keys separated by commas */
|
|
720
|
+
page_keys?: string;
|
|
721
|
+
/** The site name of your content scope */
|
|
722
|
+
site_name?: string;
|
|
723
|
+
}, params?: RequestParams) => Promise<HttpResponse<CommonJSONResult, HandlerMap & {
|
|
724
|
+
msg?: string | undefined;
|
|
725
|
+
}>>;
|
|
726
|
+
};
|
|
727
|
+
transfer: {
|
|
728
|
+
/**
|
|
729
|
+
* @description Export data from Artalk
|
|
730
|
+
*
|
|
731
|
+
* @tags Transfer
|
|
732
|
+
* @name ExportArtrans
|
|
733
|
+
* @summary Export Artrans
|
|
734
|
+
* @request GET:/transfer/export
|
|
735
|
+
* @secure
|
|
736
|
+
* @response `200` `HandlerResponseTransferExport` OK
|
|
737
|
+
* @response `500` `(HandlerMap & {
|
|
738
|
+
msg?: string,
|
|
739
|
+
|
|
740
|
+
})` Internal Server Error
|
|
741
|
+
*/
|
|
742
|
+
exportArtrans: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseTransferExport, HandlerMap & {
|
|
743
|
+
msg?: string | undefined;
|
|
744
|
+
}>>;
|
|
745
|
+
/**
|
|
746
|
+
* @description Import data to Artalk
|
|
747
|
+
*
|
|
748
|
+
* @tags Transfer
|
|
749
|
+
* @name ImportArtrans
|
|
750
|
+
* @summary Import Artrans
|
|
751
|
+
* @request POST:/transfer/import
|
|
752
|
+
* @secure
|
|
753
|
+
* @response `200` `string` OK
|
|
754
|
+
*/
|
|
755
|
+
importArtrans: (data: HandlerParamsTransferImport, params?: RequestParams) => Promise<HttpResponse<string, any>>;
|
|
756
|
+
/**
|
|
757
|
+
* @description Upload a file to prepare to import
|
|
758
|
+
*
|
|
759
|
+
* @tags Transfer
|
|
760
|
+
* @name UploadArtrans
|
|
761
|
+
* @summary Upload Artrans
|
|
762
|
+
* @request POST:/transfer/upload
|
|
763
|
+
* @secure
|
|
764
|
+
* @response `200` `(HandlerResponseTransferUpload & {
|
|
765
|
+
filename?: string,
|
|
766
|
+
|
|
767
|
+
})` OK
|
|
768
|
+
* @response `500` `(HandlerMap & {
|
|
769
|
+
msg?: string,
|
|
770
|
+
|
|
771
|
+
})` Internal Server Error
|
|
772
|
+
*/
|
|
773
|
+
uploadArtrans: (data: {
|
|
774
|
+
/**
|
|
775
|
+
* Upload file in preparation for import task
|
|
776
|
+
* @format binary
|
|
777
|
+
*/
|
|
778
|
+
file: File;
|
|
779
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseTransferUpload & {
|
|
780
|
+
filename?: string | undefined;
|
|
781
|
+
}, HandlerMap & {
|
|
782
|
+
msg?: string | undefined;
|
|
783
|
+
}>>;
|
|
784
|
+
};
|
|
785
|
+
upload: {
|
|
786
|
+
/**
|
|
787
|
+
* @description Upload file from this endpoint
|
|
788
|
+
*
|
|
789
|
+
* @tags Upload
|
|
790
|
+
* @name Upload
|
|
791
|
+
* @summary Upload
|
|
792
|
+
* @request POST:/upload
|
|
793
|
+
* @secure
|
|
794
|
+
* @response `200` `HandlerResponseUpload` OK
|
|
795
|
+
* @response `400` `(HandlerMap & {
|
|
796
|
+
msg?: string,
|
|
797
|
+
|
|
798
|
+
})` Bad Request
|
|
799
|
+
* @response `403` `(HandlerMap & {
|
|
800
|
+
msg?: string,
|
|
801
|
+
|
|
802
|
+
})` Forbidden
|
|
803
|
+
* @response `500` `(HandlerMap & {
|
|
804
|
+
msg?: string,
|
|
805
|
+
|
|
806
|
+
})` Internal Server Error
|
|
807
|
+
*/
|
|
808
|
+
upload: (data: {
|
|
809
|
+
/**
|
|
810
|
+
* Upload file
|
|
811
|
+
* @format binary
|
|
812
|
+
*/
|
|
813
|
+
file: File;
|
|
814
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUpload, HandlerMap & {
|
|
815
|
+
msg?: string | undefined;
|
|
816
|
+
}>>;
|
|
817
|
+
};
|
|
818
|
+
user: {
|
|
819
|
+
/**
|
|
820
|
+
* @description Get user info to prepare for login or check current user status
|
|
821
|
+
*
|
|
822
|
+
* @tags Account
|
|
823
|
+
* @name GetUser
|
|
824
|
+
* @summary Get User Info
|
|
825
|
+
* @request GET:/user
|
|
826
|
+
* @secure
|
|
827
|
+
* @response `200` `HandlerResponseUserInfo` OK
|
|
828
|
+
* @response `400` `(HandlerMap & {
|
|
829
|
+
msg?: string,
|
|
830
|
+
|
|
831
|
+
})` Bad Request
|
|
832
|
+
*/
|
|
833
|
+
getUser: (query?: {
|
|
834
|
+
/** The user email */
|
|
835
|
+
email?: string;
|
|
836
|
+
/** The username */
|
|
837
|
+
name?: string;
|
|
838
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserInfo, HandlerMap & {
|
|
839
|
+
msg?: string | undefined;
|
|
840
|
+
}>>;
|
|
841
|
+
/**
|
|
842
|
+
* @description Login user by name or email
|
|
843
|
+
*
|
|
844
|
+
* @tags Account
|
|
845
|
+
* @name Login
|
|
846
|
+
* @summary Get Access Token
|
|
847
|
+
* @request POST:/user/access_token
|
|
848
|
+
* @response `200` `HandlerResponseUserLogin` OK
|
|
849
|
+
* @response `400` `(HandlerMap & {
|
|
850
|
+
" data"?: {
|
|
851
|
+
need_name_select?: (string)[],
|
|
852
|
+
|
|
853
|
+
},
|
|
854
|
+
msg?: string,
|
|
855
|
+
|
|
856
|
+
})` Multiple users with the same email address are matched
|
|
857
|
+
* @response `403` `(HandlerMap & {
|
|
858
|
+
msg?: string,
|
|
859
|
+
|
|
860
|
+
})` Forbidden
|
|
861
|
+
* @response `500` `(HandlerMap & {
|
|
862
|
+
msg?: string,
|
|
863
|
+
|
|
864
|
+
})` Internal Server Error
|
|
865
|
+
*/
|
|
866
|
+
login: (user: HandlerParamsUserLogin, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserLogin, (HandlerMap & {
|
|
867
|
+
' data'?: {
|
|
868
|
+
need_name_select?: string[] | undefined;
|
|
869
|
+
} | undefined;
|
|
870
|
+
msg?: string | undefined;
|
|
871
|
+
}) | (HandlerMap & {
|
|
872
|
+
msg?: string | undefined;
|
|
873
|
+
})>>;
|
|
874
|
+
/**
|
|
875
|
+
* @description Get user login status by header Authorization
|
|
876
|
+
*
|
|
877
|
+
* @tags Account
|
|
878
|
+
* @name GetUserStatus
|
|
879
|
+
* @summary Get Login Status
|
|
880
|
+
* @request GET:/user/status
|
|
881
|
+
* @secure
|
|
882
|
+
* @response `200` `HandlerResponseUserStatus` OK
|
|
883
|
+
*/
|
|
884
|
+
getUserStatus: (query?: {
|
|
885
|
+
/** The user email */
|
|
886
|
+
email?: string;
|
|
887
|
+
/** The username */
|
|
888
|
+
name?: string;
|
|
889
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserStatus, any>>;
|
|
890
|
+
};
|
|
891
|
+
users: {
|
|
892
|
+
/**
|
|
893
|
+
* @description Create a new user
|
|
894
|
+
*
|
|
895
|
+
* @tags User
|
|
896
|
+
* @name CreateUser
|
|
897
|
+
* @summary Create User
|
|
898
|
+
* @request POST:/users
|
|
899
|
+
* @secure
|
|
900
|
+
* @response `200` `HandlerResponseUserCreate` OK
|
|
901
|
+
* @response `400` `(HandlerMap & {
|
|
902
|
+
msg?: string,
|
|
903
|
+
|
|
904
|
+
})` Bad Request
|
|
905
|
+
* @response `403` `(HandlerMap & {
|
|
906
|
+
msg?: string,
|
|
907
|
+
|
|
908
|
+
})` Forbidden
|
|
909
|
+
* @response `500` `(HandlerMap & {
|
|
910
|
+
msg?: string,
|
|
911
|
+
|
|
912
|
+
})` Internal Server Error
|
|
913
|
+
*/
|
|
914
|
+
createUser: (user: HandlerParamsUserCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserCreate, HandlerMap & {
|
|
915
|
+
msg?: string | undefined;
|
|
916
|
+
}>>;
|
|
917
|
+
/**
|
|
918
|
+
* @description Update a specific user
|
|
919
|
+
*
|
|
920
|
+
* @tags User
|
|
921
|
+
* @name UpdateUser
|
|
922
|
+
* @summary Update User
|
|
923
|
+
* @request PUT:/users/{id}
|
|
924
|
+
* @secure
|
|
925
|
+
* @response `200` `HandlerResponseUserUpdate` OK
|
|
926
|
+
* @response `400` `(HandlerMap & {
|
|
927
|
+
msg?: string,
|
|
928
|
+
|
|
929
|
+
})` Bad Request
|
|
930
|
+
* @response `403` `(HandlerMap & {
|
|
931
|
+
msg?: string,
|
|
932
|
+
|
|
933
|
+
})` Forbidden
|
|
934
|
+
* @response `404` `(HandlerMap & {
|
|
935
|
+
msg?: string,
|
|
936
|
+
|
|
937
|
+
})` Not Found
|
|
938
|
+
* @response `500` `(HandlerMap & {
|
|
939
|
+
msg?: string,
|
|
940
|
+
|
|
941
|
+
})` Internal Server Error
|
|
942
|
+
*/
|
|
943
|
+
updateUser: (id: number, user: HandlerParamsUserUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserUpdate, HandlerMap & {
|
|
944
|
+
msg?: string | undefined;
|
|
945
|
+
}>>;
|
|
946
|
+
/**
|
|
947
|
+
* @description Delete a specific user
|
|
948
|
+
*
|
|
949
|
+
* @tags User
|
|
950
|
+
* @name DeleteUser
|
|
951
|
+
* @summary Delete User
|
|
952
|
+
* @request DELETE:/users/{id}
|
|
953
|
+
* @secure
|
|
954
|
+
* @response `200` `HandlerMap` OK
|
|
955
|
+
* @response `403` `(HandlerMap & {
|
|
956
|
+
msg?: string,
|
|
957
|
+
|
|
958
|
+
})` Forbidden
|
|
959
|
+
* @response `404` `(HandlerMap & {
|
|
960
|
+
msg?: string,
|
|
961
|
+
|
|
962
|
+
})` Not Found
|
|
963
|
+
* @response `500` `(HandlerMap & {
|
|
964
|
+
msg?: string,
|
|
965
|
+
|
|
966
|
+
})` Internal Server Error
|
|
967
|
+
*/
|
|
968
|
+
deleteUser: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
969
|
+
msg?: string | undefined;
|
|
970
|
+
}>>;
|
|
971
|
+
/**
|
|
972
|
+
* @description Get a list of users by some conditions
|
|
973
|
+
*
|
|
974
|
+
* @tags User
|
|
975
|
+
* @name GetUsers
|
|
976
|
+
* @summary Get User List
|
|
977
|
+
* @request GET:/users/{type}
|
|
978
|
+
* @secure
|
|
979
|
+
* @response `200` `HandlerResponseAdminUserList` OK
|
|
980
|
+
* @response `403` `(HandlerMap & {
|
|
981
|
+
msg?: string,
|
|
982
|
+
|
|
983
|
+
})` Forbidden
|
|
984
|
+
*/
|
|
985
|
+
getUsers: (type?: 'all' | 'admin' | 'in_conf', query?: {
|
|
986
|
+
/** The limit for pagination */
|
|
987
|
+
limit?: number;
|
|
988
|
+
/** The offset for pagination */
|
|
989
|
+
offset?: number;
|
|
990
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseAdminUserList, HandlerMap & {
|
|
991
|
+
msg?: string | undefined;
|
|
992
|
+
}>>;
|
|
993
|
+
};
|
|
994
|
+
version: {
|
|
995
|
+
/**
|
|
996
|
+
* @description Get the version of Artalk
|
|
997
|
+
*
|
|
998
|
+
* @tags System
|
|
999
|
+
* @name GetVersion
|
|
1000
|
+
* @summary Get Version Info
|
|
1001
|
+
* @request GET:/version
|
|
1002
|
+
* @response `200` `CommonApiVersionData` OK
|
|
1003
|
+
*/
|
|
1004
|
+
getVersion: (params?: RequestParams) => Promise<HttpResponse<CommonApiVersionData, any>>;
|
|
1005
|
+
};
|
|
1006
|
+
votes: {
|
|
1007
|
+
/**
|
|
1008
|
+
* @description Sync the number of votes in the `comments` or `pages` data tables to keep them the same as the `votes` table
|
|
1009
|
+
*
|
|
1010
|
+
* @tags Vote
|
|
1011
|
+
* @name SyncVotes
|
|
1012
|
+
* @summary Sync Vote Data
|
|
1013
|
+
* @request POST:/votes/sync
|
|
1014
|
+
* @secure
|
|
1015
|
+
* @response `200` `HandlerMap` OK
|
|
1016
|
+
* @response `403` `(HandlerMap & {
|
|
1017
|
+
msg?: string,
|
|
1018
|
+
|
|
1019
|
+
})` Forbidden
|
|
1020
|
+
*/
|
|
1021
|
+
syncVotes: (params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
1022
|
+
msg?: string | undefined;
|
|
1023
|
+
}>>;
|
|
1024
|
+
/**
|
|
1025
|
+
* @description Vote for a specific comment or page
|
|
1026
|
+
*
|
|
1027
|
+
* @tags Vote
|
|
1028
|
+
* @name Vote
|
|
1029
|
+
* @summary Vote
|
|
1030
|
+
* @request POST:/votes/{type}/{target_id}
|
|
1031
|
+
* @response `200` `HandlerResponseVote` OK
|
|
1032
|
+
* @response `403` `(HandlerMap & {
|
|
1033
|
+
msg?: string,
|
|
1034
|
+
|
|
1035
|
+
})` Forbidden
|
|
1036
|
+
* @response `404` `(HandlerMap & {
|
|
1037
|
+
msg?: string,
|
|
1038
|
+
|
|
1039
|
+
})` Not Found
|
|
1040
|
+
* @response `500` `(HandlerMap & {
|
|
1041
|
+
msg?: string,
|
|
1042
|
+
|
|
1043
|
+
})` Internal Server Error
|
|
1044
|
+
*/
|
|
1045
|
+
vote: (type: 'comment_up' | 'comment_down' | 'page_up' | 'page_down', targetId: number, vote: HandlerParamsVote, params?: RequestParams) => Promise<HttpResponse<HandlerResponseVote, HandlerMap & {
|
|
1046
|
+
msg?: string | undefined;
|
|
1047
|
+
}>>;
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
declare interface ApiConfig<SecurityDataType = unknown> {
|
|
1052
|
+
baseUrl?: string;
|
|
1053
|
+
baseApiParams?: Omit<RequestParams, 'baseUrl' | 'cancelToken' | 'signal'>;
|
|
1054
|
+
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
|
|
1055
|
+
customFetch?: typeof fetch;
|
|
1056
|
+
}
|
|
101
1057
|
|
|
102
1058
|
declare interface ApiOptions {
|
|
103
1059
|
baseURL: string;
|
|
@@ -105,23 +1061,18 @@ declare interface ApiOptions {
|
|
|
105
1061
|
pageKey: string;
|
|
106
1062
|
pageTitle: string;
|
|
107
1063
|
timeout?: number;
|
|
108
|
-
|
|
1064
|
+
getApiToken?: () => string | undefined;
|
|
109
1065
|
userInfo?: {
|
|
110
1066
|
name: string;
|
|
111
1067
|
email: string;
|
|
112
1068
|
};
|
|
113
1069
|
onNeedCheckCaptcha?: (payload: {
|
|
114
|
-
recall: () => void;
|
|
115
|
-
reject: () => void;
|
|
116
1070
|
data: {
|
|
117
|
-
imgData
|
|
118
|
-
iframe
|
|
1071
|
+
imgData?: string;
|
|
1072
|
+
iframe?: string;
|
|
119
1073
|
};
|
|
120
|
-
}) => void
|
|
121
|
-
onNeedCheckAdmin?: (payload: {
|
|
122
|
-
recall: () => void;
|
|
123
|
-
reject: () => void;
|
|
124
|
-
}) => void;
|
|
1074
|
+
}) => Promise<void>;
|
|
1075
|
+
onNeedCheckAdmin?: (payload: {}) => Promise<void>;
|
|
125
1076
|
}
|
|
126
1077
|
|
|
127
1078
|
export declare interface ApiVersionData {
|
|
@@ -133,12 +1084,6 @@ export declare interface ApiVersionData {
|
|
|
133
1084
|
commit_hash: string;
|
|
134
1085
|
}
|
|
135
1086
|
|
|
136
|
-
declare interface ApiVersionInfo {
|
|
137
|
-
app: string;
|
|
138
|
-
version: string;
|
|
139
|
-
commit_hash: string;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
1087
|
/**
|
|
143
1088
|
* Artalk
|
|
144
1089
|
*
|
|
@@ -272,6 +1217,7 @@ export declare interface ArtalkConfig {
|
|
|
272
1217
|
listUnreadHighlight?: boolean;
|
|
273
1218
|
scrollRelativeTo?: () => HTMLElement;
|
|
274
1219
|
immediateFetch?: boolean;
|
|
1220
|
+
pvAdd?: boolean;
|
|
275
1221
|
}
|
|
276
1222
|
|
|
277
1223
|
export declare type ArtalkPlugin = (ctx: ContextApi) => void;
|
|
@@ -296,9 +1242,13 @@ declare namespace ArtalkType {
|
|
|
296
1242
|
ListLastFetchData,
|
|
297
1243
|
DataManagerApi,
|
|
298
1244
|
NotifyLevel,
|
|
1245
|
+
UserInfoApiResponseData,
|
|
1246
|
+
FetchError,
|
|
299
1247
|
ContextApi,
|
|
300
1248
|
EditorState,
|
|
301
1249
|
EditorApi,
|
|
1250
|
+
ListErrorData,
|
|
1251
|
+
ListFetchedArgs,
|
|
302
1252
|
EventPayloadMap,
|
|
303
1253
|
ArtalkPlugin,
|
|
304
1254
|
SidebarShowPayload
|
|
@@ -306,27 +1256,15 @@ declare namespace ArtalkType {
|
|
|
306
1256
|
}
|
|
307
1257
|
export { ArtalkType }
|
|
308
1258
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
declare class CaptchaApi extends ApiBase {
|
|
313
|
-
/** 验证码 · 获取 */
|
|
314
|
-
captchaGet(): Promise<string>;
|
|
315
|
-
/** 验证码 · 检验 */
|
|
316
|
-
captchaCheck(value: string): Promise<string>;
|
|
317
|
-
/** 验证码 · 状态 */
|
|
318
|
-
captchaStatus(): Promise<{
|
|
319
|
-
is_pass: boolean;
|
|
320
|
-
}>;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
declare interface Checker {
|
|
1259
|
+
declare type CancelToken = Symbol | string | number;
|
|
1260
|
+
|
|
1261
|
+
declare interface Checker<T = any> {
|
|
324
1262
|
el?: HTMLElement;
|
|
325
1263
|
inputType?: 'password' | 'text';
|
|
326
1264
|
body: (checker: CheckerCtx) => HTMLElement;
|
|
327
|
-
request: (checker: CheckerCtx, inputVal: string) => Promise<
|
|
328
|
-
onSuccess?: (checker: CheckerCtx, respData:
|
|
329
|
-
onError?: (checker: CheckerCtx,
|
|
1265
|
+
request: (checker: CheckerCtx, inputVal: string) => Promise<T>;
|
|
1266
|
+
onSuccess?: (checker: CheckerCtx, respData: T, inputVal: string, formEl: HTMLElement) => void;
|
|
1267
|
+
onError?: (checker: CheckerCtx, errData: any, inputVal: string, formEl: HTMLElement) => void;
|
|
330
1268
|
}
|
|
331
1269
|
|
|
332
1270
|
declare interface CheckerCaptchaPayload extends CheckerPayload {
|
|
@@ -351,21 +1289,20 @@ declare interface CheckerCtx {
|
|
|
351
1289
|
declare class CheckerLauncher {
|
|
352
1290
|
private opts;
|
|
353
1291
|
constructor(opts: CheckerLauncherOptions);
|
|
354
|
-
checkCaptcha(payload: CheckerCaptchaPayload)
|
|
355
|
-
checkAdmin(payload: CheckerPayload)
|
|
1292
|
+
checkCaptcha: ((payload: CheckerCaptchaPayload) => Promise<void>);
|
|
1293
|
+
checkAdmin: ((payload: CheckerPayload) => Promise<void>);
|
|
356
1294
|
fire(checker: Checker, payload: CheckerPayload, postFire?: (c: CheckerCtx) => void): void;
|
|
357
|
-
private close;
|
|
358
1295
|
}
|
|
359
1296
|
|
|
360
1297
|
declare interface CheckerLauncherOptions {
|
|
361
1298
|
getCtx: () => ContextApi;
|
|
362
1299
|
getApi: () => Api;
|
|
363
|
-
|
|
1300
|
+
getCaptchaIframeURL: () => string;
|
|
364
1301
|
onReload: () => void;
|
|
365
1302
|
}
|
|
366
1303
|
|
|
367
1304
|
declare interface CheckerPayload {
|
|
368
|
-
onSuccess?: (
|
|
1305
|
+
onSuccess?: () => void;
|
|
369
1306
|
onMount?: (dialogEl: HTMLElement) => void;
|
|
370
1307
|
onCancel?: () => void;
|
|
371
1308
|
}
|
|
@@ -376,65 +1313,12 @@ declare interface CheckerStore {
|
|
|
376
1313
|
iframe?: string;
|
|
377
1314
|
}
|
|
378
1315
|
|
|
379
|
-
declare class Comment_2 extends Component {
|
|
380
|
-
private renderInstance;
|
|
381
|
-
private actionInstance;
|
|
382
|
-
private data;
|
|
383
|
-
private cConf;
|
|
384
|
-
private parent;
|
|
385
|
-
private children;
|
|
386
|
-
private nestCurt;
|
|
387
|
-
private nestMax;
|
|
388
|
-
constructor(ctx: ContextApi, data: CommentData, conf: CommentConf);
|
|
389
|
-
/** 渲染 UI */
|
|
390
|
-
render(): void;
|
|
391
|
-
/** 获取评论操作实例对象 */
|
|
392
|
-
getActions(): CommentActions;
|
|
393
|
-
/** 获取评论渲染器实例对象 */
|
|
394
|
-
getRender(): Render;
|
|
395
|
-
/** 获取评论数据 */
|
|
396
|
-
getData(): CommentData;
|
|
397
|
-
/** 设置数据 */
|
|
398
|
-
setData(data: CommentData): void;
|
|
399
|
-
/** 获取父评论 */
|
|
400
|
-
getParent(): Comment_2 | null;
|
|
401
|
-
/** 获取所有子评论 */
|
|
402
|
-
getChildren(): Comment_2[];
|
|
403
|
-
/** 获取当前嵌套层数 */
|
|
404
|
-
getNestCurt(): number;
|
|
405
|
-
/** 判断是否为根评论 */
|
|
406
|
-
getIsRoot(): boolean;
|
|
407
|
-
/** 获取评论 ID */
|
|
408
|
-
getID(): number;
|
|
409
|
-
/** 置入子评论 */
|
|
410
|
-
putChild(childC: Comment_2, insertMode?: 'append' | 'prepend'): void;
|
|
411
|
-
/** 获取存放子评论的元素对象 */
|
|
412
|
-
getChildrenEl(): HTMLElement;
|
|
413
|
-
/** 获取所有父评论 */
|
|
414
|
-
getParents(): Comment_2[];
|
|
415
|
-
/** 获取评论元素对象 */
|
|
416
|
-
getEl(): HTMLElement;
|
|
417
|
-
/** 获取 Gravatar 头像 URL */
|
|
418
|
-
getGravatarURL(): string;
|
|
419
|
-
/** 获取评论 markdown 解析后的内容 */
|
|
420
|
-
getContentMarked(): string;
|
|
421
|
-
/** 获取格式化后的日期 */
|
|
422
|
-
getDateFormatted(): any;
|
|
423
|
-
/** 获取用户 UserAgent 信息 */
|
|
424
|
-
getUserUA(): {
|
|
425
|
-
browser: string;
|
|
426
|
-
os: string;
|
|
427
|
-
};
|
|
428
|
-
/** 获取配置 */
|
|
429
|
-
getConf(): CommentConf;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
1316
|
declare class CommentActions {
|
|
433
1317
|
private comment;
|
|
434
|
-
private get ctx();
|
|
435
1318
|
private get data();
|
|
436
|
-
private get
|
|
437
|
-
|
|
1319
|
+
private get opts();
|
|
1320
|
+
private getApi;
|
|
1321
|
+
constructor(comment: CommentNode);
|
|
438
1322
|
/** 投票操作 */
|
|
439
1323
|
vote(type: 'up' | 'down'): void;
|
|
440
1324
|
/** 管理员 - 评论状态修改 */
|
|
@@ -445,45 +1329,6 @@ declare class CommentActions {
|
|
|
445
1329
|
goToReplyComment(): void;
|
|
446
1330
|
}
|
|
447
1331
|
|
|
448
|
-
/**
|
|
449
|
-
* 评论 API
|
|
450
|
-
*/
|
|
451
|
-
declare class CommentApi extends ApiBase {
|
|
452
|
-
/** 评论 · 获取 */
|
|
453
|
-
get(offset: number, pageSize: number, flatMode?: boolean, paramsEditor?: (params: any) => void): Promise<ListData>;
|
|
454
|
-
/** 评论 · 创建 */
|
|
455
|
-
add(comment: {
|
|
456
|
-
nick: string;
|
|
457
|
-
email: string;
|
|
458
|
-
link: string;
|
|
459
|
-
content: string;
|
|
460
|
-
rid: number;
|
|
461
|
-
page_key: string;
|
|
462
|
-
page_title?: string;
|
|
463
|
-
site_name?: string;
|
|
464
|
-
}): Promise<CommentData>;
|
|
465
|
-
/** 评论 · 修改 */
|
|
466
|
-
commentEdit(data: Partial<CommentData>): Promise<CommentData>;
|
|
467
|
-
/** 评论 · 删除 */
|
|
468
|
-
commentDel(commentID: number, siteName?: string): Promise<unknown>;
|
|
469
|
-
/** 投票 */
|
|
470
|
-
vote(targetID: number, type: string): Promise<{
|
|
471
|
-
up: number;
|
|
472
|
-
down: number;
|
|
473
|
-
}>;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
declare interface CommentConf {
|
|
477
|
-
isUnread?: boolean;
|
|
478
|
-
openURL?: string;
|
|
479
|
-
isFlatMode: boolean;
|
|
480
|
-
replyTo?: CommentData;
|
|
481
|
-
afterRender?: () => void;
|
|
482
|
-
openEvt?: () => void;
|
|
483
|
-
onReplyBtnClick?: Function;
|
|
484
|
-
onDelete?: Function;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
1332
|
export declare interface CommentData {
|
|
488
1333
|
/** 评论 ID */
|
|
489
1334
|
id: number;
|
|
@@ -504,21 +1349,19 @@ export declare interface CommentData {
|
|
|
504
1349
|
/** 评论日期 */
|
|
505
1350
|
date: string;
|
|
506
1351
|
/** 是否折叠 */
|
|
507
|
-
is_collapsed
|
|
1352
|
+
is_collapsed: boolean;
|
|
508
1353
|
/** 是否待审 */
|
|
509
|
-
is_pending
|
|
1354
|
+
is_pending: boolean;
|
|
510
1355
|
/** 是否置顶 */
|
|
511
|
-
is_pinned
|
|
512
|
-
/** 是否为管理员 */
|
|
513
|
-
is_admin?: boolean;
|
|
1356
|
+
is_pinned: boolean;
|
|
514
1357
|
/** 徽章文字 */
|
|
515
1358
|
badge_name?: string;
|
|
516
1359
|
/** 徽章颜色 */
|
|
517
1360
|
badge_color?: string;
|
|
518
|
-
/** IP
|
|
1361
|
+
/** IP 属地 */
|
|
519
1362
|
ip_region?: string;
|
|
520
1363
|
/** 是否允许回复 */
|
|
521
|
-
is_allow_reply
|
|
1364
|
+
is_allow_reply: boolean;
|
|
522
1365
|
/** 评论页面 key */
|
|
523
1366
|
page_key: string;
|
|
524
1367
|
/** 评论页面 url */
|
|
@@ -533,25 +1376,139 @@ export declare interface CommentData {
|
|
|
533
1376
|
vote_down: number;
|
|
534
1377
|
}
|
|
535
1378
|
|
|
536
|
-
declare
|
|
1379
|
+
declare class CommentNode {
|
|
1380
|
+
$el?: HTMLElement;
|
|
1381
|
+
private renderInstance;
|
|
1382
|
+
private actionInstance;
|
|
1383
|
+
private data;
|
|
1384
|
+
private opts;
|
|
1385
|
+
private parent;
|
|
1386
|
+
private children;
|
|
1387
|
+
private nestCurt;
|
|
1388
|
+
constructor(data: CommentData, opts: CommentOptions);
|
|
1389
|
+
/** 渲染 UI */
|
|
1390
|
+
render(): void;
|
|
1391
|
+
/** 获取评论操作实例对象 */
|
|
1392
|
+
getActions(): CommentActions;
|
|
1393
|
+
/** 获取评论渲染器实例对象 */
|
|
1394
|
+
getRender(): Render;
|
|
1395
|
+
/** 获取评论数据 */
|
|
1396
|
+
getData(): CommentData;
|
|
1397
|
+
/** 设置数据 */
|
|
1398
|
+
setData(data: CommentData): void;
|
|
1399
|
+
/** 获取父评论 */
|
|
1400
|
+
getParent(): CommentNode | null;
|
|
1401
|
+
/** 获取所有子评论 */
|
|
1402
|
+
getChildren(): CommentNode[];
|
|
1403
|
+
/** 获取当前嵌套层数 */
|
|
1404
|
+
getNestCurt(): number;
|
|
1405
|
+
/** 判断是否为根评论 */
|
|
1406
|
+
getIsRoot(): boolean;
|
|
1407
|
+
/** 获取评论 ID */
|
|
1408
|
+
getID(): number;
|
|
1409
|
+
/** 置入子评论 */
|
|
1410
|
+
putChild(childNode: CommentNode, insertMode?: 'append' | 'prepend'): void;
|
|
1411
|
+
/** 获取存放子评论的元素对象 */
|
|
1412
|
+
getChildrenWrapEl(): HTMLElement;
|
|
1413
|
+
/** 获取所有父评论 */
|
|
1414
|
+
getParents(): CommentNode[];
|
|
1415
|
+
/**
|
|
1416
|
+
* Get the element of the comment
|
|
1417
|
+
*
|
|
1418
|
+
* The `getEl()` will always return the latest $el after calling `render()`.
|
|
1419
|
+
* Please be aware of the memory leak if you use the $el reference directly.
|
|
1420
|
+
*/
|
|
1421
|
+
getEl(): HTMLElement;
|
|
1422
|
+
/**
|
|
1423
|
+
* Focus on the comment
|
|
1424
|
+
*
|
|
1425
|
+
* Scroll to the comment and perform flash animation
|
|
1426
|
+
*/
|
|
1427
|
+
focus(): void;
|
|
1428
|
+
scrollIntoView(): void;
|
|
1429
|
+
/**
|
|
1430
|
+
* Remove the comment node
|
|
1431
|
+
*/
|
|
1432
|
+
remove(): void;
|
|
1433
|
+
/** 获取 Gravatar 头像 URL */
|
|
1434
|
+
getGravatarURL(): string;
|
|
1435
|
+
/** 获取评论 markdown 解析后的内容 */
|
|
1436
|
+
getContentMarked(): string;
|
|
1437
|
+
/** 获取格式化后的日期 */
|
|
1438
|
+
getDateFormatted(): any;
|
|
1439
|
+
/** 获取用户 UserAgent 信息 */
|
|
1440
|
+
getUserUA(): {
|
|
1441
|
+
browser: string;
|
|
1442
|
+
os: string;
|
|
1443
|
+
};
|
|
1444
|
+
/** 获取配置 */
|
|
1445
|
+
getOpts(): CommentOptions;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
declare type CommentNode_2 = {
|
|
537
1449
|
id: number;
|
|
538
1450
|
comment: CommentData;
|
|
539
|
-
children:
|
|
540
|
-
parent?:
|
|
1451
|
+
children: CommentNode_2[];
|
|
1452
|
+
parent?: CommentNode_2;
|
|
541
1453
|
level: number;
|
|
542
1454
|
};
|
|
543
1455
|
|
|
1456
|
+
declare interface CommentOptions {
|
|
1457
|
+
onAfterRender?: () => void;
|
|
1458
|
+
onDelete?: Function;
|
|
1459
|
+
/** The comment being replied to (linked comment) */
|
|
1460
|
+
replyTo?: CommentData;
|
|
1461
|
+
flatMode: boolean;
|
|
1462
|
+
vote: boolean;
|
|
1463
|
+
voteDown: boolean;
|
|
1464
|
+
uaBadge: boolean;
|
|
1465
|
+
nestMax: number;
|
|
1466
|
+
gravatar: ArtalkConfig['gravatar'];
|
|
1467
|
+
heightLimit: ArtalkConfig['heightLimit'];
|
|
1468
|
+
avatarURLBuilder: ArtalkConfig['avatarURLBuilder'];
|
|
1469
|
+
scrollRelativeTo: ArtalkConfig['scrollRelativeTo'];
|
|
1470
|
+
getApi: () => Api;
|
|
1471
|
+
replyComment: ContextApi['replyComment'];
|
|
1472
|
+
editComment: ContextApi['editComment'];
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
declare interface CommonApiVersionData {
|
|
1476
|
+
app: string;
|
|
1477
|
+
commit_hash: string;
|
|
1478
|
+
version: string;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
declare interface CommonConfData {
|
|
1482
|
+
frontend_conf: CommonMap;
|
|
1483
|
+
version: CommonApiVersionData;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
declare interface CommonJSONResult {
|
|
1487
|
+
/** Data */
|
|
1488
|
+
data: any;
|
|
1489
|
+
/** Message */
|
|
1490
|
+
msg: string;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
declare type CommonMap = Record<string, any>;
|
|
1494
|
+
|
|
544
1495
|
declare abstract class Component {
|
|
545
1496
|
ctx: ContextApi;
|
|
546
1497
|
$el: HTMLElement;
|
|
547
|
-
|
|
1498
|
+
get conf(): ArtalkConfig;
|
|
548
1499
|
constructor(ctx: ContextApi);
|
|
1500
|
+
getEl(): HTMLElement;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
declare enum ContentType {
|
|
1504
|
+
Json = "application/json",
|
|
1505
|
+
FormData = "multipart/form-data",
|
|
1506
|
+
UrlEncoded = "application/x-www-form-urlencoded",
|
|
1507
|
+
Text = "text/plain"
|
|
549
1508
|
}
|
|
550
1509
|
|
|
551
1510
|
/**
|
|
552
|
-
* Context
|
|
553
|
-
*
|
|
554
|
-
* (面向接口的编程)
|
|
1511
|
+
* Artalk Context
|
|
555
1512
|
*/
|
|
556
1513
|
export declare interface ContextApi extends EventManagerFuncs<EventPayloadMap> {
|
|
557
1514
|
/** Artalk 根元素对象 */
|
|
@@ -578,6 +1535,20 @@ export declare interface ContextApi extends EventManagerFuncs<EventPayloadMap> {
|
|
|
578
1535
|
reload(): void;
|
|
579
1536
|
/** 列表滚动到第一个评论的位置 */
|
|
580
1537
|
listGotoFirst(): void;
|
|
1538
|
+
/** Get the comment data list */
|
|
1539
|
+
getComments(): CommentData[];
|
|
1540
|
+
/** Get the comment node list */
|
|
1541
|
+
getCommentNodes(): CommentNode[];
|
|
1542
|
+
/**
|
|
1543
|
+
* Get the comment data list
|
|
1544
|
+
* @deprecated Use `getComments()` instead
|
|
1545
|
+
*/
|
|
1546
|
+
getCommentDataList(): CommentData[];
|
|
1547
|
+
/**
|
|
1548
|
+
* Get the comment node list
|
|
1549
|
+
* @deprecated Use `getCommentNodes()` instead
|
|
1550
|
+
*/
|
|
1551
|
+
getCommentList(): CommentNode[];
|
|
581
1552
|
/** 显示侧边栏 */
|
|
582
1553
|
showSidebar(payload?: SidebarShowPayload): void;
|
|
583
1554
|
/** 隐藏侧边栏 */
|
|
@@ -591,9 +1562,9 @@ export declare interface ContextApi extends EventManagerFuncs<EventPayloadMap> {
|
|
|
591
1562
|
/** 评论框 - 复原状态 */
|
|
592
1563
|
editorResetState(): void;
|
|
593
1564
|
/** 验证码检测 */
|
|
594
|
-
checkCaptcha(payload: CheckerCaptchaPayload): void
|
|
1565
|
+
checkCaptcha(payload: CheckerCaptchaPayload): Promise<void>;
|
|
595
1566
|
/** 管理员检测 */
|
|
596
|
-
checkAdmin(payload: CheckerPayload): void
|
|
1567
|
+
checkAdmin(payload: CheckerPayload): Promise<void>;
|
|
597
1568
|
/** i18n 翻译 */
|
|
598
1569
|
$t(key: keyof I18n, args?: {
|
|
599
1570
|
[key: string]: string;
|
|
@@ -606,6 +1577,8 @@ export declare interface ContextApi extends EventManagerFuncs<EventPayloadMap> {
|
|
|
606
1577
|
getEl(): HTMLElement;
|
|
607
1578
|
/** 更新配置 */
|
|
608
1579
|
updateConf(conf: Partial<ArtalkConfig>): void;
|
|
1580
|
+
/** 监听配置更新 */
|
|
1581
|
+
watchConf<T extends (keyof ArtalkConfig)[]>(keys: T, effect: (val: Pick<ArtalkConfig, T[number]>) => void): void;
|
|
609
1582
|
}
|
|
610
1583
|
|
|
611
1584
|
export declare interface DataManagerApi {
|
|
@@ -621,8 +1594,8 @@ export declare interface DataManagerApi {
|
|
|
621
1594
|
insertComment(comment: CommentData): void;
|
|
622
1595
|
updateComment(comment: CommentData): void;
|
|
623
1596
|
deleteComment(id: number): void;
|
|
624
|
-
|
|
625
|
-
|
|
1597
|
+
getNotifies(): NotifyData[];
|
|
1598
|
+
updateNotifies(notifies: NotifyData[]): void;
|
|
626
1599
|
getPage(): PageData | undefined;
|
|
627
1600
|
updatePage(pageData: PageData): void;
|
|
628
1601
|
}
|
|
@@ -718,7 +1691,7 @@ export declare interface EditorApi extends Component {
|
|
|
718
1691
|
*/
|
|
719
1692
|
hideLoading(): void;
|
|
720
1693
|
/**
|
|
721
|
-
* Start
|
|
1694
|
+
* Start replying a comment
|
|
722
1695
|
*/
|
|
723
1696
|
setReply(commentData: CommentData, $comment: HTMLElement, scroll?: boolean): void;
|
|
724
1697
|
/**
|
|
@@ -869,11 +1842,88 @@ declare const en: {
|
|
|
869
1842
|
currentVersion: string;
|
|
870
1843
|
ignore: string;
|
|
871
1844
|
open: string;
|
|
1845
|
+
openName: string;
|
|
872
1846
|
};
|
|
873
1847
|
|
|
874
|
-
declare interface
|
|
875
|
-
|
|
876
|
-
|
|
1848
|
+
declare interface EntityCookedComment {
|
|
1849
|
+
badge_color: string;
|
|
1850
|
+
badge_name: string;
|
|
1851
|
+
content: string;
|
|
1852
|
+
content_marked: string;
|
|
1853
|
+
date: string;
|
|
1854
|
+
email_encrypted: string;
|
|
1855
|
+
id: number;
|
|
1856
|
+
ip_region: string;
|
|
1857
|
+
is_allow_reply: boolean;
|
|
1858
|
+
is_collapsed: boolean;
|
|
1859
|
+
is_pending: boolean;
|
|
1860
|
+
is_pinned: boolean;
|
|
1861
|
+
link: string;
|
|
1862
|
+
nick: string;
|
|
1863
|
+
page_key: string;
|
|
1864
|
+
page_url: string;
|
|
1865
|
+
rid: number;
|
|
1866
|
+
site_name: string;
|
|
1867
|
+
ua: string;
|
|
1868
|
+
user_id: number;
|
|
1869
|
+
visible: boolean;
|
|
1870
|
+
vote_down: number;
|
|
1871
|
+
vote_up: number;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
declare interface EntityCookedNotify {
|
|
1875
|
+
comment_id: number;
|
|
1876
|
+
id: number;
|
|
1877
|
+
is_emailed: boolean;
|
|
1878
|
+
is_read: boolean;
|
|
1879
|
+
read_link: string;
|
|
1880
|
+
user_id: number;
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
declare interface EntityCookedPage {
|
|
1884
|
+
admin_only: boolean;
|
|
1885
|
+
id: number;
|
|
1886
|
+
key: string;
|
|
1887
|
+
pv: number;
|
|
1888
|
+
site_name: string;
|
|
1889
|
+
title: string;
|
|
1890
|
+
url: string;
|
|
1891
|
+
vote_down: number;
|
|
1892
|
+
vote_up: number;
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
declare interface EntityCookedSite {
|
|
1896
|
+
first_url: string;
|
|
1897
|
+
id: number;
|
|
1898
|
+
name: string;
|
|
1899
|
+
urls: string[];
|
|
1900
|
+
urls_raw: string;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
declare interface EntityCookedUser {
|
|
1904
|
+
badge_color: string;
|
|
1905
|
+
badge_name: string;
|
|
1906
|
+
email: string;
|
|
1907
|
+
id: number;
|
|
1908
|
+
is_admin: boolean;
|
|
1909
|
+
link: string;
|
|
1910
|
+
name: string;
|
|
1911
|
+
receive_email: boolean;
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
declare interface EntityCookedUserForAdmin {
|
|
1915
|
+
badge_color: string;
|
|
1916
|
+
badge_name: string;
|
|
1917
|
+
comment_count: number;
|
|
1918
|
+
email: string;
|
|
1919
|
+
id: number;
|
|
1920
|
+
is_admin: boolean;
|
|
1921
|
+
is_in_conf: boolean;
|
|
1922
|
+
last_ip: string;
|
|
1923
|
+
last_ua: string;
|
|
1924
|
+
link: string;
|
|
1925
|
+
name: string;
|
|
1926
|
+
receive_email: boolean;
|
|
877
1927
|
}
|
|
878
1928
|
|
|
879
1929
|
declare type EventHandler<T> = (payload: T) => void;
|
|
@@ -906,90 +1956,545 @@ declare interface EventOptions {
|
|
|
906
1956
|
|
|
907
1957
|
/** EventName to EventPayload Type */
|
|
908
1958
|
export declare interface EventPayloadMap {
|
|
909
|
-
'
|
|
910
|
-
'
|
|
1959
|
+
'created': undefined;
|
|
1960
|
+
'mounted': undefined;
|
|
1961
|
+
'updated': ArtalkConfig;
|
|
1962
|
+
'unmounted': undefined;
|
|
911
1963
|
'conf-fetch': undefined;
|
|
912
1964
|
'list-fetch': Partial<ListFetchParams>;
|
|
913
1965
|
'list-fetched': ListFetchedArgs;
|
|
914
1966
|
'list-load': CommentData[];
|
|
915
1967
|
'list-loaded': CommentData[];
|
|
916
|
-
'list-
|
|
1968
|
+
'list-failed': ListErrorData;
|
|
917
1969
|
'list-goto-first': undefined;
|
|
918
1970
|
'list-reach-bottom': undefined;
|
|
919
1971
|
'comment-inserted': CommentData;
|
|
920
1972
|
'comment-updated': CommentData;
|
|
921
1973
|
'comment-deleted': CommentData;
|
|
922
|
-
'comment-rendered':
|
|
923
|
-
'
|
|
1974
|
+
'comment-rendered': CommentNode;
|
|
1975
|
+
'notifies-updated': NotifyData[];
|
|
924
1976
|
'list-goto': number;
|
|
925
1977
|
'page-loaded': PageData;
|
|
926
1978
|
'editor-submit': undefined;
|
|
927
1979
|
'editor-submitted': undefined;
|
|
928
1980
|
'user-changed': LocalUser;
|
|
929
|
-
'conf-loaded': ArtalkConfig;
|
|
930
|
-
'dark-mode-changed': boolean | 'auto';
|
|
931
1981
|
'sidebar-show': undefined;
|
|
932
1982
|
'sidebar-hide': undefined;
|
|
933
1983
|
}
|
|
934
1984
|
|
|
935
|
-
export declare
|
|
1985
|
+
export declare interface FetchError extends Error {
|
|
1986
|
+
code: number;
|
|
1987
|
+
message: string;
|
|
1988
|
+
data?: any;
|
|
1989
|
+
}
|
|
936
1990
|
|
|
937
|
-
|
|
1991
|
+
declare interface FullRequestParams extends Omit<RequestInit, 'body'> {
|
|
1992
|
+
/** set parameter to `true` for call `securityWorker` for this request */
|
|
1993
|
+
secure?: boolean;
|
|
1994
|
+
/** request path */
|
|
1995
|
+
path: string;
|
|
1996
|
+
/** content type of request body */
|
|
1997
|
+
type?: ContentType;
|
|
1998
|
+
/** query params */
|
|
1999
|
+
query?: QueryParamsType;
|
|
2000
|
+
/** format of response (i.e. response.json() -> format: "json") */
|
|
2001
|
+
format?: ResponseFormat;
|
|
2002
|
+
/** request body */
|
|
2003
|
+
body?: unknown;
|
|
2004
|
+
/** base url */
|
|
2005
|
+
baseUrl?: string;
|
|
2006
|
+
/** request cancellation token */
|
|
2007
|
+
cancelToken?: CancelToken;
|
|
2008
|
+
}
|
|
938
2009
|
|
|
939
|
-
|
|
2010
|
+
declare type HandlerMap = Record<string, any>;
|
|
940
2011
|
|
|
941
|
-
declare
|
|
942
|
-
|
|
943
|
-
|
|
2012
|
+
declare interface HandlerParamsCaptchaVerify {
|
|
2013
|
+
/** The captcha value to check */
|
|
2014
|
+
value: string;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
declare interface HandlerParamsCommentCreate {
|
|
2018
|
+
/** The comment content */
|
|
2019
|
+
content: string;
|
|
2020
|
+
/** The comment email */
|
|
2021
|
+
email: string;
|
|
2022
|
+
/** The comment link */
|
|
2023
|
+
link?: string;
|
|
2024
|
+
/** The comment name */
|
|
2025
|
+
name: string;
|
|
2026
|
+
/** The comment page_key */
|
|
2027
|
+
page_key: string;
|
|
2028
|
+
/** The comment page_title */
|
|
2029
|
+
page_title?: string;
|
|
2030
|
+
/** The comment rid */
|
|
2031
|
+
rid?: number;
|
|
2032
|
+
/** The site name of your content scope */
|
|
2033
|
+
site_name: string;
|
|
2034
|
+
/** The comment ua */
|
|
2035
|
+
ua?: string;
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
declare interface HandlerParamsCommentUpdate {
|
|
2039
|
+
/** The comment content */
|
|
2040
|
+
content: string;
|
|
2041
|
+
/** The comment email */
|
|
2042
|
+
email?: string;
|
|
2043
|
+
/** The comment ip */
|
|
2044
|
+
ip?: string;
|
|
2045
|
+
/** The comment is_collapsed */
|
|
2046
|
+
is_collapsed: boolean;
|
|
2047
|
+
/** The comment is_pending */
|
|
2048
|
+
is_pending: boolean;
|
|
2049
|
+
/** The comment is_pinned */
|
|
2050
|
+
is_pinned: boolean;
|
|
2051
|
+
/** The comment link */
|
|
2052
|
+
link?: string;
|
|
2053
|
+
/** The comment nick */
|
|
2054
|
+
nick?: string;
|
|
2055
|
+
/** The comment page_key */
|
|
2056
|
+
page_key: string;
|
|
2057
|
+
/** The comment rid */
|
|
2058
|
+
rid: number;
|
|
2059
|
+
/** The site name of your content scope */
|
|
2060
|
+
site_name: string;
|
|
2061
|
+
/** The comment ua */
|
|
2062
|
+
ua: string;
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
declare interface HandlerParamsEmailSend {
|
|
2066
|
+
/** The body of email */
|
|
2067
|
+
body: string;
|
|
2068
|
+
/** The subject of email */
|
|
2069
|
+
subject: string;
|
|
2070
|
+
/** The email address of the receiver */
|
|
2071
|
+
to_addr: string;
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
declare interface HandlerParamsNotifyReadAll {
|
|
2075
|
+
/** The user email */
|
|
2076
|
+
email: string;
|
|
2077
|
+
/** The username */
|
|
2078
|
+
name: string;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
declare interface HandlerParamsPageFetchAll {
|
|
2082
|
+
/** If not empty, only fetch pages of this site */
|
|
2083
|
+
site_name?: string;
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
declare interface HandlerParamsPagePV {
|
|
2087
|
+
/** The page key */
|
|
2088
|
+
page_key: string;
|
|
2089
|
+
/** The page title */
|
|
2090
|
+
page_title?: string;
|
|
2091
|
+
/** The site name of your content scope */
|
|
2092
|
+
site_name?: string;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
declare interface HandlerParamsPageUpdate {
|
|
2096
|
+
/** Updated page admin_only option */
|
|
2097
|
+
admin_only: boolean;
|
|
2098
|
+
/** Updated page key */
|
|
2099
|
+
key: string;
|
|
2100
|
+
/** The site name of your content scope */
|
|
2101
|
+
site_name: string;
|
|
2102
|
+
/** Updated page title */
|
|
2103
|
+
title: string;
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
declare interface HandlerParamsSettingApply {
|
|
2107
|
+
/** The content of the config file in YAML format */
|
|
2108
|
+
yaml: string;
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
declare interface HandlerParamsSiteCreate {
|
|
2112
|
+
/** The site name */
|
|
2113
|
+
name: string;
|
|
2114
|
+
/** The site urls */
|
|
2115
|
+
urls: string[];
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
declare interface HandlerParamsSiteUpdate {
|
|
2119
|
+
/** Updated site name */
|
|
2120
|
+
name: string;
|
|
2121
|
+
/** Updated site urls */
|
|
2122
|
+
urls: string[];
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
declare interface HandlerParamsTransferImport {
|
|
2126
|
+
/** Automatically answer yes for all questions. */
|
|
2127
|
+
assumeyes?: boolean;
|
|
2128
|
+
/** The JSON data */
|
|
2129
|
+
json_data?: string;
|
|
2130
|
+
/** The JSON file path */
|
|
2131
|
+
json_file?: string;
|
|
2132
|
+
/** The target site name */
|
|
2133
|
+
target_site_name?: string;
|
|
2134
|
+
/** The target site url */
|
|
2135
|
+
target_site_url?: string;
|
|
2136
|
+
/** Enable URL resolver */
|
|
2137
|
+
url_resolver?: boolean;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
declare interface HandlerParamsUserCreate {
|
|
2141
|
+
/** The user badge color (hex format) */
|
|
2142
|
+
badge_color?: string;
|
|
2143
|
+
/** The user badge name */
|
|
2144
|
+
badge_name?: string;
|
|
2145
|
+
/** The user email */
|
|
2146
|
+
email: string;
|
|
2147
|
+
/** The user is an admin */
|
|
2148
|
+
is_admin: boolean;
|
|
2149
|
+
/** The user link */
|
|
2150
|
+
link?: string;
|
|
2151
|
+
/** The user name */
|
|
2152
|
+
name: string;
|
|
2153
|
+
/** The user password */
|
|
2154
|
+
password?: string;
|
|
2155
|
+
/** The user receive email */
|
|
2156
|
+
receive_email: boolean;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
declare interface HandlerParamsUserLogin {
|
|
2160
|
+
/** The user email */
|
|
2161
|
+
email: string;
|
|
2162
|
+
/** The username */
|
|
2163
|
+
name?: string;
|
|
2164
|
+
/** The user password */
|
|
2165
|
+
password: string;
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
declare interface HandlerParamsUserUpdate {
|
|
2169
|
+
/** The user badge color (hex format) */
|
|
2170
|
+
badge_color?: string;
|
|
2171
|
+
/** The user badge name */
|
|
2172
|
+
badge_name?: string;
|
|
2173
|
+
/** The user email */
|
|
2174
|
+
email: string;
|
|
2175
|
+
/** The user is an admin */
|
|
2176
|
+
is_admin: boolean;
|
|
2177
|
+
/** The user link */
|
|
2178
|
+
link?: string;
|
|
2179
|
+
/** The user name */
|
|
2180
|
+
name: string;
|
|
2181
|
+
/** The user password */
|
|
2182
|
+
password?: string;
|
|
2183
|
+
/** The user receive email */
|
|
2184
|
+
receive_email: boolean;
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2187
|
+
declare interface HandlerParamsVote {
|
|
2188
|
+
/** The user email */
|
|
2189
|
+
email?: string;
|
|
2190
|
+
/** The username */
|
|
2191
|
+
name?: string;
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
declare interface HandlerResponseAdminUserList {
|
|
2195
|
+
count: number;
|
|
2196
|
+
users: EntityCookedUserForAdmin[];
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
declare interface HandlerResponseCaptchaGet {
|
|
2200
|
+
img_data: string;
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
declare interface HandlerResponseCaptchaStatus {
|
|
2204
|
+
is_pass: boolean;
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
declare interface HandlerResponseCommentCreate {
|
|
2208
|
+
badge_color: string;
|
|
2209
|
+
badge_name: string;
|
|
2210
|
+
content: string;
|
|
2211
|
+
content_marked: string;
|
|
2212
|
+
date: string;
|
|
2213
|
+
email_encrypted: string;
|
|
2214
|
+
id: number;
|
|
2215
|
+
ip_region: string;
|
|
2216
|
+
is_allow_reply: boolean;
|
|
2217
|
+
is_collapsed: boolean;
|
|
2218
|
+
is_pending: boolean;
|
|
2219
|
+
is_pinned: boolean;
|
|
2220
|
+
link: string;
|
|
2221
|
+
nick: string;
|
|
2222
|
+
page_key: string;
|
|
2223
|
+
page_url: string;
|
|
2224
|
+
rid: number;
|
|
2225
|
+
site_name: string;
|
|
2226
|
+
ua: string;
|
|
2227
|
+
user_id: number;
|
|
2228
|
+
visible: boolean;
|
|
2229
|
+
vote_down: number;
|
|
2230
|
+
vote_up: number;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
declare interface HandlerResponseCommentGet {
|
|
2234
|
+
/** The comment detail */
|
|
2235
|
+
comment: EntityCookedComment;
|
|
2236
|
+
/** The reply comment if exists (like reply) */
|
|
2237
|
+
reply_comment: EntityCookedComment;
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
declare interface HandlerResponseCommentList {
|
|
2241
|
+
comments: EntityCookedComment[];
|
|
2242
|
+
count: number;
|
|
2243
|
+
page: EntityCookedPage;
|
|
2244
|
+
roots_count: number;
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
declare interface HandlerResponseCommentUpdate {
|
|
2248
|
+
badge_color: string;
|
|
2249
|
+
badge_name: string;
|
|
2250
|
+
content: string;
|
|
2251
|
+
content_marked: string;
|
|
2252
|
+
date: string;
|
|
2253
|
+
email_encrypted: string;
|
|
2254
|
+
id: number;
|
|
2255
|
+
ip_region: string;
|
|
2256
|
+
is_allow_reply: boolean;
|
|
2257
|
+
is_collapsed: boolean;
|
|
2258
|
+
is_pending: boolean;
|
|
2259
|
+
is_pinned: boolean;
|
|
2260
|
+
link: string;
|
|
2261
|
+
nick: string;
|
|
2262
|
+
page_key: string;
|
|
2263
|
+
page_url: string;
|
|
2264
|
+
rid: number;
|
|
2265
|
+
site_name: string;
|
|
2266
|
+
ua: string;
|
|
2267
|
+
user_id: number;
|
|
2268
|
+
visible: boolean;
|
|
2269
|
+
vote_down: number;
|
|
2270
|
+
vote_up: number;
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
declare interface HandlerResponseNotifyList {
|
|
2274
|
+
count: number;
|
|
2275
|
+
notifies: EntityCookedNotify[];
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
declare interface HandlerResponsePageFetch {
|
|
2279
|
+
admin_only: boolean;
|
|
2280
|
+
id: number;
|
|
2281
|
+
key: string;
|
|
2282
|
+
pv: number;
|
|
2283
|
+
site_name: string;
|
|
2284
|
+
title: string;
|
|
2285
|
+
url: string;
|
|
2286
|
+
vote_down: number;
|
|
2287
|
+
vote_up: number;
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
declare interface HandlerResponsePageFetchStatus {
|
|
2291
|
+
/** The number of pages that have been fetched */
|
|
2292
|
+
done: number;
|
|
2293
|
+
/** If the task is in progress */
|
|
2294
|
+
is_progress: boolean;
|
|
2295
|
+
/** The message of the task status */
|
|
2296
|
+
msg: string;
|
|
2297
|
+
/** The total number of pages */
|
|
2298
|
+
total: number;
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
declare interface HandlerResponsePageList {
|
|
2302
|
+
count: number;
|
|
2303
|
+
pages: EntityCookedPage[];
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
declare interface HandlerResponsePagePV {
|
|
2307
|
+
pv: number;
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
declare interface HandlerResponsePageUpdate {
|
|
2311
|
+
admin_only: boolean;
|
|
2312
|
+
id: number;
|
|
2313
|
+
key: string;
|
|
2314
|
+
pv: number;
|
|
2315
|
+
site_name: string;
|
|
2316
|
+
title: string;
|
|
2317
|
+
url: string;
|
|
2318
|
+
vote_down: number;
|
|
2319
|
+
vote_up: number;
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
declare interface HandlerResponseSettingGet {
|
|
2323
|
+
yaml: string;
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2326
|
+
declare interface HandlerResponseSettingTemplate {
|
|
2327
|
+
yaml: string;
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
declare interface HandlerResponseSiteCreate {
|
|
2331
|
+
first_url: string;
|
|
2332
|
+
id: number;
|
|
2333
|
+
name: string;
|
|
2334
|
+
urls: string[];
|
|
2335
|
+
urls_raw: string;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
declare interface HandlerResponseSiteList {
|
|
2339
|
+
count: number;
|
|
2340
|
+
sites: EntityCookedSite[];
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
declare interface HandlerResponseSiteUpdate {
|
|
2344
|
+
first_url: string;
|
|
2345
|
+
id: number;
|
|
2346
|
+
name: string;
|
|
2347
|
+
urls: string[];
|
|
2348
|
+
urls_raw: string;
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
declare interface HandlerResponseTransferExport {
|
|
2352
|
+
/** The exported data which is a JSON string */
|
|
2353
|
+
artrans: string;
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
declare interface HandlerResponseTransferUpload {
|
|
2357
|
+
/** The uploaded file name which can be used to import */
|
|
2358
|
+
filename: string;
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
declare interface HandlerResponseUpload {
|
|
2362
|
+
file_name: string;
|
|
2363
|
+
file_type: string;
|
|
2364
|
+
public_url: string;
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
declare interface HandlerResponseUserCreate {
|
|
2368
|
+
badge_color: string;
|
|
2369
|
+
badge_name: string;
|
|
2370
|
+
comment_count: number;
|
|
2371
|
+
email: string;
|
|
2372
|
+
id: number;
|
|
2373
|
+
is_admin: boolean;
|
|
2374
|
+
is_in_conf: boolean;
|
|
2375
|
+
last_ip: string;
|
|
2376
|
+
last_ua: string;
|
|
2377
|
+
link: string;
|
|
2378
|
+
name: string;
|
|
2379
|
+
receive_email: boolean;
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
declare interface HandlerResponseUserInfo {
|
|
2383
|
+
is_login: boolean;
|
|
2384
|
+
notifies: EntityCookedNotify[];
|
|
2385
|
+
notifies_count: number;
|
|
2386
|
+
user: EntityCookedUser;
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
declare interface HandlerResponseUserLogin {
|
|
2390
|
+
token: string;
|
|
2391
|
+
user: EntityCookedUser;
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
declare interface HandlerResponseUserStatus {
|
|
2395
|
+
is_admin: boolean;
|
|
2396
|
+
is_login: boolean;
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
declare interface HandlerResponseUserUpdate {
|
|
2400
|
+
badge_color: string;
|
|
2401
|
+
badge_name: string;
|
|
2402
|
+
comment_count: number;
|
|
2403
|
+
email: string;
|
|
2404
|
+
id: number;
|
|
2405
|
+
is_admin: boolean;
|
|
2406
|
+
is_in_conf: boolean;
|
|
2407
|
+
last_ip: string;
|
|
2408
|
+
last_ua: string;
|
|
2409
|
+
link: string;
|
|
2410
|
+
name: string;
|
|
2411
|
+
receive_email: boolean;
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
declare interface HandlerResponseVote {
|
|
2415
|
+
down: number;
|
|
2416
|
+
up: number;
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
declare class HttpClient<SecurityDataType = unknown> {
|
|
2420
|
+
baseUrl: string;
|
|
2421
|
+
private securityData;
|
|
2422
|
+
private securityWorker?;
|
|
2423
|
+
private abortControllers;
|
|
2424
|
+
private customFetch;
|
|
2425
|
+
private baseApiParams;
|
|
2426
|
+
constructor(apiConfig?: ApiConfig<SecurityDataType>);
|
|
2427
|
+
setSecurityData: (data: SecurityDataType | null) => void;
|
|
2428
|
+
protected encodeQueryParam(key: string, value: any): string;
|
|
2429
|
+
protected addQueryParam(query: QueryParamsType, key: string): string;
|
|
2430
|
+
protected addArrayQueryParam(query: QueryParamsType, key: string): any;
|
|
2431
|
+
protected toQueryString(rawQuery?: QueryParamsType): string;
|
|
2432
|
+
protected addQueryParams(rawQuery?: QueryParamsType): string;
|
|
2433
|
+
private contentFormatters;
|
|
2434
|
+
protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams;
|
|
2435
|
+
protected createAbortSignal: (cancelToken: CancelToken) => AbortSignal | undefined;
|
|
2436
|
+
abortRequest: (cancelToken: CancelToken) => void;
|
|
2437
|
+
request: <T = any, E = any>({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams) => Promise<HttpResponse<T, E>>;
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
declare interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
|
|
2441
|
+
data: D;
|
|
2442
|
+
error: E;
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
export declare type I18n = typeof en;
|
|
2446
|
+
|
|
2447
|
+
export declare type I18nKeys = keyof I18n;
|
|
2448
|
+
|
|
2449
|
+
export declare const init: typeof Artalk.init;
|
|
2450
|
+
|
|
2451
|
+
declare class Layer {
|
|
2452
|
+
private $el;
|
|
2453
|
+
private opts;
|
|
2454
|
+
private allowMaskClose;
|
|
944
2455
|
private onAfterHide?;
|
|
945
|
-
constructor(
|
|
2456
|
+
constructor($el: HTMLElement, opts: LayerOptions);
|
|
946
2457
|
setOnAfterHide(func: () => void): void;
|
|
2458
|
+
setAllowMaskClose(allow: boolean): void;
|
|
2459
|
+
getAllowMaskClose(): boolean;
|
|
947
2460
|
getEl(): HTMLElement;
|
|
948
2461
|
show(): void;
|
|
949
|
-
hide(): void
|
|
950
|
-
destroy(): void
|
|
2462
|
+
hide(): Promise<void>;
|
|
2463
|
+
destroy(): Promise<void>;
|
|
951
2464
|
}
|
|
952
2465
|
|
|
953
2466
|
declare class LayerManager {
|
|
954
2467
|
private wrap;
|
|
955
|
-
private ctx;
|
|
956
2468
|
constructor(ctx: ContextApi);
|
|
957
2469
|
getEl(): HTMLElement;
|
|
958
|
-
create(name: string, el?: HTMLElement
|
|
2470
|
+
create(name: string, el?: HTMLElement): Layer;
|
|
959
2471
|
}
|
|
960
2472
|
|
|
961
|
-
declare
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
private allowMaskClose;
|
|
965
|
-
private items;
|
|
966
|
-
constructor();
|
|
967
|
-
createItem(name: string, el?: HTMLElement): HTMLElement;
|
|
968
|
-
getWrap(): HTMLElement;
|
|
969
|
-
getMask(): HTMLElement;
|
|
970
|
-
setMaskClose(enabled: boolean): void;
|
|
971
|
-
show(): void;
|
|
972
|
-
hide(callback?: () => void): void;
|
|
2473
|
+
declare interface LayerOptions {
|
|
2474
|
+
onShow: () => void;
|
|
2475
|
+
onHide: () => void;
|
|
973
2476
|
}
|
|
974
2477
|
|
|
975
2478
|
declare interface LayoutOptions {
|
|
2479
|
+
/** The comments wrap of list */
|
|
976
2480
|
$commentsWrap: HTMLElement;
|
|
977
2481
|
nestSortBy: ListNest.SortByType;
|
|
978
2482
|
nestMax: number;
|
|
979
2483
|
flatMode: boolean;
|
|
980
|
-
createCommentNode(comment: CommentData,
|
|
981
|
-
findCommentNode(id: number):
|
|
982
|
-
getCommentDataList(): CommentData[];
|
|
2484
|
+
createCommentNode(comment: CommentData, replyComment?: CommentData): CommentNode;
|
|
2485
|
+
findCommentNode(id: number): CommentNode | undefined;
|
|
983
2486
|
}
|
|
984
2487
|
|
|
985
2488
|
declare class List extends Component {
|
|
986
2489
|
/** 列表评论集区域元素 */
|
|
987
2490
|
$commentsWrap: HTMLElement;
|
|
988
2491
|
getCommentsWrapEl(): HTMLElement;
|
|
989
|
-
protected commentNodes:
|
|
990
|
-
getCommentNodes():
|
|
2492
|
+
protected commentNodes: CommentNode[];
|
|
2493
|
+
getCommentNodes(): CommentNode[];
|
|
991
2494
|
constructor(ctx: ContextApi);
|
|
992
|
-
getListLayout(
|
|
2495
|
+
getListLayout({ forceFlatMode }?: {
|
|
2496
|
+
forceFlatMode?: boolean;
|
|
2497
|
+
}): ListLayout;
|
|
993
2498
|
private initCrudEvents;
|
|
994
2499
|
}
|
|
995
2500
|
|
|
@@ -997,27 +2502,22 @@ export declare interface ListData {
|
|
|
997
2502
|
/** 评论数据 */
|
|
998
2503
|
comments: CommentData[];
|
|
999
2504
|
/** 根评论总数 */
|
|
1000
|
-
|
|
2505
|
+
roots_count: number;
|
|
1001
2506
|
/** 评论总数(包括所有子评论) */
|
|
1002
|
-
|
|
2507
|
+
count: number;
|
|
1003
2508
|
/** 页面信息 */
|
|
1004
2509
|
page: PageData;
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
/** 后端配置 */
|
|
1014
|
-
conf: any;
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
declare interface ListFetchedArgs {
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
export declare interface ListErrorData {
|
|
2513
|
+
msg: string;
|
|
2514
|
+
data?: any;
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
export declare interface ListFetchedArgs {
|
|
1018
2518
|
params: Partial<ListFetchParams>;
|
|
1019
2519
|
data?: ListData;
|
|
1020
|
-
error?:
|
|
2520
|
+
error?: ListErrorData;
|
|
1021
2521
|
}
|
|
1022
2522
|
|
|
1023
2523
|
export declare interface ListFetchParams {
|
|
@@ -1037,19 +2537,15 @@ export declare interface ListLastFetchData {
|
|
|
1037
2537
|
declare class ListLayout {
|
|
1038
2538
|
private options;
|
|
1039
2539
|
constructor(options: LayoutOptions);
|
|
2540
|
+
private getStrategy;
|
|
1040
2541
|
import(comments: CommentData[]): void;
|
|
1041
|
-
insert(comment: CommentData): void;
|
|
1042
|
-
private importCommentsNestMode;
|
|
1043
|
-
/** 导入评论 · 平铺模式 */
|
|
1044
|
-
private putCommentFlatMode;
|
|
1045
|
-
private insertCommentNest;
|
|
1046
|
-
private insertCommentFlatMode;
|
|
2542
|
+
insert(comment: CommentData, replyComment?: CommentData): void;
|
|
1047
2543
|
}
|
|
1048
2544
|
|
|
1049
2545
|
declare namespace ListNest {
|
|
1050
2546
|
export {
|
|
1051
2547
|
makeNestCommentNodeList,
|
|
1052
|
-
CommentNode,
|
|
2548
|
+
CommentNode_2 as CommentNode,
|
|
1053
2549
|
SortByType
|
|
1054
2550
|
}
|
|
1055
2551
|
}
|
|
@@ -1073,7 +2569,7 @@ export declare interface LocalUser {
|
|
|
1073
2569
|
isAdmin: boolean;
|
|
1074
2570
|
}
|
|
1075
2571
|
|
|
1076
|
-
declare function makeNestCommentNodeList(srcData: CommentData[], sortBy?: SortByType, nestMax?: number):
|
|
2572
|
+
declare function makeNestCommentNodeList(srcData: CommentData[], sortBy?: SortByType, nestMax?: number): CommentNode_2[];
|
|
1077
2573
|
|
|
1078
2574
|
export declare interface NotifyData {
|
|
1079
2575
|
/** 通知 ID */
|
|
@@ -1092,27 +2588,6 @@ export declare interface NotifyData {
|
|
|
1092
2588
|
|
|
1093
2589
|
export declare type NotifyLevel = "i" | "s" | "w" | "e";
|
|
1094
2590
|
|
|
1095
|
-
/**
|
|
1096
|
-
* 页面 API
|
|
1097
|
-
*/
|
|
1098
|
-
declare class PageApi extends ApiBase {
|
|
1099
|
-
/** 页面 · 获取 */
|
|
1100
|
-
pageGet(siteName?: string, offset?: number, limit?: number): Promise<{
|
|
1101
|
-
pages: PageData[];
|
|
1102
|
-
total: number;
|
|
1103
|
-
}>;
|
|
1104
|
-
/** 页面 · 修改 */
|
|
1105
|
-
pageEdit(data: PageData): Promise<PageData>;
|
|
1106
|
-
/** 页面 · 删除 */
|
|
1107
|
-
pageDel(pageKey: string, siteName?: string): Promise<unknown>;
|
|
1108
|
-
/** 页面 · 数据更新 */
|
|
1109
|
-
pageFetch(id?: number, siteName?: string, getStatus?: boolean): Promise<any>;
|
|
1110
|
-
/** PV */
|
|
1111
|
-
pv(): Promise<number>;
|
|
1112
|
-
/** 统计 */
|
|
1113
|
-
stat(type: 'latest_comments' | 'latest_pages' | 'pv_most_pages' | 'comment_most_pages' | 'page_pv' | 'site_pv' | 'page_comment' | 'site_comment', pageKeys?: string | string[], limit?: number): Promise<number | object | CommentData[] | PageData[]>;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
2591
|
export declare interface PageData {
|
|
1117
2592
|
/** 页面 ID */
|
|
1118
2593
|
id: number;
|
|
@@ -1185,12 +2660,12 @@ declare class PlugManager {
|
|
|
1185
2660
|
getTransformedContent(rawContent: string): string;
|
|
1186
2661
|
}
|
|
1187
2662
|
|
|
2663
|
+
declare type QueryParamsType = Record<string | number, any>;
|
|
2664
|
+
|
|
1188
2665
|
declare class Render {
|
|
1189
|
-
comment:
|
|
1190
|
-
get ctx(): ContextApi;
|
|
2666
|
+
comment: CommentNode;
|
|
1191
2667
|
get data(): CommentData;
|
|
1192
|
-
get
|
|
1193
|
-
get cConf(): CommentConf;
|
|
2668
|
+
get opts(): CommentOptions;
|
|
1194
2669
|
$el: HTMLElement;
|
|
1195
2670
|
$main: HTMLElement;
|
|
1196
2671
|
$header: HTMLElement;
|
|
@@ -1204,7 +2679,16 @@ declare class Render {
|
|
|
1204
2679
|
voteBtnDown?: ActionBtn;
|
|
1205
2680
|
$replyTo?: HTMLElement;
|
|
1206
2681
|
$replyAt?: HTMLElement;
|
|
1207
|
-
constructor(comment:
|
|
2682
|
+
constructor(comment: CommentNode);
|
|
2683
|
+
/**
|
|
2684
|
+
* Render the comment ui
|
|
2685
|
+
*
|
|
2686
|
+
* If comment data is updated, call this method to re-render the comment ui.
|
|
2687
|
+
* The method will be called multiple times, so it should be idempotent.
|
|
2688
|
+
*
|
|
2689
|
+
* Renders may add event listeners to the comment ui, so it should be called only once or override the original.
|
|
2690
|
+
* Please be aware of the memory leak caused by the event listener.
|
|
2691
|
+
*/
|
|
1208
2692
|
render(): HTMLElement;
|
|
1209
2693
|
/** 内容限高检测 */
|
|
1210
2694
|
checkHeightLimit(): void;
|
|
@@ -1214,12 +2698,10 @@ declare class Render {
|
|
|
1214
2698
|
playFadeAnim(): void;
|
|
1215
2699
|
/** 渐出动画 · 评论内容区域 */
|
|
1216
2700
|
playFadeAnimForBody(): void;
|
|
2701
|
+
/** Perform the flash animation */
|
|
2702
|
+
playFlashAnim(): void;
|
|
1217
2703
|
/** 获取子评论 Wrap */
|
|
1218
|
-
getChildrenWrap(): HTMLElement
|
|
1219
|
-
/** 初始化子评论区域 Wrap */
|
|
1220
|
-
renderChildrenWrap(): HTMLElement;
|
|
1221
|
-
/** 恢复原有的子评论区域 Wrap */
|
|
1222
|
-
recoveryChildrenWrap(): void;
|
|
2704
|
+
getChildrenWrap(): HTMLElement;
|
|
1223
2705
|
/** 设置已读 */
|
|
1224
2706
|
setUnread(val: boolean): void;
|
|
1225
2707
|
/** 设置为可点击的评论 */
|
|
@@ -1230,6 +2712,10 @@ declare class Render {
|
|
|
1230
2712
|
setOpenAction(action: () => void): void;
|
|
1231
2713
|
}
|
|
1232
2714
|
|
|
2715
|
+
declare type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
|
|
2716
|
+
|
|
2717
|
+
declare type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
|
|
2718
|
+
|
|
1233
2719
|
declare const Sel: {
|
|
1234
2720
|
$header: string;
|
|
1235
2721
|
$nick: string;
|
|
@@ -1267,7 +2753,10 @@ declare class SidebarLayer extends Component {
|
|
|
1267
2753
|
$iframeWrap: HTMLElement;
|
|
1268
2754
|
$iframe?: HTMLIFrameElement;
|
|
1269
2755
|
constructor(ctx: ContextApi);
|
|
1270
|
-
|
|
2756
|
+
/** Refresh iFrame on show */
|
|
2757
|
+
private refreshOnShow;
|
|
2758
|
+
/** Animation timer */
|
|
2759
|
+
private animTimer?;
|
|
1271
2760
|
/** 显示 */
|
|
1272
2761
|
show(conf?: SidebarShowPayload): Promise<void>;
|
|
1273
2762
|
/** 隐藏 */
|
|
@@ -1282,22 +2771,6 @@ export declare interface SidebarShowPayload {
|
|
|
1282
2771
|
view?: 'comments' | 'sites' | 'pages' | 'transfer';
|
|
1283
2772
|
}
|
|
1284
2773
|
|
|
1285
|
-
/**
|
|
1286
|
-
* 站点 API
|
|
1287
|
-
*/
|
|
1288
|
-
declare class SiteApi extends ApiBase {
|
|
1289
|
-
/** 站点 · 获取 */
|
|
1290
|
-
siteGet(): Promise<SiteData[]>;
|
|
1291
|
-
/** 站点 · 创建 */
|
|
1292
|
-
siteAdd(name: string, urls: string): Promise<SiteData>;
|
|
1293
|
-
/** 站点 · 修改 */
|
|
1294
|
-
siteEdit(data: SiteData): Promise<SiteData>;
|
|
1295
|
-
/** 站点 · 删除 */
|
|
1296
|
-
siteDel(id: number, delContent?: boolean): Promise<unknown>;
|
|
1297
|
-
/** 导出 */
|
|
1298
|
-
export(): Promise<any>;
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
2774
|
export declare interface SiteData {
|
|
1302
2775
|
/** 站点 ID */
|
|
1303
2776
|
id: number;
|
|
@@ -1313,35 +2786,6 @@ export declare interface SiteData {
|
|
|
1313
2786
|
|
|
1314
2787
|
declare type SortByType = 'DATE_DESC' | 'DATE_ASC' | 'SRC_INDEX' | 'VOTE_UP_DESC';
|
|
1315
2788
|
|
|
1316
|
-
/**
|
|
1317
|
-
* 系统 API
|
|
1318
|
-
*/
|
|
1319
|
-
declare class SystemApi extends ApiBase {
|
|
1320
|
-
/** 获取配置 */
|
|
1321
|
-
conf(): Promise<SystemConfResp>;
|
|
1322
|
-
/** 获取配置数据 */
|
|
1323
|
-
getSettings(): Promise<{
|
|
1324
|
-
custom: string;
|
|
1325
|
-
template: string;
|
|
1326
|
-
}>;
|
|
1327
|
-
/** 保存配置数据 */
|
|
1328
|
-
saveSettings(yamlStr: string): Promise<boolean>;
|
|
1329
|
-
/** 获取 API 版本信息 */
|
|
1330
|
-
version(): Promise<{
|
|
1331
|
-
app: string;
|
|
1332
|
-
version: string;
|
|
1333
|
-
commit_hash: string;
|
|
1334
|
-
fe_min_version: string;
|
|
1335
|
-
}>;
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
declare interface SystemConfResp {
|
|
1339
|
-
frontend_conf: Partial<ArtalkConfig>;
|
|
1340
|
-
version: ApiVersionInfo;
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
declare type TC = typeof ApiComponents;
|
|
1344
|
-
|
|
1345
2789
|
declare type TInjectedServices = {
|
|
1346
2790
|
[K in keyof TServiceInjectors]: ReturnType<TServiceInjectors[K]>;
|
|
1347
2791
|
};
|
|
@@ -1362,17 +2806,6 @@ declare type TServiceImps = typeof services;
|
|
|
1362
2806
|
|
|
1363
2807
|
declare type TServiceInjectors = Omit<TServiceImps, TOmitConditions>;
|
|
1364
2808
|
|
|
1365
|
-
/**
|
|
1366
|
-
* 上传 API
|
|
1367
|
-
*/
|
|
1368
|
-
declare class UploadApi extends ApiBase {
|
|
1369
|
-
/** 图片上传 */
|
|
1370
|
-
imgUpload(file: File): Promise<{
|
|
1371
|
-
img_file: string;
|
|
1372
|
-
img_url: string;
|
|
1373
|
-
}>;
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
2809
|
export declare const use: typeof Artalk.use;
|
|
1377
2810
|
|
|
1378
2811
|
declare class User {
|
|
@@ -1380,7 +2813,7 @@ declare class User {
|
|
|
1380
2813
|
private data;
|
|
1381
2814
|
constructor(opts: UserOpts);
|
|
1382
2815
|
getData(): LocalUser;
|
|
1383
|
-
/**
|
|
2816
|
+
/** Update user data and save to localStorage */
|
|
1384
2817
|
update(obj?: Partial<LocalUser>): void;
|
|
1385
2818
|
/**
|
|
1386
2819
|
* Logout
|
|
@@ -1388,51 +2821,10 @@ declare class User {
|
|
|
1388
2821
|
* @description Logout will clear login status, but not clear user data (nick, email, link)
|
|
1389
2822
|
*/
|
|
1390
2823
|
logout(): void;
|
|
1391
|
-
/**
|
|
2824
|
+
/** Check if user has filled basic data */
|
|
1392
2825
|
checkHasBasicUserInfo(): boolean;
|
|
1393
2826
|
}
|
|
1394
2827
|
|
|
1395
|
-
/**
|
|
1396
|
-
* 用户 API
|
|
1397
|
-
*/
|
|
1398
|
-
declare class UserApi extends ApiBase {
|
|
1399
|
-
/** 用户 · 登录 */
|
|
1400
|
-
login(name: string, email: string, password: string): Promise<{
|
|
1401
|
-
token: string;
|
|
1402
|
-
user: UserData;
|
|
1403
|
-
}>;
|
|
1404
|
-
/** 用户 · 获取 */
|
|
1405
|
-
userGet(name: string, email: string): {
|
|
1406
|
-
req: Promise<{
|
|
1407
|
-
user: UserData | null;
|
|
1408
|
-
is_login: boolean;
|
|
1409
|
-
unread: NotifyData[];
|
|
1410
|
-
unread_count: any;
|
|
1411
|
-
}>;
|
|
1412
|
-
abort: () => void;
|
|
1413
|
-
};
|
|
1414
|
-
/** 用户 · 登录状态 */
|
|
1415
|
-
loginStatus(): Promise<{
|
|
1416
|
-
is_login: boolean;
|
|
1417
|
-
is_admin: boolean;
|
|
1418
|
-
}>;
|
|
1419
|
-
/** 用户 · 注销 */
|
|
1420
|
-
logout(): Promise<unknown>;
|
|
1421
|
-
/** 已读标记 */
|
|
1422
|
-
markRead(commentID: number, notifyKey: string, readAll?: boolean): Promise<unknown>;
|
|
1423
|
-
/** 用户 · 列表 */
|
|
1424
|
-
userList(offset?: number, limit?: number, type?: 'all' | 'admin' | 'in_conf'): Promise<{
|
|
1425
|
-
users: UserDataForAdmin[];
|
|
1426
|
-
total: number;
|
|
1427
|
-
}>;
|
|
1428
|
-
/** 用户 · 新增 */
|
|
1429
|
-
userAdd(user: Partial<UserDataForAdmin>, password?: string): Promise<UserDataForAdmin>;
|
|
1430
|
-
/** 用户 · 修改 */
|
|
1431
|
-
userEdit(user: Partial<UserDataForAdmin>, password?: string): Promise<UserDataForAdmin>;
|
|
1432
|
-
/** 用户 · 删除 */
|
|
1433
|
-
userDel(userID: number): Promise<unknown>;
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
2828
|
export declare interface UserData {
|
|
1437
2829
|
/** 用户 ID */
|
|
1438
2830
|
id: number;
|
|
@@ -1448,10 +2840,6 @@ export declare interface UserData {
|
|
|
1448
2840
|
badge_color: string;
|
|
1449
2841
|
/** 是否属于管理员 */
|
|
1450
2842
|
is_admin: boolean;
|
|
1451
|
-
/** 所属站点名 */
|
|
1452
|
-
site_names: string[];
|
|
1453
|
-
/** 所属站点名 (字符串) */
|
|
1454
|
-
site_names_raw: string;
|
|
1455
2843
|
/** 是否允许接收邮件通知 */
|
|
1456
2844
|
receive_email: boolean;
|
|
1457
2845
|
}
|
|
@@ -1465,8 +2853,13 @@ export declare interface UserDataForAdmin extends UserData {
|
|
|
1465
2853
|
is_in_conf: boolean;
|
|
1466
2854
|
/** 评论数 */
|
|
1467
2855
|
comment_count: number;
|
|
1468
|
-
|
|
1469
|
-
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
export declare interface UserInfoApiResponseData {
|
|
2859
|
+
user?: UserData;
|
|
2860
|
+
is_login: boolean;
|
|
2861
|
+
notifies: NotifyData[];
|
|
2862
|
+
notifies_count: number;
|
|
1470
2863
|
}
|
|
1471
2864
|
|
|
1472
2865
|
declare interface UserOpts {
|