anixartjs 0.1.5 → 0.1.6
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/api/notification.d.ts +5 -4
- package/dist/api/notification.js +3 -1
- package/dist/types/collection.d.ts +9 -1
- package/dist/types/notification.d.ts +12 -2
- package/dist/types/profile.d.ts +5 -0
- package/dist/types/release.d.ts +9 -1
- package/dist/types/response.d.ts +7 -1
- package/dist/utils/LinkParser.js +4 -4
- package/package.json +1 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { IPageableResponse, INotificationCountResponse, IFriendNotification, IRelatedReleaseNotification, IResponse, IBaseApiParams, IArticleNotification } from "../types";
|
|
2
|
+
import { IPageableResponse, INotificationCountResponse, IFriendNotification, IRelatedReleaseNotification, IResponse, IBaseApiParams, IArticleNotification, IReleaseCommentNotification, ICollectionCommentNotification } from "../types";
|
|
3
3
|
export declare class Notification {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: Anixart);
|
|
6
6
|
countNotifications(options?: IBaseApiParams): Promise<INotificationCountResponse>;
|
|
7
|
-
getNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IFriendNotification | IRelatedReleaseNotification>>;
|
|
7
|
+
getNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IFriendNotification | IRelatedReleaseNotification | IArticleNotification | IReleaseCommentNotification | ICollectionCommentNotification>>;
|
|
8
8
|
getFriendsNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IFriendNotification>>;
|
|
9
9
|
getRelatedReleaseNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IRelatedReleaseNotification>>;
|
|
10
10
|
getEpisodeNotificaions(page: number, options?: IBaseApiParams): Promise<IPageableResponse<any>>;
|
|
11
|
-
getReleaseCommentNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<
|
|
12
|
-
getCollectionCommentNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<
|
|
11
|
+
getReleaseCommentNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IReleaseCommentNotification>>;
|
|
12
|
+
getCollectionCommentNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<ICollectionCommentNotification>>;
|
|
13
13
|
getArticleNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticleNotification>>;
|
|
14
14
|
removeAllNotifications(options?: IBaseApiParams): Promise<IResponse>;
|
|
15
|
+
removeNotification(type: "friend" | "episode" | "releaseComment" | "collectionComment" | "article" | "related/release", id: number, options?: IBaseApiParams): Promise<IResponse>;
|
|
15
16
|
readNotifications(options?: IBaseApiParams): Promise<IResponse>;
|
|
16
17
|
}
|
package/dist/api/notification.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Notification = void 0;
|
|
4
|
-
//TODO: Удаление конкретных уведомлений
|
|
5
4
|
class Notification {
|
|
6
5
|
constructor(client) {
|
|
7
6
|
this.client = client;
|
|
@@ -33,6 +32,9 @@ class Notification {
|
|
|
33
32
|
async removeAllNotifications(options) {
|
|
34
33
|
return await this.client.call({ path: `/notification/delete/all`, ...options });
|
|
35
34
|
}
|
|
35
|
+
async removeNotification(type, id, options) {
|
|
36
|
+
return await this.client.call({ path: `/notification/${type}/delete/${id}`, ...options });
|
|
37
|
+
}
|
|
36
38
|
async readNotifications(options) {
|
|
37
39
|
return await this.client.call({ path: `/notification/read`, ...options });
|
|
38
40
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IProfile } from "./profile";
|
|
2
2
|
import { IRelease } from "./release";
|
|
3
|
-
import { IBaseComment, IResponse } from "./response";
|
|
3
|
+
import { IBaseComment, IBaseCompactComment, IResponse } from "./response";
|
|
4
4
|
import { IBaseRequestPageable } from "./request";
|
|
5
5
|
export interface ICollection {
|
|
6
6
|
'@id': number;
|
|
@@ -18,6 +18,14 @@ export interface ICollection {
|
|
|
18
18
|
is_favorite: boolean;
|
|
19
19
|
releases: IRelease[];
|
|
20
20
|
}
|
|
21
|
+
export interface ICollectionCompact {
|
|
22
|
+
id: number;
|
|
23
|
+
title: string;
|
|
24
|
+
image: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ICollectionCompactComment extends IBaseCompactComment {
|
|
27
|
+
collection: ICollectionCompact;
|
|
28
|
+
}
|
|
21
29
|
export interface ICollectionResponse<T extends number = CollectionResult> extends IResponse<T> {
|
|
22
30
|
collection: ICollection;
|
|
23
31
|
watching_count: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ICollectionCompactComment } from "./collection";
|
|
1
2
|
import { IProfile } from "./profile";
|
|
2
|
-
import { IRelease } from "./release";
|
|
3
|
+
import { IRelease, IReleaseCompactComment } from "./release";
|
|
3
4
|
import { IResponse } from "./response";
|
|
4
5
|
export interface INotificationCountResponse extends IResponse {
|
|
5
6
|
count: number;
|
|
@@ -7,20 +8,29 @@ export interface INotificationCountResponse extends IResponse {
|
|
|
7
8
|
export interface IBaseNotification {
|
|
8
9
|
id: number;
|
|
9
10
|
type: string;
|
|
10
|
-
profile: IProfile;
|
|
11
11
|
timestamp: number;
|
|
12
12
|
is_pushed: boolean;
|
|
13
13
|
is_new: boolean;
|
|
14
14
|
}
|
|
15
15
|
export interface IFriendNotification extends IBaseNotification {
|
|
16
|
+
profile: IProfile;
|
|
16
17
|
status: string;
|
|
17
18
|
by_profile: IProfile;
|
|
18
19
|
}
|
|
19
20
|
export interface IArticleNotification extends IBaseNotification {
|
|
20
21
|
'@id': number;
|
|
21
22
|
article: number;
|
|
23
|
+
profile: IProfile;
|
|
22
24
|
}
|
|
23
25
|
export interface IRelatedReleaseNotification extends IBaseNotification {
|
|
24
26
|
'@id': number;
|
|
25
27
|
release: IRelease | number;
|
|
26
28
|
}
|
|
29
|
+
export interface IReleaseCommentNotification extends IBaseNotification {
|
|
30
|
+
parentComment: IReleaseCompactComment;
|
|
31
|
+
comment: IReleaseCompactComment;
|
|
32
|
+
}
|
|
33
|
+
export interface ICollectionCommentNotification extends IBaseNotification {
|
|
34
|
+
parentComment: ICollectionCompactComment;
|
|
35
|
+
comment: ICollectionCompactComment;
|
|
36
|
+
}
|
package/dist/types/profile.d.ts
CHANGED
package/dist/types/release.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPageableResponse, IResponse, IBaseComment, CommentAddResult } from './response';
|
|
1
|
+
import { IPageableResponse, IResponse, IBaseComment, CommentAddResult, IBaseCompactComment } from './response';
|
|
2
2
|
import { IProfile, BookmarkType } from './profile';
|
|
3
3
|
import { IBaseRequestPageable, IBaseSearchRequest } from './request';
|
|
4
4
|
export declare enum ReleaseCategory {
|
|
@@ -65,6 +65,11 @@ export interface IReleaseCategory {
|
|
|
65
65
|
id: ReleaseCategory;
|
|
66
66
|
name: string;
|
|
67
67
|
}
|
|
68
|
+
export interface ICompactRelease {
|
|
69
|
+
id: number;
|
|
70
|
+
title: string;
|
|
71
|
+
image: string;
|
|
72
|
+
}
|
|
68
73
|
export interface IReleaseStatus {
|
|
69
74
|
id: ReleaseStatus;
|
|
70
75
|
name: string;
|
|
@@ -293,6 +298,9 @@ export interface IEpisodesResponse extends IResponse {
|
|
|
293
298
|
export interface IEpisodeResponse extends IResponse {
|
|
294
299
|
episode: IEpisode;
|
|
295
300
|
}
|
|
301
|
+
export interface IReleaseCompactComment extends IBaseCompactComment {
|
|
302
|
+
release: ICompactRelease;
|
|
303
|
+
}
|
|
296
304
|
export interface IInterestingRelease {
|
|
297
305
|
'@id': number;
|
|
298
306
|
id: number;
|
package/dist/types/response.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDubber, IRelease } from "./release";
|
|
2
|
-
import { IProfileShort } from "./profile";
|
|
2
|
+
import { IProfileCompact, IProfileShort } from "./profile";
|
|
3
3
|
export declare enum DefaultResult {
|
|
4
4
|
Ok = 0,
|
|
5
5
|
UnexpectedError = 1,
|
|
@@ -66,6 +66,12 @@ export interface IBaseComment {
|
|
|
66
66
|
reply_count: number;
|
|
67
67
|
can_like: boolean;
|
|
68
68
|
}
|
|
69
|
+
export interface IBaseCompactComment {
|
|
70
|
+
id: number;
|
|
71
|
+
message: string;
|
|
72
|
+
is_spoiler: boolean;
|
|
73
|
+
profile: IProfileCompact;
|
|
74
|
+
}
|
|
69
75
|
export interface IUrlResponse extends IResponse {
|
|
70
76
|
url: string;
|
|
71
77
|
}
|
package/dist/utils/LinkParser.js
CHANGED
|
@@ -23,9 +23,9 @@ class KodikParser {
|
|
|
23
23
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
24
24
|
const urlResponse = await (await fetch(url)).text();
|
|
25
25
|
const urlParams = JSON.parse((_c = (_b = (_a = urlResponse.match(/var\surlParams\s=\s'(?<params>.*?)';/is)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.params) !== null && _c !== void 0 ? _c : "{}");
|
|
26
|
-
const videoInfoHash = (_e = (_d = urlResponse.match(
|
|
27
|
-
const videoInfoId = (_g = (_f = urlResponse.match(
|
|
28
|
-
const videoInfoType = (_j = (_h = urlResponse.match(
|
|
26
|
+
const videoInfoHash = (_e = (_d = urlResponse.match(/\w+.hash\s=\s'(?<hash>.*?)';/is)) === null || _d === void 0 ? void 0 : _d.groups) === null || _e === void 0 ? void 0 : _e.hash;
|
|
27
|
+
const videoInfoId = (_g = (_f = urlResponse.match(/\w+.id\s=\s'(?<id>.*?)';/is)) === null || _f === void 0 ? void 0 : _f.groups) === null || _g === void 0 ? void 0 : _g.id;
|
|
28
|
+
const videoInfoType = (_j = (_h = urlResponse.match(/\w+.type\s=\s'(?<type>.*?)';/)) === null || _h === void 0 ? void 0 : _h.groups) === null || _j === void 0 ? void 0 : _j.type;
|
|
29
29
|
const validKodikUrl = new RegExp(/\/\/(get|cloud)\.kodik-storage\.com\/useruploads\/.*?\/.*?\/(240|360|480|720|1080)\.mp4:hls:manifest.m3u8/s);
|
|
30
30
|
if (!videoInfoHash || !videoInfoId || !videoInfoType)
|
|
31
31
|
return null;
|
|
@@ -90,7 +90,7 @@ class AniLibriaParser {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
exports.AniLibriaParser = AniLibriaParser;
|
|
93
|
-
AniLibriaParser._baseAniLibriaDomain = '
|
|
93
|
+
AniLibriaParser._baseAniLibriaDomain = 'aniliberty.top';
|
|
94
94
|
AniLibriaParser._endpointUrl = '/api/v1/anime/releases';
|
|
95
95
|
AniLibriaParser.idPattern = new RegExp(/id=(?<id>\d+)/g);
|
|
96
96
|
AniLibriaParser.episodePattern = new RegExp(/ep=(?<ep>\d+)/g);
|