Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
cf0ba794
Unverified
Commit
cf0ba794
authored
Nov 28, 2023
by
crazywoola
Committed by
GitHub
Nov 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: old webapp url still valid (#1643)
parent
c21e2063
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
22 deletions
+17
-22
wraps.py
api/controllers/web/wraps.py
+1
-1
base.ts
web/service/base.ts
+16
-21
No files found.
api/controllers/web/wraps.py
View file @
cf0ba794
...
...
@@ -40,7 +40,7 @@ def decode_jwt_token():
site
=
db
.
session
.
query
(
Site
)
.
filter
(
Site
.
code
==
app_code
)
.
first
()
if
not
app_model
:
raise
NotFound
()
if
not
app_code
and
not
site
:
if
not
app_code
or
not
site
:
raise
Unauthorized
(
'Site URL is no longer valid.'
)
if
app_model
.
enable_site
is
False
:
raise
Unauthorized
(
'Site is disabled.'
)
...
...
web/service/base.ts
View file @
cf0ba794
...
...
@@ -237,29 +237,24 @@ const baseFetch = <T>(
switch
(
res
.
status
)
{
case
401
:
{
if
(
isPublicAPI
)
{
Toast
.
notify
({
type
:
'error'
,
message
:
'Invalid token'
})
return
bodyJson
.
then
((
data
:
T
)
=>
Promise
.
reject
(
data
))
return
bodyJson
.
then
((
data
:
ResponseError
)
=>
{
Toast
.
notify
({
type
:
'error'
,
message
:
data
.
message
})
return
Promise
.
reject
(
data
)
})
}
const
loginUrl
=
`
${
globalThis
.
location
.
origin
}
/signin`
if
(
IS_CE_EDITION
)
{
bodyJson
.
then
((
data
:
ResponseError
)
=>
{
if
(
data
.
code
===
'not_setup'
)
{
if
(
data
.
code
===
'not_setup'
&&
IS_CE_EDITION
)
globalThis
.
location
.
href
=
`
${
globalThis
.
location
.
origin
}
/install`
}
else
{
if
(
location
.
pathname
===
'/signin'
)
{
bodyJson
.
then
((
data
:
ResponseError
)
=>
{
else
if
(
location
.
pathname
!==
'/signin'
||
!
IS_CE_EDITION
)
globalThis
.
location
.
href
=
loginUrl
else
Toast
.
notify
({
type
:
'error'
,
message
:
data
.
message
})
})
}
else
{
}).
catch
(()
=>
{
// Handle any other errors
globalThis
.
location
.
href
=
loginUrl
}
}
})
return
Promise
.
reject
(
Error
(
'Unauthorized'
))
}
globalThis
.
location
.
href
=
loginUrl
break
}
case
403
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment