@xuda.io/xuda-widget-plugin-xuda-drive 1.0.4 → 1.0.6
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/package.json +1 -1
- package/runtime.mjs +6 -21
package/package.json
CHANGED
package/runtime.mjs
CHANGED
|
@@ -506,6 +506,8 @@ export async function upload(fields, e) {
|
|
|
506
506
|
}
|
|
507
507
|
|
|
508
508
|
export async function viewer(fields, e) {
|
|
509
|
+
const { app_id, gtp_token, app_token } = SESSION_OBJ[e.SESSION_ID];
|
|
510
|
+
|
|
509
511
|
await func.utils.load_js_on_demand(
|
|
510
512
|
"https://cdn.tailwindcss.com?plugins=forms"
|
|
511
513
|
);
|
|
@@ -557,38 +559,21 @@ export async function viewer(fields, e) {
|
|
|
557
559
|
|
|
558
560
|
e.$containerP.html(html);
|
|
559
561
|
|
|
560
|
-
|
|
561
|
-
// 100 seconds
|
|
562
|
-
const controller = new AbortController();
|
|
563
|
-
const { signal } = controller;
|
|
564
|
-
|
|
565
|
-
const timeoutPromise = new Promise((_, reject) =>
|
|
566
|
-
setTimeout(() => {
|
|
567
|
-
controller.abort();
|
|
568
|
-
reject(new Error("Request timed out"));
|
|
569
|
-
}, timeout)
|
|
570
|
-
);
|
|
571
|
-
|
|
572
|
-
const fetchPromise = fetch(url, { ...options, signal });
|
|
573
|
-
|
|
574
|
-
return Promise.race([fetchPromise, timeoutPromise]);
|
|
575
|
-
};
|
|
576
|
-
|
|
577
|
-
let opt = {};
|
|
562
|
+
let opt = { app_id };
|
|
578
563
|
|
|
579
564
|
try {
|
|
580
565
|
let domain =
|
|
581
566
|
e._session.engine_mode === "live_preview" ? `dev.xuda.io` : `xuda.io`;
|
|
582
567
|
|
|
583
|
-
const response = await
|
|
568
|
+
const response = await fetch(
|
|
584
569
|
`https://${domain}/cpi/search_drive_files_workspace`,
|
|
585
570
|
{
|
|
586
571
|
method: "POST",
|
|
587
572
|
headers: {
|
|
588
573
|
Accept: "application/json",
|
|
589
574
|
"Content-Type": "application/json",
|
|
590
|
-
"xu-gtp-token":
|
|
591
|
-
"xu-app-token":
|
|
575
|
+
"xu-gtp-token": gtp_token,
|
|
576
|
+
"xu-app-token": app_token,
|
|
592
577
|
},
|
|
593
578
|
body: JSON.stringify(opt),
|
|
594
579
|
}
|