mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-28 05:27:35 +00:00
refac
This commit is contained in:
parent
21366fa1b1
commit
5ce198b1d7
2 changed files with 1 additions and 26 deletions
|
|
@ -572,15 +572,8 @@ export const initiateOAuthRedirect = (tool: {
|
||||||
}) => {
|
}) => {
|
||||||
sessionStorage.setItem('pendingOAuthToolId', tool.id);
|
sessionStorage.setItem('pendingOAuthToolId', tool.id);
|
||||||
sessionStorage.setItem('oauthRedirectInProgressToolId', tool.id);
|
sessionStorage.setItem('oauthRedirectInProgressToolId', tool.id);
|
||||||
localStorage.setItem('pendingOAuthToolId', tool.id);
|
|
||||||
localStorage.setItem('oauthRedirectInProgressToolId', tool.id);
|
|
||||||
const authUrl = getOAuthClientAuthorizationUrl(tool.serverId, tool.authType ?? 'mcp');
|
const authUrl = getOAuthClientAuthorizationUrl(tool.serverId, tool.authType ?? 'mcp');
|
||||||
const tab = window.open(authUrl, '_blank');
|
window.open(authUrl, '_self', 'noopener');
|
||||||
if (!tab) {
|
|
||||||
localStorage.removeItem('pendingOAuthToolId');
|
|
||||||
localStorage.removeItem('oauthRedirectInProgressToolId');
|
|
||||||
window.open(authUrl, '_self', 'noopener');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCodeExecutionConfig = async (token: string) => {
|
export const getCodeExecutionConfig = async (token: string) => {
|
||||||
|
|
|
||||||
|
|
@ -1069,24 +1069,6 @@
|
||||||
|
|
||||||
window.addEventListener('message', windowMessageEventHandler);
|
window.addEventListener('message', windowMessageEventHandler);
|
||||||
|
|
||||||
const pendingOAuthToolId =
|
|
||||||
sessionStorage.getItem('pendingOAuthToolId') ?? localStorage.getItem('pendingOAuthToolId');
|
|
||||||
if (window.opener && window.location.pathname === '/' && pendingOAuthToolId) {
|
|
||||||
window.opener.postMessage(
|
|
||||||
{
|
|
||||||
type: 'oauth:complete',
|
|
||||||
toolId: pendingOAuthToolId,
|
|
||||||
error: new URLSearchParams(window.location.search).get('error')
|
|
||||||
},
|
|
||||||
window.location.origin
|
|
||||||
);
|
|
||||||
sessionStorage.removeItem('pendingOAuthToolId');
|
|
||||||
sessionStorage.removeItem('oauthRedirectInProgressToolId');
|
|
||||||
localStorage.removeItem('pendingOAuthToolId');
|
|
||||||
localStorage.removeItem('oauthRedirectInProgressToolId');
|
|
||||||
window.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
let touchstartY = 0;
|
let touchstartY = 0;
|
||||||
|
|
||||||
function isNavOrDescendant(el) {
|
function isNavOrDescendant(el) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue