@xuda.io/drive_module 1.1.532 → 1.1.533
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 +11 -73
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const module_path =
|
|
|
17
17
|
(!_conf.is_debug ? "/node_modules/@xuda.io" : "");
|
|
18
18
|
const fs_module = require(`${module_path}/fs_module`);
|
|
19
19
|
const db_module = require(`${module_path}/db_module`);
|
|
20
|
-
|
|
20
|
+
const misc_module = require(`${module_path}/misc_module`);
|
|
21
21
|
////////////////////////////////////////////
|
|
22
22
|
|
|
23
23
|
const rimraf = require("rimraf");
|
|
@@ -500,7 +500,7 @@ exports.delete_drive_files = async function (req) {
|
|
|
500
500
|
doc_ret.data
|
|
501
501
|
);
|
|
502
502
|
}
|
|
503
|
-
|
|
503
|
+
|
|
504
504
|
misc_module.rsync_drive_resources_to_remote_servers(
|
|
505
505
|
"studio",
|
|
506
506
|
app_id_master
|
|
@@ -542,7 +542,6 @@ exports.delete_drive_files = async function (req) {
|
|
|
542
542
|
doc_ret.data
|
|
543
543
|
);
|
|
544
544
|
|
|
545
|
-
const misc_module = require(`${module_path}/misc_module`);
|
|
546
545
|
misc_module.rsync_drive_resources_to_remote_servers(
|
|
547
546
|
"workspace",
|
|
548
547
|
app_id_reference
|
|
@@ -574,7 +573,6 @@ exports.delete_drive_files = async function (req) {
|
|
|
574
573
|
doc_ret.data.stat = 4;
|
|
575
574
|
save_ret = await db_module.save_couch_doc("xuda_drive", doc_ret.data);
|
|
576
575
|
|
|
577
|
-
const misc_module = require(`${module_path}/misc_module`);
|
|
578
576
|
misc_module.rsync_drive_resources_to_remote_servers(
|
|
579
577
|
"user",
|
|
580
578
|
doc_ret.data.uid
|
|
@@ -586,75 +584,6 @@ exports.delete_drive_files = async function (req) {
|
|
|
586
584
|
}
|
|
587
585
|
}
|
|
588
586
|
|
|
589
|
-
////////////////////////////////////
|
|
590
|
-
// const app_id_master = await _common.get_project_app_id(req.app_id, true);
|
|
591
|
-
|
|
592
|
-
// if (drive_type === "studio" || drive_type === "workspace") {
|
|
593
|
-
// const app_id_reference = await _common.get_project_app_id(app_id);
|
|
594
|
-
// req.files_arr.forEach(function (file) {
|
|
595
|
-
// if (!file.path.includes(app_id_reference)) {
|
|
596
|
-
// throw new Error("error - file path unauthorized");
|
|
597
|
-
// }
|
|
598
|
-
// });
|
|
599
|
-
// }
|
|
600
|
-
// for await (const file of files_arr) {
|
|
601
|
-
// // const ret = rimraf.sync(file.path); // delete the file
|
|
602
|
-
|
|
603
|
-
// // var doc_ret;
|
|
604
|
-
|
|
605
|
-
// // switch (drive_type) {
|
|
606
|
-
// // case "workspace":
|
|
607
|
-
// // case "studio":
|
|
608
|
-
// // const app_id_reference = await _common.get_project_app_id(app_id);
|
|
609
|
-
// // doc_ret = await db_module.get_app_couch_doc(
|
|
610
|
-
// // app_id_reference,
|
|
611
|
-
// // req.drive_type === "studio" ? file.path : file.name
|
|
612
|
-
// // );
|
|
613
|
-
// // break;
|
|
614
|
-
|
|
615
|
-
// // case "user":
|
|
616
|
-
// // doc_ret = await db_module.get_couch_doc("xuda_drive", file.name);
|
|
617
|
-
// // break;
|
|
618
|
-
|
|
619
|
-
// // default:
|
|
620
|
-
// // break;
|
|
621
|
-
// // }
|
|
622
|
-
|
|
623
|
-
// // if (doc_ret.code > -1) {
|
|
624
|
-
// // throw new Error(`error - file ${file.name} ${doc_ret.data}`);
|
|
625
|
-
// // }
|
|
626
|
-
// if (doc_ret.code > -1) {
|
|
627
|
-
// var doc = doc_ret.data;
|
|
628
|
-
|
|
629
|
-
// doc.ts = Date.now();
|
|
630
|
-
// doc.stat = 4;
|
|
631
|
-
|
|
632
|
-
// var save_ret;
|
|
633
|
-
|
|
634
|
-
// switch (drive_type) {
|
|
635
|
-
// case "workspace":
|
|
636
|
-
// case "studio":
|
|
637
|
-
// const app_id_reference = await _common.get_project_app_id(app_id);
|
|
638
|
-
// save_ret = await db_module.save_app_couch_doc(
|
|
639
|
-
// app_id_reference,
|
|
640
|
-
// doc
|
|
641
|
-
// );
|
|
642
|
-
// break;
|
|
643
|
-
|
|
644
|
-
// case "user":
|
|
645
|
-
// save_ret = await db_module.save_couch_doc("xuda_drive", doc);
|
|
646
|
-
// break;
|
|
647
|
-
|
|
648
|
-
// default:
|
|
649
|
-
// break;
|
|
650
|
-
// }
|
|
651
|
-
|
|
652
|
-
// if (save_ret.code < 0) {
|
|
653
|
-
// throw new Error(save_ret.data);
|
|
654
|
-
// }
|
|
655
|
-
// }
|
|
656
|
-
// }
|
|
657
|
-
|
|
658
587
|
return {
|
|
659
588
|
code: 200,
|
|
660
589
|
data: req.files_arr,
|
|
@@ -726,6 +655,11 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
726
655
|
case "studio": {
|
|
727
656
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
728
657
|
save_ret = await db_module.save_app_couch_doc(app_id_reference, doc);
|
|
658
|
+
|
|
659
|
+
misc_module.rsync_drive_resources_to_remote_servers(
|
|
660
|
+
"studio",
|
|
661
|
+
app_id_reference
|
|
662
|
+
);
|
|
729
663
|
break;
|
|
730
664
|
}
|
|
731
665
|
case "workspace": {
|
|
@@ -740,6 +674,10 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
740
674
|
);
|
|
741
675
|
|
|
742
676
|
save_ret = await db_module.save_app_couch_doc(app_id_reference, doc);
|
|
677
|
+
misc_module.rsync_drive_resources_to_remote_servers(
|
|
678
|
+
"workspace",
|
|
679
|
+
app_id_reference
|
|
680
|
+
);
|
|
743
681
|
break;
|
|
744
682
|
}
|
|
745
683
|
case "user": {
|