@xuda.io/drive_module 1.1.1050 → 1.1.1052
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/index.js +1 -83
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -346,12 +346,6 @@ exports.get_drive_files = async function (req) {
|
|
|
346
346
|
""
|
|
347
347
|
);
|
|
348
348
|
|
|
349
|
-
// if (type === "studio" || type === "user") {
|
|
350
|
-
// return `https://${process.env.XUDA_HOSTNAME}/${drive_type}-drive/${ref}/${file_path}`;
|
|
351
|
-
// } else {
|
|
352
|
-
// return `https://${process.env.XUDA_HOSTNAME}/${drive_type}-drive/${file_path}`;
|
|
353
|
-
// }
|
|
354
|
-
|
|
355
349
|
return `https://${process.env.XUDA_HOSTNAME}/studio-drive/${app_id_master}/${file_path}`;
|
|
356
350
|
};
|
|
357
351
|
|
|
@@ -427,19 +421,11 @@ exports.get_drive_files = async function (req) {
|
|
|
427
421
|
.slice(from, to + 1);
|
|
428
422
|
}
|
|
429
423
|
await drill(tree.children);
|
|
430
|
-
// tree.path = get_studio_path(tree.path, app_id_master, tree?.name || "");
|
|
431
|
-
// tree.file_path = path.join(tree.path, tree.name);
|
|
432
424
|
} else {
|
|
433
425
|
tree = {
|
|
434
426
|
children: [],
|
|
435
427
|
name: tree?.name,
|
|
436
428
|
size: 0,
|
|
437
|
-
// path: get_studio_path(directoryPath, app_id_master, tree?.name || ""), // directoryPath,
|
|
438
|
-
// file_path: get_studio_path(
|
|
439
|
-
// directoryPath,
|
|
440
|
-
// app_id_master,
|
|
441
|
-
// tree?.name || ""
|
|
442
|
-
// ),
|
|
443
429
|
};
|
|
444
430
|
}
|
|
445
431
|
|
|
@@ -822,67 +808,6 @@ exports.create_drive_folder = async function (req, job_id, headers) {
|
|
|
822
808
|
code: 200,
|
|
823
809
|
data: target_dir,
|
|
824
810
|
};
|
|
825
|
-
|
|
826
|
-
// if (!(await file_exists(target_dir))) {
|
|
827
|
-
// try {
|
|
828
|
-
// await create_directory(target_dir, 0o775, true);
|
|
829
|
-
|
|
830
|
-
// // const job_info = await db_module.get_job_info(job_id);
|
|
831
|
-
// var doc = {
|
|
832
|
-
// _id: folder_id,
|
|
833
|
-
|
|
834
|
-
// docType: `${drive_type}_drive`,
|
|
835
|
-
// stat: 3,
|
|
836
|
-
// folder_name,
|
|
837
|
-
// uid,
|
|
838
|
-
// date_created: Date.now(),
|
|
839
|
-
// ip: headers?.["cf-connecting-ip"],
|
|
840
|
-
// country: headers?.["cf-ipcountry"],
|
|
841
|
-
// is_folder: true,
|
|
842
|
-
// type: "directory",
|
|
843
|
-
// file_path: req.path,
|
|
844
|
-
// };
|
|
845
|
-
// if (drive_type === "studio" || drive_type === "workspace") {
|
|
846
|
-
// doc.app_id = await _common.get_project_app_id(app_id);
|
|
847
|
-
// doc.app_id_reference = await _common.get_project_app_id(app_id, true);
|
|
848
|
-
// }
|
|
849
|
-
|
|
850
|
-
// let save_ret;
|
|
851
|
-
|
|
852
|
-
// switch (drive_type) {
|
|
853
|
-
// case "workspace":
|
|
854
|
-
// case "studio":
|
|
855
|
-
// const app_id_reference = await _common.get_project_app_id(app_id);
|
|
856
|
-
// save_ret = await db_module.save_app_couch_doc(
|
|
857
|
-
// app_id_reference,
|
|
858
|
-
// doc
|
|
859
|
-
// );
|
|
860
|
-
// break;
|
|
861
|
-
|
|
862
|
-
// case "user":
|
|
863
|
-
// save_ret = await db_module.save_couch_doc("xuda_drive", doc);
|
|
864
|
-
// break;
|
|
865
|
-
|
|
866
|
-
// default:
|
|
867
|
-
// break;
|
|
868
|
-
// }
|
|
869
|
-
|
|
870
|
-
// if (save_ret.code < 0) {
|
|
871
|
-
// return save_ret;
|
|
872
|
-
// }
|
|
873
|
-
// } catch (err) {
|
|
874
|
-
// return { code: -1, data: err.message };
|
|
875
|
-
// }
|
|
876
|
-
|
|
877
|
-
// return {
|
|
878
|
-
// code: 200,
|
|
879
|
-
// data: target_dir,
|
|
880
|
-
// };
|
|
881
|
-
// }
|
|
882
|
-
// return {
|
|
883
|
-
// code: -200,
|
|
884
|
-
// data: target_dir + " folder exist",
|
|
885
|
-
// };
|
|
886
811
|
} catch (err) {
|
|
887
812
|
return {
|
|
888
813
|
code: -200,
|
|
@@ -1326,15 +1251,8 @@ exports.upload_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
1326
1251
|
ref = await _common.get_project_app_id(req.app_id, true);
|
|
1327
1252
|
const target_dir = path.join(_conf[`studio_drive_path`], ref);
|
|
1328
1253
|
file_name = path.join(req.path, file_obj.originalname);
|
|
1329
|
-
|
|
1330
|
-
// req.path.replace(target_dir, ""),
|
|
1331
|
-
// file_obj.originalname
|
|
1332
|
-
// );
|
|
1254
|
+
|
|
1333
1255
|
target_file = path.join(target_dir, file_name);
|
|
1334
|
-
// target_file = path.join(
|
|
1335
|
-
// req.path !== "/" ? req.path : target_dir,
|
|
1336
|
-
// originalname
|
|
1337
|
-
// );
|
|
1338
1256
|
|
|
1339
1257
|
if (!(await fs_module.file_exists(target_dir))) {
|
|
1340
1258
|
await fs_module.mkdir(target_dir, 0o775, true);
|