eebc86a52b
Add a shared ServiceBaseUrl type (BeforeValidator + Field description) in integrations/base.py and apply it to base_url across all six service configs (grafana, prometheus, alertmanager, jellyfin, jellyseerr, nextcloud). Missing http:// or https:// schema now fails fast with a clear 422 instead of breaking HTTP clients silently. Tests cover reject/accept cases; REQUIREMENTS updated.
34 lines
813 B
Python
34 lines
813 B
Python
"""Nextcloud service definition.
|
|
|
|
Nextcloud is included as a proof-of-concept third-party service. It has no
|
|
dashboard widgets yet; its service page holds connection config only.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from media_library_viewer_api.integrations.base import (
|
|
SecretField,
|
|
ServiceBaseUrl,
|
|
ServiceConfigBase,
|
|
ServiceDefinition,
|
|
)
|
|
|
|
|
|
class NextcloudConfig(ServiceConfigBase):
|
|
"""Non-secret Nextcloud connection config."""
|
|
|
|
base_url: ServiceBaseUrl
|
|
username: str = ""
|
|
|
|
|
|
DEFINITION = ServiceDefinition(
|
|
service_type="nextcloud",
|
|
name="Nextcloud",
|
|
description="Self-hosted files and collaboration.",
|
|
config_model=NextcloudConfig,
|
|
secret_fields=[
|
|
SecretField(key="app_password", label="App password", required=True),
|
|
],
|
|
widget_kinds=[],
|
|
)
|