@nger/fk-upload 1.0.3 → 1.0.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/entities/fk-download-task.entity.d.ts +12 -0
- package/dist/entities/fk-download-task.entity.js +80 -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 +9 -2
- package/dist/fk-upload.controller.js +91 -32
- package/dist/fk-upload.module.js +35 -2
- package/dist/fk-v2.service.d.ts +29 -0
- package/dist/fk-v2.service.js +153 -0
- package/dist/fk.service.d.ts +14 -0
- package/dist/fk.service.js +66 -1
- package/dist/login.controller.d.ts +14 -0
- package/dist/login.controller.js +211 -0
- package/dist/main.js +3 -1
- 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 +6 -0
- package/dist/templates/add-fk-login.js +68 -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 +10 -0
- package/dist/templates/download-task.js +183 -0
- package/dist/templates/help.d.ts +7 -0
- package/dist/templates/help.js +88 -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 +78 -0
- package/dist/templates/upload-task.d.ts +10 -0
- package/dist/templates/upload-task.js +157 -0
- package/dist/templates/upload.d.ts +15 -0
- package/dist/templates/upload.js +245 -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 +12 -4
- package/pnpm-lock.yaml +1026 -0
- package/readme.md +11 -0
- 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/readme.md
ADDED
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)
|