@nger/fk-upload 1.0.3 → 1.0.4
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/package.json +16 -4
- package/readme.md +11 -0
- package/dist/core.d.ts +0 -1
- package/dist/fk-upload.controller.d.ts +0 -21
- package/dist/fk-upload.controller.js +0 -212
- package/dist/fk-upload.module.d.ts +0 -2
- package/dist/fk-upload.module.js +0 -25
- package/dist/fk.service.d.ts +0 -4
- package/dist/fk.service.js +0 -24
- package/dist/main.d.ts +0 -3
- package/dist/main.js +0 -32
- package/pnpm-lock.yaml +0 -27
- package/src/core.ts +0 -1
- package/src/fk-upload.controller.ts +0 -135
- package/src/fk-upload.module.ts +0 -13
- package/src/fk.service.ts +0 -14
- package/src/index.html +0 -20
- package/src/main.ts +0 -20
- package/tsconfig.json +0 -12
package/package.json
CHANGED
@@ -1,21 +1,33 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nger/fk-upload",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.4",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/core.js",
|
6
6
|
"types": "dist/core.d.ts",
|
7
7
|
"publishConfig": {
|
8
8
|
"access": "public"
|
9
9
|
},
|
10
|
+
"files": [
|
11
|
+
"./dist",
|
12
|
+
"./readme.md"
|
13
|
+
],
|
10
14
|
"author": "",
|
11
15
|
"license": "ISC",
|
12
16
|
"dependencies": {
|
13
|
-
"axios": "^0.26.1",
|
14
17
|
"@nger/core": "^1.0.0",
|
15
|
-
"@nger/http": "^4.0.0"
|
18
|
+
"@nger/http": "^4.0.0",
|
19
|
+
"@nger/ws": "^1.0.0",
|
20
|
+
"@types/download": "^8.0.1",
|
21
|
+
"@types/request": "^2.48.8",
|
22
|
+
"axios": "^0.26.1",
|
23
|
+
"download": "^8.0.0",
|
24
|
+
"form-data": "^4.0.0",
|
25
|
+
"md5-file": "^5.0.0",
|
26
|
+
"request": "^2.88.2"
|
16
27
|
},
|
17
28
|
"scripts": {
|
18
29
|
"tsc": "tsc -w",
|
19
30
|
"tsc:build": "tsc"
|
20
|
-
}
|
31
|
+
},
|
32
|
+
"readme": "## admin\n\n## account\n\n## test url -- \n\n## \n\nhttp://kaifa2.jidujiaowang.com/web/index.php?c=site&a=entry&eid=8&version_id=0\nadmin888\n12345678"
|
21
33
|
}
|
package/readme.md
ADDED
package/dist/core.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './fk-upload.module';
|
@@ -1,21 +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
|
-
index(item: string, ctx: Context): Promise<string | undefined>;
|
11
|
-
statisticsH(query: any, post: any, ctx: Context): Promise<any>;
|
12
|
-
logH(query: any, post: any, ctx: Context): Promise<any>;
|
13
|
-
couponH(query: any, post: any, ctx: Context): Promise<any>;
|
14
|
-
funPanel_h(token: string, post: any, ctx: Context): Promise<any>;
|
15
|
-
portal(query: any, ctx: Context): Promise<any>;
|
16
|
-
get(url: string, ctx: Context): Promise<any>;
|
17
|
-
post(url: string, data: any, ctx: Context): Promise<any>;
|
18
|
-
toUrl(data: any): string;
|
19
|
-
formatBody(data: any): any;
|
20
|
-
private parseCookies;
|
21
|
-
}
|
@@ -1,212 +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
|
-
return this.get(`https://adm.webportal.top`, ctx);
|
32
|
-
}
|
33
|
-
async loginH(cmd, ctx, post) {
|
34
|
-
const data = this.formatBody(post);
|
35
|
-
return this.post(`https://adm.webportal.top/ajax/login_h.jsp?cmd=${cmd}`, data, ctx);
|
36
|
-
}
|
37
|
-
async index(item, ctx) {
|
38
|
-
if (!this.fk.cookies.has('_FSESSIONID')) {
|
39
|
-
ctx.redirect('/login');
|
40
|
-
return;
|
41
|
-
}
|
42
|
-
let res = await this.get(`https://i.vip.webportal.top/?siteId=0&_item=${item}`, ctx);
|
43
|
-
return res;
|
44
|
-
}
|
45
|
-
statisticsH(query, post, ctx) {
|
46
|
-
const data = this.formatBody(post);
|
47
|
-
return this.post(`${this.indexUrl}ajax/log_h.jsp?${this.toUrl(query)}`, data, ctx);
|
48
|
-
}
|
49
|
-
async logH(query, post, ctx) {
|
50
|
-
if (ctx.method.toLowerCase() === 'get') {
|
51
|
-
return this.get(`${this.baseUrl}ajax/log_h.jsp?${this.toUrl(query)}`, ctx);
|
52
|
-
}
|
53
|
-
else {
|
54
|
-
const data = this.formatBody(post);
|
55
|
-
return this.post(`${this.baseUrl}ajax/log_h.jsp?${this.toUrl(query)}`, data, ctx);
|
56
|
-
}
|
57
|
-
}
|
58
|
-
couponH(query, post, ctx) {
|
59
|
-
const data = this.formatBody(post);
|
60
|
-
return this.post(`${this.indexUrl}ajax/coupon_h.jsp?${this.toUrl(query)}`, data, ctx);
|
61
|
-
}
|
62
|
-
async funPanel_h(token, post, ctx) {
|
63
|
-
const url = `https://i.vip.webportal.top/ajax/funPanel_h.jsp?_TOKEN=${token}`;
|
64
|
-
const data = this.formatBody(post);
|
65
|
-
return this.post(url, data, ctx).then(res => res.data);
|
66
|
-
}
|
67
|
-
portal(query, ctx) {
|
68
|
-
return this.get(`${this.baseUrl}portal.jsp?${this.toUrl(query)}`, ctx);
|
69
|
-
}
|
70
|
-
get(url, ctx) {
|
71
|
-
if (ctx.headers.cookie)
|
72
|
-
this.parseCookies([ctx.headers.cookie]);
|
73
|
-
return axios_1.default.get(url, {
|
74
|
-
headers: {
|
75
|
-
Cookie: this.fk.getCookie(),
|
76
|
-
[`Content-Type`]: `application/x-www-form-urlencoded; charset=UTF-8`
|
77
|
-
}
|
78
|
-
}).then(res => {
|
79
|
-
const cookies = res.headers['set-cookie'];
|
80
|
-
this.parseCookies(cookies);
|
81
|
-
this.fk.cookies.forEach((val, key) => {
|
82
|
-
ctx.cookies.set(key, val);
|
83
|
-
});
|
84
|
-
return res.data;
|
85
|
-
});
|
86
|
-
}
|
87
|
-
post(url, data, ctx) {
|
88
|
-
if (ctx.headers.cookie)
|
89
|
-
this.parseCookies([ctx.headers.cookie]);
|
90
|
-
return axios_1.default.post(url, this.toUrl(data), {
|
91
|
-
headers: {
|
92
|
-
Cookie: this.fk.getCookie()
|
93
|
-
}
|
94
|
-
}).then(res => {
|
95
|
-
const cookies = res.headers['set-cookie'];
|
96
|
-
this.parseCookies(cookies);
|
97
|
-
this.fk.cookies.forEach((val, key) => {
|
98
|
-
ctx.cookies.set(key, val);
|
99
|
-
});
|
100
|
-
return res.data;
|
101
|
-
});
|
102
|
-
}
|
103
|
-
toUrl(data) {
|
104
|
-
return Object.keys(data).map(key => {
|
105
|
-
const value = Reflect.get(data, key);
|
106
|
-
return `${key}=${value}`;
|
107
|
-
}).join('&');
|
108
|
-
}
|
109
|
-
formatBody(data) {
|
110
|
-
const res = {};
|
111
|
-
if (typeof data === 'object') {
|
112
|
-
Object.keys(data).map(key => {
|
113
|
-
const value = Reflect.get(data, key);
|
114
|
-
Reflect.set(res, key, this.formatBody(value));
|
115
|
-
});
|
116
|
-
return res;
|
117
|
-
}
|
118
|
-
if (typeof data === 'string') {
|
119
|
-
if (data === 'false')
|
120
|
-
return false;
|
121
|
-
if (data === 'true')
|
122
|
-
return true;
|
123
|
-
return data;
|
124
|
-
}
|
125
|
-
return data;
|
126
|
-
}
|
127
|
-
parseCookies(cookies) {
|
128
|
-
if (cookies) {
|
129
|
-
cookies.map(cookie => {
|
130
|
-
const list = cookie.split(';');
|
131
|
-
list.map(item => {
|
132
|
-
const [name, value] = item.split('=');
|
133
|
-
this.fk.cookies.set(name, value);
|
134
|
-
});
|
135
|
-
});
|
136
|
-
}
|
137
|
-
}
|
138
|
-
};
|
139
|
-
__decorate([
|
140
|
-
(0, http_1.Get)('login'),
|
141
|
-
__param(0, (0, core_1.Inject)(http_1.CONTEXT)),
|
142
|
-
__metadata("design:type", Function),
|
143
|
-
__metadata("design:paramtypes", [Object]),
|
144
|
-
__metadata("design:returntype", void 0)
|
145
|
-
], FkAjaxController.prototype, "login", null);
|
146
|
-
__decorate([
|
147
|
-
(0, http_1.Post)('ajax/login_h.jsp'),
|
148
|
-
__param(0, (0, http_1.Query)('cmd')),
|
149
|
-
__param(1, (0, core_1.Inject)(http_1.CONTEXT)),
|
150
|
-
__param(2, (0, http_1.Body)()),
|
151
|
-
__metadata("design:type", Function),
|
152
|
-
__metadata("design:paramtypes", [String, Object, Object]),
|
153
|
-
__metadata("design:returntype", Promise)
|
154
|
-
], FkAjaxController.prototype, "loginH", null);
|
155
|
-
__decorate([
|
156
|
-
(0, http_1.Get)('/'),
|
157
|
-
__param(0, (0, http_1.Query)('_item')),
|
158
|
-
__param(1, (0, core_1.Inject)(http_1.CONTEXT)),
|
159
|
-
__metadata("design:type", Function),
|
160
|
-
__metadata("design:paramtypes", [String, Object]),
|
161
|
-
__metadata("design:returntype", Promise)
|
162
|
-
], FkAjaxController.prototype, "index", null);
|
163
|
-
__decorate([
|
164
|
-
(0, http_1.Post)('ajax/statistics_h.jsp'),
|
165
|
-
__param(0, (0, http_1.Query)()),
|
166
|
-
__param(1, (0, http_1.Body)()),
|
167
|
-
__param(2, (0, core_1.Inject)(http_1.CONTEXT)),
|
168
|
-
__metadata("design:type", Function),
|
169
|
-
__metadata("design:paramtypes", [Object, Object, Object]),
|
170
|
-
__metadata("design:returntype", void 0)
|
171
|
-
], FkAjaxController.prototype, "statisticsH", null);
|
172
|
-
__decorate([
|
173
|
-
(0, http_1.Get)(`ajax/log_h.jsp`),
|
174
|
-
(0, http_1.Post)('ajax/log_h.jsp'),
|
175
|
-
__param(0, (0, http_1.Query)()),
|
176
|
-
__param(1, (0, http_1.Body)()),
|
177
|
-
__param(2, (0, core_1.Inject)(http_1.CONTEXT)),
|
178
|
-
__metadata("design:type", Function),
|
179
|
-
__metadata("design:paramtypes", [Object, Object, Object]),
|
180
|
-
__metadata("design:returntype", Promise)
|
181
|
-
], FkAjaxController.prototype, "logH", null);
|
182
|
-
__decorate([
|
183
|
-
(0, http_1.Post)(`ajax/coupon_h.jsp`),
|
184
|
-
__param(0, (0, http_1.Query)()),
|
185
|
-
__param(1, (0, http_1.Body)()),
|
186
|
-
__param(2, (0, core_1.Inject)(http_1.CONTEXT)),
|
187
|
-
__metadata("design:type", Function),
|
188
|
-
__metadata("design:paramtypes", [Object, Object, Object]),
|
189
|
-
__metadata("design:returntype", void 0)
|
190
|
-
], FkAjaxController.prototype, "couponH", null);
|
191
|
-
__decorate([
|
192
|
-
(0, http_1.Post)('ajax/funPanel_h.jsp'),
|
193
|
-
__param(0, (0, http_1.Query)('_TOKEN')),
|
194
|
-
__param(1, (0, http_1.Body)()),
|
195
|
-
__param(2, (0, core_1.Inject)(http_1.CONTEXT)),
|
196
|
-
__metadata("design:type", Function),
|
197
|
-
__metadata("design:paramtypes", [String, Object, Object]),
|
198
|
-
__metadata("design:returntype", Promise)
|
199
|
-
], FkAjaxController.prototype, "funPanel_h", null);
|
200
|
-
__decorate([
|
201
|
-
(0, http_1.Get)(`portal.jsp`),
|
202
|
-
__param(0, (0, http_1.Query)()),
|
203
|
-
__param(1, (0, core_1.Inject)(http_1.CONTEXT)),
|
204
|
-
__metadata("design:type", Function),
|
205
|
-
__metadata("design:paramtypes", [Object, Object]),
|
206
|
-
__metadata("design:returntype", void 0)
|
207
|
-
], FkAjaxController.prototype, "portal", null);
|
208
|
-
FkAjaxController = __decorate([
|
209
|
-
(0, core_1.Controller)(),
|
210
|
-
__metadata("design:paramtypes", [fk_service_1.FkService])
|
211
|
-
], FkAjaxController);
|
212
|
-
exports.FkAjaxController = FkAjaxController;
|
package/dist/fk-upload.module.js
DELETED
@@ -1,25 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
-
exports.FkUploadModule = void 0;
|
10
|
-
const core_1 = require("@nger/core");
|
11
|
-
const fk_upload_controller_1 = require("./fk-upload.controller");
|
12
|
-
const fk_service_1 = require("./fk.service");
|
13
|
-
let FkUploadModule = class FkUploadModule {
|
14
|
-
};
|
15
|
-
FkUploadModule = __decorate([
|
16
|
-
(0, core_1.Module)({
|
17
|
-
providers: [
|
18
|
-
fk_service_1.FkService
|
19
|
-
],
|
20
|
-
controllers: [
|
21
|
-
fk_upload_controller_1.FkAjaxController
|
22
|
-
]
|
23
|
-
})
|
24
|
-
], FkUploadModule);
|
25
|
-
exports.FkUploadModule = FkUploadModule;
|
package/dist/fk.service.d.ts
DELETED
package/dist/fk.service.js
DELETED
@@ -1,24 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
-
exports.FkService = void 0;
|
10
|
-
const core_1 = require("@nger/core");
|
11
|
-
let FkService = class FkService {
|
12
|
-
cookies = new Map();
|
13
|
-
getCookie() {
|
14
|
-
let cookies = [];
|
15
|
-
this.cookies.forEach((value, key) => {
|
16
|
-
cookies.push(`${key}=${value}`);
|
17
|
-
});
|
18
|
-
return cookies.join(';');
|
19
|
-
}
|
20
|
-
};
|
21
|
-
FkService = __decorate([
|
22
|
-
(0, core_1.Injectable)()
|
23
|
-
], FkService);
|
24
|
-
exports.FkService = FkService;
|
package/dist/main.d.ts
DELETED
package/dist/main.js
DELETED
@@ -1,32 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
-
exports.AppModule = void 0;
|
10
|
-
require("reflect-metadata");
|
11
|
-
require('dotenv').config();
|
12
|
-
const core_1 = require("@nger/core");
|
13
|
-
const core_2 = require("@nger/core");
|
14
|
-
const fk_upload_module_1 = require("./fk-upload.module");
|
15
|
-
const http_1 = require("@nger/http");
|
16
|
-
let AppModule = class AppModule {
|
17
|
-
};
|
18
|
-
AppModule = __decorate([
|
19
|
-
(0, core_2.Module)({
|
20
|
-
providers: [{
|
21
|
-
provide: core_1.APP_ROOT,
|
22
|
-
useValue: process.cwd()
|
23
|
-
}],
|
24
|
-
imports: [
|
25
|
-
fk_upload_module_1.FkUploadModule,
|
26
|
-
http_1.HttpModule.forEnv()
|
27
|
-
],
|
28
|
-
controllers: []
|
29
|
-
})
|
30
|
-
], AppModule);
|
31
|
-
exports.AppModule = AppModule;
|
32
|
-
(0, core_1.platformCore)().bootstrap(AppModule);
|
package/pnpm-lock.yaml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
lockfileVersion: 5.3
|
2
|
-
|
3
|
-
specifiers:
|
4
|
-
axios: ^0.26.1
|
5
|
-
|
6
|
-
dependencies:
|
7
|
-
axios: 0.26.1
|
8
|
-
|
9
|
-
packages:
|
10
|
-
|
11
|
-
/axios/0.26.1:
|
12
|
-
resolution: {integrity: sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==}
|
13
|
-
dependencies:
|
14
|
-
follow-redirects: 1.14.9
|
15
|
-
transitivePeerDependencies:
|
16
|
-
- debug
|
17
|
-
dev: false
|
18
|
-
|
19
|
-
/follow-redirects/1.14.9:
|
20
|
-
resolution: {integrity: sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==}
|
21
|
-
engines: {node: '>=4.0'}
|
22
|
-
peerDependencies:
|
23
|
-
debug: '*'
|
24
|
-
peerDependenciesMeta:
|
25
|
-
debug:
|
26
|
-
optional: true
|
27
|
-
dev: false
|
package/src/core.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './fk-upload.module';
|
@@ -1,135 +0,0 @@
|
|
1
|
-
import { Controller, Inject } from '@nger/core'
|
2
|
-
import { Body, CONTEXT, Get, Post, Query } from '@nger/http'
|
3
|
-
import axios from 'axios'
|
4
|
-
import { Context } from 'koa';
|
5
|
-
import { FkService } from './fk.service';
|
6
|
-
@Controller()
|
7
|
-
export class FkAjaxController {
|
8
|
-
baseUrl: string = `https://adm.webportal.top/`
|
9
|
-
indexUrl: string = `https://i.vip.webportal.top/`
|
10
|
-
constructor(private fk: FkService) { }
|
11
|
-
@Get('login')
|
12
|
-
login(@Inject(CONTEXT) ctx: Context) {
|
13
|
-
return this.get(`https://adm.webportal.top`, ctx)
|
14
|
-
}
|
15
|
-
|
16
|
-
@Post('ajax/login_h.jsp')
|
17
|
-
async loginH(@Query('cmd') cmd: string, @Inject(CONTEXT) ctx: Context, @Body() post: any) {
|
18
|
-
const data = this.formatBody(post);
|
19
|
-
return this.post(`https://adm.webportal.top/ajax/login_h.jsp?cmd=${cmd}`, data, ctx)
|
20
|
-
}
|
21
|
-
|
22
|
-
@Get('/')
|
23
|
-
async index(@Query('_item') item: string, @Inject(CONTEXT) ctx: Context) {
|
24
|
-
if (!this.fk.cookies.has('_FSESSIONID')) {
|
25
|
-
ctx.redirect('/login')
|
26
|
-
return;
|
27
|
-
}
|
28
|
-
let res: string = await this.get(`https://i.vip.webportal.top/?siteId=0&_item=${item}`, ctx)
|
29
|
-
return res;
|
30
|
-
}
|
31
|
-
|
32
|
-
@Post('ajax/statistics_h.jsp')
|
33
|
-
statisticsH(@Query() query: any, @Body() post: any, @Inject(CONTEXT) ctx: Context) {
|
34
|
-
const data = this.formatBody(post);
|
35
|
-
return this.post(`${this.indexUrl}ajax/log_h.jsp?${this.toUrl(query)}`, data, ctx)
|
36
|
-
}
|
37
|
-
|
38
|
-
@Get(`ajax/log_h.jsp`)
|
39
|
-
@Post('ajax/log_h.jsp')
|
40
|
-
async logH(@Query() query: any, @Body() post: any, @Inject(CONTEXT) ctx: Context) {
|
41
|
-
if (ctx.method.toLowerCase() === 'get') {
|
42
|
-
return this.get(`${this.baseUrl}ajax/log_h.jsp?${this.toUrl(query)}`, ctx)
|
43
|
-
} else {
|
44
|
-
const data = this.formatBody(post);
|
45
|
-
return this.post(`${this.baseUrl}ajax/log_h.jsp?${this.toUrl(query)}`, data, ctx)
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
@Post(`ajax/coupon_h.jsp`)
|
50
|
-
couponH(@Query() query: any, @Body() post: any, @Inject(CONTEXT) ctx: Context) {
|
51
|
-
const data = this.formatBody(post);
|
52
|
-
return this.post(`${this.indexUrl}ajax/coupon_h.jsp?${this.toUrl(query)}`, data, ctx)
|
53
|
-
}
|
54
|
-
|
55
|
-
@Post('ajax/funPanel_h.jsp')
|
56
|
-
async funPanel_h(@Query('_TOKEN') token: string, @Body() post: any, @Inject(CONTEXT) ctx: Context) {
|
57
|
-
const url = `https://i.vip.webportal.top/ajax/funPanel_h.jsp?_TOKEN=${token}`
|
58
|
-
const data = this.formatBody(post)
|
59
|
-
return this.post(url, data, ctx).then(res => res.data)
|
60
|
-
}
|
61
|
-
|
62
|
-
@Get(`portal.jsp`)
|
63
|
-
portal(@Query() query: any, @Inject(CONTEXT) ctx: Context) {
|
64
|
-
return this.get(`${this.baseUrl}portal.jsp?${this.toUrl(query)}`, ctx)
|
65
|
-
}
|
66
|
-
|
67
|
-
get(url: string, ctx: Context) {
|
68
|
-
if (ctx.headers.cookie) this.parseCookies([ctx.headers.cookie])
|
69
|
-
return axios.get(url, {
|
70
|
-
headers: {
|
71
|
-
Cookie: this.fk.getCookie(),
|
72
|
-
[`Content-Type`]: `application/x-www-form-urlencoded; charset=UTF-8`
|
73
|
-
}
|
74
|
-
}).then(res => {
|
75
|
-
const cookies = res.headers['set-cookie'];
|
76
|
-
this.parseCookies(cookies)
|
77
|
-
this.fk.cookies.forEach((val, key) => {
|
78
|
-
ctx.cookies.set(key, val)
|
79
|
-
});
|
80
|
-
return res.data;
|
81
|
-
})
|
82
|
-
}
|
83
|
-
|
84
|
-
post(url: string, data: any, ctx: Context) {
|
85
|
-
if (ctx.headers.cookie) this.parseCookies([ctx.headers.cookie])
|
86
|
-
return axios.post(url, this.toUrl(data), {
|
87
|
-
headers: {
|
88
|
-
Cookie: this.fk.getCookie()
|
89
|
-
}
|
90
|
-
}).then(res => {
|
91
|
-
const cookies = res.headers['set-cookie'];
|
92
|
-
this.parseCookies(cookies)
|
93
|
-
this.fk.cookies.forEach((val, key) => {
|
94
|
-
ctx.cookies.set(key, val)
|
95
|
-
});
|
96
|
-
return res.data
|
97
|
-
})
|
98
|
-
}
|
99
|
-
|
100
|
-
toUrl(data: any) {
|
101
|
-
return Object.keys(data).map(key => {
|
102
|
-
const value = Reflect.get(data, key)
|
103
|
-
return `${key}=${value}`
|
104
|
-
}).join('&')
|
105
|
-
}
|
106
|
-
|
107
|
-
formatBody(data: any) {
|
108
|
-
const res: any = {};
|
109
|
-
if (typeof data === 'object') {
|
110
|
-
Object.keys(data).map(key => {
|
111
|
-
const value = Reflect.get(data, key);
|
112
|
-
Reflect.set(res, key, this.formatBody(value))
|
113
|
-
})
|
114
|
-
return res;
|
115
|
-
}
|
116
|
-
if (typeof data === 'string') {
|
117
|
-
if (data === 'false') return false;
|
118
|
-
if (data === 'true') return true;
|
119
|
-
return data;
|
120
|
-
}
|
121
|
-
return data;
|
122
|
-
}
|
123
|
-
|
124
|
-
private parseCookies(cookies?: string[]) {
|
125
|
-
if (cookies) {
|
126
|
-
cookies.map(cookie => {
|
127
|
-
const list = cookie.split(';');
|
128
|
-
list.map(item => {
|
129
|
-
const [name, value] = item.split('=')
|
130
|
-
this.fk.cookies.set(name, value)
|
131
|
-
})
|
132
|
-
})
|
133
|
-
}
|
134
|
-
}
|
135
|
-
}
|
package/src/fk-upload.module.ts
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
import { Module } from '@nger/core'
|
2
|
-
import { FkAjaxController } from './fk-upload.controller';
|
3
|
-
import { FkService } from './fk.service';
|
4
|
-
|
5
|
-
@Module({
|
6
|
-
providers: [
|
7
|
-
FkService
|
8
|
-
],
|
9
|
-
controllers: [
|
10
|
-
FkAjaxController
|
11
|
-
]
|
12
|
-
})
|
13
|
-
export class FkUploadModule { }
|
package/src/fk.service.ts
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
import { Injectable } from '@nger/core'
|
2
|
-
@Injectable()
|
3
|
-
export class FkService {
|
4
|
-
|
5
|
-
cookies: Map<string, any> = new Map();
|
6
|
-
|
7
|
-
getCookie(){
|
8
|
-
let cookies: string[] = []
|
9
|
-
this.cookies.forEach((value, key)=>{
|
10
|
-
cookies.push(`${key}=${value}`)
|
11
|
-
})
|
12
|
-
return cookies.join(';')
|
13
|
-
}
|
14
|
-
}
|
package/src/index.html
DELETED
package/src/main.ts
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
import "reflect-metadata";
|
2
|
-
require('dotenv').config();
|
3
|
-
import { APP_ROOT, platformCore } from '@nger/core'
|
4
|
-
import { Module } from '@nger/core'
|
5
|
-
import { FkUploadModule } from "./fk-upload.module";
|
6
|
-
import { HttpModule } from '@nger/http';
|
7
|
-
|
8
|
-
@Module({
|
9
|
-
providers: [{
|
10
|
-
provide: APP_ROOT,
|
11
|
-
useValue: process.cwd()
|
12
|
-
}],
|
13
|
-
imports: [
|
14
|
-
FkUploadModule,
|
15
|
-
HttpModule.forEnv()
|
16
|
-
],
|
17
|
-
controllers: []
|
18
|
-
})
|
19
|
-
export class AppModule { }
|
20
|
-
platformCore().bootstrap(AppModule)
|