Open instance in new tab as full page, not embed shell.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+13
-5
@@ -823,10 +823,18 @@ def register_hub_routes(app):
|
|||||||
token = (request.args.get("token") or "").strip()
|
token = (request.args.get("token") or "").strip()
|
||||||
ok, next_path, err = verify_hub_sso_token(token, ex)
|
ok, next_path, err = verify_hub_sso_token(token, ex)
|
||||||
if ok:
|
if ok:
|
||||||
dest_next = _embed_login_dest(next_path) if request.args.get(
|
embed_on = request.args.get("embed", "").strip().lower() in (
|
||||||
"embed", ""
|
"1",
|
||||||
).strip().lower() in ("1", "true", "yes", "on") else next_path
|
"true",
|
||||||
if _sso_wants_embed_auth() and request.is_secure:
|
"yes",
|
||||||
|
"on",
|
||||||
|
)
|
||||||
|
dest_next = _embed_login_dest(next_path) if embed_on else next_path
|
||||||
|
if not embed_on:
|
||||||
|
ht = (request.args.get("hub_theme") or "").strip().lower()
|
||||||
|
if ht in ("light", "dark"):
|
||||||
|
dest_next = _merge_query_into_path(next_path, hub_theme=ht)
|
||||||
|
if embed_on and _sso_wants_embed_auth() and request.is_secure:
|
||||||
boot = mint_hub_embed_bootstrap(ex, dest_next)
|
boot = mint_hub_embed_bootstrap(ex, dest_next)
|
||||||
if boot:
|
if boot:
|
||||||
from urllib.parse import urlencode as _ue
|
from urllib.parse import urlencode as _ue
|
||||||
@@ -838,7 +846,7 @@ def register_hub_routes(app):
|
|||||||
return redirect(f"/hub-embed-auth?{_ue(qdict)}")
|
return redirect(f"/hub-embed-auth?{_ue(qdict)}")
|
||||||
session["logged_in"] = True
|
session["logged_in"] = True
|
||||||
session.modified = True
|
session.modified = True
|
||||||
return redirect(_embed_login_dest(next_path))
|
return redirect(dest_next)
|
||||||
hint = err or "校验失败"
|
hint = err or "校验失败"
|
||||||
flash(
|
flash(
|
||||||
f"中控 SSO 未生效({hint})。"
|
f"中控 SSO 未生效({hint})。"
|
||||||
|
|||||||
@@ -418,7 +418,7 @@
|
|||||||
const next = nextPath || "/";
|
const next = nextPath || "/";
|
||||||
const q = new URLSearchParams({ exchange_id: String(exchangeId), next });
|
const q = new URLSearchParams({ exchange_id: String(exchangeId), next });
|
||||||
if (options.embed) q.set("embed", "1");
|
if (options.embed) q.set("embed", "1");
|
||||||
if (globalThis.HubTheme && typeof HubTheme.get === "function") {
|
if (options.embed && globalThis.HubTheme && typeof HubTheme.get === "function") {
|
||||||
q.set("hub_theme", HubTheme.get());
|
q.set("hub_theme", HubTheme.get());
|
||||||
}
|
}
|
||||||
const r = await apiFetch("/api/instance/open-url?" + q.toString());
|
const r = await apiFetch("/api/instance/open-url?" + q.toString());
|
||||||
@@ -456,7 +456,7 @@
|
|||||||
try {
|
try {
|
||||||
const embedded = isHubEmbedded();
|
const embedded = isHubEmbedded();
|
||||||
const url = await fetchInstanceOpenUrl(exchangeId, next, {
|
const url = await fetchInstanceOpenUrl(exchangeId, next, {
|
||||||
embed: embedded || !newTab,
|
embed: !newTab,
|
||||||
});
|
});
|
||||||
if (newTab) {
|
if (newTab) {
|
||||||
window.open(url, "_blank", "noopener");
|
window.open(url, "_blank", "noopener");
|
||||||
|
|||||||
Reference in New Issue
Block a user