@nger/fk-upload 1.0.24 → 1.0.27
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/templates/task.service.js +15 -12
- package/package.json +1 -1
@@ -70,14 +70,14 @@ let TaskService = class TaskService {
|
|
70
70
|
async createDownLoadTask(url, fkLoginId, topicId) {
|
71
71
|
const hash = await (0, multihashing_async_1.default)(Buffer.from(url), 'sha1', 16);
|
72
72
|
const cid = new cids_1.default(1, 'raw', hash, 'base64');
|
73
|
-
const filename = cid.toString('base64');
|
73
|
+
const filename = encodeURIComponent(cid.toString('base64'));
|
74
74
|
const _url = new URL(url);
|
75
75
|
const filePath = _url.pathname;
|
76
76
|
const ext = (0, path_1.extname)(filePath);
|
77
77
|
const task = new entities_1.FkDownloadTaskEntity();
|
78
78
|
const root = this.injector.get(core_1.APP_ROOT);
|
79
79
|
(0, fs_extra_1.ensureDirSync)((0, path_1.join)(root, 'attachments/fk-upload'));
|
80
|
-
const path = (0, path_1.join)(root, 'attachments/fk-upload',
|
80
|
+
const path = (0, path_1.join)(root, 'attachments/fk-upload', filename + ext);
|
81
81
|
task.filename = filename + ext;
|
82
82
|
task.url = url;
|
83
83
|
task.loginId = fkLoginId;
|
@@ -167,16 +167,16 @@ let TaskService = class TaskService {
|
|
167
167
|
const fileStream = (0, fs_extra_1.createReadStream)(task.path, { start: task.start, end: task.end });
|
168
168
|
const formdata = new form_data_1.default();
|
169
169
|
formdata.append('ctrl', fileStream);
|
170
|
-
formdata.append('isFreeVer',
|
171
|
-
formdata.append('aid',
|
172
|
-
formdata.append('folderId',
|
170
|
+
formdata.append('isFreeVer', this.encodeURIComponent(false));
|
171
|
+
formdata.append('aid', this.encodeURIComponent(task.aid));
|
172
|
+
formdata.append('folderId', this.encodeURIComponent(task.folderId));
|
173
173
|
formdata.append('fileName', task.filename);
|
174
|
-
formdata.append(`totalSize`,
|
174
|
+
formdata.append(`totalSize`, this.encodeURIComponent(task.total));
|
175
175
|
formdata.append(`fileMd5`, task.fileMd5);
|
176
|
-
formdata.append('index',
|
177
|
-
formdata.append('chunkSize',
|
178
|
-
formdata.append('totalChunks',
|
179
|
-
formdata.append(`complete`,
|
176
|
+
formdata.append('index', this.encodeURIComponent(task.index));
|
177
|
+
formdata.append('chunkSize', this.encodeURIComponent(task.splitSize));
|
178
|
+
formdata.append('totalChunks', this.encodeURIComponent(task.totalChunks));
|
179
|
+
formdata.append(`complete`, this.encodeURIComponent(task.complete));
|
180
180
|
const bssInfo = {
|
181
181
|
fromSite: true, siteId: 0, groupId: 0, fileSizeLimit: 1024
|
182
182
|
};
|
@@ -204,7 +204,7 @@ let TaskService = class TaskService {
|
|
204
204
|
const downUrl = data.fullDownUrl;
|
205
205
|
if (downUrl) {
|
206
206
|
const fullUrl = downUrl.startsWith('http') ? downUrl : `https:` + downUrl;
|
207
|
-
console.log(data);
|
207
|
+
console.log({ data, task });
|
208
208
|
axios_1.default.post(`https://smr00.vip.webportal.top/ajax/advanceUpload.jsp?cmd=_report&_TOKEN=${task.token}`, this.encodeURIComponent({
|
209
209
|
type: 1,
|
210
210
|
size: task.total,
|
@@ -310,6 +310,9 @@ let TaskService = class TaskService {
|
|
310
310
|
return `https://${token.url}/${token.visitType}/${token.app}/advance/info?cmd=${token.cmd}&token=${token.token}`;
|
311
311
|
}
|
312
312
|
encodeURIComponent(data) {
|
313
|
+
if ((0, core_1.isPrimitive)(data)) {
|
314
|
+
return encodeURIComponent(data);
|
315
|
+
}
|
313
316
|
return Object.keys(data).map(key => {
|
314
317
|
const value = Reflect.get(data, key);
|
315
318
|
return `${key}=${encodeURIComponent(value)}`;
|
@@ -343,7 +346,7 @@ let TaskService = class TaskService {
|
|
343
346
|
}
|
344
347
|
if (token.length > 0) {
|
345
348
|
// 01
|
346
|
-
const url = `https://smr00.vip.webportal.top/cn/api/manage/advanceUpload/genAccessKey?_v
|
349
|
+
const url = `https://smr00.vip.webportal.top/cn/api/manage/advanceUpload/genAccessKey?_v=${new Date().getTime()}&_TOKEN=${token}`;
|
347
350
|
const accessKey = await axios_1.default.get(url).then(res => res.data);
|
348
351
|
if (accessKey.success) {
|
349
352
|
const accessTokenString = decode(accessKey.accessKey);
|