Compare commits

...

4 Commits

Author SHA1 Message Date
6a934db8ac chore: bump version 2026-06-06 20:38:21 +02:00
ac7302b1dd fix: add /setup/unresolved to exempt paths and improve error handling
- Add /setup/unresolved to EXEMPT_PATHS to allow access after initial setup
- Handle 401 Unauthorized response in loading page (clear invalid token)
- Add console.log statements for debugging setup flow issues
2026-06-06 20:37:11 +02:00
ac5ee3bb27 chore: bump version 2026-06-06 20:08:05 +02:00
a9084202e3 fixed missing import 2026-06-06 20:07:45 +02:00
5 changed files with 18 additions and 2 deletions

View File

@@ -1 +1 @@
v1.4.5 v1.4.7

View File

@@ -1,6 +1,6 @@
{ {
"name": "aniworld-web", "name": "aniworld-web",
"version": "1.4.5", "version": "1.4.7",
"description": "Aniworld Anime Download Manager - Web Frontend", "description": "Aniworld Anime Download Manager - Web Frontend",
"type": "module", "type": "module",
"scripts": { "scripts": {

View File

@@ -1,6 +1,7 @@
"""Authentication API endpoints for Aniworld.""" """Authentication API endpoints for Aniworld."""
from typing import Optional from typing import Optional
import structlog
from fastapi import APIRouter, Depends, HTTPException from fastapi import APIRouter, Depends, HTTPException
from fastapi import status as http_status from fastapi import status as http_status
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
@@ -16,6 +17,8 @@ from src.server.models.config import AppConfig
from src.server.services.auth_service import AuthError, LockedOutError, auth_service from src.server.services.auth_service import AuthError, LockedOutError, auth_service
from src.server.services.config_service import get_config_service from src.server.services.config_service import get_config_service
logger = structlog.get_logger(__name__)
# NOTE: import dependencies (optional_auth, security) lazily inside handlers # NOTE: import dependencies (optional_auth, security) lazily inside handlers
# to avoid importing heavyweight modules (e.g. sqlalchemy) at import time. # to avoid importing heavyweight modules (e.g. sqlalchemy) at import time.

View File

@@ -32,6 +32,7 @@ class SetupRedirectMiddleware(BaseHTTPMiddleware):
# Paths that should always be accessible, even without setup # Paths that should always be accessible, even without setup
EXEMPT_PATHS = { EXEMPT_PATHS = {
"/setup", # Setup page itself "/setup", # Setup page itself
"/setup/unresolved", # Unresolved folders page (after setup)
"/loading", # Loading page (initialization progress) "/loading", # Loading page (initialization progress)
"/login", # Login page (needs to be accessible after setup) "/login", # Login page (needs to be accessible after setup)
"/queue", # Queue page (for initial load) "/queue", # Queue page (for initial load)

View File

@@ -481,8 +481,10 @@
async function checkUnresolvedAndProceed() { async function checkUnresolvedAndProceed() {
try { try {
const token = localStorage.getItem('auth_token'); const token = localStorage.getItem('auth_token');
console.log('Checking unresolved folders, token exists:', !!token);
if (!token) { if (!token) {
// No token, go to login // No token, go to login
console.log('No auth token found, showing completion');
document.getElementById('completionMessage').style.display = 'block'; document.getElementById('completionMessage').style.display = 'block';
return; return;
} }
@@ -490,20 +492,30 @@
const res = await fetch('/api/setup/unresolved', { const res = await fetch('/api/setup/unresolved', {
headers: { 'Authorization': `Bearer ${token}` } headers: { 'Authorization': `Bearer ${token}` }
}); });
console.log('Unresolved API response status:', res.status);
if (res.ok) { if (res.ok) {
const unresolved = await res.json(); const unresolved = await res.json();
console.log('Unresolved folders:', unresolved);
if (unresolved && unresolved.length > 0) { if (unresolved && unresolved.length > 0) {
// Has unresolved folders - redirect to unresolved page // Has unresolved folders - redirect to unresolved page
console.log('Redirecting to /setup/unresolved');
window.location.href = '/setup/unresolved'; window.location.href = '/setup/unresolved';
return; return;
} }
} else if (res.status === 401) {
// Token invalid, clear it
localStorage.removeItem('auth_token');
console.log('Token invalid, showing completion');
document.getElementById('completionMessage').style.display = 'block';
return;
} }
} catch (e) { } catch (e) {
console.error('Error checking unresolved folders:', e); console.error('Error checking unresolved folders:', e);
} }
// No unresolved folders or error - show completion message // No unresolved folders or error - show completion message
console.log('No unresolved folders or error, showing completion');
document.getElementById('completionMessage').style.display = 'block'; document.getElementById('completionMessage').style.display = 'block';
} }