Skip to content

Commit

Permalink
2.0.1 fix #32
Browse files Browse the repository at this point in the history
  • Loading branch information
Jazee6 committed Apr 20, 2024
1 parent b99916d commit d80d1c5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudflare-ai-web",
"version": "2.0",
"version": "2.0.1",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion server/middleware/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default defineEventHandler((event) => {
if (pass) {
if (event.path.startsWith('/api/auth')) {
if (event.headers.get('Authorization') !== pass) {
return new Response('', {status: 401, statusText: 'password incorrect'})
return new Response('Password Incorrect', {status: 401})
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ export async function basicFetch(
})

if (!response.ok) {
if (response.status === 401 && response.statusText === 'password incorrect') {
const text = await response.text()
if (response.status === 401 && text === 'Password Incorrect') {
passModal.value = true
}
throw new Error(response.status + ' ' + response.statusText + ' ' + await response.text())
throw new Error(response.status + ' ' + response.statusText + ' ' + text)
}

if (response.headers.get('Content-Type')?.includes('text/event-stream')) {
Expand Down

0 comments on commit d80d1c5

Please sign in to comment.