fix: update OAuth redirect logic to include model thumbnail pages (#1977)
Browse files- src/hooks.server.ts +5 -1
src/hooks.server.ts
CHANGED
|
@@ -154,7 +154,7 @@ export const handle: Handle = async ({ event, resolve }) => {
|
|
| 154 |
});
|
| 155 |
}
|
| 156 |
} else {
|
| 157 |
-
// Redirect to OAuth flow unless on the authorized pages (home, shared conversation, login, healthcheck)
|
| 158 |
if (
|
| 159 |
event.url.pathname !== `${base}/` &&
|
| 160 |
event.url.pathname !== `${base}` &&
|
|
@@ -163,6 +163,10 @@ export const handle: Handle = async ({ event, resolve }) => {
|
|
| 163 |
!event.url.pathname.startsWith(`${base}/healthcheck`) &&
|
| 164 |
!event.url.pathname.startsWith(`${base}/r/`) &&
|
| 165 |
!event.url.pathname.startsWith(`${base}/conversation/`) &&
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
!event.url.pathname.startsWith(`${base}/api`)
|
| 167 |
) {
|
| 168 |
refreshSessionCookie(event.cookies, auth.secretSessionId);
|
|
|
|
| 154 |
});
|
| 155 |
}
|
| 156 |
} else {
|
| 157 |
+
// Redirect to OAuth flow unless on the authorized pages (home, shared conversation, login, healthcheck, model thumbnails)
|
| 158 |
if (
|
| 159 |
event.url.pathname !== `${base}/` &&
|
| 160 |
event.url.pathname !== `${base}` &&
|
|
|
|
| 163 |
!event.url.pathname.startsWith(`${base}/healthcheck`) &&
|
| 164 |
!event.url.pathname.startsWith(`${base}/r/`) &&
|
| 165 |
!event.url.pathname.startsWith(`${base}/conversation/`) &&
|
| 166 |
+
!(
|
| 167 |
+
event.url.pathname.startsWith(`${base}/models/`) &&
|
| 168 |
+
event.url.pathname.endsWith("/thumbnail.png")
|
| 169 |
+
) &&
|
| 170 |
!event.url.pathname.startsWith(`${base}/api`)
|
| 171 |
) {
|
| 172 |
refreshSessionCookie(event.cookies, auth.secretSessionId);
|