修复中控
This commit is contained in:
@@ -39,9 +39,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchInstanceOpenUrl(exchangeId, nextPath) {
|
||||
async function fetchInstanceOpenUrl(exchangeId, nextPath, opts) {
|
||||
const options = opts || {};
|
||||
const next = nextPath || "/";
|
||||
const q = new URLSearchParams({ exchange_id: String(exchangeId), next });
|
||||
if (options.embed) q.set("embed", "1");
|
||||
const r = await apiFetch("/api/instance/open-url?" + q.toString());
|
||||
const j = await r.json();
|
||||
if (!j.ok || !j.url) {
|
||||
@@ -55,7 +57,8 @@
|
||||
const newTab = !!options.newTab;
|
||||
const next = nextPath || "/";
|
||||
try {
|
||||
const url = await fetchInstanceOpenUrl(exchangeId, next);
|
||||
const embedded = isHubEmbedded();
|
||||
const url = await fetchInstanceOpenUrl(exchangeId, next, { embed: embedded });
|
||||
if (newTab) {
|
||||
window.open(url, "_blank", "noopener");
|
||||
return;
|
||||
@@ -63,7 +66,18 @@
|
||||
const row = lastMonitorRows.find((x) => String(x.id) === String(exchangeId));
|
||||
const title = row ? row.name : exchangeId;
|
||||
instanceFrameCtx = { exchangeId: String(exchangeId), nextPath: next, title };
|
||||
if (isHubEmbedded()) {
|
||||
if (embedded) {
|
||||
try {
|
||||
window.parent.postMessage(
|
||||
{
|
||||
type: "hub:open-instance-nav",
|
||||
exchangeId: String(exchangeId),
|
||||
nextPath: next,
|
||||
title,
|
||||
},
|
||||
"*"
|
||||
);
|
||||
} catch (_) {}
|
||||
if (openInstanceInParentFrame(url)) return;
|
||||
}
|
||||
openInstanceFrame(url, title);
|
||||
@@ -83,7 +97,8 @@
|
||||
try {
|
||||
const url = await fetchInstanceOpenUrl(
|
||||
instanceFrameCtx.exchangeId,
|
||||
instanceFrameCtx.nextPath
|
||||
instanceFrameCtx.nextPath,
|
||||
{ embed: isHubEmbedded() }
|
||||
);
|
||||
instanceFrameUrl = url;
|
||||
const frame = document.getElementById("instance-frame");
|
||||
|
||||
Reference in New Issue
Block a user