4c71148ff9
- Add linked_upstream_id to CustomPage model with DB migration
- New POST /api/custom-pages/{pid}/refresh-auth endpoint extracts
credentials from active remote browser and updates linked upstream
- PageViewer toolbar shows key icon button when page has linked upstream
- CustomPages form adds upstream dropdown for remote_browser pages
- Auth capture extracts New-Api-User from localStorage uid/user/self API
- Upstream client sends New-Api-User header in cookie auth mode
- Fix auth capture dialog: transparent background, field persistence,
login URL defaults to base_url/login, focus on click for keyboard input
- Fix upstream test ASCII encoding with non-header characters validation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
35 lines
1.9 KiB
Python
35 lines
1.9 KiB
Python
"""Custom embedded pages model."""
|
|
from datetime import datetime, timezone
|
|
from typing import Optional
|
|
from sqlalchemy import Integer, String, Boolean, DateTime, Text
|
|
from sqlalchemy.orm import mapped_column, Mapped
|
|
from app.database import Base
|
|
|
|
|
|
class CustomPage(Base):
|
|
__tablename__ = "custom_pages"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True, index=True)
|
|
name: Mapped[str] = mapped_column(String(128), nullable=False)
|
|
url: Mapped[str] = mapped_column(String(2048), nullable=False)
|
|
icon: Mapped[str] = mapped_column(String(64), default="Link")
|
|
sort_order: Mapped[int] = mapped_column(Integer, default=0)
|
|
enabled: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
use_proxy: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
access_mode: Mapped[str] = mapped_column(String(32), default="direct", nullable=False)
|
|
description: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
|
login_username: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)
|
|
login_password: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
|
login_username_selector: Mapped[Optional[str]] = mapped_column(String(512), nullable=True)
|
|
login_password_selector: Mapped[Optional[str]] = mapped_column(String(512), nullable=True)
|
|
login_submit_selector: Mapped[Optional[str]] = mapped_column(String(512), nullable=True)
|
|
login_autofill_enabled: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
|
login_autofill_backfilled_at: Mapped[Optional[datetime]] = mapped_column(DateTime, nullable=True)
|
|
linked_upstream_id: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime, default=lambda: datetime.now(timezone.utc))
|
|
updated_at: Mapped[datetime] = mapped_column(
|
|
DateTime,
|
|
default=lambda: datetime.now(timezone.utc),
|
|
onupdate=lambda: datetime.now(timezone.utc),
|
|
)
|