@xuda.io/drive_module 1.1.1195 → 1.1.1197

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.
Files changed (2) hide show
  1. package/index.js +10 -19
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -615,7 +615,16 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
615
615
  const app_id_master = await _common.get_project_app_id(app_id, true);
616
616
  ref = app_id_master;
617
617
 
618
- doc.bucket[`${process.env.XUDA_HOSTNAME}`] = await upload_file_to_spaces(tempPath, app_id_master, drive_type, file_name);
618
+ const { data: app_obj } = await db_module.get_app_obj(app_id);
619
+ if (app_obj?.app_type === 'datacenter') {
620
+ const host = `root@${app_obj.app_hosting_server.ip}`;
621
+ await _utils.run_ssh_script(`scp ${tempPath} ${host}:/var/xuda/workspace_drive/${file_name}; `);
622
+ } else if (app_obj?.is_deployment) {
623
+ const host = `root@${app_obj.app_hosting_server.ip}`;
624
+ await _utils.run_ssh_script(`scp ${tempPath} ${host}:/var/xuda/workspace_drive/${file_name}; `);
625
+ } else {
626
+ doc.bucket[`${process.env.XUDA_HOSTNAME}`] = await upload_file_to_spaces(tempPath, app_id_master, drive_type, file_name);
627
+ }
619
628
 
620
629
  save_ret = await db_module.save_app_couch_doc(app_id_reference, doc);
621
630
  // misc_module.rsync_drive_resources_to_remote_servers('workspace', app_id_master);
@@ -1159,24 +1168,6 @@ exports.upload_drive_file = async function (req, job_id, headers, file_obj) {
1159
1168
  doc.app_id = app_id;
1160
1169
  doc.app_id_reference = ref;
1161
1170
 
1162
- /// check existing file
1163
- // if (check_exist) {
1164
- // const workspace_drive_res = await db_module.find_app_couch_query(
1165
- // app_id,
1166
- // {
1167
- // selector: { docType: "workspace_drive", originalname, stat: 3 },
1168
- // limit: 99,
1169
- // }
1170
- // );
1171
- // if (workspace_drive_res.docs.length) {
1172
- // return {
1173
- // code: -762,
1174
- // data: "file already exist",
1175
- // duplicates: workspace_drive_res.docs,
1176
- // };
1177
- // }
1178
- // }
1179
- debugger;
1180
1171
  // if file uploaded from deployment or from datacenter then save to the datacenter server fs
1181
1172
  const { data: app_obj } = await db_module.get_app_obj(app_id);
1182
1173
  if (app_obj?.app_type === 'datacenter') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.1195",
3
+ "version": "1.1.1197",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {