@nger/fk-upload 1.0.198 → 1.0.202
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.
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
import { Config } from '@nger/core';
|
|
3
3
|
import { Db } from '@nger/typeorm';
|
|
4
4
|
import { Context } from 'koa';
|
|
5
|
-
import { BrowserWindow } from 'electron';
|
|
6
5
|
import { W7DataSource } from '@nger/w7';
|
|
7
6
|
export declare class TaskManageController {
|
|
8
7
|
private db;
|
|
9
8
|
private config;
|
|
10
|
-
private win;
|
|
11
9
|
private w7;
|
|
12
|
-
constructor(db: Db, config: Config,
|
|
10
|
+
constructor(db: Db, config: Config, w7: W7DataSource);
|
|
13
11
|
toUrl(query: any): string;
|
|
14
12
|
createPages(total: number, query: any, page: number): {
|
|
15
13
|
index: number;
|
|
@@ -24,17 +24,15 @@ function getStatusTitle(status) {
|
|
|
24
24
|
return '未知';
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
// import { BrowserWindow } from 'electron'
|
|
28
28
|
const w7_1 = require("@nger/w7");
|
|
29
29
|
let TaskManageController = class TaskManageController {
|
|
30
30
|
db;
|
|
31
31
|
config;
|
|
32
|
-
win;
|
|
33
32
|
w7;
|
|
34
|
-
constructor(db, config,
|
|
33
|
+
constructor(db, config, w7) {
|
|
35
34
|
this.db = db;
|
|
36
35
|
this.config = config;
|
|
37
|
-
this.win = win;
|
|
38
36
|
this.w7 = w7;
|
|
39
37
|
}
|
|
40
38
|
toUrl(query) {
|
|
@@ -249,13 +247,12 @@ let TaskManageController = class TaskManageController {
|
|
|
249
247
|
react_1.default.createElement("script", { src: "/@nger/fk-upload/static/task-manage.js?t=" + new Date().getTime() }));
|
|
250
248
|
}
|
|
251
249
|
downloadFile(url, back, ctx) {
|
|
252
|
-
if (this.win) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
250
|
+
// if (this.win) {
|
|
251
|
+
// this.win.webContents.downloadURL(url)
|
|
252
|
+
// ctx.redirect(back)
|
|
253
|
+
// } else {
|
|
254
|
+
// }
|
|
255
|
+
ctx.redirect(url);
|
|
259
256
|
}
|
|
260
257
|
staticTaskManage(ctx) {
|
|
261
258
|
try {
|
|
@@ -312,6 +309,6 @@ tslib_1.__decorate([
|
|
|
312
309
|
], TaskManageController.prototype, "finishTask", null);
|
|
313
310
|
TaskManageController = tslib_1.__decorate([
|
|
314
311
|
(0, core_1.Controller)(`@nger/fk-upload`),
|
|
315
|
-
tslib_1.__metadata("design:paramtypes", [typeorm_1.Db, core_1.Config,
|
|
312
|
+
tslib_1.__metadata("design:paramtypes", [typeorm_1.Db, core_1.Config, w7_1.W7DataSource])
|
|
316
313
|
], TaskManageController);
|
|
317
314
|
exports.TaskManageController = TaskManageController;
|
|
@@ -59,7 +59,7 @@ class EffectTask extends rabbitmq_1.Task {
|
|
|
59
59
|
await (0, fs_extra_1.unlink)(filePath);
|
|
60
60
|
}
|
|
61
61
|
catch (e) { }
|
|
62
|
-
await w7.manager.update(w7_1.W7ChatTopicEntity, task.topicId, { topicStyle: 7, thirdUrl: item.url, foreverUrl:
|
|
62
|
+
await w7.manager.update(w7_1.W7ChatTopicEntity, task.topicId, { topicStyle: 7, thirdUrl: item.url, foreverUrl: uploadUrl });
|
|
63
63
|
await complete();
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
@@ -103,12 +103,14 @@ let FkService = class FkService {
|
|
|
103
103
|
}
|
|
104
104
|
async startUploadFile(task) {
|
|
105
105
|
const info = await this.getUploadInfo(task.loginId, task.filename, task.fileMd5, task.total);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
106
|
+
if (info) {
|
|
107
|
+
task.cookies = info.cookies;
|
|
108
|
+
task.splitSize = info.splitSize;
|
|
109
|
+
task.start = info.uploadedSize;
|
|
110
|
+
task.uploadUrl = info.uploadUrl;
|
|
111
|
+
task.index = Math.ceil(info.uploadedSize / info.splitSize);
|
|
112
|
+
return await this.uploadFile(task);
|
|
113
|
+
}
|
|
112
114
|
}
|
|
113
115
|
async getSize(url) {
|
|
114
116
|
const size = (0, core_1.defer)();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nger/fk-upload",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.202",
|
|
4
4
|
"description": "nger fk upload",
|
|
5
5
|
"main": "dist/electon.js",
|
|
6
6
|
"types": "dist/core.d.ts",
|
|
@@ -39,15 +39,9 @@
|
|
|
39
39
|
"react": "^18.1.0",
|
|
40
40
|
"request": "^2.88.2"
|
|
41
41
|
},
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"electron": "^18.2.3"
|
|
44
|
-
},
|
|
45
42
|
"scripts": {
|
|
46
43
|
"tsc": "tsc",
|
|
47
|
-
"tsc:build": "tsc"
|
|
48
|
-
"electron": "electron .",
|
|
49
|
-
"pack": "electron-builder --dir",
|
|
50
|
-
"dist": "electron-builder --win --ia32"
|
|
44
|
+
"tsc:build": "tsc"
|
|
51
45
|
},
|
|
52
46
|
"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"
|
|
53
47
|
}
|