Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: remove REDIRECT_URL_KEY from url (#32770)
Stephen Zhou46d45e4c396d
diff --git a/web/app/account/oauth/authorize/constants.ts b/web/app/account/oauth/authorize/constants.tsdeleted file mode 100644index f1d8b98ef4f..00000000000--- a/web/app/account/oauth/authorize/constants.ts+++ /dev/null@@ -1,3 +0,0 @@-export const OAUTH_AUTHORIZE_PENDING_KEY = 'oauth_authorize_pending'-export const REDIRECT_URL_KEY = 'oauth_redirect_url'-export const OAUTH_AUTHORIZE_PENDING_TTL = 60 * 3diff --git a/web/app/account/oauth/authorize/page.tsx b/web/app/account/oauth/authorize/page.tsxindex c923d6457a3..d718e0941d1 100644--- a/web/app/account/oauth/authorize/page.tsx+++ b/web/app/account/oauth/authorize/page.tsx@@ -7,7 +7,6 @@ import {RiMailLine,RiTranslate2,} from '@remixicon/react'-import dayjs from 'dayjs'import { useRouter, useSearchParams } from 'next/navigation'import * as React from 'react'import { useEffect, useRef } from 'react'@@ -17,22 +16,10 @@ import Button from '@/app/components/base/button'import Loading from '@/app/components/base/loading'import Toast from '@/app/components/base/toast'import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'+import { setPostLoginRedirect } from '@/app/signin/utils/post-login-redirect'import { useAppContext } from '@/context/app-context'import { useIsLogin } from '@/service/use-common'import { useAuthorizeOAuthApp, useOAuthAppInfo } from '@/service/use-oauth'-import {- OAUTH_AUTHORIZE_PENDING_KEY,- OAUTH_AUTHORIZE_PENDING_TTL,- REDIRECT_URL_KEY,-} from './constants'--function setItemWithExpiry(key: string, value: string, ttl: number) {- const item = {- value,- expiry: dayjs().add(ttl, 'seconds').unix(),- }- localStorage.setItem(key, JSON.stringify(item))-}function buildReturnUrl(pathname: string, search: string) {try {@@ -86,8 +73,8 @@ export default function OAuthAuthorize() {const onLoginSwitchClick = () => {try {const returnUrl = buildReturnUrl('/account/oauth/authorize', `?client_id=${encodeURIComponent(client_id)}&redirect_uri=${encodeURIComponent(redirect_uri)}`)- setItemWithExpiry(OAUTH_AUTHORIZE_PENDING_KEY, returnUrl, OAUTH_AUTHORIZE_PENDING_TTL)- router.push(`/signin?${REDIRECT_URL_KEY}=${encodeURIComponent(returnUrl)}`)+ setPostLoginRedirect(returnUrl)+ router.push('/signin')}catch {router.push('/signin')@@ -145,7 +132,7 @@ export default function OAuthAuthorize() {<div className="text-[var(--color-saas-dify-blue-inverted)]">{authAppInfo?.app_label[language] || authAppInfo?.app_label?.en_US || t('unknownApp', { ns: 'oauth' })}</div>{!isLoggedIn && <div className="text-text-primary">{t('tips.notLoggedIn', { ns: 'oauth' })}</div>}</div>- <div className="body-md-regular text-text-secondary">{isLoggedIn ? `${authAppInfo?.app_label[language] || authAppInfo?.app_label?.en_US || t('unknownApp', { ns: 'oauth' })} ${t('tips.loggedIn', { ns: 'oauth' })}` : t('tips.needLogin', { ns: 'oauth' })}</div>+ <div className="text-text-secondary body-md-regular">{isLoggedIn ? `${authAppInfo?.app_label[language] || authAppInfo?.app_label?.en_US || t('unknownApp', { ns: 'oauth' })} ${t('tips.loggedIn', { ns: 'oauth' })}` : t('tips.needLogin', { ns: 'oauth' })}</div></div>{isLoggedIn && userProfile && (@@ -154,7 +141,7 @@ export default function OAuthAuthorize() {<Avatar avatar={userProfile.avatar_url} name={userProfile.name} size={36} /><div><div className="system-md-semi-bold text-text-secondary">{userProfile.name}</div>- <div className="system-xs-regular text-text-tertiary">{userProfile.email}</div>+ <div className="text-text-tertiary system-xs-regular">{userProfile.email}</div></div></div><Button variant="tertiary" size="small" onClick={onLoginSwitchClick}>{t('switchAccount', { ns: 'oauth' })}</Button>@@ -166,7 +153,7 @@ export default function OAuthAuthorize() {{authAppInfo!.scope.split(/\s+/).filter(Boolean).map((scope: string) => {const Icon = SCOPE_INFO_MAP[scope]return (- <div key={scope} className="body-sm-medium flex items-center gap-2 text-text-secondary">+ <div key={scope} className="flex items-center gap-2 text-text-secondary body-sm-medium">{Icon ? <Icon.icon className="h-4 w-4" /> : <RiAccountCircleLine className="h-4 w-4" />}{Icon.label}</div>@@ -199,7 +186,7 @@ export default function OAuthAuthorize() {</defs></svg></div>- <div className="system-xs-regular mt-3 text-text-tertiary">{t('tips.common', { ns: 'oauth' })}</div>+ <div className="mt-3 text-text-tertiary system-xs-regular">{t('tips.common', { ns: 'oauth' })}</div></div>)}diff --git a/web/app/components/app-initializer.tsx b/web/app/components/app-initializer.tsxindex dfbac5d7430..e4cd10175ae 100644--- a/web/app/components/app-initializer.tsx+++ b/web/app/components/app-initializer.tsx@@ -84,7 +84,7 @@ export const AppInitializer = ({return}- const redirectUrl = resolvePostLoginRedirect(searchParams)+ const redirectUrl = resolvePostLoginRedirect()if (redirectUrl) {location.replace(redirectUrl)returndiff --git a/web/app/signin/check-code/page.tsx b/web/app/signin/check-code/page.tsxindex 59579a76ecd..24ac92157ee 100644--- a/web/app/signin/check-code/page.tsx+++ b/web/app/signin/check-code/page.tsx@@ -57,7 +57,7 @@ export default function CheckCode() {router.replace(`/signin/invite-settings?${searchParams.toString()}`)}else {- const redirectUrl = resolvePostLoginRedirect(searchParams)+ const redirectUrl = resolvePostLoginRedirect()router.replace(redirectUrl || '/apps')}}@@ -95,8 +95,8 @@ export default function CheckCode() {<RiMailSendFill className="h-6 w-6 text-2xl text-text-accent-light-mode-only" /></div><div className="pb-4 pt-2">- <h2 className="title-4xl-semi-bold text-text-primary">{t('checkCode.checkYourEmail', { ns: 'login' })}</h2>- <p className="body-md-regular mt-2 text-text-secondary">+ <h2 className="text-text-primary title-4xl-semi-bold">{t('checkCode.checkYourEmail', { ns: 'login' })}</h2>+ <p className="mt-2 text-text-secondary body-md-regular"><span>{t('checkCode.tipsPrefix', { ns: 'login' })}<strong>{email}</strong>@@ -107,7 +107,7 @@ export default function CheckCode() {</div><form onSubmit={handleSubmit}>- <label htmlFor="code" className="system-md-semibold mb-1 text-text-secondary">{t('checkCode.verificationCode', { ns: 'login' })}</label>+ <label htmlFor="code" className="mb-1 text-text-secondary system-md-semibold">{t('checkCode.verificationCode', { ns: 'login' })}</label><Inputref={codeInputRef}id="code"@@ -127,7 +127,7 @@ export default function CheckCode() {<div className="inline-block rounded-full bg-background-default-dimmed p-1"><RiArrowLeftLine size={12} /></div>- <span className="system-xs-regular ml-2">{t('back', { ns: 'login' })}</span>+ <span className="ml-2 system-xs-regular">{t('back', { ns: 'login' })}</span></div></div>)diff --git a/web/app/signin/components/mail-and-password-auth.tsx b/web/app/signin/components/mail-and-password-auth.tsxindex 92165bb65bc..877720b691e 100644--- a/web/app/signin/components/mail-and-password-auth.tsx+++ b/web/app/signin/components/mail-and-password-auth.tsx@@ -78,7 +78,7 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup, allowRegisrouter.replace(`/signin/invite-settings?${searchParams.toString()}`)}else {- const redirectUrl = resolvePostLoginRedirect(searchParams)+ const redirectUrl = resolvePostLoginRedirect()router.replace(redirectUrl || '/apps')}}@@ -105,7 +105,7 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup, allowRegisreturn (<form onSubmit={noop}><div className="mb-3">- <label htmlFor="email" className="system-md-semibold my-2 text-text-secondary">+ <label htmlFor="email" className="my-2 text-text-secondary system-md-semibold">{t('email', { ns: 'login' })}</label><div className="mt-1">@@ -124,7 +124,7 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup, allowRegis<div className="mb-3"><label htmlFor="password" className="my-2 flex items-center justify-between">- <span className="system-md-semibold text-text-secondary">{t('password', { ns: 'login' })}</span>+ <span className="text-text-secondary system-md-semibold">{t('password', { ns: 'login' })}</span><Linkhref={`/reset-password?${searchParams.toString()}`}className={`system-xs-regular ${isEmailSetup ? 'text-components-button-secondary-accent-text' : 'pointer-events-none text-components-button-secondary-accent-text-disabled'}`}diff --git a/web/app/signin/invite-settings/page.tsx b/web/app/signin/invite-settings/page.tsxindex c16a580b3a7..915e85ce57e 100644--- a/web/app/signin/invite-settings/page.tsx+++ b/web/app/signin/invite-settings/page.tsx@@ -56,7 +56,7 @@ export default function InviteSettingsPage() {if (res.result === 'success') {// Tokens are now stored in cookies by the backendawait setLocaleOnClient(language, false)- const redirectUrl = resolvePostLoginRedirect(searchParams)+ const redirectUrl = resolvePostLoginRedirect()router.replace(redirectUrl || '/apps')}}@@ -72,7 +72,7 @@ export default function InviteSettingsPage() {<div className="flex flex-col md:w-[400px]"><div className="mx-auto w-full"><div className="mb-3 flex h-14 w-14 items-center justify-center rounded-2xl border border-components-panel-border-subtle text-2xl font-bold shadow-lg">🤷♂️</div>- <h2 className="title-4xl-semi-bold text-text-primary">{t('invalid', { ns: 'login' })}</h2>+ <h2 className="text-text-primary title-4xl-semi-bold">{t('invalid', { ns: 'login' })}</h2></div><div className="mx-auto mt-6 w-full"><Button variant="primary" className="w-full !text-sm">@@ -89,11 +89,11 @@ export default function InviteSettingsPage() {<RiAccountCircleLine className="h-6 w-6 text-2xl text-text-accent-light-mode-only" /></div><div className="pb-4 pt-2">- <h2 className="title-4xl-semi-bold text-text-primary">{t('setYourAccount', { ns: 'login' })}</h2>+ <h2 className="text-text-primary title-4xl-semi-bold">{t('setYourAccount', { ns: 'login' })}</h2></div><form onSubmit={noop}><div className="mb-5">- <label htmlFor="name" className="system-md-semibold my-2 text-text-secondary">+ <label htmlFor="name" className="my-2 text-text-secondary system-md-semibold">{t('name', { ns: 'login' })}</label><div className="mt-1">@@ -114,7 +114,7 @@ export default function InviteSettingsPage() {</div></div><div className="mb-5">- <label htmlFor="name" className="system-md-semibold my-2 text-text-secondary">+ <label htmlFor="name" className="my-2 text-text-secondary system-md-semibold">{t('interfaceLanguage', { ns: 'login' })}</label><div className="mt-1">@@ -129,7 +129,7 @@ export default function InviteSettingsPage() {</div>{/* timezone */}<div className="mb-5">- <label htmlFor="timezone" className="system-md-semibold text-text-secondary">+ <label htmlFor="timezone" className="text-text-secondary system-md-semibold">{t('timezone', { ns: 'login' })}</label><div className="mt-1">@@ -153,11 +153,11 @@ export default function InviteSettingsPage() {</div></form>{!systemFeatures.branding.enabled && (- <div className="system-xs-regular mt-2 block w-full text-text-tertiary">+ <div className="mt-2 block w-full text-text-tertiary system-xs-regular">{t('license.tip', { ns: 'login' })} <Link- className="system-xs-medium text-text-accent-secondary"+ className="text-text-accent-secondary system-xs-medium"target="_blank"rel="noopener noreferrer"href={LICENSE_LINK}diff --git a/web/app/signin/normal-form.tsx b/web/app/signin/normal-form.tsxindex be0feea6c15..15d86f482ca 100644--- a/web/app/signin/normal-form.tsx+++ b/web/app/signin/normal-form.tsx@@ -42,7 +42,7 @@ const NormalForm = () => {try {if (isLoggedIn) {setIsRedirecting(true)- const redirectUrl = resolvePostLoginRedirect(searchParams)+ const redirectUrl = resolvePostLoginRedirect()router.replace(redirectUrl || '/apps')return}@@ -98,8 +98,8 @@ const NormalForm = () => {<RiContractLine className="h-5 w-5" /><RiErrorWarningFill className="absolute -right-1 -top-1 h-4 w-4 text-text-warning-secondary" /></div>- <p className="system-sm-medium text-text-primary">{t('licenseLost', { ns: 'login' })}</p>- <p className="system-xs-regular mt-1 text-text-tertiary">{t('licenseLostTip', { ns: 'login' })}</p>+ <p className="text-text-primary system-sm-medium">{t('licenseLost', { ns: 'login' })}</p>+ <p className="mt-1 text-text-tertiary system-xs-regular">{t('licenseLostTip', { ns: 'login' })}</p></div></div></div>@@ -114,8 +114,8 @@ const NormalForm = () => {<RiContractLine className="h-5 w-5" /><RiErrorWarningFill className="absolute -right-1 -top-1 h-4 w-4 text-text-warning-secondary" /></div>- <p className="system-sm-medium text-text-primary">{t('licenseExpired', { ns: 'login' })}</p>- <p className="system-xs-regular mt-1 text-text-tertiary">{t('licenseExpiredTip', { ns: 'login' })}</p>+ <p className="text-text-primary system-sm-medium">{t('licenseExpired', { ns: 'login' })}</p>+ <p className="mt-1 text-text-tertiary system-xs-regular">{t('licenseExpiredTip', { ns: 'login' })}</p></div></div></div>@@ -130,8 +130,8 @@ const NormalForm = () => {<RiContractLine className="h-5 w-5" /><RiErrorWarningFill className="absolute -right-1 -top-1 h-4 w-4 text-text-warning-secondary" /></div>- <p className="system-sm-medium text-text-primary">{t('licenseInactive', { ns: 'login' })}</p>- <p className="system-xs-regular mt-1 text-text-tertiary">{t('licenseInactiveTip', { ns: 'login' })}</p>+ <p className="text-text-primary system-sm-medium">{t('licenseInactive', { ns: 'login' })}</p>+ <p className="mt-1 text-text-tertiary system-xs-regular">{t('licenseInactiveTip', { ns: 'login' })}</p></div></div></div>@@ -144,12 +144,12 @@ const NormalForm = () => {{isInviteLink? (<div className="mx-auto w-full">- <h2 className="title-4xl-semi-bold text-text-primary">+ <h2 className="text-text-primary title-4xl-semi-bold">{t('join', { ns: 'login' })}{workspaceName}</h2>{!systemFeatures.branding.enabled && (- <p className="body-md-regular mt-2 text-text-tertiary">+ <p className="mt-2 text-text-tertiary body-md-regular">{t('joinTipStart', { ns: 'login' })}{workspaceName}{t('joinTipEnd', { ns: 'login' })}@@ -159,8 +159,8 @@ const NormalForm = () => {): (<div className="mx-auto w-full">- <h2 className="title-4xl-semi-bold text-text-primary">{systemFeatures.branding.enabled ? t('pageTitleForE', { ns: 'login' }) : t('pageTitle', { ns: 'login' })}</h2>- <p className="body-md-regular mt-2 text-text-tertiary">{t('welcome', { ns: 'login' })}</p>+ <h2 className="text-text-primary title-4xl-semi-bold">{systemFeatures.branding.enabled ? t('pageTitleForE', { ns: 'login' }) : t('pageTitle', { ns: 'login' })}</h2>+ <p className="mt-2 text-text-tertiary body-md-regular">{t('welcome', { ns: 'login' })}</p></div>)}<div className="relative">@@ -177,7 +177,7 @@ const NormalForm = () => {<div className="relative mt-6"><div className="flex items-center"><div className="h-px flex-1 bg-gradient-to-r from-background-gradient-mask-transparent to-divider-regular"></div>- <span className="system-xs-medium-uppercase px-3 text-text-tertiary">{t('or', { ns: 'login' })}</span>+ <span className="px-3 text-text-tertiary system-xs-medium-uppercase">{t('or', { ns: 'login' })}</span><div className="h-px flex-1 bg-gradient-to-l from-background-gradient-mask-transparent to-divider-regular"></div></div></div>@@ -190,7 +190,7 @@ const NormalForm = () => {<MailAndCodeAuth isInvite={isInviteLink} />{systemFeatures.enable_email_password_login && (<div className="cursor-pointer py-1 text-center" onClick={() => { updateAuthType('password') }}>- <span className="system-xs-medium text-components-button-secondary-accent-text">{t('usePassword', { ns: 'login' })}</span>+ <span className="text-components-button-secondary-accent-text system-xs-medium">{t('usePassword', { ns: 'login' })}</span></div>)}</>@@ -200,7 +200,7 @@ const NormalForm = () => {<MailAndPasswordAuth isInvite={isInviteLink} isEmailSetup={systemFeatures.is_email_setup} allowRegistration={systemFeatures.is_allow_register} />{systemFeatures.enable_email_code_login && (<div className="cursor-pointer py-1 text-center" onClick={() => { updateAuthType('code') }}>- <span className="system-xs-medium text-components-button-secondary-accent-text">{t('useVerificationCode', { ns: 'login' })}</span>+ <span className="text-components-button-secondary-accent-text system-xs-medium">{t('useVerificationCode', { ns: 'login' })}</span></div>)}</>@@ -227,8 +227,8 @@ const NormalForm = () => {<div className="shadows-shadow-lg mb-2 flex h-10 w-10 items-center justify-center rounded-xl bg-components-card-bg shadow"><RiDoorLockLine className="h-5 w-5" /></div>- <p className="system-sm-medium text-text-primary">{t('noLoginMethod', { ns: 'login' })}</p>- <p className="system-xs-regular mt-1 text-text-tertiary">{t('noLoginMethodTip', { ns: 'login' })}</p>+ <p className="text-text-primary system-sm-medium">{t('noLoginMethod', { ns: 'login' })}</p>+ <p className="mt-1 text-text-tertiary system-xs-regular">{t('noLoginMethodTip', { ns: 'login' })}</p></div><div className="relative my-2 py-2"><div className="absolute inset-0 flex items-center" aria-hidden="true">@@ -239,11 +239,11 @@ const NormalForm = () => {)}{!systemFeatures.branding.enabled && (<>- <div className="system-xs-regular mt-2 block w-full text-text-tertiary">+ <div className="mt-2 block w-full text-text-tertiary system-xs-regular">{t('tosDesc', { ns: 'login' })} <Link- className="system-xs-medium text-text-secondary hover:underline"+ className="text-text-secondary system-xs-medium hover:underline"target="_blank"rel="noopener noreferrer"href="https://dify.ai/terms"@@ -252,7 +252,7 @@ const NormalForm = () => {</Link> & <Link- className="system-xs-medium text-text-secondary hover:underline"+ className="text-text-secondary system-xs-medium hover:underline"target="_blank"rel="noopener noreferrer"href="https://dify.ai/privacy"@@ -261,11 +261,11 @@ const NormalForm = () => {</Link></div>{IS_CE_EDITION && (- <div className="w-hull system-xs-regular mt-2 block text-text-tertiary">+ <div className="w-hull mt-2 block text-text-tertiary system-xs-regular">{t('goToInit', { ns: 'login' })} <Link- className="system-xs-medium text-text-secondary hover:underline"+ className="text-text-secondary system-xs-medium hover:underline"href="/install">{t('setAdminAccount', { ns: 'login' })}diff --git a/web/app/signin/utils/post-login-redirect.ts b/web/app/signin/utils/post-login-redirect.tsindex b548a1bac97..a94fb2ad798 100644--- a/web/app/signin/utils/post-login-redirect.ts+++ b/web/app/signin/utils/post-login-redirect.ts@@ -1,37 +1,15 @@-import type { ReadonlyURLSearchParams } from 'next/navigation'-import dayjs from 'dayjs'-import { OAUTH_AUTHORIZE_PENDING_KEY, REDIRECT_URL_KEY } from '@/app/account/oauth/authorize/constants'+let postLoginRedirect: string | null = null-function getItemWithExpiry(key: string): string | null {- const itemStr = localStorage.getItem(key)- if (!itemStr)- return null-- try {- const item = JSON.parse(itemStr)- localStorage.removeItem(key)- if (!item?.value)- return null-- return dayjs().unix() > item.expiry ? null : item.value- }- catch {- return null- }+export const setPostLoginRedirect = (value: string | null) => {+ postLoginRedirect = value}-export const resolvePostLoginRedirect = (searchParams: ReadonlyURLSearchParams) => {- const redirectUrl = searchParams.get(REDIRECT_URL_KEY)- if (redirectUrl) {- try {- localStorage.removeItem(OAUTH_AUTHORIZE_PENDING_KEY)- return decodeURIComponent(redirectUrl)- }- catch (e) {- console.error('Failed to decode redirect URL:', e)- return redirectUrl- }+export const resolvePostLoginRedirect = () => {+ if (postLoginRedirect) {+ const redirectUrl = postLoginRedirect+ postLoginRedirect = null+ return redirectUrl}- return getItemWithExpiry(OAUTH_AUTHORIZE_PENDING_KEY)+ return null}diff --git a/web/eslint-suppressions.json b/web/eslint-suppressions.jsonindex 31f7058e20e..3282630fef5 100644--- a/web/eslint-suppressions.json+++ b/web/eslint-suppressions.json@@ -273,9 +273,6 @@}},"app/account/oauth/authorize/page.tsx": {- "tailwindcss/enforce-consistent-class-order": {- "count": 4- },"ts/no-explicit-any": {"count": 1}@@ -7976,29 +7973,16 @@"count": 6}},- "app/signin/check-code/page.tsx": {- "tailwindcss/enforce-consistent-class-order": {- "count": 4- }- },"app/signin/components/mail-and-code-auth.tsx": {"tailwindcss/enforce-consistent-class-order": {"count": 1}},"app/signin/components/mail-and-password-auth.tsx": {- "tailwindcss/enforce-consistent-class-order": {- "count": 2- },"ts/no-explicit-any": {"count": 1}},- "app/signin/invite-settings/page.tsx": {- "tailwindcss/enforce-consistent-class-order": {- "count": 7- }- },"app/signin/layout.tsx": {"tailwindcss/enforce-consistent-class-order": {"count": 1@@ -8007,11 +7991,6 @@"count": 1}},- "app/signin/normal-form.tsx": {- "tailwindcss/enforce-consistent-class-order": {- "count": 20- }- },"app/signin/one-more-step.tsx": {"tailwindcss/enforce-consistent-class-order": {"count": 7