@nger/fk-upload 1.0.23 → 1.0.26
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.
@@ -167,21 +167,20 @@ 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',
|
173
|
-
|
174
|
-
formdata.append(
|
175
|
-
formdata.append(`
|
176
|
-
formdata.append(
|
177
|
-
formdata.append('
|
178
|
-
formdata.append('
|
179
|
-
formdata.append(
|
180
|
-
formdata.append(`complete`, `${task.complete}`);
|
170
|
+
formdata.append('isFreeVer', this.encodeURIComponent(false));
|
171
|
+
formdata.append('aid', this.encodeURIComponent(task.aid));
|
172
|
+
formdata.append('folderId', this.encodeURIComponent(task.folderId));
|
173
|
+
formdata.append('fileName', this.encodeURIComponent(task.filename));
|
174
|
+
formdata.append(`totalSize`, this.encodeURIComponent(task.total));
|
175
|
+
formdata.append(`fileMd5`, this.encodeURIComponent(task.fileMd5));
|
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));
|
181
180
|
const bssInfo = {
|
182
181
|
fromSite: true, siteId: 0, groupId: 0, fileSizeLimit: 1024
|
183
182
|
};
|
184
|
-
formdata.append('bssInfo',
|
183
|
+
formdata.append('bssInfo', this.encodeURIComponent(bssInfo));
|
185
184
|
const headers = formdata.getHeaders();
|
186
185
|
const uploadResult = await axios_1.default.post(task.uploadUrl, formdata, {
|
187
186
|
headers: {
|
@@ -204,8 +203,20 @@ let TaskService = class TaskService {
|
|
204
203
|
// fullDownUrl
|
205
204
|
const downUrl = data.fullDownUrl;
|
206
205
|
if (downUrl) {
|
207
|
-
const fullUrl = downUrl.startsWith('http') ? downUrl : `https
|
208
|
-
console.log(
|
206
|
+
const fullUrl = downUrl.startsWith('http') ? downUrl : `https:` + downUrl;
|
207
|
+
console.log({ data, task });
|
208
|
+
axios_1.default.post(`https://smr00.vip.webportal.top/ajax/advanceUpload.jsp?cmd=_report&_TOKEN=${task.token}`, this.encodeURIComponent({
|
209
|
+
type: 1,
|
210
|
+
size: task.total,
|
211
|
+
time: NaN,
|
212
|
+
flag: true,
|
213
|
+
name: task.filename
|
214
|
+
}), {
|
215
|
+
headers: {
|
216
|
+
[`Content-Type`]: `application/x-www-form-urlencoded; charset=UTF-8`,
|
217
|
+
Cookie: task.cookies
|
218
|
+
}
|
219
|
+
});
|
209
220
|
this.redis.del(task.filename);
|
210
221
|
this.ws.send({
|
211
222
|
action: `@nger/fk-upload/uploading`,
|
@@ -299,6 +310,9 @@ let TaskService = class TaskService {
|
|
299
310
|
return `https://${token.url}/${token.visitType}/${token.app}/advance/info?cmd=${token.cmd}&token=${token.token}`;
|
300
311
|
}
|
301
312
|
encodeURIComponent(data) {
|
313
|
+
if ((0, core_1.isPrimitive)(data)) {
|
314
|
+
return encodeURIComponent(data);
|
315
|
+
}
|
302
316
|
return Object.keys(data).map(key => {
|
303
317
|
const value = Reflect.get(data, key);
|
304
318
|
return `${key}=${encodeURIComponent(value)}`;
|
@@ -332,7 +346,7 @@ let TaskService = class TaskService {
|
|
332
346
|
}
|
333
347
|
if (token.length > 0) {
|
334
348
|
// 01
|
335
|
-
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}`;
|
336
350
|
const accessKey = await axios_1.default.get(url).then(res => res.data);
|
337
351
|
if (accessKey.success) {
|
338
352
|
const accessTokenString = decode(accessKey.accessKey);
|
@@ -381,7 +395,8 @@ let TaskService = class TaskService {
|
|
381
395
|
totalChunks: totalChunks,
|
382
396
|
splitSize,
|
383
397
|
complete,
|
384
|
-
topicId: task.topicId
|
398
|
+
topicId: task.topicId,
|
399
|
+
token: token
|
385
400
|
});
|
386
401
|
index = index + 1;
|
387
402
|
start = endSize;
|