artalk 2.7.3 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +2527 -1852
- 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 +2060 -1186
- 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 +1688 -352
- package/dist/main.d.ts +1688 -352
- 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,989 @@ 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 Update a specific comment
|
|
242
|
+
*
|
|
243
|
+
* @tags Comment
|
|
244
|
+
* @name UpdateComment
|
|
245
|
+
* @summary Update Comment
|
|
246
|
+
* @request PUT:/comments/{id}
|
|
247
|
+
* @secure
|
|
248
|
+
* @response `200` `HandlerResponseCommentUpdate` OK
|
|
249
|
+
* @response `400` `(HandlerMap & {
|
|
250
|
+
msg?: string,
|
|
251
|
+
|
|
252
|
+
})` Bad Request
|
|
253
|
+
* @response `403` `(HandlerMap & {
|
|
254
|
+
msg?: string,
|
|
255
|
+
|
|
256
|
+
})` Forbidden
|
|
257
|
+
* @response `404` `(HandlerMap & {
|
|
258
|
+
msg?: string,
|
|
259
|
+
|
|
260
|
+
})` Not Found
|
|
261
|
+
* @response `500` `(HandlerMap & {
|
|
262
|
+
msg?: string,
|
|
263
|
+
|
|
264
|
+
})` Internal Server Error
|
|
265
|
+
*/
|
|
266
|
+
updateComment: (id: number, comment: HandlerParamsCommentUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentUpdate, HandlerMap & {
|
|
267
|
+
msg?: string | undefined;
|
|
268
|
+
}>>;
|
|
269
|
+
/**
|
|
270
|
+
* @description Delete a specific comment
|
|
271
|
+
*
|
|
272
|
+
* @tags Comment
|
|
273
|
+
* @name DeleteComment
|
|
274
|
+
* @summary Delete Comment
|
|
275
|
+
* @request DELETE:/comments/{id}
|
|
276
|
+
* @secure
|
|
277
|
+
* @response `200` `HandlerMap` OK
|
|
278
|
+
* @response `403` `(HandlerMap & {
|
|
279
|
+
msg?: string,
|
|
280
|
+
|
|
281
|
+
})` Forbidden
|
|
282
|
+
* @response `404` `(HandlerMap & {
|
|
283
|
+
msg?: string,
|
|
284
|
+
|
|
285
|
+
})` Not Found
|
|
286
|
+
* @response `500` `(HandlerMap & {
|
|
287
|
+
msg?: string,
|
|
288
|
+
|
|
289
|
+
})` Internal Server Error
|
|
290
|
+
*/
|
|
291
|
+
deleteComment: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
292
|
+
msg?: string | undefined;
|
|
293
|
+
}>>;
|
|
294
|
+
};
|
|
295
|
+
conf: {
|
|
296
|
+
/**
|
|
297
|
+
* @description Get System Configs for UI
|
|
298
|
+
*
|
|
299
|
+
* @tags System
|
|
300
|
+
* @name Conf
|
|
301
|
+
* @summary Get System Configs
|
|
302
|
+
* @request GET:/conf
|
|
303
|
+
* @response `200` `CommonConfData` OK
|
|
304
|
+
*/
|
|
305
|
+
conf: (params?: RequestParams) => Promise<HttpResponse<CommonConfData, any>>;
|
|
306
|
+
};
|
|
307
|
+
notifies: {
|
|
308
|
+
/**
|
|
309
|
+
* @description Get a list of notifies for user
|
|
310
|
+
*
|
|
311
|
+
* @tags Notify
|
|
312
|
+
* @name GetNotifies
|
|
313
|
+
* @summary Get Notifies
|
|
314
|
+
* @request GET:/notifies
|
|
315
|
+
* @response `200` `HandlerResponseNotifyList` OK
|
|
316
|
+
* @response `400` `(HandlerMap & {
|
|
317
|
+
msg?: string,
|
|
318
|
+
|
|
319
|
+
})` Bad Request
|
|
320
|
+
* @response `500` `(HandlerMap & {
|
|
321
|
+
msg?: string,
|
|
322
|
+
|
|
323
|
+
})` Internal Server Error
|
|
324
|
+
*/
|
|
325
|
+
getNotifies: (query: {
|
|
326
|
+
/** The user email */
|
|
327
|
+
email: string;
|
|
328
|
+
/** The user name */
|
|
329
|
+
name: string;
|
|
330
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseNotifyList, HandlerMap & {
|
|
331
|
+
msg?: string | undefined;
|
|
332
|
+
}>>;
|
|
333
|
+
/**
|
|
334
|
+
* @description Mark all notifies as read for user
|
|
335
|
+
*
|
|
336
|
+
* @tags Notify
|
|
337
|
+
* @name MarkAllNotifyRead
|
|
338
|
+
* @summary Mark All Notifies as Read
|
|
339
|
+
* @request POST:/notifies/read
|
|
340
|
+
* @response `200` `HandlerMap` OK
|
|
341
|
+
* @response `400` `(HandlerMap & {
|
|
342
|
+
msg?: string,
|
|
343
|
+
|
|
344
|
+
})` Bad Request
|
|
345
|
+
* @response `500` `(HandlerMap & {
|
|
346
|
+
msg?: string,
|
|
347
|
+
|
|
348
|
+
})` Internal Server Error
|
|
349
|
+
*/
|
|
350
|
+
markAllNotifyRead: (options: HandlerParamsNotifyReadAll, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
351
|
+
msg?: string | undefined;
|
|
352
|
+
}>>;
|
|
353
|
+
/**
|
|
354
|
+
* @description Mark specific notification as read for user
|
|
355
|
+
*
|
|
356
|
+
* @tags Notify
|
|
357
|
+
* @name MarkNotifyRead
|
|
358
|
+
* @summary Mark Notify as Read
|
|
359
|
+
* @request POST:/notifies/{comment_id}/{notify_key}
|
|
360
|
+
* @response `200` `HandlerMap` OK
|
|
361
|
+
* @response `400` `(HandlerMap & {
|
|
362
|
+
msg?: string,
|
|
363
|
+
|
|
364
|
+
})` Bad Request
|
|
365
|
+
* @response `404` `(HandlerMap & {
|
|
366
|
+
msg?: string,
|
|
367
|
+
|
|
368
|
+
})` Not Found
|
|
369
|
+
* @response `500` `(HandlerMap & {
|
|
370
|
+
msg?: string,
|
|
371
|
+
|
|
372
|
+
})` Internal Server Error
|
|
373
|
+
*/
|
|
374
|
+
markNotifyRead: (commentId: number, notifyKey: string, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
375
|
+
msg?: string | undefined;
|
|
376
|
+
}>>;
|
|
377
|
+
};
|
|
378
|
+
pages: {
|
|
379
|
+
/**
|
|
380
|
+
* @description Get a list of pages by some conditions
|
|
381
|
+
*
|
|
382
|
+
* @tags Page
|
|
383
|
+
* @name GetPages
|
|
384
|
+
* @summary Get Page List
|
|
385
|
+
* @request GET:/pages
|
|
386
|
+
* @secure
|
|
387
|
+
* @response `200` `HandlerResponsePageList` OK
|
|
388
|
+
* @response `403` `(HandlerMap & {
|
|
389
|
+
msg?: string,
|
|
390
|
+
|
|
391
|
+
})` Forbidden
|
|
392
|
+
*/
|
|
393
|
+
getPages: (query?: {
|
|
394
|
+
/** The limit for pagination */
|
|
395
|
+
limit?: number;
|
|
396
|
+
/** The offset for pagination */
|
|
397
|
+
offset?: number;
|
|
398
|
+
/** The site name of your content scope */
|
|
399
|
+
site_name?: string;
|
|
400
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageList, HandlerMap & {
|
|
401
|
+
msg?: string | undefined;
|
|
402
|
+
}>>;
|
|
403
|
+
/**
|
|
404
|
+
* @description Fetch the data of all pages
|
|
405
|
+
*
|
|
406
|
+
* @tags Page
|
|
407
|
+
* @name FetchAllPages
|
|
408
|
+
* @summary Fetch All Pages Data
|
|
409
|
+
* @request POST:/pages/fetch
|
|
410
|
+
* @secure
|
|
411
|
+
* @response `200` `HandlerMap` OK
|
|
412
|
+
* @response `400` `(HandlerMap & {
|
|
413
|
+
msg?: string,
|
|
414
|
+
|
|
415
|
+
})` Bad Request
|
|
416
|
+
* @response `500` `(HandlerMap & {
|
|
417
|
+
msg?: string,
|
|
418
|
+
|
|
419
|
+
})` Internal Server Error
|
|
420
|
+
*/
|
|
421
|
+
fetchAllPages: (options: HandlerParamsPageFetchAll, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
422
|
+
msg?: string | undefined;
|
|
423
|
+
}>>;
|
|
424
|
+
/**
|
|
425
|
+
* @description Get the status of the task of fetching all pages
|
|
426
|
+
*
|
|
427
|
+
* @tags Page
|
|
428
|
+
* @name GetPageFetchStatus
|
|
429
|
+
* @summary Get Pages Fetch Status
|
|
430
|
+
* @request GET:/pages/fetch/status
|
|
431
|
+
* @secure
|
|
432
|
+
* @response `200` `HandlerResponsePageFetchStatus` OK
|
|
433
|
+
*/
|
|
434
|
+
getPageFetchStatus: (params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageFetchStatus, any>>;
|
|
435
|
+
/**
|
|
436
|
+
* @description Increase and get the number of page views
|
|
437
|
+
*
|
|
438
|
+
* @tags Page
|
|
439
|
+
* @name LogPv
|
|
440
|
+
* @summary Increase Page Views (PV)
|
|
441
|
+
* @request POST:/pages/pv
|
|
442
|
+
* @response `200` `HandlerResponsePagePV` OK
|
|
443
|
+
*/
|
|
444
|
+
logPv: (page: HandlerParamsPagePV, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePagePV, any>>;
|
|
445
|
+
/**
|
|
446
|
+
* @description Update a specific page
|
|
447
|
+
*
|
|
448
|
+
* @tags Page
|
|
449
|
+
* @name UpdatePage
|
|
450
|
+
* @summary Update Page
|
|
451
|
+
* @request PUT:/pages/{id}
|
|
452
|
+
* @secure
|
|
453
|
+
* @response `200` `HandlerResponsePageUpdate` OK
|
|
454
|
+
* @response `400` `(HandlerMap & {
|
|
455
|
+
msg?: string,
|
|
456
|
+
|
|
457
|
+
})` Bad Request
|
|
458
|
+
* @response `403` `(HandlerMap & {
|
|
459
|
+
msg?: string,
|
|
460
|
+
|
|
461
|
+
})` Forbidden
|
|
462
|
+
* @response `404` `(HandlerMap & {
|
|
463
|
+
msg?: string,
|
|
464
|
+
|
|
465
|
+
})` Not Found
|
|
466
|
+
* @response `500` `(HandlerMap & {
|
|
467
|
+
msg?: string,
|
|
468
|
+
|
|
469
|
+
})` Internal Server Error
|
|
470
|
+
*/
|
|
471
|
+
updatePage: (id: number, page: HandlerParamsPageUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageUpdate, HandlerMap & {
|
|
472
|
+
msg?: string | undefined;
|
|
473
|
+
}>>;
|
|
474
|
+
/**
|
|
475
|
+
* @description Delete a specific page
|
|
476
|
+
*
|
|
477
|
+
* @tags Page
|
|
478
|
+
* @name DeletePage
|
|
479
|
+
* @summary Delete Page
|
|
480
|
+
* @request DELETE:/pages/{id}
|
|
481
|
+
* @secure
|
|
482
|
+
* @response `200` `HandlerMap` OK
|
|
483
|
+
* @response `403` `(HandlerMap & {
|
|
484
|
+
msg?: string,
|
|
485
|
+
|
|
486
|
+
})` Forbidden
|
|
487
|
+
* @response `404` `(HandlerMap & {
|
|
488
|
+
msg?: string,
|
|
489
|
+
|
|
490
|
+
})` Not Found
|
|
491
|
+
* @response `500` `(HandlerMap & {
|
|
492
|
+
msg?: string,
|
|
493
|
+
|
|
494
|
+
})` Internal Server Error
|
|
495
|
+
*/
|
|
496
|
+
deletePage: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
497
|
+
msg?: string | undefined;
|
|
498
|
+
}>>;
|
|
499
|
+
/**
|
|
500
|
+
* @description Fetch the data of a specific page
|
|
501
|
+
*
|
|
502
|
+
* @tags Page
|
|
503
|
+
* @name FetchPage
|
|
504
|
+
* @summary Fetch Page Data
|
|
505
|
+
* @request POST:/pages/{id}/fetch
|
|
506
|
+
* @secure
|
|
507
|
+
* @response `200` `HandlerResponsePageFetch` OK
|
|
508
|
+
* @response `404` `(HandlerMap & {
|
|
509
|
+
msg?: string,
|
|
510
|
+
|
|
511
|
+
})` Not Found
|
|
512
|
+
* @response `500` `(HandlerMap & {
|
|
513
|
+
msg?: string,
|
|
514
|
+
|
|
515
|
+
})` Internal Server Error
|
|
516
|
+
*/
|
|
517
|
+
fetchPage: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerResponsePageFetch, HandlerMap & {
|
|
518
|
+
msg?: string | undefined;
|
|
519
|
+
}>>;
|
|
520
|
+
};
|
|
521
|
+
sendEmail: {
|
|
522
|
+
/**
|
|
523
|
+
* @description Send an email to test the email sender
|
|
524
|
+
*
|
|
525
|
+
* @tags System
|
|
526
|
+
* @name SendEmail
|
|
527
|
+
* @summary Send Email
|
|
528
|
+
* @request POST:/send_email
|
|
529
|
+
* @secure
|
|
530
|
+
* @response `200` `HandlerMap` OK
|
|
531
|
+
* @response `403` `(HandlerMap & {
|
|
532
|
+
msg?: string,
|
|
533
|
+
|
|
534
|
+
})` Forbidden
|
|
535
|
+
* @response `500` `HandlerMap` Internal Server Error
|
|
536
|
+
*/
|
|
537
|
+
sendEmail: (email: HandlerParamsEmailSend, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap | (HandlerMap & {
|
|
538
|
+
msg?: string | undefined;
|
|
539
|
+
})>>;
|
|
540
|
+
};
|
|
541
|
+
settings: {
|
|
542
|
+
/**
|
|
543
|
+
* @description Get settings from app config file
|
|
544
|
+
*
|
|
545
|
+
* @tags System
|
|
546
|
+
* @name GetSettings
|
|
547
|
+
* @summary Get Settings
|
|
548
|
+
* @request GET:/settings
|
|
549
|
+
* @secure
|
|
550
|
+
* @response `200` `HandlerResponseSettingGet` OK
|
|
551
|
+
* @response `403` `(HandlerMap & {
|
|
552
|
+
msg?: string,
|
|
553
|
+
|
|
554
|
+
})` Forbidden
|
|
555
|
+
* @response `500` `(HandlerMap & {
|
|
556
|
+
msg?: string,
|
|
557
|
+
|
|
558
|
+
})` Internal Server Error
|
|
559
|
+
*/
|
|
560
|
+
getSettings: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseSettingGet, HandlerMap & {
|
|
561
|
+
msg?: string | undefined;
|
|
562
|
+
}>>;
|
|
563
|
+
/**
|
|
564
|
+
* @description Apply settings and restart the server
|
|
565
|
+
*
|
|
566
|
+
* @tags System
|
|
567
|
+
* @name ApplySettings
|
|
568
|
+
* @summary Save and apply Settings
|
|
569
|
+
* @request PUT:/settings
|
|
570
|
+
* @secure
|
|
571
|
+
* @response `200` `HandlerMap` OK
|
|
572
|
+
* @response `403` `(HandlerMap & {
|
|
573
|
+
msg?: string,
|
|
574
|
+
|
|
575
|
+
})` Forbidden
|
|
576
|
+
* @response `500` `(HandlerMap & {
|
|
577
|
+
msg?: string,
|
|
578
|
+
|
|
579
|
+
})` Internal Server Error
|
|
580
|
+
*/
|
|
581
|
+
applySettings: (settings: HandlerParamsSettingApply, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
582
|
+
msg?: string | undefined;
|
|
583
|
+
}>>;
|
|
584
|
+
/**
|
|
585
|
+
* @description Get config templates in different languages for rendering the settings page in the frontend
|
|
586
|
+
*
|
|
587
|
+
* @tags System
|
|
588
|
+
* @name GetSettingsTemplate
|
|
589
|
+
* @summary Get Settings Template
|
|
590
|
+
* @request GET:/settings/template/{locale}
|
|
591
|
+
* @secure
|
|
592
|
+
* @response `200` `HandlerResponseSettingTemplate` OK
|
|
593
|
+
*/
|
|
594
|
+
getSettingsTemplate: (locale: string, params?: RequestParams) => Promise<HttpResponse<HandlerResponseSettingTemplate, any>>;
|
|
595
|
+
};
|
|
596
|
+
sites: {
|
|
597
|
+
/**
|
|
598
|
+
* @description Get a list of sites by some conditions
|
|
599
|
+
*
|
|
600
|
+
* @tags Site
|
|
601
|
+
* @name GetSites
|
|
602
|
+
* @summary Get Site List
|
|
603
|
+
* @request GET:/sites
|
|
604
|
+
* @secure
|
|
605
|
+
* @response `200` `HandlerResponseSiteList` OK
|
|
606
|
+
*/
|
|
607
|
+
getSites: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseSiteList, any>>;
|
|
608
|
+
/**
|
|
609
|
+
* @description Create a new site
|
|
610
|
+
*
|
|
611
|
+
* @tags Site
|
|
612
|
+
* @name CreateSite
|
|
613
|
+
* @summary Create Site
|
|
614
|
+
* @request POST:/sites
|
|
615
|
+
* @secure
|
|
616
|
+
* @response `200` `HandlerResponseSiteCreate` OK
|
|
617
|
+
* @response `400` `(HandlerMap & {
|
|
618
|
+
msg?: string,
|
|
619
|
+
|
|
620
|
+
})` Bad Request
|
|
621
|
+
* @response `403` `(HandlerMap & {
|
|
622
|
+
msg?: string,
|
|
623
|
+
|
|
624
|
+
})` Forbidden
|
|
625
|
+
* @response `500` `(HandlerMap & {
|
|
626
|
+
msg?: string,
|
|
627
|
+
|
|
628
|
+
})` Internal Server Error
|
|
629
|
+
*/
|
|
630
|
+
createSite: (site: HandlerParamsSiteCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseSiteCreate, HandlerMap & {
|
|
631
|
+
msg?: string | undefined;
|
|
632
|
+
}>>;
|
|
633
|
+
/**
|
|
634
|
+
* @description Update a specific site
|
|
635
|
+
*
|
|
636
|
+
* @tags Site
|
|
637
|
+
* @name UpdateSite
|
|
638
|
+
* @summary Update Site
|
|
639
|
+
* @request PUT:/sites/{id}
|
|
640
|
+
* @secure
|
|
641
|
+
* @response `200` `HandlerResponseSiteUpdate` OK
|
|
642
|
+
*/
|
|
643
|
+
updateSite: (id: number, site: HandlerParamsSiteUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseSiteUpdate, any>>;
|
|
644
|
+
/**
|
|
645
|
+
* @description Delete a specific site
|
|
646
|
+
*
|
|
647
|
+
* @tags Site
|
|
648
|
+
* @name DeleteSite
|
|
649
|
+
* @summary Site Delete
|
|
650
|
+
* @request DELETE:/sites/{id}
|
|
651
|
+
* @secure
|
|
652
|
+
* @response `200` `HandlerMap` OK
|
|
653
|
+
* @response `403` `(HandlerMap & {
|
|
654
|
+
msg?: string,
|
|
655
|
+
|
|
656
|
+
})` Forbidden
|
|
657
|
+
* @response `404` `(HandlerMap & {
|
|
658
|
+
msg?: string,
|
|
659
|
+
|
|
660
|
+
})` Not Found
|
|
661
|
+
* @response `500` `(HandlerMap & {
|
|
662
|
+
msg?: string,
|
|
663
|
+
|
|
664
|
+
})` Internal Server Error
|
|
665
|
+
*/
|
|
666
|
+
deleteSite: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
667
|
+
msg?: string | undefined;
|
|
668
|
+
}>>;
|
|
669
|
+
};
|
|
670
|
+
stats: {
|
|
671
|
+
/**
|
|
672
|
+
* @description Get the statistics of various data analysis
|
|
673
|
+
*
|
|
674
|
+
* @tags Statistic
|
|
675
|
+
* @name GetStats
|
|
676
|
+
* @summary Statistic
|
|
677
|
+
* @request GET:/stats/{type}
|
|
678
|
+
* @response `200` `CommonJSONResult` OK
|
|
679
|
+
* @response `400` `(HandlerMap & {
|
|
680
|
+
msg?: string,
|
|
681
|
+
|
|
682
|
+
})` Bad Request
|
|
683
|
+
* @response `403` `(HandlerMap & {
|
|
684
|
+
msg?: string,
|
|
685
|
+
|
|
686
|
+
})` Forbidden
|
|
687
|
+
* @response `404` `(HandlerMap & {
|
|
688
|
+
msg?: string,
|
|
689
|
+
|
|
690
|
+
})` Not Found
|
|
691
|
+
* @response `500` `(HandlerMap & {
|
|
692
|
+
msg?: string,
|
|
693
|
+
|
|
694
|
+
})` Internal Server Error
|
|
695
|
+
*/
|
|
696
|
+
getStats: (type: 'latest_comments' | 'latest_pages' | 'pv_most_pages' | 'comment_most_pages' | 'page_pv' | 'site_pv' | 'page_comment' | 'site_comment' | 'rand_comments' | 'rand_pages', query?: {
|
|
697
|
+
/** The limit for pagination */
|
|
698
|
+
limit?: number;
|
|
699
|
+
/** multiple page keys separated by commas */
|
|
700
|
+
page_keys?: string;
|
|
701
|
+
/** The site name of your content scope */
|
|
702
|
+
site_name?: string;
|
|
703
|
+
}, params?: RequestParams) => Promise<HttpResponse<CommonJSONResult, HandlerMap & {
|
|
704
|
+
msg?: string | undefined;
|
|
705
|
+
}>>;
|
|
706
|
+
};
|
|
707
|
+
transfer: {
|
|
708
|
+
/**
|
|
709
|
+
* @description Export data from Artalk
|
|
710
|
+
*
|
|
711
|
+
* @tags Transfer
|
|
712
|
+
* @name ExportArtrans
|
|
713
|
+
* @summary Export Artrans
|
|
714
|
+
* @request GET:/transfer/export
|
|
715
|
+
* @secure
|
|
716
|
+
* @response `200` `HandlerResponseTransferExport` OK
|
|
717
|
+
* @response `500` `(HandlerMap & {
|
|
718
|
+
msg?: string,
|
|
719
|
+
|
|
720
|
+
})` Internal Server Error
|
|
721
|
+
*/
|
|
722
|
+
exportArtrans: (params?: RequestParams) => Promise<HttpResponse<HandlerResponseTransferExport, HandlerMap & {
|
|
723
|
+
msg?: string | undefined;
|
|
724
|
+
}>>;
|
|
725
|
+
/**
|
|
726
|
+
* @description Import data to Artalk
|
|
727
|
+
*
|
|
728
|
+
* @tags Transfer
|
|
729
|
+
* @name ImportArtrans
|
|
730
|
+
* @summary Import Artrans
|
|
731
|
+
* @request POST:/transfer/import
|
|
732
|
+
* @secure
|
|
733
|
+
* @response `200` `string` OK
|
|
734
|
+
*/
|
|
735
|
+
importArtrans: (data: HandlerParamsTransferImport, params?: RequestParams) => Promise<HttpResponse<string, any>>;
|
|
736
|
+
/**
|
|
737
|
+
* @description Upload a file to prepare to import
|
|
738
|
+
*
|
|
739
|
+
* @tags Transfer
|
|
740
|
+
* @name UploadArtrans
|
|
741
|
+
* @summary Upload Artrans
|
|
742
|
+
* @request POST:/transfer/upload
|
|
743
|
+
* @secure
|
|
744
|
+
* @response `200` `(HandlerResponseTransferUpload & {
|
|
745
|
+
filename?: string,
|
|
746
|
+
|
|
747
|
+
})` OK
|
|
748
|
+
* @response `500` `(HandlerMap & {
|
|
749
|
+
msg?: string,
|
|
750
|
+
|
|
751
|
+
})` Internal Server Error
|
|
752
|
+
*/
|
|
753
|
+
uploadArtrans: (data: {
|
|
754
|
+
/**
|
|
755
|
+
* Upload file in preparation for import task
|
|
756
|
+
* @format binary
|
|
757
|
+
*/
|
|
758
|
+
file: File;
|
|
759
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseTransferUpload & {
|
|
760
|
+
filename?: string | undefined;
|
|
761
|
+
}, HandlerMap & {
|
|
762
|
+
msg?: string | undefined;
|
|
763
|
+
}>>;
|
|
764
|
+
};
|
|
765
|
+
upload: {
|
|
766
|
+
/**
|
|
767
|
+
* @description Upload file from this endpoint
|
|
768
|
+
*
|
|
769
|
+
* @tags Upload
|
|
770
|
+
* @name Upload
|
|
771
|
+
* @summary Upload
|
|
772
|
+
* @request POST:/upload
|
|
773
|
+
* @secure
|
|
774
|
+
* @response `200` `HandlerResponseUpload` OK
|
|
775
|
+
* @response `400` `(HandlerMap & {
|
|
776
|
+
msg?: string,
|
|
777
|
+
|
|
778
|
+
})` Bad Request
|
|
779
|
+
* @response `403` `(HandlerMap & {
|
|
780
|
+
msg?: string,
|
|
781
|
+
|
|
782
|
+
})` Forbidden
|
|
783
|
+
* @response `500` `(HandlerMap & {
|
|
784
|
+
msg?: string,
|
|
785
|
+
|
|
786
|
+
})` Internal Server Error
|
|
787
|
+
*/
|
|
788
|
+
upload: (data: {
|
|
789
|
+
/**
|
|
790
|
+
* Upload file
|
|
791
|
+
* @format binary
|
|
792
|
+
*/
|
|
793
|
+
file: File;
|
|
794
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUpload, HandlerMap & {
|
|
795
|
+
msg?: string | undefined;
|
|
796
|
+
}>>;
|
|
797
|
+
};
|
|
798
|
+
user: {
|
|
799
|
+
/**
|
|
800
|
+
* @description Get user info to prepare for login or check current user status
|
|
801
|
+
*
|
|
802
|
+
* @tags Account
|
|
803
|
+
* @name GetUser
|
|
804
|
+
* @summary Get User Info
|
|
805
|
+
* @request GET:/user
|
|
806
|
+
* @secure
|
|
807
|
+
* @response `200` `HandlerResponseUserInfo` OK
|
|
808
|
+
* @response `400` `(HandlerMap & {
|
|
809
|
+
msg?: string,
|
|
810
|
+
|
|
811
|
+
})` Bad Request
|
|
812
|
+
*/
|
|
813
|
+
getUser: (query?: {
|
|
814
|
+
/** The user email */
|
|
815
|
+
email?: string;
|
|
816
|
+
/** The username */
|
|
817
|
+
name?: string;
|
|
818
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserInfo, HandlerMap & {
|
|
819
|
+
msg?: string | undefined;
|
|
820
|
+
}>>;
|
|
821
|
+
/**
|
|
822
|
+
* @description Login user by name or email
|
|
823
|
+
*
|
|
824
|
+
* @tags Account
|
|
825
|
+
* @name Login
|
|
826
|
+
* @summary Get Access Token
|
|
827
|
+
* @request POST:/user/access_token
|
|
828
|
+
* @response `200` `HandlerResponseUserLogin` OK
|
|
829
|
+
* @response `400` `(HandlerMap & {
|
|
830
|
+
" data"?: {
|
|
831
|
+
need_name_select?: (string)[],
|
|
832
|
+
|
|
833
|
+
},
|
|
834
|
+
msg?: string,
|
|
835
|
+
|
|
836
|
+
})` Multiple users with the same email address are matched
|
|
837
|
+
* @response `403` `(HandlerMap & {
|
|
838
|
+
msg?: string,
|
|
839
|
+
|
|
840
|
+
})` Forbidden
|
|
841
|
+
* @response `500` `(HandlerMap & {
|
|
842
|
+
msg?: string,
|
|
843
|
+
|
|
844
|
+
})` Internal Server Error
|
|
845
|
+
*/
|
|
846
|
+
login: (user: HandlerParamsUserLogin, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserLogin, (HandlerMap & {
|
|
847
|
+
' data'?: {
|
|
848
|
+
need_name_select?: string[] | undefined;
|
|
849
|
+
} | undefined;
|
|
850
|
+
msg?: string | undefined;
|
|
851
|
+
}) | (HandlerMap & {
|
|
852
|
+
msg?: string | undefined;
|
|
853
|
+
})>>;
|
|
854
|
+
/**
|
|
855
|
+
* @description Get user login status by header Authorization
|
|
856
|
+
*
|
|
857
|
+
* @tags Account
|
|
858
|
+
* @name GetUserStatus
|
|
859
|
+
* @summary Get Login Status
|
|
860
|
+
* @request GET:/user/status
|
|
861
|
+
* @secure
|
|
862
|
+
* @response `200` `HandlerResponseUserStatus` OK
|
|
863
|
+
*/
|
|
864
|
+
getUserStatus: (query?: {
|
|
865
|
+
/** The user email */
|
|
866
|
+
email?: string;
|
|
867
|
+
/** The username */
|
|
868
|
+
name?: string;
|
|
869
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserStatus, any>>;
|
|
870
|
+
};
|
|
871
|
+
users: {
|
|
872
|
+
/**
|
|
873
|
+
* @description Create a new user
|
|
874
|
+
*
|
|
875
|
+
* @tags User
|
|
876
|
+
* @name CreateUser
|
|
877
|
+
* @summary Create User
|
|
878
|
+
* @request POST:/users
|
|
879
|
+
* @secure
|
|
880
|
+
* @response `200` `HandlerResponseUserCreate` OK
|
|
881
|
+
* @response `400` `(HandlerMap & {
|
|
882
|
+
msg?: string,
|
|
883
|
+
|
|
884
|
+
})` Bad Request
|
|
885
|
+
* @response `403` `(HandlerMap & {
|
|
886
|
+
msg?: string,
|
|
887
|
+
|
|
888
|
+
})` Forbidden
|
|
889
|
+
* @response `500` `(HandlerMap & {
|
|
890
|
+
msg?: string,
|
|
891
|
+
|
|
892
|
+
})` Internal Server Error
|
|
893
|
+
*/
|
|
894
|
+
createUser: (user: HandlerParamsUserCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserCreate, HandlerMap & {
|
|
895
|
+
msg?: string | undefined;
|
|
896
|
+
}>>;
|
|
897
|
+
/**
|
|
898
|
+
* @description Update a specific user
|
|
899
|
+
*
|
|
900
|
+
* @tags User
|
|
901
|
+
* @name UpdateUser
|
|
902
|
+
* @summary Update User
|
|
903
|
+
* @request PUT:/users/{id}
|
|
904
|
+
* @secure
|
|
905
|
+
* @response `200` `HandlerResponseUserUpdate` OK
|
|
906
|
+
* @response `400` `(HandlerMap & {
|
|
907
|
+
msg?: string,
|
|
908
|
+
|
|
909
|
+
})` Bad Request
|
|
910
|
+
* @response `403` `(HandlerMap & {
|
|
911
|
+
msg?: string,
|
|
912
|
+
|
|
913
|
+
})` Forbidden
|
|
914
|
+
* @response `404` `(HandlerMap & {
|
|
915
|
+
msg?: string,
|
|
916
|
+
|
|
917
|
+
})` Not Found
|
|
918
|
+
* @response `500` `(HandlerMap & {
|
|
919
|
+
msg?: string,
|
|
920
|
+
|
|
921
|
+
})` Internal Server Error
|
|
922
|
+
*/
|
|
923
|
+
updateUser: (id: number, user: HandlerParamsUserUpdate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseUserUpdate, HandlerMap & {
|
|
924
|
+
msg?: string | undefined;
|
|
925
|
+
}>>;
|
|
926
|
+
/**
|
|
927
|
+
* @description Delete a specific user
|
|
928
|
+
*
|
|
929
|
+
* @tags User
|
|
930
|
+
* @name DeleteUser
|
|
931
|
+
* @summary Delete User
|
|
932
|
+
* @request DELETE:/users/{id}
|
|
933
|
+
* @secure
|
|
934
|
+
* @response `200` `HandlerMap` OK
|
|
935
|
+
* @response `403` `(HandlerMap & {
|
|
936
|
+
msg?: string,
|
|
937
|
+
|
|
938
|
+
})` Forbidden
|
|
939
|
+
* @response `404` `(HandlerMap & {
|
|
940
|
+
msg?: string,
|
|
941
|
+
|
|
942
|
+
})` Not Found
|
|
943
|
+
* @response `500` `(HandlerMap & {
|
|
944
|
+
msg?: string,
|
|
945
|
+
|
|
946
|
+
})` Internal Server Error
|
|
947
|
+
*/
|
|
948
|
+
deleteUser: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
949
|
+
msg?: string | undefined;
|
|
950
|
+
}>>;
|
|
951
|
+
/**
|
|
952
|
+
* @description Get a list of users by some conditions
|
|
953
|
+
*
|
|
954
|
+
* @tags User
|
|
955
|
+
* @name GetUsers
|
|
956
|
+
* @summary Get User List
|
|
957
|
+
* @request GET:/users/{type}
|
|
958
|
+
* @secure
|
|
959
|
+
* @response `200` `HandlerResponseAdminUserList` OK
|
|
960
|
+
* @response `403` `(HandlerMap & {
|
|
961
|
+
msg?: string,
|
|
962
|
+
|
|
963
|
+
})` Forbidden
|
|
964
|
+
*/
|
|
965
|
+
getUsers: (type?: 'all' | 'admin' | 'in_conf', query?: {
|
|
966
|
+
/** The limit for pagination */
|
|
967
|
+
limit?: number;
|
|
968
|
+
/** The offset for pagination */
|
|
969
|
+
offset?: number;
|
|
970
|
+
}, params?: RequestParams) => Promise<HttpResponse<HandlerResponseAdminUserList, HandlerMap & {
|
|
971
|
+
msg?: string | undefined;
|
|
972
|
+
}>>;
|
|
973
|
+
};
|
|
974
|
+
version: {
|
|
975
|
+
/**
|
|
976
|
+
* @description Get the version of Artalk
|
|
977
|
+
*
|
|
978
|
+
* @tags System
|
|
979
|
+
* @name GetVersion
|
|
980
|
+
* @summary Get Version Info
|
|
981
|
+
* @request GET:/version
|
|
982
|
+
* @response `200` `CommonApiVersionData` OK
|
|
983
|
+
*/
|
|
984
|
+
getVersion: (params?: RequestParams) => Promise<HttpResponse<CommonApiVersionData, any>>;
|
|
985
|
+
};
|
|
986
|
+
votes: {
|
|
987
|
+
/**
|
|
988
|
+
* @description Sync the number of votes in the `comments` or `pages` data tables to keep them the same as the `votes` table
|
|
989
|
+
*
|
|
990
|
+
* @tags Vote
|
|
991
|
+
* @name SyncVotes
|
|
992
|
+
* @summary Sync Vote Data
|
|
993
|
+
* @request POST:/votes/sync
|
|
994
|
+
* @secure
|
|
995
|
+
* @response `200` `HandlerMap` OK
|
|
996
|
+
* @response `403` `(HandlerMap & {
|
|
997
|
+
msg?: string,
|
|
998
|
+
|
|
999
|
+
})` Forbidden
|
|
1000
|
+
*/
|
|
1001
|
+
syncVotes: (params?: RequestParams) => Promise<HttpResponse<HandlerMap, HandlerMap & {
|
|
1002
|
+
msg?: string | undefined;
|
|
1003
|
+
}>>;
|
|
1004
|
+
/**
|
|
1005
|
+
* @description Vote for a specific comment or page
|
|
1006
|
+
*
|
|
1007
|
+
* @tags Vote
|
|
1008
|
+
* @name Vote
|
|
1009
|
+
* @summary Vote
|
|
1010
|
+
* @request POST:/votes/{type}/{target_id}
|
|
1011
|
+
* @response `200` `HandlerResponseVote` OK
|
|
1012
|
+
* @response `403` `(HandlerMap & {
|
|
1013
|
+
msg?: string,
|
|
1014
|
+
|
|
1015
|
+
})` Forbidden
|
|
1016
|
+
* @response `404` `(HandlerMap & {
|
|
1017
|
+
msg?: string,
|
|
1018
|
+
|
|
1019
|
+
})` Not Found
|
|
1020
|
+
* @response `500` `(HandlerMap & {
|
|
1021
|
+
msg?: string,
|
|
1022
|
+
|
|
1023
|
+
})` Internal Server Error
|
|
1024
|
+
*/
|
|
1025
|
+
vote: (type: 'comment_up' | 'comment_down' | 'page_up' | 'page_down', targetId: number, vote: HandlerParamsVote, params?: RequestParams) => Promise<HttpResponse<HandlerResponseVote, HandlerMap & {
|
|
1026
|
+
msg?: string | undefined;
|
|
1027
|
+
}>>;
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
declare interface ApiConfig<SecurityDataType = unknown> {
|
|
1032
|
+
baseUrl?: string;
|
|
1033
|
+
baseApiParams?: Omit<RequestParams, 'baseUrl' | 'cancelToken' | 'signal'>;
|
|
1034
|
+
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
|
|
1035
|
+
customFetch?: typeof fetch;
|
|
1036
|
+
}
|
|
101
1037
|
|
|
102
1038
|
declare interface ApiOptions {
|
|
103
1039
|
baseURL: string;
|
|
@@ -105,23 +1041,18 @@ declare interface ApiOptions {
|
|
|
105
1041
|
pageKey: string;
|
|
106
1042
|
pageTitle: string;
|
|
107
1043
|
timeout?: number;
|
|
108
|
-
|
|
1044
|
+
getApiToken?: () => string | undefined;
|
|
109
1045
|
userInfo?: {
|
|
110
1046
|
name: string;
|
|
111
1047
|
email: string;
|
|
112
1048
|
};
|
|
113
1049
|
onNeedCheckCaptcha?: (payload: {
|
|
114
|
-
recall: () => void;
|
|
115
|
-
reject: () => void;
|
|
116
1050
|
data: {
|
|
117
|
-
imgData
|
|
118
|
-
iframe
|
|
1051
|
+
imgData?: string;
|
|
1052
|
+
iframe?: string;
|
|
119
1053
|
};
|
|
120
|
-
}) => void
|
|
121
|
-
onNeedCheckAdmin?: (payload: {
|
|
122
|
-
recall: () => void;
|
|
123
|
-
reject: () => void;
|
|
124
|
-
}) => void;
|
|
1054
|
+
}) => Promise<void>;
|
|
1055
|
+
onNeedCheckAdmin?: (payload: {}) => Promise<void>;
|
|
125
1056
|
}
|
|
126
1057
|
|
|
127
1058
|
export declare interface ApiVersionData {
|
|
@@ -133,12 +1064,6 @@ export declare interface ApiVersionData {
|
|
|
133
1064
|
commit_hash: string;
|
|
134
1065
|
}
|
|
135
1066
|
|
|
136
|
-
declare interface ApiVersionInfo {
|
|
137
|
-
app: string;
|
|
138
|
-
version: string;
|
|
139
|
-
commit_hash: string;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
1067
|
/**
|
|
143
1068
|
* Artalk
|
|
144
1069
|
*
|
|
@@ -272,6 +1197,7 @@ export declare interface ArtalkConfig {
|
|
|
272
1197
|
listUnreadHighlight?: boolean;
|
|
273
1198
|
scrollRelativeTo?: () => HTMLElement;
|
|
274
1199
|
immediateFetch?: boolean;
|
|
1200
|
+
pvAdd?: boolean;
|
|
275
1201
|
}
|
|
276
1202
|
|
|
277
1203
|
export declare type ArtalkPlugin = (ctx: ContextApi) => void;
|
|
@@ -296,6 +1222,8 @@ declare namespace ArtalkType {
|
|
|
296
1222
|
ListLastFetchData,
|
|
297
1223
|
DataManagerApi,
|
|
298
1224
|
NotifyLevel,
|
|
1225
|
+
UserInfoApiResponseData,
|
|
1226
|
+
FetchError,
|
|
299
1227
|
ContextApi,
|
|
300
1228
|
EditorState,
|
|
301
1229
|
EditorApi,
|
|
@@ -306,27 +1234,15 @@ declare namespace ArtalkType {
|
|
|
306
1234
|
}
|
|
307
1235
|
export { ArtalkType }
|
|
308
1236
|
|
|
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 {
|
|
1237
|
+
declare type CancelToken = Symbol | string | number;
|
|
1238
|
+
|
|
1239
|
+
declare interface Checker<T = any> {
|
|
324
1240
|
el?: HTMLElement;
|
|
325
1241
|
inputType?: 'password' | 'text';
|
|
326
1242
|
body: (checker: CheckerCtx) => HTMLElement;
|
|
327
|
-
request: (checker: CheckerCtx, inputVal: string) => Promise<
|
|
328
|
-
onSuccess?: (checker: CheckerCtx, respData:
|
|
329
|
-
onError?: (checker: CheckerCtx,
|
|
1243
|
+
request: (checker: CheckerCtx, inputVal: string) => Promise<T>;
|
|
1244
|
+
onSuccess?: (checker: CheckerCtx, respData: T, inputVal: string, formEl: HTMLElement) => void;
|
|
1245
|
+
onError?: (checker: CheckerCtx, errData: any, inputVal: string, formEl: HTMLElement) => void;
|
|
330
1246
|
}
|
|
331
1247
|
|
|
332
1248
|
declare interface CheckerCaptchaPayload extends CheckerPayload {
|
|
@@ -351,21 +1267,20 @@ declare interface CheckerCtx {
|
|
|
351
1267
|
declare class CheckerLauncher {
|
|
352
1268
|
private opts;
|
|
353
1269
|
constructor(opts: CheckerLauncherOptions);
|
|
354
|
-
checkCaptcha(payload: CheckerCaptchaPayload)
|
|
355
|
-
checkAdmin(payload: CheckerPayload)
|
|
1270
|
+
checkCaptcha: ((payload: CheckerCaptchaPayload) => Promise<void>);
|
|
1271
|
+
checkAdmin: ((payload: CheckerPayload) => Promise<void>);
|
|
356
1272
|
fire(checker: Checker, payload: CheckerPayload, postFire?: (c: CheckerCtx) => void): void;
|
|
357
|
-
private close;
|
|
358
1273
|
}
|
|
359
1274
|
|
|
360
1275
|
declare interface CheckerLauncherOptions {
|
|
361
1276
|
getCtx: () => ContextApi;
|
|
362
1277
|
getApi: () => Api;
|
|
363
|
-
|
|
1278
|
+
getCaptchaIframeURL: () => string;
|
|
364
1279
|
onReload: () => void;
|
|
365
1280
|
}
|
|
366
1281
|
|
|
367
1282
|
declare interface CheckerPayload {
|
|
368
|
-
onSuccess?: (
|
|
1283
|
+
onSuccess?: () => void;
|
|
369
1284
|
onMount?: (dialogEl: HTMLElement) => void;
|
|
370
1285
|
onCancel?: () => void;
|
|
371
1286
|
}
|
|
@@ -376,65 +1291,12 @@ declare interface CheckerStore {
|
|
|
376
1291
|
iframe?: string;
|
|
377
1292
|
}
|
|
378
1293
|
|
|
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
1294
|
declare class CommentActions {
|
|
433
1295
|
private comment;
|
|
434
1296
|
private get ctx();
|
|
435
1297
|
private get data();
|
|
436
1298
|
private get cConf();
|
|
437
|
-
constructor(comment:
|
|
1299
|
+
constructor(comment: CommentNode);
|
|
438
1300
|
/** 投票操作 */
|
|
439
1301
|
vote(type: 'up' | 'down'): void;
|
|
440
1302
|
/** 管理员 - 评论状态修改 */
|
|
@@ -445,34 +1307,6 @@ declare class CommentActions {
|
|
|
445
1307
|
goToReplyComment(): void;
|
|
446
1308
|
}
|
|
447
1309
|
|
|
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
1310
|
declare interface CommentConf {
|
|
477
1311
|
isUnread?: boolean;
|
|
478
1312
|
openURL?: string;
|
|
@@ -504,13 +1338,11 @@ export declare interface CommentData {
|
|
|
504
1338
|
/** 评论日期 */
|
|
505
1339
|
date: string;
|
|
506
1340
|
/** 是否折叠 */
|
|
507
|
-
is_collapsed
|
|
1341
|
+
is_collapsed: boolean;
|
|
508
1342
|
/** 是否待审 */
|
|
509
|
-
is_pending
|
|
1343
|
+
is_pending: boolean;
|
|
510
1344
|
/** 是否置顶 */
|
|
511
|
-
is_pinned
|
|
512
|
-
/** 是否为管理员 */
|
|
513
|
-
is_admin?: boolean;
|
|
1345
|
+
is_pinned: boolean;
|
|
514
1346
|
/** 徽章文字 */
|
|
515
1347
|
badge_name?: string;
|
|
516
1348
|
/** 徽章颜色 */
|
|
@@ -518,7 +1350,7 @@ export declare interface CommentData {
|
|
|
518
1350
|
/** IP 归属地 */
|
|
519
1351
|
ip_region?: string;
|
|
520
1352
|
/** 是否允许回复 */
|
|
521
|
-
is_allow_reply
|
|
1353
|
+
is_allow_reply: boolean;
|
|
522
1354
|
/** 评论页面 key */
|
|
523
1355
|
page_key: string;
|
|
524
1356
|
/** 评论页面 url */
|
|
@@ -533,25 +1365,103 @@ export declare interface CommentData {
|
|
|
533
1365
|
vote_down: number;
|
|
534
1366
|
}
|
|
535
1367
|
|
|
536
|
-
declare
|
|
1368
|
+
declare class CommentNode extends Component {
|
|
1369
|
+
private renderInstance;
|
|
1370
|
+
private actionInstance;
|
|
1371
|
+
private data;
|
|
1372
|
+
private cConf;
|
|
1373
|
+
private parent;
|
|
1374
|
+
private children;
|
|
1375
|
+
private nestCurt;
|
|
1376
|
+
private nestMax;
|
|
1377
|
+
constructor(ctx: ContextApi, data: CommentData, conf: CommentConf);
|
|
1378
|
+
/** 渲染 UI */
|
|
1379
|
+
render(): void;
|
|
1380
|
+
/** 获取评论操作实例对象 */
|
|
1381
|
+
getActions(): CommentActions;
|
|
1382
|
+
/** 获取评论渲染器实例对象 */
|
|
1383
|
+
getRender(): Render;
|
|
1384
|
+
/** 获取评论数据 */
|
|
1385
|
+
getData(): CommentData;
|
|
1386
|
+
/** 设置数据 */
|
|
1387
|
+
setData(data: CommentData): void;
|
|
1388
|
+
/** 获取父评论 */
|
|
1389
|
+
getParent(): CommentNode | null;
|
|
1390
|
+
/** 获取所有子评论 */
|
|
1391
|
+
getChildren(): CommentNode[];
|
|
1392
|
+
/** 获取当前嵌套层数 */
|
|
1393
|
+
getNestCurt(): number;
|
|
1394
|
+
/** 判断是否为根评论 */
|
|
1395
|
+
getIsRoot(): boolean;
|
|
1396
|
+
/** 获取评论 ID */
|
|
1397
|
+
getID(): number;
|
|
1398
|
+
/** 置入子评论 */
|
|
1399
|
+
putChild(childC: CommentNode, insertMode?: 'append' | 'prepend'): void;
|
|
1400
|
+
/** 获取存放子评论的元素对象 */
|
|
1401
|
+
getChildrenEl(): HTMLElement;
|
|
1402
|
+
/** 获取所有父评论 */
|
|
1403
|
+
getParents(): CommentNode[];
|
|
1404
|
+
/** 获取评论元素对象 */
|
|
1405
|
+
getEl(): HTMLElement;
|
|
1406
|
+
/** 获取 Gravatar 头像 URL */
|
|
1407
|
+
getGravatarURL(): string;
|
|
1408
|
+
/** 获取评论 markdown 解析后的内容 */
|
|
1409
|
+
getContentMarked(): string;
|
|
1410
|
+
/** 获取格式化后的日期 */
|
|
1411
|
+
getDateFormatted(): any;
|
|
1412
|
+
/** 获取用户 UserAgent 信息 */
|
|
1413
|
+
getUserUA(): {
|
|
1414
|
+
browser: string;
|
|
1415
|
+
os: string;
|
|
1416
|
+
};
|
|
1417
|
+
/** 获取配置 */
|
|
1418
|
+
getConf(): CommentConf;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
declare type CommentNode_2 = {
|
|
537
1422
|
id: number;
|
|
538
1423
|
comment: CommentData;
|
|
539
|
-
children:
|
|
540
|
-
parent?:
|
|
1424
|
+
children: CommentNode_2[];
|
|
1425
|
+
parent?: CommentNode_2;
|
|
541
1426
|
level: number;
|
|
542
1427
|
};
|
|
543
1428
|
|
|
1429
|
+
declare interface CommonApiVersionData {
|
|
1430
|
+
app: string;
|
|
1431
|
+
commit_hash: string;
|
|
1432
|
+
version: string;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
declare interface CommonConfData {
|
|
1436
|
+
frontend_conf: CommonMap;
|
|
1437
|
+
version: CommonApiVersionData;
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
declare interface CommonJSONResult {
|
|
1441
|
+
/** Data */
|
|
1442
|
+
data: any;
|
|
1443
|
+
/** Message */
|
|
1444
|
+
msg: string;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
declare type CommonMap = Record<string, any>;
|
|
1448
|
+
|
|
544
1449
|
declare abstract class Component {
|
|
545
1450
|
ctx: ContextApi;
|
|
546
1451
|
$el: HTMLElement;
|
|
547
|
-
|
|
1452
|
+
get conf(): ArtalkConfig;
|
|
548
1453
|
constructor(ctx: ContextApi);
|
|
549
1454
|
}
|
|
550
1455
|
|
|
1456
|
+
declare enum ContentType {
|
|
1457
|
+
Json = "application/json",
|
|
1458
|
+
FormData = "multipart/form-data",
|
|
1459
|
+
UrlEncoded = "application/x-www-form-urlencoded",
|
|
1460
|
+
Text = "text/plain"
|
|
1461
|
+
}
|
|
1462
|
+
|
|
551
1463
|
/**
|
|
552
|
-
* Context
|
|
553
|
-
*
|
|
554
|
-
* (面向接口的编程)
|
|
1464
|
+
* Artalk Context
|
|
555
1465
|
*/
|
|
556
1466
|
export declare interface ContextApi extends EventManagerFuncs<EventPayloadMap> {
|
|
557
1467
|
/** Artalk 根元素对象 */
|
|
@@ -578,6 +1488,20 @@ export declare interface ContextApi extends EventManagerFuncs<EventPayloadMap> {
|
|
|
578
1488
|
reload(): void;
|
|
579
1489
|
/** 列表滚动到第一个评论的位置 */
|
|
580
1490
|
listGotoFirst(): void;
|
|
1491
|
+
/** Get the comment data list */
|
|
1492
|
+
getComments(): CommentData[];
|
|
1493
|
+
/** Get the comment node list */
|
|
1494
|
+
getCommentNodes(): CommentNode[];
|
|
1495
|
+
/**
|
|
1496
|
+
* Get the comment data list
|
|
1497
|
+
* @deprecated Use `getComments()` instead
|
|
1498
|
+
*/
|
|
1499
|
+
getCommentDataList(): CommentData[];
|
|
1500
|
+
/**
|
|
1501
|
+
* Get the comment node list
|
|
1502
|
+
* @deprecated Use `getCommentNodes()` instead
|
|
1503
|
+
*/
|
|
1504
|
+
getCommentList(): CommentNode[];
|
|
581
1505
|
/** 显示侧边栏 */
|
|
582
1506
|
showSidebar(payload?: SidebarShowPayload): void;
|
|
583
1507
|
/** 隐藏侧边栏 */
|
|
@@ -591,9 +1515,9 @@ export declare interface ContextApi extends EventManagerFuncs<EventPayloadMap> {
|
|
|
591
1515
|
/** 评论框 - 复原状态 */
|
|
592
1516
|
editorResetState(): void;
|
|
593
1517
|
/** 验证码检测 */
|
|
594
|
-
checkCaptcha(payload: CheckerCaptchaPayload): void
|
|
1518
|
+
checkCaptcha(payload: CheckerCaptchaPayload): Promise<void>;
|
|
595
1519
|
/** 管理员检测 */
|
|
596
|
-
checkAdmin(payload: CheckerPayload): void
|
|
1520
|
+
checkAdmin(payload: CheckerPayload): Promise<void>;
|
|
597
1521
|
/** i18n 翻译 */
|
|
598
1522
|
$t(key: keyof I18n, args?: {
|
|
599
1523
|
[key: string]: string;
|
|
@@ -606,6 +1530,8 @@ export declare interface ContextApi extends EventManagerFuncs<EventPayloadMap> {
|
|
|
606
1530
|
getEl(): HTMLElement;
|
|
607
1531
|
/** 更新配置 */
|
|
608
1532
|
updateConf(conf: Partial<ArtalkConfig>): void;
|
|
1533
|
+
/** 监听配置更新 */
|
|
1534
|
+
watchConf<T extends (keyof ArtalkConfig)[]>(keys: T, effect: (val: Pick<ArtalkConfig, T[number]>) => void): void;
|
|
609
1535
|
}
|
|
610
1536
|
|
|
611
1537
|
export declare interface DataManagerApi {
|
|
@@ -621,8 +1547,8 @@ export declare interface DataManagerApi {
|
|
|
621
1547
|
insertComment(comment: CommentData): void;
|
|
622
1548
|
updateComment(comment: CommentData): void;
|
|
623
1549
|
deleteComment(id: number): void;
|
|
624
|
-
|
|
625
|
-
|
|
1550
|
+
getNotifies(): NotifyData[];
|
|
1551
|
+
updateNotifies(notifies: NotifyData[]): void;
|
|
626
1552
|
getPage(): PageData | undefined;
|
|
627
1553
|
updatePage(pageData: PageData): void;
|
|
628
1554
|
}
|
|
@@ -869,8 +1795,90 @@ declare const en: {
|
|
|
869
1795
|
currentVersion: string;
|
|
870
1796
|
ignore: string;
|
|
871
1797
|
open: string;
|
|
1798
|
+
openName: string;
|
|
872
1799
|
};
|
|
873
1800
|
|
|
1801
|
+
declare interface EntityCookedComment {
|
|
1802
|
+
badge_color: string;
|
|
1803
|
+
badge_name: string;
|
|
1804
|
+
content: string;
|
|
1805
|
+
content_marked: string;
|
|
1806
|
+
date: string;
|
|
1807
|
+
email_encrypted: string;
|
|
1808
|
+
id: number;
|
|
1809
|
+
ip_region: string;
|
|
1810
|
+
is_allow_reply: boolean;
|
|
1811
|
+
is_collapsed: boolean;
|
|
1812
|
+
is_pending: boolean;
|
|
1813
|
+
is_pinned: boolean;
|
|
1814
|
+
link: string;
|
|
1815
|
+
nick: string;
|
|
1816
|
+
page_key: string;
|
|
1817
|
+
page_url: string;
|
|
1818
|
+
rid: number;
|
|
1819
|
+
site_name: string;
|
|
1820
|
+
ua: string;
|
|
1821
|
+
user_id: number;
|
|
1822
|
+
visible: boolean;
|
|
1823
|
+
vote_down: number;
|
|
1824
|
+
vote_up: number;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
declare interface EntityCookedNotify {
|
|
1828
|
+
comment_id: number;
|
|
1829
|
+
id: number;
|
|
1830
|
+
is_emailed: boolean;
|
|
1831
|
+
is_read: boolean;
|
|
1832
|
+
read_link: string;
|
|
1833
|
+
user_id: number;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
declare interface EntityCookedPage {
|
|
1837
|
+
admin_only: boolean;
|
|
1838
|
+
id: number;
|
|
1839
|
+
key: string;
|
|
1840
|
+
pv: number;
|
|
1841
|
+
site_name: string;
|
|
1842
|
+
title: string;
|
|
1843
|
+
url: string;
|
|
1844
|
+
vote_down: number;
|
|
1845
|
+
vote_up: number;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
declare interface EntityCookedSite {
|
|
1849
|
+
first_url: string;
|
|
1850
|
+
id: number;
|
|
1851
|
+
name: string;
|
|
1852
|
+
urls: string[];
|
|
1853
|
+
urls_raw: string;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
declare interface EntityCookedUser {
|
|
1857
|
+
badge_color: string;
|
|
1858
|
+
badge_name: string;
|
|
1859
|
+
email: string;
|
|
1860
|
+
id: number;
|
|
1861
|
+
is_admin: boolean;
|
|
1862
|
+
link: string;
|
|
1863
|
+
name: string;
|
|
1864
|
+
receive_email: boolean;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
declare interface EntityCookedUserForAdmin {
|
|
1868
|
+
badge_color: string;
|
|
1869
|
+
badge_name: string;
|
|
1870
|
+
comment_count: number;
|
|
1871
|
+
email: string;
|
|
1872
|
+
id: number;
|
|
1873
|
+
is_admin: boolean;
|
|
1874
|
+
is_in_conf: boolean;
|
|
1875
|
+
last_ip: string;
|
|
1876
|
+
last_ua: string;
|
|
1877
|
+
link: string;
|
|
1878
|
+
name: string;
|
|
1879
|
+
receive_email: boolean;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
874
1882
|
declare interface ErrorData {
|
|
875
1883
|
msg: string;
|
|
876
1884
|
data?: any;
|
|
@@ -906,32 +1914,485 @@ declare interface EventOptions {
|
|
|
906
1914
|
|
|
907
1915
|
/** EventName to EventPayload Type */
|
|
908
1916
|
export declare interface EventPayloadMap {
|
|
909
|
-
'
|
|
910
|
-
'
|
|
1917
|
+
'created': undefined;
|
|
1918
|
+
'mounted': undefined;
|
|
1919
|
+
'updated': ArtalkConfig;
|
|
1920
|
+
'unmounted': undefined;
|
|
911
1921
|
'conf-fetch': undefined;
|
|
912
1922
|
'list-fetch': Partial<ListFetchParams>;
|
|
913
1923
|
'list-fetched': ListFetchedArgs;
|
|
914
1924
|
'list-load': CommentData[];
|
|
915
1925
|
'list-loaded': CommentData[];
|
|
916
|
-
'list-
|
|
1926
|
+
'list-failed': ErrorData;
|
|
917
1927
|
'list-goto-first': undefined;
|
|
918
1928
|
'list-reach-bottom': undefined;
|
|
919
1929
|
'comment-inserted': CommentData;
|
|
920
1930
|
'comment-updated': CommentData;
|
|
921
1931
|
'comment-deleted': CommentData;
|
|
922
|
-
'comment-rendered':
|
|
923
|
-
'
|
|
1932
|
+
'comment-rendered': CommentNode;
|
|
1933
|
+
'notifies-updated': NotifyData[];
|
|
924
1934
|
'list-goto': number;
|
|
925
1935
|
'page-loaded': PageData;
|
|
926
1936
|
'editor-submit': undefined;
|
|
927
1937
|
'editor-submitted': undefined;
|
|
928
1938
|
'user-changed': LocalUser;
|
|
929
|
-
'conf-loaded': ArtalkConfig;
|
|
930
|
-
'dark-mode-changed': boolean | 'auto';
|
|
931
1939
|
'sidebar-show': undefined;
|
|
932
1940
|
'sidebar-hide': undefined;
|
|
933
1941
|
}
|
|
934
1942
|
|
|
1943
|
+
export declare interface FetchError extends Error {
|
|
1944
|
+
code: number;
|
|
1945
|
+
message: string;
|
|
1946
|
+
data?: any;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
declare interface FullRequestParams extends Omit<RequestInit, 'body'> {
|
|
1950
|
+
/** set parameter to `true` for call `securityWorker` for this request */
|
|
1951
|
+
secure?: boolean;
|
|
1952
|
+
/** request path */
|
|
1953
|
+
path: string;
|
|
1954
|
+
/** content type of request body */
|
|
1955
|
+
type?: ContentType;
|
|
1956
|
+
/** query params */
|
|
1957
|
+
query?: QueryParamsType;
|
|
1958
|
+
/** format of response (i.e. response.json() -> format: "json") */
|
|
1959
|
+
format?: ResponseFormat;
|
|
1960
|
+
/** request body */
|
|
1961
|
+
body?: unknown;
|
|
1962
|
+
/** base url */
|
|
1963
|
+
baseUrl?: string;
|
|
1964
|
+
/** request cancellation token */
|
|
1965
|
+
cancelToken?: CancelToken;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
declare type HandlerMap = Record<string, any>;
|
|
1969
|
+
|
|
1970
|
+
declare interface HandlerParamsCaptchaVerify {
|
|
1971
|
+
/** The captcha value to check */
|
|
1972
|
+
value: string;
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
declare interface HandlerParamsCommentCreate {
|
|
1976
|
+
/** The comment content */
|
|
1977
|
+
content: string;
|
|
1978
|
+
/** The comment email */
|
|
1979
|
+
email: string;
|
|
1980
|
+
/** The comment link */
|
|
1981
|
+
link?: string;
|
|
1982
|
+
/** The comment name */
|
|
1983
|
+
name: string;
|
|
1984
|
+
/** The comment page_key */
|
|
1985
|
+
page_key: string;
|
|
1986
|
+
/** The comment page_title */
|
|
1987
|
+
page_title?: string;
|
|
1988
|
+
/** The comment rid */
|
|
1989
|
+
rid?: number;
|
|
1990
|
+
/** The site name of your content scope */
|
|
1991
|
+
site_name: string;
|
|
1992
|
+
/** The comment ua */
|
|
1993
|
+
ua?: string;
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
declare interface HandlerParamsCommentUpdate {
|
|
1997
|
+
/** The comment content */
|
|
1998
|
+
content: string;
|
|
1999
|
+
/** The comment email */
|
|
2000
|
+
email?: string;
|
|
2001
|
+
/** The comment ip */
|
|
2002
|
+
ip?: string;
|
|
2003
|
+
/** The comment is_collapsed */
|
|
2004
|
+
is_collapsed: boolean;
|
|
2005
|
+
/** The comment is_pending */
|
|
2006
|
+
is_pending: boolean;
|
|
2007
|
+
/** The comment is_pinned */
|
|
2008
|
+
is_pinned: boolean;
|
|
2009
|
+
/** The comment link */
|
|
2010
|
+
link?: string;
|
|
2011
|
+
/** The comment nick */
|
|
2012
|
+
nick?: string;
|
|
2013
|
+
/** The comment page_key */
|
|
2014
|
+
page_key: string;
|
|
2015
|
+
/** The comment rid */
|
|
2016
|
+
rid: number;
|
|
2017
|
+
/** The site name of your content scope */
|
|
2018
|
+
site_name: string;
|
|
2019
|
+
/** The comment ua */
|
|
2020
|
+
ua: string;
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
declare interface HandlerParamsEmailSend {
|
|
2024
|
+
/** The body of email */
|
|
2025
|
+
body: string;
|
|
2026
|
+
/** The subject of email */
|
|
2027
|
+
subject: string;
|
|
2028
|
+
/** The email address of the receiver */
|
|
2029
|
+
to_addr: string;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
declare interface HandlerParamsNotifyReadAll {
|
|
2033
|
+
/** The user email */
|
|
2034
|
+
email: string;
|
|
2035
|
+
/** The username */
|
|
2036
|
+
name: string;
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
declare interface HandlerParamsPageFetchAll {
|
|
2040
|
+
/** If not empty, only fetch pages of this site */
|
|
2041
|
+
site_name?: string;
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
declare interface HandlerParamsPagePV {
|
|
2045
|
+
/** The page key */
|
|
2046
|
+
page_key: string;
|
|
2047
|
+
/** The page title */
|
|
2048
|
+
page_title?: string;
|
|
2049
|
+
/** The site name of your content scope */
|
|
2050
|
+
site_name?: string;
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
declare interface HandlerParamsPageUpdate {
|
|
2054
|
+
/** Updated page admin_only option */
|
|
2055
|
+
admin_only: boolean;
|
|
2056
|
+
/** Updated page key */
|
|
2057
|
+
key: string;
|
|
2058
|
+
/** The site name of your content scope */
|
|
2059
|
+
site_name: string;
|
|
2060
|
+
/** Updated page title */
|
|
2061
|
+
title: string;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
declare interface HandlerParamsSettingApply {
|
|
2065
|
+
/** The content of the config file in YAML format */
|
|
2066
|
+
yaml: string;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
declare interface HandlerParamsSiteCreate {
|
|
2070
|
+
/** The site name */
|
|
2071
|
+
name: string;
|
|
2072
|
+
/** The site urls */
|
|
2073
|
+
urls: string[];
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
declare interface HandlerParamsSiteUpdate {
|
|
2077
|
+
/** Updated site name */
|
|
2078
|
+
name: string;
|
|
2079
|
+
/** Updated site urls */
|
|
2080
|
+
urls: string[];
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
declare interface HandlerParamsTransferImport {
|
|
2084
|
+
/** Automatically answer yes for all questions. */
|
|
2085
|
+
assumeyes?: boolean;
|
|
2086
|
+
/** The JSON data */
|
|
2087
|
+
json_data?: string;
|
|
2088
|
+
/** The JSON file path */
|
|
2089
|
+
json_file?: string;
|
|
2090
|
+
/** The target site name */
|
|
2091
|
+
target_site_name?: string;
|
|
2092
|
+
/** The target site url */
|
|
2093
|
+
target_site_url?: string;
|
|
2094
|
+
/** Enable URL resolver */
|
|
2095
|
+
url_resolver?: boolean;
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
declare interface HandlerParamsUserCreate {
|
|
2099
|
+
/** The user badge color (hex format) */
|
|
2100
|
+
badge_color?: string;
|
|
2101
|
+
/** The user badge name */
|
|
2102
|
+
badge_name?: string;
|
|
2103
|
+
/** The user email */
|
|
2104
|
+
email: string;
|
|
2105
|
+
/** The user is an admin */
|
|
2106
|
+
is_admin: boolean;
|
|
2107
|
+
/** The user link */
|
|
2108
|
+
link?: string;
|
|
2109
|
+
/** The user name */
|
|
2110
|
+
name: string;
|
|
2111
|
+
/** The user password */
|
|
2112
|
+
password?: string;
|
|
2113
|
+
/** The user receive email */
|
|
2114
|
+
receive_email: boolean;
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
declare interface HandlerParamsUserLogin {
|
|
2118
|
+
/** The user email */
|
|
2119
|
+
email: string;
|
|
2120
|
+
/** The username */
|
|
2121
|
+
name?: string;
|
|
2122
|
+
/** The user password */
|
|
2123
|
+
password: string;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
declare interface HandlerParamsUserUpdate {
|
|
2127
|
+
/** The user badge color (hex format) */
|
|
2128
|
+
badge_color?: string;
|
|
2129
|
+
/** The user badge name */
|
|
2130
|
+
badge_name?: string;
|
|
2131
|
+
/** The user email */
|
|
2132
|
+
email: string;
|
|
2133
|
+
/** The user is an admin */
|
|
2134
|
+
is_admin: boolean;
|
|
2135
|
+
/** The user link */
|
|
2136
|
+
link?: string;
|
|
2137
|
+
/** The user name */
|
|
2138
|
+
name: string;
|
|
2139
|
+
/** The user password */
|
|
2140
|
+
password?: string;
|
|
2141
|
+
/** The user receive email */
|
|
2142
|
+
receive_email: boolean;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
declare interface HandlerParamsVote {
|
|
2146
|
+
/** The user email */
|
|
2147
|
+
email?: string;
|
|
2148
|
+
/** The username */
|
|
2149
|
+
name?: string;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
declare interface HandlerResponseAdminUserList {
|
|
2153
|
+
count: number;
|
|
2154
|
+
users: EntityCookedUserForAdmin[];
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
declare interface HandlerResponseCaptchaGet {
|
|
2158
|
+
img_data: string;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
declare interface HandlerResponseCaptchaStatus {
|
|
2162
|
+
is_pass: boolean;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
declare interface HandlerResponseCommentCreate {
|
|
2166
|
+
badge_color: string;
|
|
2167
|
+
badge_name: string;
|
|
2168
|
+
content: string;
|
|
2169
|
+
content_marked: string;
|
|
2170
|
+
date: string;
|
|
2171
|
+
email_encrypted: string;
|
|
2172
|
+
id: number;
|
|
2173
|
+
ip_region: string;
|
|
2174
|
+
is_allow_reply: boolean;
|
|
2175
|
+
is_collapsed: boolean;
|
|
2176
|
+
is_pending: boolean;
|
|
2177
|
+
is_pinned: boolean;
|
|
2178
|
+
link: string;
|
|
2179
|
+
nick: string;
|
|
2180
|
+
page_key: string;
|
|
2181
|
+
page_url: string;
|
|
2182
|
+
rid: number;
|
|
2183
|
+
site_name: string;
|
|
2184
|
+
ua: string;
|
|
2185
|
+
user_id: number;
|
|
2186
|
+
visible: boolean;
|
|
2187
|
+
vote_down: number;
|
|
2188
|
+
vote_up: number;
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
declare interface HandlerResponseCommentList {
|
|
2192
|
+
comments: EntityCookedComment[];
|
|
2193
|
+
count: number;
|
|
2194
|
+
page: EntityCookedPage;
|
|
2195
|
+
roots_count: number;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
declare interface HandlerResponseCommentUpdate {
|
|
2199
|
+
badge_color: string;
|
|
2200
|
+
badge_name: string;
|
|
2201
|
+
content: string;
|
|
2202
|
+
content_marked: string;
|
|
2203
|
+
date: string;
|
|
2204
|
+
email_encrypted: string;
|
|
2205
|
+
id: number;
|
|
2206
|
+
ip_region: string;
|
|
2207
|
+
is_allow_reply: boolean;
|
|
2208
|
+
is_collapsed: boolean;
|
|
2209
|
+
is_pending: boolean;
|
|
2210
|
+
is_pinned: boolean;
|
|
2211
|
+
link: string;
|
|
2212
|
+
nick: string;
|
|
2213
|
+
page_key: string;
|
|
2214
|
+
page_url: string;
|
|
2215
|
+
rid: number;
|
|
2216
|
+
site_name: string;
|
|
2217
|
+
ua: string;
|
|
2218
|
+
user_id: number;
|
|
2219
|
+
visible: boolean;
|
|
2220
|
+
vote_down: number;
|
|
2221
|
+
vote_up: number;
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
declare interface HandlerResponseNotifyList {
|
|
2225
|
+
count: number;
|
|
2226
|
+
notifies: EntityCookedNotify[];
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
declare interface HandlerResponsePageFetch {
|
|
2230
|
+
admin_only: boolean;
|
|
2231
|
+
id: number;
|
|
2232
|
+
key: string;
|
|
2233
|
+
pv: number;
|
|
2234
|
+
site_name: string;
|
|
2235
|
+
title: string;
|
|
2236
|
+
url: string;
|
|
2237
|
+
vote_down: number;
|
|
2238
|
+
vote_up: number;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
declare interface HandlerResponsePageFetchStatus {
|
|
2242
|
+
/** The number of pages that have been fetched */
|
|
2243
|
+
done: number;
|
|
2244
|
+
/** If the task is in progress */
|
|
2245
|
+
is_progress: boolean;
|
|
2246
|
+
/** The message of the task status */
|
|
2247
|
+
msg: string;
|
|
2248
|
+
/** The total number of pages */
|
|
2249
|
+
total: number;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
declare interface HandlerResponsePageList {
|
|
2253
|
+
count: number;
|
|
2254
|
+
pages: EntityCookedPage[];
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
declare interface HandlerResponsePagePV {
|
|
2258
|
+
pv: number;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
declare interface HandlerResponsePageUpdate {
|
|
2262
|
+
admin_only: boolean;
|
|
2263
|
+
id: number;
|
|
2264
|
+
key: string;
|
|
2265
|
+
pv: number;
|
|
2266
|
+
site_name: string;
|
|
2267
|
+
title: string;
|
|
2268
|
+
url: string;
|
|
2269
|
+
vote_down: number;
|
|
2270
|
+
vote_up: number;
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
declare interface HandlerResponseSettingGet {
|
|
2274
|
+
yaml: string;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
declare interface HandlerResponseSettingTemplate {
|
|
2278
|
+
yaml: string;
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
declare interface HandlerResponseSiteCreate {
|
|
2282
|
+
first_url: string;
|
|
2283
|
+
id: number;
|
|
2284
|
+
name: string;
|
|
2285
|
+
urls: string[];
|
|
2286
|
+
urls_raw: string;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
declare interface HandlerResponseSiteList {
|
|
2290
|
+
count: number;
|
|
2291
|
+
sites: EntityCookedSite[];
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
declare interface HandlerResponseSiteUpdate {
|
|
2295
|
+
first_url: string;
|
|
2296
|
+
id: number;
|
|
2297
|
+
name: string;
|
|
2298
|
+
urls: string[];
|
|
2299
|
+
urls_raw: string;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
declare interface HandlerResponseTransferExport {
|
|
2303
|
+
/** The exported data which is a JSON string */
|
|
2304
|
+
artrans: string;
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
declare interface HandlerResponseTransferUpload {
|
|
2308
|
+
/** The uploaded file name which can be used to import */
|
|
2309
|
+
filename: string;
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
declare interface HandlerResponseUpload {
|
|
2313
|
+
file_name: string;
|
|
2314
|
+
file_type: string;
|
|
2315
|
+
public_url: string;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
declare interface HandlerResponseUserCreate {
|
|
2319
|
+
badge_color: string;
|
|
2320
|
+
badge_name: string;
|
|
2321
|
+
comment_count: number;
|
|
2322
|
+
email: string;
|
|
2323
|
+
id: number;
|
|
2324
|
+
is_admin: boolean;
|
|
2325
|
+
is_in_conf: boolean;
|
|
2326
|
+
last_ip: string;
|
|
2327
|
+
last_ua: string;
|
|
2328
|
+
link: string;
|
|
2329
|
+
name: string;
|
|
2330
|
+
receive_email: boolean;
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
declare interface HandlerResponseUserInfo {
|
|
2334
|
+
is_login: boolean;
|
|
2335
|
+
notifies: EntityCookedNotify[];
|
|
2336
|
+
notifies_count: number;
|
|
2337
|
+
user: EntityCookedUser;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
declare interface HandlerResponseUserLogin {
|
|
2341
|
+
token: string;
|
|
2342
|
+
user: EntityCookedUser;
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
declare interface HandlerResponseUserStatus {
|
|
2346
|
+
is_admin: boolean;
|
|
2347
|
+
is_login: boolean;
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
declare interface HandlerResponseUserUpdate {
|
|
2351
|
+
badge_color: string;
|
|
2352
|
+
badge_name: string;
|
|
2353
|
+
comment_count: number;
|
|
2354
|
+
email: string;
|
|
2355
|
+
id: number;
|
|
2356
|
+
is_admin: boolean;
|
|
2357
|
+
is_in_conf: boolean;
|
|
2358
|
+
last_ip: string;
|
|
2359
|
+
last_ua: string;
|
|
2360
|
+
link: string;
|
|
2361
|
+
name: string;
|
|
2362
|
+
receive_email: boolean;
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
declare interface HandlerResponseVote {
|
|
2366
|
+
down: number;
|
|
2367
|
+
up: number;
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
declare class HttpClient<SecurityDataType = unknown> {
|
|
2371
|
+
baseUrl: string;
|
|
2372
|
+
private securityData;
|
|
2373
|
+
private securityWorker?;
|
|
2374
|
+
private abortControllers;
|
|
2375
|
+
private customFetch;
|
|
2376
|
+
private baseApiParams;
|
|
2377
|
+
constructor(apiConfig?: ApiConfig<SecurityDataType>);
|
|
2378
|
+
setSecurityData: (data: SecurityDataType | null) => void;
|
|
2379
|
+
protected encodeQueryParam(key: string, value: any): string;
|
|
2380
|
+
protected addQueryParam(query: QueryParamsType, key: string): string;
|
|
2381
|
+
protected addArrayQueryParam(query: QueryParamsType, key: string): any;
|
|
2382
|
+
protected toQueryString(rawQuery?: QueryParamsType): string;
|
|
2383
|
+
protected addQueryParams(rawQuery?: QueryParamsType): string;
|
|
2384
|
+
private contentFormatters;
|
|
2385
|
+
protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams;
|
|
2386
|
+
protected createAbortSignal: (cancelToken: CancelToken) => AbortSignal | undefined;
|
|
2387
|
+
abortRequest: (cancelToken: CancelToken) => void;
|
|
2388
|
+
request: <T = any, E = any>({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams) => Promise<HttpResponse<T, E>>;
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
declare interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
|
|
2392
|
+
data: D;
|
|
2393
|
+
error: E;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
935
2396
|
export declare type I18n = typeof en;
|
|
936
2397
|
|
|
937
2398
|
export declare type I18nKeys = keyof I18n;
|
|
@@ -940,36 +2401,29 @@ export declare const init: typeof Artalk.init;
|
|
|
940
2401
|
|
|
941
2402
|
declare class Layer {
|
|
942
2403
|
private $el;
|
|
943
|
-
private
|
|
2404
|
+
private opts;
|
|
2405
|
+
private allowMaskClose;
|
|
944
2406
|
private onAfterHide?;
|
|
945
|
-
constructor(
|
|
2407
|
+
constructor($el: HTMLElement, opts: LayerOptions);
|
|
946
2408
|
setOnAfterHide(func: () => void): void;
|
|
2409
|
+
setAllowMaskClose(allow: boolean): void;
|
|
2410
|
+
getAllowMaskClose(): boolean;
|
|
947
2411
|
getEl(): HTMLElement;
|
|
948
2412
|
show(): void;
|
|
949
|
-
hide(): void
|
|
950
|
-
destroy(): void
|
|
2413
|
+
hide(): Promise<void>;
|
|
2414
|
+
destroy(): Promise<void>;
|
|
951
2415
|
}
|
|
952
2416
|
|
|
953
2417
|
declare class LayerManager {
|
|
954
2418
|
private wrap;
|
|
955
|
-
private ctx;
|
|
956
2419
|
constructor(ctx: ContextApi);
|
|
957
2420
|
getEl(): HTMLElement;
|
|
958
|
-
create(name: string, el?: HTMLElement
|
|
2421
|
+
create(name: string, el?: HTMLElement): Layer;
|
|
959
2422
|
}
|
|
960
2423
|
|
|
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;
|
|
2424
|
+
declare interface LayerOptions {
|
|
2425
|
+
onShow: () => void;
|
|
2426
|
+
onHide: () => void;
|
|
973
2427
|
}
|
|
974
2428
|
|
|
975
2429
|
declare interface LayoutOptions {
|
|
@@ -977,8 +2431,8 @@ declare interface LayoutOptions {
|
|
|
977
2431
|
nestSortBy: ListNest.SortByType;
|
|
978
2432
|
nestMax: number;
|
|
979
2433
|
flatMode: boolean;
|
|
980
|
-
createCommentNode(comment: CommentData, ctxComments: CommentData[]):
|
|
981
|
-
findCommentNode(id: number):
|
|
2434
|
+
createCommentNode(comment: CommentData, ctxComments: CommentData[]): CommentNode;
|
|
2435
|
+
findCommentNode(id: number): CommentNode | undefined;
|
|
982
2436
|
getCommentDataList(): CommentData[];
|
|
983
2437
|
}
|
|
984
2438
|
|
|
@@ -986,8 +2440,8 @@ declare class List extends Component {
|
|
|
986
2440
|
/** 列表评论集区域元素 */
|
|
987
2441
|
$commentsWrap: HTMLElement;
|
|
988
2442
|
getCommentsWrapEl(): HTMLElement;
|
|
989
|
-
protected commentNodes:
|
|
990
|
-
getCommentNodes():
|
|
2443
|
+
protected commentNodes: CommentNode[];
|
|
2444
|
+
getCommentNodes(): CommentNode[];
|
|
991
2445
|
constructor(ctx: ContextApi);
|
|
992
2446
|
getListLayout(): ListLayout;
|
|
993
2447
|
private initCrudEvents;
|
|
@@ -997,21 +2451,11 @@ export declare interface ListData {
|
|
|
997
2451
|
/** 评论数据 */
|
|
998
2452
|
comments: CommentData[];
|
|
999
2453
|
/** 根评论总数 */
|
|
1000
|
-
|
|
2454
|
+
roots_count: number;
|
|
1001
2455
|
/** 评论总数(包括所有子评论) */
|
|
1002
|
-
|
|
2456
|
+
count: number;
|
|
1003
2457
|
/** 页面信息 */
|
|
1004
2458
|
page: PageData;
|
|
1005
|
-
/** 站点信息 */
|
|
1006
|
-
site: SiteData;
|
|
1007
|
-
/** 未读的 Notifies */
|
|
1008
|
-
unread: NotifyData[];
|
|
1009
|
-
/** 未读计数 */
|
|
1010
|
-
unread_count: number;
|
|
1011
|
-
/** API 版本 */
|
|
1012
|
-
api_version: ApiVersionData;
|
|
1013
|
-
/** 后端配置 */
|
|
1014
|
-
conf: any;
|
|
1015
2459
|
}
|
|
1016
2460
|
|
|
1017
2461
|
declare interface ListFetchedArgs {
|
|
@@ -1049,7 +2493,7 @@ declare class ListLayout {
|
|
|
1049
2493
|
declare namespace ListNest {
|
|
1050
2494
|
export {
|
|
1051
2495
|
makeNestCommentNodeList,
|
|
1052
|
-
CommentNode,
|
|
2496
|
+
CommentNode_2 as CommentNode,
|
|
1053
2497
|
SortByType
|
|
1054
2498
|
}
|
|
1055
2499
|
}
|
|
@@ -1073,7 +2517,7 @@ export declare interface LocalUser {
|
|
|
1073
2517
|
isAdmin: boolean;
|
|
1074
2518
|
}
|
|
1075
2519
|
|
|
1076
|
-
declare function makeNestCommentNodeList(srcData: CommentData[], sortBy?: SortByType, nestMax?: number):
|
|
2520
|
+
declare function makeNestCommentNodeList(srcData: CommentData[], sortBy?: SortByType, nestMax?: number): CommentNode_2[];
|
|
1077
2521
|
|
|
1078
2522
|
export declare interface NotifyData {
|
|
1079
2523
|
/** 通知 ID */
|
|
@@ -1092,27 +2536,6 @@ export declare interface NotifyData {
|
|
|
1092
2536
|
|
|
1093
2537
|
export declare type NotifyLevel = "i" | "s" | "w" | "e";
|
|
1094
2538
|
|
|
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
2539
|
export declare interface PageData {
|
|
1117
2540
|
/** 页面 ID */
|
|
1118
2541
|
id: number;
|
|
@@ -1185,8 +2608,10 @@ declare class PlugManager {
|
|
|
1185
2608
|
getTransformedContent(rawContent: string): string;
|
|
1186
2609
|
}
|
|
1187
2610
|
|
|
2611
|
+
declare type QueryParamsType = Record<string | number, any>;
|
|
2612
|
+
|
|
1188
2613
|
declare class Render {
|
|
1189
|
-
comment:
|
|
2614
|
+
comment: CommentNode;
|
|
1190
2615
|
get ctx(): ContextApi;
|
|
1191
2616
|
get data(): CommentData;
|
|
1192
2617
|
get conf(): ArtalkConfig;
|
|
@@ -1204,7 +2629,7 @@ declare class Render {
|
|
|
1204
2629
|
voteBtnDown?: ActionBtn;
|
|
1205
2630
|
$replyTo?: HTMLElement;
|
|
1206
2631
|
$replyAt?: HTMLElement;
|
|
1207
|
-
constructor(comment:
|
|
2632
|
+
constructor(comment: CommentNode);
|
|
1208
2633
|
render(): HTMLElement;
|
|
1209
2634
|
/** 内容限高检测 */
|
|
1210
2635
|
checkHeightLimit(): void;
|
|
@@ -1230,6 +2655,10 @@ declare class Render {
|
|
|
1230
2655
|
setOpenAction(action: () => void): void;
|
|
1231
2656
|
}
|
|
1232
2657
|
|
|
2658
|
+
declare type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
|
|
2659
|
+
|
|
2660
|
+
declare type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
|
|
2661
|
+
|
|
1233
2662
|
declare const Sel: {
|
|
1234
2663
|
$header: string;
|
|
1235
2664
|
$nick: string;
|
|
@@ -1267,7 +2696,10 @@ declare class SidebarLayer extends Component {
|
|
|
1267
2696
|
$iframeWrap: HTMLElement;
|
|
1268
2697
|
$iframe?: HTMLIFrameElement;
|
|
1269
2698
|
constructor(ctx: ContextApi);
|
|
1270
|
-
|
|
2699
|
+
/** Refresh iFrame on show */
|
|
2700
|
+
private refreshOnShow;
|
|
2701
|
+
/** Animation timer */
|
|
2702
|
+
private animTimer?;
|
|
1271
2703
|
/** 显示 */
|
|
1272
2704
|
show(conf?: SidebarShowPayload): Promise<void>;
|
|
1273
2705
|
/** 隐藏 */
|
|
@@ -1282,22 +2714,6 @@ export declare interface SidebarShowPayload {
|
|
|
1282
2714
|
view?: 'comments' | 'sites' | 'pages' | 'transfer';
|
|
1283
2715
|
}
|
|
1284
2716
|
|
|
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
2717
|
export declare interface SiteData {
|
|
1302
2718
|
/** 站点 ID */
|
|
1303
2719
|
id: number;
|
|
@@ -1313,35 +2729,6 @@ export declare interface SiteData {
|
|
|
1313
2729
|
|
|
1314
2730
|
declare type SortByType = 'DATE_DESC' | 'DATE_ASC' | 'SRC_INDEX' | 'VOTE_UP_DESC';
|
|
1315
2731
|
|
|
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
2732
|
declare type TInjectedServices = {
|
|
1346
2733
|
[K in keyof TServiceInjectors]: ReturnType<TServiceInjectors[K]>;
|
|
1347
2734
|
};
|
|
@@ -1362,17 +2749,6 @@ declare type TServiceImps = typeof services;
|
|
|
1362
2749
|
|
|
1363
2750
|
declare type TServiceInjectors = Omit<TServiceImps, TOmitConditions>;
|
|
1364
2751
|
|
|
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
2752
|
export declare const use: typeof Artalk.use;
|
|
1377
2753
|
|
|
1378
2754
|
declare class User {
|
|
@@ -1380,7 +2756,7 @@ declare class User {
|
|
|
1380
2756
|
private data;
|
|
1381
2757
|
constructor(opts: UserOpts);
|
|
1382
2758
|
getData(): LocalUser;
|
|
1383
|
-
/**
|
|
2759
|
+
/** Update user data and save to localStorage */
|
|
1384
2760
|
update(obj?: Partial<LocalUser>): void;
|
|
1385
2761
|
/**
|
|
1386
2762
|
* Logout
|
|
@@ -1388,51 +2764,10 @@ declare class User {
|
|
|
1388
2764
|
* @description Logout will clear login status, but not clear user data (nick, email, link)
|
|
1389
2765
|
*/
|
|
1390
2766
|
logout(): void;
|
|
1391
|
-
/**
|
|
2767
|
+
/** Check if user has filled basic data */
|
|
1392
2768
|
checkHasBasicUserInfo(): boolean;
|
|
1393
2769
|
}
|
|
1394
2770
|
|
|
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
2771
|
export declare interface UserData {
|
|
1437
2772
|
/** 用户 ID */
|
|
1438
2773
|
id: number;
|
|
@@ -1448,10 +2783,6 @@ export declare interface UserData {
|
|
|
1448
2783
|
badge_color: string;
|
|
1449
2784
|
/** 是否属于管理员 */
|
|
1450
2785
|
is_admin: boolean;
|
|
1451
|
-
/** 所属站点名 */
|
|
1452
|
-
site_names: string[];
|
|
1453
|
-
/** 所属站点名 (字符串) */
|
|
1454
|
-
site_names_raw: string;
|
|
1455
2786
|
/** 是否允许接收邮件通知 */
|
|
1456
2787
|
receive_email: boolean;
|
|
1457
2788
|
}
|
|
@@ -1465,8 +2796,13 @@ export declare interface UserDataForAdmin extends UserData {
|
|
|
1465
2796
|
is_in_conf: boolean;
|
|
1466
2797
|
/** 评论数 */
|
|
1467
2798
|
comment_count: number;
|
|
1468
|
-
|
|
1469
|
-
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
export declare interface UserInfoApiResponseData {
|
|
2802
|
+
user?: UserData;
|
|
2803
|
+
is_login: boolean;
|
|
2804
|
+
notifies: NotifyData[];
|
|
2805
|
+
notifies_count: number;
|
|
1470
2806
|
}
|
|
1471
2807
|
|
|
1472
2808
|
declare interface UserOpts {
|