zet-lib 1.4.23 → 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.
Files changed (2) hide show
  1. package/lib/zAppRouter.js +28 -5
  2. package/package.json +1 -1
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
- console.error("Error getting temporary link:", error);
2084
- io.to(room).emit(
2085
- "errormessage",
2086
- `Error getting temporary link: ${error.message}`
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zet-lib",
3
- "version": "1.4.23",
3
+ "version": "1.4.24",
4
4
  "description": "zet is a library that part of zet generator.",
5
5
  "engines": {
6
6
  "node": ">=18"