zet-lib 1.4.22 → 1.4.24
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/lib/moduleLib.js +15 -2
- package/lib/zAppRouter.js +28 -5
- package/package.json +1 -1
package/lib/moduleLib.js
CHANGED
|
@@ -569,7 +569,8 @@ m.dropboxview = (req, res) => {
|
|
|
569
569
|
let head = ``;
|
|
570
570
|
let end = ``;
|
|
571
571
|
script +=
|
|
572
|
-
|
|
572
|
+
`let dropbox_image = {}
|
|
573
|
+
$(()=>{
|
|
573
574
|
$(".zdropbox-view").each(function (index, item) {
|
|
574
575
|
let dropboxLength = $(".zdropbox-view").length || 0;
|
|
575
576
|
ajaxPost('/zdropbox-file/' + index, {
|
|
@@ -577,6 +578,7 @@ m.dropboxview = (req, res) => {
|
|
|
577
578
|
table: $(this).attr('data-table'),
|
|
578
579
|
field: $(this).attr('data-field'),
|
|
579
580
|
}, function (result) {
|
|
581
|
+
dropbox_image[result.name] = result.link;
|
|
580
582
|
$(item).attr("src", result.link)
|
|
581
583
|
$(item).attr('data-link', result.link);
|
|
582
584
|
if (+result.index == (+dropboxLength - 1)) {
|
|
@@ -602,7 +604,18 @@ function modaldropbox() {
|
|
|
602
604
|
})
|
|
603
605
|
}
|
|
604
606
|
})
|
|
605
|
-
|
|
607
|
+
setTimeout(() => {
|
|
608
|
+
$("img").each(function(){
|
|
609
|
+
if($(this).attr("src") == "/img/dropbox.png") {
|
|
610
|
+
let name = $(this).attr("data-name");
|
|
611
|
+
if(dropbox_image[name]) {
|
|
612
|
+
$(this).attr("src",dropbox_image[name]);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
})
|
|
616
|
+
},3000)
|
|
617
|
+
}
|
|
618
|
+
` + newLine;
|
|
606
619
|
|
|
607
620
|
return {
|
|
608
621
|
head: head,
|
package/lib/zAppRouter.js
CHANGED
|
@@ -2080,11 +2080,34 @@ router.post("/zdropbox-file/:index", handleTokenRefresh, async (req, res) => {
|
|
|
2080
2080
|
});
|
|
2081
2081
|
link = response.result.link;
|
|
2082
2082
|
} catch (error) {
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2083
|
+
setTimeout(async () => {
|
|
2084
|
+
try {
|
|
2085
|
+
const response = await dbx.filesGetTemporaryLink({
|
|
2086
|
+
path: pathFile,
|
|
2087
|
+
});
|
|
2088
|
+
link = response.result.link;
|
|
2089
|
+
const mockFile = {
|
|
2090
|
+
name: metadata.result.name,
|
|
2091
|
+
id: metadata.result,
|
|
2092
|
+
path: metadata.result.path_display,
|
|
2093
|
+
link: link,
|
|
2094
|
+
isImage: metadata.result.name.match(/\.(jpg|jpeg|png|gif)$/i),
|
|
2095
|
+
size: metadata.result.size,
|
|
2096
|
+
modified: metadata.result.server_modified,
|
|
2097
|
+
accepted: true,
|
|
2098
|
+
index: req.params.index,
|
|
2099
|
+
};
|
|
2100
|
+
//console.log(mockFile)
|
|
2101
|
+
datas = mockFile;
|
|
2102
|
+
res.json(datas);
|
|
2103
|
+
} catch (e) {
|
|
2104
|
+
console.error("Error getting temporary link:", error);
|
|
2105
|
+
io.to(room).emit(
|
|
2106
|
+
"errormessage",
|
|
2107
|
+
`Please reload your browser, Error getting temporary link: ${error.message}`
|
|
2108
|
+
);
|
|
2109
|
+
}
|
|
2110
|
+
}, 2000);
|
|
2088
2111
|
}
|
|
2089
2112
|
const mockFile = {
|
|
2090
2113
|
name: metadata.result.name,
|