@xuda.io/drive_module 1.1.1117 → 1.1.1118
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 +13 -18
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -217,9 +217,8 @@ exports.get_drive_files = async function (req) {
|
|
|
217
217
|
size: formatBytes(doc.size),
|
|
218
218
|
extension: doc?.file_ext?.substr(1),
|
|
219
219
|
type: doc.type,
|
|
220
|
-
access_link: `https://${domain}/${drive_type}-drive/${
|
|
221
|
-
|
|
222
|
-
}/${doc._id}`,
|
|
220
|
+
access_link: `https://${domain}/${drive_type}-drive/${datasource_id || app_id
|
|
221
|
+
}/${doc._id}`,
|
|
223
222
|
is_archive: doc.is_archive,
|
|
224
223
|
public: doc.public,
|
|
225
224
|
path: doc.file_path,
|
|
@@ -653,7 +652,7 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
653
652
|
);
|
|
654
653
|
try {
|
|
655
654
|
fse.unlinkSync(target_dir);
|
|
656
|
-
} catch (error) {}
|
|
655
|
+
} catch (error) { }
|
|
657
656
|
|
|
658
657
|
fse.copyFileSync(tempPath, target_dir);
|
|
659
658
|
}
|
|
@@ -716,11 +715,9 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
716
715
|
if (save_ret.code < 0) {
|
|
717
716
|
return save_ret;
|
|
718
717
|
}
|
|
719
|
-
const server_file_name = `https://${
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
drive_type === "studio" ? `/${master_id}/${target_file}` : file_name
|
|
723
|
-
}`;
|
|
718
|
+
const server_file_name = `https://${process.env.XUDA_HOSTNAME
|
|
719
|
+
}/${drive_type}-drive${drive_type === "studio" ? `/${master_id}/${target_file}` : file_name
|
|
720
|
+
}`;
|
|
724
721
|
|
|
725
722
|
misc_module.purge_cloudflare_cache(false, server_file_name);
|
|
726
723
|
return {
|
|
@@ -1108,7 +1105,7 @@ exports.extract_drive_file = async function (req, job_id, headers) {
|
|
|
1108
1105
|
|
|
1109
1106
|
try {
|
|
1110
1107
|
await db_module.save_app_couch_doc(app_id_reference, file_doc);
|
|
1111
|
-
} catch (error) {}
|
|
1108
|
+
} catch (error) { }
|
|
1112
1109
|
})
|
|
1113
1110
|
.on("close", () => {
|
|
1114
1111
|
console.log("Extraction complete.");
|
|
@@ -1182,7 +1179,7 @@ exports.upload_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
1182
1179
|
let tags_arr = [];
|
|
1183
1180
|
try {
|
|
1184
1181
|
if (tags) tags_arr = tags.split(",");
|
|
1185
|
-
} catch (error) {}
|
|
1182
|
+
} catch (error) { }
|
|
1186
1183
|
|
|
1187
1184
|
var doc = {
|
|
1188
1185
|
docType: `${drive_type}_drive`,
|
|
@@ -1870,7 +1867,7 @@ const get_file_info = async function (file_path) {
|
|
|
1870
1867
|
const sizeOf = require("image-size");
|
|
1871
1868
|
const dimensions = sizeOf(file_path);
|
|
1872
1869
|
doc.dimensions = `${dimensions.width}x${dimensions.height}`;
|
|
1873
|
-
} catch (error) {}
|
|
1870
|
+
} catch (error) { }
|
|
1874
1871
|
return doc;
|
|
1875
1872
|
};
|
|
1876
1873
|
|
|
@@ -1957,11 +1954,9 @@ exports.update_drive_file_tags = async function (req, job_id, headers) {
|
|
|
1957
1954
|
};
|
|
1958
1955
|
|
|
1959
1956
|
const get_file_url = function (drive_type, file_name, ref) {
|
|
1960
|
-
let file_url = `https://${
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
file_name?.substr(0, 1) !== "/" ? "/" : ""
|
|
1964
|
-
}${file_name}`;
|
|
1957
|
+
let file_url = `https://${process.env.XUDA_HOSTNAME
|
|
1958
|
+
}/${drive_type}-drive/${ref}${file_name?.substr(0, 1) !== "/" ? "/" : ""
|
|
1959
|
+
}${file_name}`;
|
|
1965
1960
|
// if (["workspace"].includes(drive_type)) {
|
|
1966
1961
|
// file_url = `https://${process.env.XUDA_HOSTNAME}/workspace-drive${
|
|
1967
1962
|
// file_name.substr(0, 1) !== "/" ? "/" : ""
|
|
@@ -2153,7 +2148,7 @@ exports.compile_javascript_program_in_studio_drive = async function (
|
|
|
2153
2148
|
const wrappedCode = [
|
|
2154
2149
|
...importLines,
|
|
2155
2150
|
"",
|
|
2156
|
-
"export default async function (xu, SESSION_ID, SESSION_OBJ, job_id) {",
|
|
2151
|
+
"export default async function (params,xu, SESSION_ID, SESSION_OBJ, job_id) {",
|
|
2157
2152
|
...codeLines.map((line) => ` ${line}`), // Indent the code inside the function
|
|
2158
2153
|
"}",
|
|
2159
2154
|
];
|