@xuda.io/drive_module 1.1.1132 → 1.1.1134
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 +9 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -177,7 +177,7 @@ exports.get_drive_files = async function (req) {
|
|
|
177
177
|
else return (bytes / 1073741824).toFixed(2) + ' GB';
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
const fetch_drive_files = async function (ret, file_doc, app_id_reference, uid, datasource_id, domain = process.env.XUDA_HOSTNAME) {
|
|
180
|
+
const fetch_drive_files = async function (ret, file_doc, app_id_reference, uid, datasource_id, domain = process.env.XUDA_HOSTNAME, app_obj) {
|
|
181
181
|
let files = {
|
|
182
182
|
path: req.path || '/',
|
|
183
183
|
name: file_doc.data.folder_name || '/',
|
|
@@ -188,6 +188,12 @@ exports.get_drive_files = async function (req) {
|
|
|
188
188
|
|
|
189
189
|
for await (let doc of ret.docs) {
|
|
190
190
|
if (doc.type === 'file') {
|
|
191
|
+
let ts = '';
|
|
192
|
+
if (doc.date_modified && Date.now() - doc.date_modified < 4320 * 1000) {
|
|
193
|
+
ts = '?ts=' + Date.now();
|
|
194
|
+
} else if (app_obj.app_build_id) {
|
|
195
|
+
}
|
|
196
|
+
|
|
191
197
|
try {
|
|
192
198
|
files.sizeInBytes += doc.size;
|
|
193
199
|
files.children.push({
|
|
@@ -196,7 +202,7 @@ exports.get_drive_files = async function (req) {
|
|
|
196
202
|
size: formatBytes(doc.size),
|
|
197
203
|
extension: doc?.file_ext?.substr(1),
|
|
198
204
|
type: doc.type,
|
|
199
|
-
access_link: `https://${domain}/${drive_type}-drive/${datasource_id || app_id}/${doc._id}`,
|
|
205
|
+
access_link: `https://${domain}/${drive_type}-drive/${datasource_id || app_id}/${doc._id}${ts}`,
|
|
200
206
|
is_archive: doc.is_archive,
|
|
201
207
|
public: doc.public,
|
|
202
208
|
path: doc.file_path,
|
|
@@ -245,7 +251,7 @@ exports.get_drive_files = async function (req) {
|
|
|
245
251
|
|
|
246
252
|
return {
|
|
247
253
|
code: 1,
|
|
248
|
-
data: await fetch_drive_files(ret, file_doc, app_id_reference, null, app_obj.app_datacenter_id, app_obj.is_deployment ? app_obj.app_access_url : undefined),
|
|
254
|
+
data: await fetch_drive_files(ret, file_doc, app_id_reference, null, app_obj.app_datacenter_id, app_obj.is_deployment ? app_obj.app_access_url : undefined, app_obj),
|
|
249
255
|
};
|
|
250
256
|
};
|
|
251
257
|
const get_user_files = async function () {
|