@nger/fk-upload 1.0.4 → 1.0.7
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/core.d.ts +1 -0
- package/dist/entities/fk-download-task.entity.d.ts +12 -0
- package/dist/entities/fk-download-task.entity.js +83 -0
- package/dist/entities/fk-login-account.entity.d.ts +5 -0
- package/dist/entities/fk-login-account.entity.js +38 -0
- package/dist/entities/fk-login-cookie.entity.d.ts +7 -0
- package/dist/entities/fk-login-cookie.entity.js +54 -0
- package/dist/entities/fk-login.entity.d.ts +12 -0
- package/dist/entities/fk-login.entity.js +88 -0
- package/dist/entities/index.d.ts +3 -0
- package/dist/entities/index.js +19 -0
- package/dist/fk-upload.controller.d.ts +28 -0
- package/dist/fk-upload.controller.js +271 -0
- package/dist/fk-upload.module.d.ts +2 -0
- package/dist/fk-upload.module.js +66 -0
- package/dist/fk-v2.service.d.ts +29 -0
- package/dist/fk-v2.service.js +153 -0
- package/dist/fk.service.d.ts +18 -0
- package/dist/fk.service.js +89 -0
- package/dist/login.controller.d.ts +14 -0
- package/dist/login.controller.js +211 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.js +36 -0
- package/dist/templates/account-manage.d.ts +3 -0
- package/dist/templates/account-manage.js +27 -0
- package/dist/templates/add-account.d.ts +0 -0
- package/dist/templates/add-account.js +1 -0
- package/dist/templates/add-fk-login.d.ts +10 -0
- package/dist/templates/add-fk-login.js +96 -0
- package/dist/templates/add-task.d.ts +10 -0
- package/dist/templates/add-task.js +76 -0
- package/dist/templates/code.d.ts +3 -0
- package/dist/templates/code.js +51 -0
- package/dist/templates/component.d.ts +9 -0
- package/dist/templates/component.js +34 -0
- package/dist/templates/download-task.d.ts +12 -0
- package/dist/templates/download-task.js +103 -0
- package/dist/templates/error.d.ts +3 -0
- package/dist/templates/error.js +41 -0
- package/dist/templates/help.d.ts +6 -0
- package/dist/templates/help.js +67 -0
- package/dist/templates/login.service.d.ts +2 -0
- package/dist/templates/login.service.js +16 -0
- package/dist/templates/relogin.d.ts +5 -0
- package/dist/templates/relogin.js +25 -0
- package/dist/templates/task-manage.d.ts +6 -0
- package/dist/templates/task-manage.js +76 -0
- package/dist/templates/upload-task.d.ts +9 -0
- package/dist/templates/upload-task.js +155 -0
- package/dist/templates/upload.d.ts +15 -0
- package/dist/templates/upload.js +248 -0
- package/dist/templates/upload.service.d.ts +18 -0
- package/dist/templates/upload.service.js +293 -0
- package/dist/templates/verify.d.ts +15 -0
- package/dist/templates/verify.js +75 -0
- package/dist/tests/test.d.ts +3 -0
- package/dist/tests/test.js +101 -0
- package/dist/urlSafeBase64Decode.d.ts +3 -0
- package/dist/urlSafeBase64Decode.js +37 -0
- package/package.json +6 -5
- package/pnpm-lock.yaml +1172 -0
- package/tsconfig.json +12 -0
package/dist/core.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './fk-upload.module';
|
@@ -0,0 +1,83 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.FkDownloadTaskEntity = void 0;
|
13
|
+
const typeorm_1 = require("typeorm");
|
14
|
+
let FkDownloadTaskEntity = class FkDownloadTaskEntity {
|
15
|
+
filename;
|
16
|
+
status;
|
17
|
+
totalSize;
|
18
|
+
size;
|
19
|
+
url;
|
20
|
+
path;
|
21
|
+
uploadSize;
|
22
|
+
uploadUrl;
|
23
|
+
loginId;
|
24
|
+
fileMd5;
|
25
|
+
};
|
26
|
+
__decorate([
|
27
|
+
(0, typeorm_1.PrimaryColumn)(),
|
28
|
+
__metadata("design:type", String)
|
29
|
+
], FkDownloadTaskEntity.prototype, "filename", void 0);
|
30
|
+
__decorate([
|
31
|
+
(0, typeorm_1.Column)(),
|
32
|
+
__metadata("design:type", Number)
|
33
|
+
], FkDownloadTaskEntity.prototype, "status", void 0);
|
34
|
+
__decorate([
|
35
|
+
(0, typeorm_1.Column)(),
|
36
|
+
__metadata("design:type", Number)
|
37
|
+
], FkDownloadTaskEntity.prototype, "totalSize", void 0);
|
38
|
+
__decorate([
|
39
|
+
(0, typeorm_1.Column)(),
|
40
|
+
__metadata("design:type", Number)
|
41
|
+
], FkDownloadTaskEntity.prototype, "size", void 0);
|
42
|
+
__decorate([
|
43
|
+
(0, typeorm_1.Column)({
|
44
|
+
length: 320
|
45
|
+
}),
|
46
|
+
__metadata("design:type", String)
|
47
|
+
], FkDownloadTaskEntity.prototype, "url", void 0);
|
48
|
+
__decorate([
|
49
|
+
(0, typeorm_1.Column)(),
|
50
|
+
__metadata("design:type", String)
|
51
|
+
], FkDownloadTaskEntity.prototype, "path", void 0);
|
52
|
+
__decorate([
|
53
|
+
(0, typeorm_1.Column)({
|
54
|
+
default: 0
|
55
|
+
}),
|
56
|
+
__metadata("design:type", Number)
|
57
|
+
], FkDownloadTaskEntity.prototype, "uploadSize", void 0);
|
58
|
+
__decorate([
|
59
|
+
(0, typeorm_1.Column)({
|
60
|
+
default: '',
|
61
|
+
length: 320
|
62
|
+
}),
|
63
|
+
__metadata("design:type", String)
|
64
|
+
], FkDownloadTaskEntity.prototype, "uploadUrl", void 0);
|
65
|
+
__decorate([
|
66
|
+
(0, typeorm_1.Column)({
|
67
|
+
default: 0
|
68
|
+
}),
|
69
|
+
__metadata("design:type", Number)
|
70
|
+
], FkDownloadTaskEntity.prototype, "loginId", void 0);
|
71
|
+
__decorate([
|
72
|
+
(0, typeorm_1.Column)({
|
73
|
+
name: 'file_md5',
|
74
|
+
default: ``
|
75
|
+
}),
|
76
|
+
__metadata("design:type", String)
|
77
|
+
], FkDownloadTaskEntity.prototype, "fileMd5", void 0);
|
78
|
+
FkDownloadTaskEntity = __decorate([
|
79
|
+
(0, typeorm_1.Entity)({
|
80
|
+
name: 'nger_fk_download_task'
|
81
|
+
})
|
82
|
+
], FkDownloadTaskEntity);
|
83
|
+
exports.FkDownloadTaskEntity = FkDownloadTaskEntity;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.FkLoginAccountEntity = void 0;
|
13
|
+
const typeorm_1 = require("typeorm");
|
14
|
+
let FkLoginAccountEntity = class FkLoginAccountEntity {
|
15
|
+
fkLoginAccountId;
|
16
|
+
uniacid;
|
17
|
+
fkLoginId;
|
18
|
+
};
|
19
|
+
__decorate([
|
20
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
21
|
+
name: 'fk_login_account_id'
|
22
|
+
}),
|
23
|
+
__metadata("design:type", Number)
|
24
|
+
], FkLoginAccountEntity.prototype, "fkLoginAccountId", void 0);
|
25
|
+
__decorate([
|
26
|
+
(0, typeorm_1.Column)(),
|
27
|
+
__metadata("design:type", Number)
|
28
|
+
], FkLoginAccountEntity.prototype, "uniacid", void 0);
|
29
|
+
__decorate([
|
30
|
+
(0, typeorm_1.Column)(),
|
31
|
+
__metadata("design:type", Number)
|
32
|
+
], FkLoginAccountEntity.prototype, "fkLoginId", void 0);
|
33
|
+
FkLoginAccountEntity = __decorate([
|
34
|
+
(0, typeorm_1.Entity)({
|
35
|
+
name: 'nger_fk_login_account'
|
36
|
+
})
|
37
|
+
], FkLoginAccountEntity);
|
38
|
+
exports.FkLoginAccountEntity = FkLoginAccountEntity;
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.FkLoginCookieEntity = void 0;
|
13
|
+
const typeorm_1 = require("typeorm");
|
14
|
+
let FkLoginCookieEntity = class FkLoginCookieEntity {
|
15
|
+
fkLoginCookieId;
|
16
|
+
fkLoginId;
|
17
|
+
key;
|
18
|
+
value;
|
19
|
+
domain;
|
20
|
+
};
|
21
|
+
__decorate([
|
22
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
23
|
+
name: 'fk_login_cookie_id'
|
24
|
+
}),
|
25
|
+
__metadata("design:type", Number)
|
26
|
+
], FkLoginCookieEntity.prototype, "fkLoginCookieId", void 0);
|
27
|
+
__decorate([
|
28
|
+
(0, typeorm_1.Column)({
|
29
|
+
name: 'fk_login_id'
|
30
|
+
}),
|
31
|
+
__metadata("design:type", Number)
|
32
|
+
], FkLoginCookieEntity.prototype, "fkLoginId", void 0);
|
33
|
+
__decorate([
|
34
|
+
(0, typeorm_1.Column)(),
|
35
|
+
__metadata("design:type", String)
|
36
|
+
], FkLoginCookieEntity.prototype, "key", void 0);
|
37
|
+
__decorate([
|
38
|
+
(0, typeorm_1.Column)({
|
39
|
+
default: ''
|
40
|
+
}),
|
41
|
+
__metadata("design:type", String)
|
42
|
+
], FkLoginCookieEntity.prototype, "value", void 0);
|
43
|
+
__decorate([
|
44
|
+
(0, typeorm_1.Column)({
|
45
|
+
default: ``
|
46
|
+
}),
|
47
|
+
__metadata("design:type", String)
|
48
|
+
], FkLoginCookieEntity.prototype, "domain", void 0);
|
49
|
+
FkLoginCookieEntity = __decorate([
|
50
|
+
(0, typeorm_1.Entity)({
|
51
|
+
name: 'nger_fk_login_cookie'
|
52
|
+
})
|
53
|
+
], FkLoginCookieEntity);
|
54
|
+
exports.FkLoginCookieEntity = FkLoginCookieEntity;
|
@@ -0,0 +1,88 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.FkLoginEntity = void 0;
|
13
|
+
const typeorm_1 = require("typeorm");
|
14
|
+
let FkLoginEntity = class FkLoginEntity {
|
15
|
+
fkLoginId;
|
16
|
+
username;
|
17
|
+
pass;
|
18
|
+
password;
|
19
|
+
token;
|
20
|
+
aid;
|
21
|
+
uploadGroupId;
|
22
|
+
fileSizeLimit;
|
23
|
+
w7Username;
|
24
|
+
status;
|
25
|
+
};
|
26
|
+
__decorate([
|
27
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
28
|
+
name: 'fk_login_id'
|
29
|
+
}),
|
30
|
+
__metadata("design:type", Number)
|
31
|
+
], FkLoginEntity.prototype, "fkLoginId", void 0);
|
32
|
+
__decorate([
|
33
|
+
(0, typeorm_1.Column)(),
|
34
|
+
__metadata("design:type", String)
|
35
|
+
], FkLoginEntity.prototype, "username", void 0);
|
36
|
+
__decorate([
|
37
|
+
(0, typeorm_1.Column)({
|
38
|
+
default: ``
|
39
|
+
}),
|
40
|
+
__metadata("design:type", String)
|
41
|
+
], FkLoginEntity.prototype, "pass", void 0);
|
42
|
+
__decorate([
|
43
|
+
(0, typeorm_1.Column)(),
|
44
|
+
__metadata("design:type", String)
|
45
|
+
], FkLoginEntity.prototype, "password", void 0);
|
46
|
+
__decorate([
|
47
|
+
(0, typeorm_1.Column)({
|
48
|
+
default: ``
|
49
|
+
}),
|
50
|
+
__metadata("design:type", String)
|
51
|
+
], FkLoginEntity.prototype, "token", void 0);
|
52
|
+
__decorate([
|
53
|
+
(0, typeorm_1.Column)({ name: 'aid', default: 0 }),
|
54
|
+
__metadata("design:type", Number)
|
55
|
+
], FkLoginEntity.prototype, "aid", void 0);
|
56
|
+
__decorate([
|
57
|
+
(0, typeorm_1.Column)({
|
58
|
+
name: 'upload_group_id',
|
59
|
+
default: 0
|
60
|
+
}),
|
61
|
+
__metadata("design:type", Number)
|
62
|
+
], FkLoginEntity.prototype, "uploadGroupId", void 0);
|
63
|
+
__decorate([
|
64
|
+
(0, typeorm_1.Column)({
|
65
|
+
default: 1024,
|
66
|
+
name: 'file_size_limit'
|
67
|
+
}),
|
68
|
+
__metadata("design:type", Number)
|
69
|
+
], FkLoginEntity.prototype, "fileSizeLimit", void 0);
|
70
|
+
__decorate([
|
71
|
+
(0, typeorm_1.Column)({
|
72
|
+
name: 'w7_username',
|
73
|
+
default: ''
|
74
|
+
}),
|
75
|
+
__metadata("design:type", String)
|
76
|
+
], FkLoginEntity.prototype, "w7Username", void 0);
|
77
|
+
__decorate([
|
78
|
+
(0, typeorm_1.Column)({
|
79
|
+
default: 0
|
80
|
+
}),
|
81
|
+
__metadata("design:type", Number)
|
82
|
+
], FkLoginEntity.prototype, "status", void 0);
|
83
|
+
FkLoginEntity = __decorate([
|
84
|
+
(0, typeorm_1.Entity)({
|
85
|
+
name: 'nger_fk_login'
|
86
|
+
})
|
87
|
+
], FkLoginEntity);
|
88
|
+
exports.FkLoginEntity = FkLoginEntity;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./fk-login-cookie.entity"), exports);
|
18
|
+
__exportStar(require("./fk-login.entity"), exports);
|
19
|
+
__exportStar(require("./fk-download-task.entity"), exports);
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { Context } from 'koa';
|
2
|
+
import { FkService } from './fk.service';
|
3
|
+
export declare class FkAjaxController {
|
4
|
+
private fk;
|
5
|
+
baseUrl: string;
|
6
|
+
indexUrl: string;
|
7
|
+
constructor(fk: FkService);
|
8
|
+
login(ctx: Context): Promise<any>;
|
9
|
+
loginH(cmd: string, ctx: Context, post: any): Promise<any>;
|
10
|
+
statisticsH(query: any, post: any, ctx: Context): Promise<any>;
|
11
|
+
logH(query: any, post: any, ctx: Context): Promise<any>;
|
12
|
+
couponH(query: any, post: any, ctx: Context): Promise<any>;
|
13
|
+
funPanel_h(token: string, post: any, ctx: Context): Promise<any>;
|
14
|
+
portal(query: any, ctx: Context): Promise<any>;
|
15
|
+
/**
|
16
|
+
* https://live.video.stona777.com/upload-trans/bsy_1577382_800002446/202204/1651127219734-f.mp4
|
17
|
+
* smr00
|
18
|
+
* @param username
|
19
|
+
* @param file
|
20
|
+
*/
|
21
|
+
postUpload(username: string, file: string): Promise<void>;
|
22
|
+
putFile(url: string, data: any, cookies: string): Promise<any>;
|
23
|
+
get(url: string, ctx: Context, cookie?: boolean): Promise<any>;
|
24
|
+
post(url: string, data: any, ctx: Context): Promise<any>;
|
25
|
+
toUrl(data: any): string;
|
26
|
+
formatBody(data: any): any;
|
27
|
+
private parseCookies;
|
28
|
+
}
|
@@ -0,0 +1,271 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
13
|
+
};
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
16
|
+
};
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
+
exports.FkAjaxController = void 0;
|
19
|
+
const core_1 = require("@nger/core");
|
20
|
+
const http_1 = require("@nger/http");
|
21
|
+
const axios_1 = __importDefault(require("axios"));
|
22
|
+
const fk_service_1 = require("./fk.service");
|
23
|
+
let FkAjaxController = class FkAjaxController {
|
24
|
+
fk;
|
25
|
+
baseUrl = `https://adm.webportal.top/`;
|
26
|
+
indexUrl = `https://i.vip.webportal.top/`;
|
27
|
+
constructor(fk) {
|
28
|
+
this.fk = fk;
|
29
|
+
}
|
30
|
+
login(ctx) {
|
31
|
+
this.fk.cookies = new Map();
|
32
|
+
return this.get(`https://adm.webportal.top`, ctx, false);
|
33
|
+
}
|
34
|
+
async loginH(cmd, ctx, post) {
|
35
|
+
const data = this.formatBody(post);
|
36
|
+
let fkLogin;
|
37
|
+
if (data)
|
38
|
+
fkLogin = await this.fk.saveLogin(data.cacct, data.pwd);
|
39
|
+
return this.post(`https://adm.webportal.top/ajax/login_h.jsp?cmd=${cmd}`, data, ctx).then(async (res) => {
|
40
|
+
if (cmd === 'initLoginConf') {
|
41
|
+
return res;
|
42
|
+
}
|
43
|
+
if (res.success) {
|
44
|
+
const _fkLogin = fkLogin;
|
45
|
+
if (_fkLogin) {
|
46
|
+
await this.fk.saveCookie(_fkLogin.fkLoginId);
|
47
|
+
// login success
|
48
|
+
const fkv2 = await this.fk.createV2(_fkLogin);
|
49
|
+
await fkv2.init();
|
50
|
+
const token = await fkv2.genAccessKey();
|
51
|
+
await fkv2.updateToken(token.token);
|
52
|
+
}
|
53
|
+
return res;
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
return res;
|
57
|
+
}
|
58
|
+
});
|
59
|
+
}
|
60
|
+
statisticsH(query, post, ctx) {
|
61
|
+
const data = this.formatBody(post);
|
62
|
+
return this.post(`${this.indexUrl}ajax/log_h.jsp?${this.toUrl(query)}`, data, ctx);
|
63
|
+
}
|
64
|
+
async logH(query, post, ctx) {
|
65
|
+
if (ctx.method.toLowerCase() === 'get') {
|
66
|
+
return this.get(`${this.baseUrl}ajax/log_h.jsp?${this.toUrl(query)}`, ctx);
|
67
|
+
}
|
68
|
+
else {
|
69
|
+
const data = this.formatBody(post);
|
70
|
+
debugger;
|
71
|
+
const res = await this.post(`${this.baseUrl}ajax/log_h.jsp?${this.toUrl(query)}`, data, ctx);
|
72
|
+
return res;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
couponH(query, post, ctx) {
|
76
|
+
const data = this.formatBody(post);
|
77
|
+
return this.post(`${this.indexUrl}ajax/coupon_h.jsp?${this.toUrl(query)}`, data, ctx);
|
78
|
+
}
|
79
|
+
async funPanel_h(token, post, ctx) {
|
80
|
+
const url = `https://i.vip.webportal.top/ajax/funPanel_h.jsp?_TOKEN=${token}`;
|
81
|
+
const data = this.formatBody(post);
|
82
|
+
return this.post(url, data, ctx).then(res => res.data);
|
83
|
+
}
|
84
|
+
portal(query, ctx) {
|
85
|
+
return this.get(`${this.baseUrl}portal.jsp?${this.toUrl(query)}`, ctx);
|
86
|
+
}
|
87
|
+
/**
|
88
|
+
* https://live.video.stona777.com/upload-trans/bsy_1577382_800002446/202204/1651127219734-f.mp4
|
89
|
+
* smr00
|
90
|
+
* @param username
|
91
|
+
* @param file
|
92
|
+
*/
|
93
|
+
async postUpload(username, file) {
|
94
|
+
const fkLogin = await this.fk.getFkLogin(`smr00`);
|
95
|
+
if (fkLogin) {
|
96
|
+
// const source = `https://live.video.stona777.com/upload-trans/bsy_1577382_800002446/202204/1651127219734-f.mp4`;
|
97
|
+
// await this.fk.getCloudUrl(source)
|
98
|
+
const url = `https://site-upload.webportal.top/v/21/upload?cmd=site-fileadvanceupload&token=${fkLogin.token}`;
|
99
|
+
const cookies = await this.fk.getFkLoginCookie(fkLogin.fkLoginId);
|
100
|
+
const cookieStr = cookies.map(cookie => `${cookie.key}=${cookie.value}`).join(';');
|
101
|
+
const res = await this.putFile(url, {}, cookieStr);
|
102
|
+
debugger;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
putFile(url, data, cookies) {
|
106
|
+
return axios_1.default.post(url, data, {
|
107
|
+
headers: {
|
108
|
+
'Content-Type': 'multipart/form-data',
|
109
|
+
Cookie: cookies
|
110
|
+
}
|
111
|
+
}).then(res => res.data);
|
112
|
+
}
|
113
|
+
get(url, ctx, cookie = true) {
|
114
|
+
if (cookie) {
|
115
|
+
if (ctx.headers.cookie)
|
116
|
+
this.parseCookies([ctx.headers.cookie]);
|
117
|
+
return axios_1.default.get(url, {
|
118
|
+
headers: {
|
119
|
+
Cookie: this.fk.getCookie(),
|
120
|
+
[`Content-Type`]: `application/x-www-form-urlencoded; charset=UTF-8`
|
121
|
+
}
|
122
|
+
}).then(res => {
|
123
|
+
const cookies = res.headers['set-cookie'];
|
124
|
+
this.parseCookies(cookies);
|
125
|
+
this.fk.cookies.forEach((val, key) => {
|
126
|
+
ctx.cookies.set(key, val);
|
127
|
+
});
|
128
|
+
return res.data;
|
129
|
+
});
|
130
|
+
}
|
131
|
+
else {
|
132
|
+
return axios_1.default.get(url, {
|
133
|
+
headers: {
|
134
|
+
[`Content-Type`]: `application/x-www-form-urlencoded; charset=UTF-8`
|
135
|
+
}
|
136
|
+
}).then(res => {
|
137
|
+
const cookies = res.headers['set-cookie'];
|
138
|
+
this.parseCookies(cookies);
|
139
|
+
this.fk.cookies.forEach((val, key) => {
|
140
|
+
ctx.cookies.set(key, val);
|
141
|
+
});
|
142
|
+
return res.data;
|
143
|
+
});
|
144
|
+
}
|
145
|
+
}
|
146
|
+
post(url, data, ctx) {
|
147
|
+
if (ctx.headers.cookie)
|
148
|
+
this.parseCookies([ctx.headers.cookie]);
|
149
|
+
return axios_1.default.post(url, this.toUrl(data), {
|
150
|
+
headers: {
|
151
|
+
Cookie: this.fk.getCookie()
|
152
|
+
}
|
153
|
+
}).then(res => {
|
154
|
+
const cookies = res.headers['set-cookie'];
|
155
|
+
this.parseCookies(cookies);
|
156
|
+
this.fk.cookies.forEach((val, key) => {
|
157
|
+
ctx.cookies.set(key, val);
|
158
|
+
});
|
159
|
+
return res.data;
|
160
|
+
});
|
161
|
+
}
|
162
|
+
toUrl(data) {
|
163
|
+
return Object.keys(data).map(key => {
|
164
|
+
const value = Reflect.get(data, key);
|
165
|
+
return `${key}=${value}`;
|
166
|
+
}).join('&');
|
167
|
+
}
|
168
|
+
formatBody(data) {
|
169
|
+
const res = {};
|
170
|
+
if (typeof data === 'object') {
|
171
|
+
Object.keys(data).map(key => {
|
172
|
+
const value = Reflect.get(data, key);
|
173
|
+
Reflect.set(res, key, this.formatBody(value));
|
174
|
+
});
|
175
|
+
return res;
|
176
|
+
}
|
177
|
+
if (typeof data === 'string') {
|
178
|
+
if (data === 'false')
|
179
|
+
return false;
|
180
|
+
if (data === 'true')
|
181
|
+
return true;
|
182
|
+
return data;
|
183
|
+
}
|
184
|
+
return data;
|
185
|
+
}
|
186
|
+
parseCookies(cookies) {
|
187
|
+
if (cookies) {
|
188
|
+
cookies.map(cookie => {
|
189
|
+
const list = cookie.split(';');
|
190
|
+
list.map(item => {
|
191
|
+
const [name, value] = item.split('=');
|
192
|
+
this.fk.cookies.set(name, value);
|
193
|
+
});
|
194
|
+
});
|
195
|
+
}
|
196
|
+
}
|
197
|
+
};
|
198
|
+
__decorate([
|
199
|
+
(0, http_1.Get)('login'),
|
200
|
+
__param(0, (0, core_1.Inject)(http_1.CONTEXT)),
|
201
|
+
__metadata("design:type", Function),
|
202
|
+
__metadata("design:paramtypes", [Object]),
|
203
|
+
__metadata("design:returntype", void 0)
|
204
|
+
], FkAjaxController.prototype, "login", null);
|
205
|
+
__decorate([
|
206
|
+
(0, http_1.Post)('ajax/login_h.jsp'),
|
207
|
+
__param(0, (0, http_1.Query)('cmd')),
|
208
|
+
__param(1, (0, core_1.Inject)(http_1.CONTEXT)),
|
209
|
+
__param(2, (0, http_1.Body)()),
|
210
|
+
__metadata("design:type", Function),
|
211
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
212
|
+
__metadata("design:returntype", Promise)
|
213
|
+
], FkAjaxController.prototype, "loginH", null);
|
214
|
+
__decorate([
|
215
|
+
(0, http_1.Post)('ajax/statistics_h.jsp'),
|
216
|
+
__param(0, (0, http_1.Query)()),
|
217
|
+
__param(1, (0, http_1.Body)()),
|
218
|
+
__param(2, (0, core_1.Inject)(http_1.CONTEXT)),
|
219
|
+
__metadata("design:type", Function),
|
220
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
221
|
+
__metadata("design:returntype", void 0)
|
222
|
+
], FkAjaxController.prototype, "statisticsH", null);
|
223
|
+
__decorate([
|
224
|
+
(0, http_1.Get)(`ajax/log_h.jsp`),
|
225
|
+
(0, http_1.Post)('ajax/log_h.jsp'),
|
226
|
+
__param(0, (0, http_1.Query)()),
|
227
|
+
__param(1, (0, http_1.Body)()),
|
228
|
+
__param(2, (0, core_1.Inject)(http_1.CONTEXT)),
|
229
|
+
__metadata("design:type", Function),
|
230
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
231
|
+
__metadata("design:returntype", Promise)
|
232
|
+
], FkAjaxController.prototype, "logH", null);
|
233
|
+
__decorate([
|
234
|
+
(0, http_1.Post)(`ajax/coupon_h.jsp`),
|
235
|
+
__param(0, (0, http_1.Query)()),
|
236
|
+
__param(1, (0, http_1.Body)()),
|
237
|
+
__param(2, (0, core_1.Inject)(http_1.CONTEXT)),
|
238
|
+
__metadata("design:type", Function),
|
239
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
240
|
+
__metadata("design:returntype", void 0)
|
241
|
+
], FkAjaxController.prototype, "couponH", null);
|
242
|
+
__decorate([
|
243
|
+
(0, http_1.Post)('ajax/funPanel_h.jsp'),
|
244
|
+
__param(0, (0, http_1.Query)('_TOKEN')),
|
245
|
+
__param(1, (0, http_1.Body)()),
|
246
|
+
__param(2, (0, core_1.Inject)(http_1.CONTEXT)),
|
247
|
+
__metadata("design:type", Function),
|
248
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
249
|
+
__metadata("design:returntype", Promise)
|
250
|
+
], FkAjaxController.prototype, "funPanel_h", null);
|
251
|
+
__decorate([
|
252
|
+
(0, http_1.Get)(`portal.jsp`),
|
253
|
+
__param(0, (0, http_1.Query)()),
|
254
|
+
__param(1, (0, core_1.Inject)(http_1.CONTEXT)),
|
255
|
+
__metadata("design:type", Function),
|
256
|
+
__metadata("design:paramtypes", [Object, Object]),
|
257
|
+
__metadata("design:returntype", void 0)
|
258
|
+
], FkAjaxController.prototype, "portal", null);
|
259
|
+
__decorate([
|
260
|
+
(0, http_1.Post)('upload'),
|
261
|
+
__param(0, (0, http_1.Body)('username')),
|
262
|
+
__param(1, (0, http_1.Body)('file')),
|
263
|
+
__metadata("design:type", Function),
|
264
|
+
__metadata("design:paramtypes", [String, String]),
|
265
|
+
__metadata("design:returntype", Promise)
|
266
|
+
], FkAjaxController.prototype, "postUpload", null);
|
267
|
+
FkAjaxController = __decorate([
|
268
|
+
(0, core_1.Controller)(),
|
269
|
+
__metadata("design:paramtypes", [fk_service_1.FkService])
|
270
|
+
], FkAjaxController);
|
271
|
+
exports.FkAjaxController = FkAjaxController;
|