@nger/fk-upload 1.0.161 → 1.0.165
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/{tests/test.d.ts → electon.d.ts} +0 -0
- package/dist/electon.js +70 -0
- package/dist/templates/add-fk-login.js +1 -3
- package/dist/templates/add-task.d.ts +1 -1
- package/dist/templates/add-task.js +11 -5
- package/dist/templates/code.js +2 -1
- package/dist/templates/component.js +1 -1
- package/dist/templates/help.js +0 -1
- package/dist/templates/setting.d.ts +1 -3
- package/dist/templates/setting.js +2 -5
- package/dist/templates/task-manage.d.ts +5 -1
- package/dist/templates/task-manage.js +71 -34
- package/dist/templates/tasks/upload-task.js +11 -6
- package/electron/.env +32 -0
- package/electron/package.json +31 -0
- package/electron/pnpm-lock.yaml +2888 -0
- package/env.env +30 -0
- package/package.json +14 -5
- package/pnpm-lock.yaml +1847 -103
- package/dist/entities/fk-login-account.entity.d.ts +0 -6
- package/dist/entities/fk-login-account.entity.js +0 -47
- package/dist/fk-upload.controller.d.ts +0 -28
- package/dist/fk-upload.controller.js +0 -271
- package/dist/fk-v2.service.d.ts +0 -29
- package/dist/fk-v2.service.js +0 -152
- package/dist/fk.service.d.ts +0 -17
- package/dist/fk.service.js +0 -89
- package/dist/templates/account-manage.d.ts +0 -3
- package/dist/templates/account-manage.js +0 -27
- package/dist/templates/add-account.d.ts +0 -0
- package/dist/templates/add-account.js +0 -1
- package/dist/templates/create-download-task.d.ts +0 -0
- package/dist/templates/create-download-task.js +0 -1
- package/dist/templates/download-task.d.ts +0 -10
- package/dist/templates/download-task.js +0 -47
- package/dist/templates/login.service.d.ts +0 -2
- package/dist/templates/login.service.js +0 -16
- package/dist/templates/receive-shedule-task.d.ts +0 -14
- package/dist/templates/receive-shedule-task.js +0 -64
- package/dist/templates/relogin.d.ts +0 -5
- package/dist/templates/relogin.js +0 -25
- package/dist/templates/task-types.d.ts +0 -34
- package/dist/templates/task-types.js +0 -2
- package/dist/templates/task.service.d.ts +0 -0
- package/dist/templates/task.service.js +0 -407
- package/dist/templates/tasks/create-download-task.d.ts +0 -12
- package/dist/templates/tasks/create-download-task.js +0 -65
- package/dist/templates/tasks/index.d.ts +0 -0
- package/dist/templates/tasks/index.js +0 -1
- package/dist/templates/tasks/receive-shedule-task.d.ts +0 -16
- package/dist/templates/tasks/receive-shedule-task.js +0 -66
- package/dist/templates/upload.service.d.ts +0 -0
- package/dist/templates/upload.service.js +0 -1
- package/dist/tests/test.js +0 -101
@@ -1,47 +0,0 @@
|
|
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
|
-
topicId;
|
18
|
-
fkLoginId;
|
19
|
-
};
|
20
|
-
__decorate([
|
21
|
-
(0, typeorm_1.PrimaryGeneratedColumn)({
|
22
|
-
name: 'fk_login_account_id'
|
23
|
-
}),
|
24
|
-
__metadata("design:type", Number)
|
25
|
-
], FkLoginAccountEntity.prototype, "fkLoginAccountId", void 0);
|
26
|
-
__decorate([
|
27
|
-
(0, typeorm_1.Column)(),
|
28
|
-
__metadata("design:type", Number)
|
29
|
-
], FkLoginAccountEntity.prototype, "uniacid", void 0);
|
30
|
-
__decorate([
|
31
|
-
(0, typeorm_1.Column)({
|
32
|
-
name: 'topic_id'
|
33
|
-
}),
|
34
|
-
__metadata("design:type", Number)
|
35
|
-
], FkLoginAccountEntity.prototype, "topicId", void 0);
|
36
|
-
__decorate([
|
37
|
-
(0, typeorm_1.Column)({
|
38
|
-
name: 'fk_login_id'
|
39
|
-
}),
|
40
|
-
__metadata("design:type", Number)
|
41
|
-
], FkLoginAccountEntity.prototype, "fkLoginId", void 0);
|
42
|
-
FkLoginAccountEntity = __decorate([
|
43
|
-
(0, typeorm_1.Entity)({
|
44
|
-
name: 'nger_fk_login_account'
|
45
|
-
})
|
46
|
-
], FkLoginAccountEntity);
|
47
|
-
exports.FkLoginAccountEntity = FkLoginAccountEntity;
|
@@ -1,28 +0,0 @@
|
|
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
|
-
}
|
@@ -1,271 +0,0 @@
|
|
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;
|
package/dist/fk-v2.service.d.ts
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
import { Injector } from '@nger/core';
|
2
|
-
import { Db } from '@nger/typeorm';
|
3
|
-
import { FkLoginEntity } from './entities';
|
4
|
-
import { UrlSafeBase64 } from './urlSafeBase64Decode';
|
5
|
-
export declare class FkV2Service {
|
6
|
-
private fkLogin;
|
7
|
-
private db;
|
8
|
-
private injector;
|
9
|
-
baseurl: string;
|
10
|
-
get urlSafeBase64(): UrlSafeBase64;
|
11
|
-
aid: number | undefined;
|
12
|
-
siteId: number | undefined;
|
13
|
-
get fileSizeLimit(): number;
|
14
|
-
constructor(fkLogin: FkLoginEntity, db: Db, injector: Injector);
|
15
|
-
init(): Promise<any>;
|
16
|
-
updateToken(token: string): Promise<void>;
|
17
|
-
getSiteId(html: string): number | undefined;
|
18
|
-
getAid(html: string): number | undefined;
|
19
|
-
getCookies(): Promise<string>;
|
20
|
-
genAccessKey(): Promise<any>;
|
21
|
-
getUploadUrl(token: any): string;
|
22
|
-
getWatermark(): Promise<any>;
|
23
|
-
_uTime: number;
|
24
|
-
advanceUploadReport(tempFile: any, tempType: number, tempFlag: boolean): Promise<void>;
|
25
|
-
get(url: string): Promise<any>;
|
26
|
-
post(url: string, data: any): Promise<any>;
|
27
|
-
encodeURIComponent(data: any): string;
|
28
|
-
upload(): void;
|
29
|
-
}
|
package/dist/fk-v2.service.js
DELETED
@@ -1,152 +0,0 @@
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
exports.FkV2Service = void 0;
|
16
|
-
const core_1 = require("@nger/core");
|
17
|
-
const typeorm_1 = require("@nger/typeorm");
|
18
|
-
const entities_1 = require("./entities");
|
19
|
-
const axios_1 = __importDefault(require("axios"));
|
20
|
-
const urlSafeBase64Decode_1 = require("./urlSafeBase64Decode");
|
21
|
-
let FkV2Service = class FkV2Service {
|
22
|
-
fkLogin;
|
23
|
-
db;
|
24
|
-
injector;
|
25
|
-
baseurl = `https://smr00.vip.webportal.top/`;
|
26
|
-
get urlSafeBase64() {
|
27
|
-
return this.injector.get(urlSafeBase64Decode_1.UrlSafeBase64);
|
28
|
-
}
|
29
|
-
aid;
|
30
|
-
siteId;
|
31
|
-
get fileSizeLimit() {
|
32
|
-
return this.fkLogin.fileSizeLimit;
|
33
|
-
}
|
34
|
-
constructor(fkLogin, db, injector) {
|
35
|
-
this.fkLogin = fkLogin;
|
36
|
-
this.db = db;
|
37
|
-
this.injector = injector;
|
38
|
-
}
|
39
|
-
async init() {
|
40
|
-
return this.get(`https://i.vip.webportal.top/`).then(async (html) => {
|
41
|
-
this.aid = this.getAid(html);
|
42
|
-
this.siteId = this.getSiteId(html);
|
43
|
-
await this.db.manager.update(entities_1.FkLoginEntity, this.fkLogin.fkLoginId, {
|
44
|
-
aid: this.aid || 0,
|
45
|
-
uploadGroupId: this.siteId || 0
|
46
|
-
});
|
47
|
-
return html;
|
48
|
-
});
|
49
|
-
}
|
50
|
-
async updateToken(token) {
|
51
|
-
await this.db.manager.update(entities_1.FkLoginEntity, this.fkLogin.fkLoginId, {
|
52
|
-
token
|
53
|
-
});
|
54
|
-
}
|
55
|
-
// Fai.top._siteId
|
56
|
-
getSiteId(html) {
|
57
|
-
const list = html.match(/Fai.top._siteId = (.*),/);
|
58
|
-
if (list && list.length === 2)
|
59
|
-
return Number(list[1]);
|
60
|
-
return undefined;
|
61
|
-
}
|
62
|
-
getAid(html) {
|
63
|
-
const list = html.match(/Fai.top._aid = (.*),/);
|
64
|
-
if (list && list.length === 2)
|
65
|
-
return Number(list[1]);
|
66
|
-
return undefined;
|
67
|
-
}
|
68
|
-
async getCookies() {
|
69
|
-
const cookies = await this.db.manager.find(entities_1.FkLoginCookieEntity, { where: { fkLoginId: this.fkLogin.fkLoginId } });
|
70
|
-
const cookieStr = cookies.map(cookie => `${cookie.key}=${cookie.value}`).join(';');
|
71
|
-
return cookieStr;
|
72
|
-
}
|
73
|
-
async genAccessKey() {
|
74
|
-
const url = `${this.baseurl}/api/manage/advanceUpload/genAccessKey`;
|
75
|
-
const res = await this.get(url);
|
76
|
-
if (res.success) {
|
77
|
-
const str = this.urlSafeBase64.decode(res.accessKey);
|
78
|
-
if (str) {
|
79
|
-
const obj = JSON.parse(str);
|
80
|
-
return obj;
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}
|
84
|
-
getUploadUrl(token) {
|
85
|
-
return `https://${token.url}/${token.visitType}/${token.app}/upload?cmd=${token.cmd}&token=${token.token}`;
|
86
|
-
}
|
87
|
-
async getWatermark() {
|
88
|
-
const url = `${this.baseurl}/api/manage/advanceUpload/getWatermark`;
|
89
|
-
const res = await this.get(url);
|
90
|
-
if (res.success) {
|
91
|
-
return res.waterMark;
|
92
|
-
}
|
93
|
-
}
|
94
|
-
_uTime = new Date().getTime();
|
95
|
-
async advanceUploadReport(tempFile, tempType, tempFlag) {
|
96
|
-
const url = `${this.baseurl}/ajax/advanceUpload.jsp?cmd=_report`;
|
97
|
-
const tempTime = new Date().getTime() - this._uTime;
|
98
|
-
const tempSize = tempFile.size;
|
99
|
-
const tempName = tempFile.name;
|
100
|
-
const res = await this.post(url, { "type": tempType, "size": tempSize, "time": tempTime, "flag": tempFlag, "name": tempName });
|
101
|
-
debugger;
|
102
|
-
}
|
103
|
-
async get(url) {
|
104
|
-
return axios_1.default.get(url, {
|
105
|
-
headers: {
|
106
|
-
Cookie: await this.getCookies()
|
107
|
-
}
|
108
|
-
}).then(res => {
|
109
|
-
const cookies = res.headers['set-cookie'];
|
110
|
-
return res.data;
|
111
|
-
});
|
112
|
-
}
|
113
|
-
async post(url, data) {
|
114
|
-
return axios_1.default.post(url, this.encodeURIComponent(data), {
|
115
|
-
headers: {
|
116
|
-
Cookie: await this.getCookies()
|
117
|
-
}
|
118
|
-
}).then(res => res.data);
|
119
|
-
}
|
120
|
-
encodeURIComponent(data) {
|
121
|
-
return Object.keys(data).map(key => {
|
122
|
-
const value = Reflect.get(data, key);
|
123
|
-
return `${key}=${encodeURIComponent(value)}`;
|
124
|
-
}).join('&');
|
125
|
-
}
|
126
|
-
upload() {
|
127
|
-
// get /api/manage/advanceUpload/genAccessKey
|
128
|
-
// get /api/manage/advanceUpload/getWatermark
|
129
|
-
// post /ajax/advanceUpload.jsp?cmd=_report
|
130
|
-
// file, accessKey
|
131
|
-
// var bssInfo = {
|
132
|
-
// fromSite: true,
|
133
|
-
// siteId: Fai.top._siteId || 0,
|
134
|
-
// groupId: upload_groupId,
|
135
|
-
// fileSizeLimit: file_size_limit,
|
136
|
-
// }
|
137
|
-
// if(watermarkUse) {
|
138
|
-
// bssInfo.waterMark = waterMark
|
139
|
-
// }
|
140
|
-
// var params = {
|
141
|
-
// isFreeVer:(false || false == true),//是否为免费版
|
142
|
-
// aid: Fai.top._aid,
|
143
|
-
// folderId: Fai.top._siteId || 0,
|
144
|
-
// bssInfo: JSON.stringify(bssInfo)
|
145
|
-
// }
|
146
|
-
}
|
147
|
-
};
|
148
|
-
FkV2Service = __decorate([
|
149
|
-
(0, core_1.Injectable)(),
|
150
|
-
__metadata("design:paramtypes", [entities_1.FkLoginEntity, typeorm_1.Db, core_1.Injector])
|
151
|
-
], FkV2Service);
|
152
|
-
exports.FkV2Service = FkV2Service;
|
package/dist/fk.service.d.ts
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import { Injector } from '@nger/core';
|
2
|
-
import { Db } from '@nger/typeorm';
|
3
|
-
import { FkLoginCookieEntity, FkLoginEntity } from './entities';
|
4
|
-
export declare class FkService {
|
5
|
-
db: Db;
|
6
|
-
private injector;
|
7
|
-
cookies: Map<string, any>;
|
8
|
-
constructor(db: Db, injector: Injector);
|
9
|
-
saveLogin(username: string, password: string): Promise<FkLoginEntity | null>;
|
10
|
-
updateFkLoginToken(token: string, fkLoginId: number): Promise<any>;
|
11
|
-
getCookie(): string;
|
12
|
-
getCloudUrl(url: string): void;
|
13
|
-
getFkLogin(username: string): Promise<FkLoginEntity | null>;
|
14
|
-
getFkLoginCookie(fkLoginId: number): Promise<FkLoginCookieEntity[]>;
|
15
|
-
createV2(login: FkLoginEntity): Promise<any>;
|
16
|
-
saveCookie(fkLoginId: number): Promise<void>;
|
17
|
-
}
|
package/dist/fk.service.js
DELETED
@@ -1,89 +0,0 @@
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
exports.FkService = void 0;
|
16
|
-
const core_1 = require("@nger/core");
|
17
|
-
const typeorm_1 = require("@nger/typeorm");
|
18
|
-
const entities_1 = require("./entities");
|
19
|
-
const request_1 = __importDefault(require("request"));
|
20
|
-
const fs_1 = require("fs");
|
21
|
-
const path_1 = require("path");
|
22
|
-
const fk_v2_service_1 = require("./fk-v2.service");
|
23
|
-
let FkService = class FkService {
|
24
|
-
db;
|
25
|
-
injector;
|
26
|
-
cookies = new Map();
|
27
|
-
constructor(db, injector) {
|
28
|
-
this.db = db;
|
29
|
-
this.injector = injector;
|
30
|
-
}
|
31
|
-
async saveLogin(username, password) {
|
32
|
-
let item = await this.db.manager.findOne(entities_1.FkLoginEntity, { where: { username } });
|
33
|
-
if (!item && username && password) {
|
34
|
-
const login = new entities_1.FkLoginEntity();
|
35
|
-
login.username = username;
|
36
|
-
login.password = password;
|
37
|
-
item = await this.db.manager.save(entities_1.FkLoginEntity, login);
|
38
|
-
}
|
39
|
-
return item;
|
40
|
-
}
|
41
|
-
async updateFkLoginToken(token, fkLoginId) {
|
42
|
-
return this.db.manager.update(entities_1.FkLoginEntity, fkLoginId, { token });
|
43
|
-
}
|
44
|
-
getCookie() {
|
45
|
-
let cookies = [];
|
46
|
-
this.cookies.forEach((value, key) => {
|
47
|
-
cookies.push(`${key}=${value}`);
|
48
|
-
});
|
49
|
-
return cookies.join(';');
|
50
|
-
}
|
51
|
-
getCloudUrl(url) {
|
52
|
-
const req = (0, request_1.default)({
|
53
|
-
uri: url,
|
54
|
-
method: 'GET'
|
55
|
-
});
|
56
|
-
const out = (0, fs_1.createWriteStream)((0, path_1.join)(__dirname, 'demo.mp4'));
|
57
|
-
req.pipe(out);
|
58
|
-
req.on('end', () => {
|
59
|
-
console.log(`en`);
|
60
|
-
});
|
61
|
-
}
|
62
|
-
getFkLogin(username) {
|
63
|
-
return this.db.manager.findOne(entities_1.FkLoginEntity, { where: { username } });
|
64
|
-
}
|
65
|
-
getFkLoginCookie(fkLoginId) {
|
66
|
-
return this.db.manager.find(entities_1.FkLoginCookieEntity, { where: { fkLoginId } });
|
67
|
-
}
|
68
|
-
async createV2(login) {
|
69
|
-
return new fk_v2_service_1.FkV2Service(login, this.db, this.injector);
|
70
|
-
}
|
71
|
-
async saveCookie(fkLoginId) {
|
72
|
-
const cookies = this.cookies;
|
73
|
-
const list = await this.db.manager.find(entities_1.FkLoginCookieEntity, { where: { fkLoginId } });
|
74
|
-
await this.db.manager.remove(list);
|
75
|
-
const cookieEntities = [...cookies.entries()].map(([k, v]) => {
|
76
|
-
const cookie = new entities_1.FkLoginCookieEntity();
|
77
|
-
cookie.fkLoginId = fkLoginId;
|
78
|
-
cookie.key = k;
|
79
|
-
cookie.value = v;
|
80
|
-
return cookie;
|
81
|
-
});
|
82
|
-
await this.db.manager.save(entities_1.FkLoginCookieEntity, cookieEntities);
|
83
|
-
}
|
84
|
-
};
|
85
|
-
FkService = __decorate([
|
86
|
-
(0, core_1.Injectable)(),
|
87
|
-
__metadata("design:paramtypes", [typeorm_1.Db, core_1.Injector])
|
88
|
-
], FkService);
|
89
|
-
exports.FkService = FkService;
|
@@ -1,27 +0,0 @@
|
|
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.AccountManageController = void 0;
|
13
|
-
const core_1 = require("@nger/core");
|
14
|
-
const http_1 = require("@nger/http");
|
15
|
-
let AccountManageController = class AccountManageController {
|
16
|
-
accountManage() { }
|
17
|
-
};
|
18
|
-
__decorate([
|
19
|
-
(0, http_1.Get)('account-manage'),
|
20
|
-
__metadata("design:type", Function),
|
21
|
-
__metadata("design:paramtypes", []),
|
22
|
-
__metadata("design:returntype", void 0)
|
23
|
-
], AccountManageController.prototype, "accountManage", null);
|
24
|
-
AccountManageController = __decorate([
|
25
|
-
(0, core_1.Controller)(`@nger/fk-upload`)
|
26
|
-
], AccountManageController);
|
27
|
-
exports.AccountManageController = AccountManageController;
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";
|