mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
POST /api/repos/import/inspect reports what importing a clone in the media directory would do, without changing it: its origin (an SSH or git:// origin is converted to https://), branch, latest commit, commits not on the remote, whether it is shallow, and where it will be moved. It refuses special directories, Collections' directories, `.git` files/links, bare repos, and partial clones. It runs no git command which could run a program from the clone's config (the latest commit is read with cat-file, not log). POST /api/repos/import (confirmed, with a URL that is the clone's origin) moves the clone into the Repos directory (the old location is refreshed away), sanitizes its config, points origin at the URL, marks it as WROLPi's, and creates the Repo and its Download. The Repo shows the clone's commit and README at once; its first update makes it a mirror (local work is discarded, and the page warns of local commits). The Repos page has an Import button; the Import page inspects the chosen directory, then imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
1.2 KiB
Python
52 lines
1.2 KiB
Python
from dataclasses import dataclass, field
|
|
from typing import Optional, List
|
|
|
|
|
|
@dataclass
|
|
class RepoCreateRequest:
|
|
url: str
|
|
tag_name: Optional[str] = None
|
|
frequency: Optional[int] = None
|
|
mode: Optional[str] = None
|
|
branch: Optional[str] = None
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
submodules: bool = False
|
|
|
|
|
|
@dataclass
|
|
class RepoSearchRequest:
|
|
search_str: Optional[str] = None
|
|
tag_names: List[str] = field(default_factory=list)
|
|
limit: int = 20
|
|
offset: int = 0
|
|
|
|
|
|
@dataclass
|
|
class RepoUpdateRequest:
|
|
description: Optional[str] = None
|
|
frequency: Optional[int] = None
|
|
mode: Optional[str] = None
|
|
branch: Optional[str] = None
|
|
submodules: Optional[bool] = None
|
|
|
|
|
|
@dataclass
|
|
class RepoImportInspectRequest:
|
|
directory: str
|
|
name: Optional[str] = None
|
|
tag_name: Optional[str] = None
|
|
|
|
|
|
@dataclass
|
|
class RepoImportRequest:
|
|
directory: str
|
|
confirm: bool = False
|
|
url: Optional[str] = None
|
|
tag_name: Optional[str] = None
|
|
frequency: Optional[int] = None
|
|
mode: Optional[str] = None
|
|
branch: Optional[str] = None
|
|
submodules: bool = False
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|