fix: Use settings.enable_offline_access for env var consolidation
Migrate all direct ENABLE_OFFLINE_ACCESS environment variable checks to use settings.enable_offline_access, which handles both the new ENABLE_BACKGROUND_OPERATIONS and deprecated ENABLE_OFFLINE_ACCESS vars. Also fixes JWT issuer validation in Docker by using NEXTCLOUD_PUBLIC_ISSUER_URL when set, resolving 401 errors caused by internal/external URL mismatch. Changes: - app.py: Use settings for offline access checks in setup_oauth_config, register_oauth_client, and tool registration - oauth_tools.py: Use settings in provision_nextcloud_access and check_logged_in - management.py: Use settings in get_user_session - scope_authorization.py: Use settings in require_scopes decorator - Remove unused os imports after migration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
10a0969138
commit
a51376fd5a
@@ -11,7 +11,6 @@ The PHP app obtains tokens through PKCE flow and uses them to access these endpo
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
from importlib.metadata import version
|
||||
from typing import Any
|
||||
@@ -347,11 +346,12 @@ async def get_user_session(request: Request) -> JSONResponse:
|
||||
)
|
||||
|
||||
# Check if offline access is enabled
|
||||
enable_offline_access = os.getenv("ENABLE_OFFLINE_ACCESS", "false").lower() in (
|
||||
"true",
|
||||
"1",
|
||||
"yes",
|
||||
)
|
||||
# Use settings.enable_offline_access which handles both ENABLE_BACKGROUND_OPERATIONS (new)
|
||||
# and ENABLE_OFFLINE_ACCESS (deprecated) environment variables
|
||||
from nextcloud_mcp_server.config import get_settings
|
||||
|
||||
settings = get_settings()
|
||||
enable_offline_access = settings.enable_offline_access
|
||||
|
||||
if not enable_offline_access:
|
||||
# Offline access disabled - return minimal session info
|
||||
|
||||
Reference in New Issue
Block a user