Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -3597,10 +3597,10 @@ If both `since` and `Last-Event-ID` are present, the larger value is used.
---

### GET /api/docs/{file}
**Purpose**: Serve documentation files from the GitHub repository.
**Purpose**: Serve files from the GitHub repository.

**Path Parameter**:
- `file`: Documentation filename (e.g., `README.md`, `FAQ.md`, `API.md`, `sc_short.jpg`, `sc_simple.jpg`)
- `file`: Documentation filename (e.g., `README.md`, `FAQ.md`, `API.md`, `SECURITY.md`, `sc_short.jpg`, `sc_simple.jpg`)

**Response**:
- File content with appropriate `Content-Type` header (text/markdown for .md, image/jpeg for .jpg, etc.)
Expand Down
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ Before writing any code, **propose your idea** through one of these channels:
```bash
git checkout dev
git pull origin dev
git checkout -b feature/descriptive-name
git switch -C feature/descriptive-name
```

**Run the backend:**
```bash
uv run python -m app.main --dev
```

**Follow project standards:**
Expand Down
29 changes: 28 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
sys.path.insert(0, APP_ROOT)


import argparse
import asyncio
import logging
from collections.abc import Sequence
from pathlib import Path

import magic
Expand Down Expand Up @@ -217,6 +219,31 @@ def started(_):
)


if __name__ == "__main__":
def start() -> None:
logging.basicConfig(level=logging.DEBUG)
Main().start()


def run_dev() -> None:
from watchfiles import PythonFilter, run_process

run_process(
ROOT_PATH,
target=start,
watch_filter=PythonFilter(ignore_paths=(ROOT_PATH / "migrations",)),
)


def main(argv: Sequence[str] | None = None) -> None:
parser = argparse.ArgumentParser(description="Start YTPTube server", allow_abbrev=False)
parser.add_argument("--dev", action="store_true", help="Reload the server when Python files change")
args, _ = parser.parse_known_args(argv)

if args.dev:
run_dev()
else:
start()


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion app/routes/api/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

LOG = get_logger()

STATIC_FILES = ["README.md", "FAQ.md", "API.md", "sc_short.jpg", "sc_simple.jpg"]
STATIC_FILES = ["README.md", "FAQ.md", "API.md", "SECURITY.md", "sc_short.jpg", "sc_simple.jpg"]
EXT_TO_MIME: dict = {
".md": "text/markdown",
".png": "image/png",
Expand Down
12 changes: 12 additions & 0 deletions app/tests/test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from unittest.mock import Mock

from app import main


def test_accepts_process_arg(monkeypatch):
start = Mock()
monkeypatch.setattr(main, "start", start)

main.main(["--ytp-process"])

start.assert_called_once_with()
12 changes: 11 additions & 1 deletion ui/app/composables/useDocs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type DocsFile = 'README.md' | 'FAQ.md' | 'API.md';
export type DocsFile = 'README.md' | 'FAQ.md' | 'API.md' | 'SECURITY.md';

export type DocsEntry = {
id: string;
Expand Down Expand Up @@ -44,6 +44,16 @@ const DOCS_ENTRIES: DocsEntry[] = [
icon: 'i-lucide-code-xml',
navLabel: 'docs.entries.api.navLabel',
},
{
id: 'docs-security',
title: 'docs.entries.security.title',
description: 'docs.entries.security.description',
file: 'SECURITY.md',
route: '/docs/security',
slug: ['security'],
icon: 'i-lucide-shield-check',
navLabel: 'docs.entries.security.navLabel',
},
];

const DOCS_ROUTE_BY_FILE = new Map(DOCS_ENTRIES.map((entry) => [entry.file, entry.route]));
Expand Down
2 changes: 2 additions & 0 deletions ui/app/utils/generatedIconCatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export const bundledIconNames = [
"lucide:shapes",
"lucide:share",
"lucide:shield-alert",
"lucide:shield-check",
"lucide:sliders-horizontal",
"lucide:split",
"lucide:square",
Expand Down Expand Up @@ -355,6 +356,7 @@ export const bundledUiIconNames = [
"i-lucide-shapes",
"i-lucide-share",
"i-lucide-shield-alert",
"i-lucide-shield-check",
"i-lucide-sliders-horizontal",
"i-lucide-split",
"i-lucide-square",
Expand Down
5 changes: 5 additions & 0 deletions ui/i18n/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,11 @@
"title": "API",
"navLabel": "API",
"description": "مرجع HTTP API وسلوك نقاط النهاية."
},
"security": {
"title": "الأمان",
"navLabel": "الأمان",
"description": "سياسة الأمان وإرشادات الإبلاغ عن الثغرات الأمنية."
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions ui/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,11 @@
"title": "API",
"navLabel": "API",
"description": "HTTP API reference and endpoint behavior."
},
"security": {
"title": "Security",
"navLabel": "Security",
"description": "Security policy and vulnerability reporting guidance."
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions ui/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,11 @@
"title": "API",
"navLabel": "API",
"description": "Référence de l'API HTTP et comportement des points de terminaison."
},
"security": {
"title": "Sécurité",
"navLabel": "Sécurité",
"description": "Politique de sécurité et consignes de signalement des vulnérabilités."
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions ui/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,11 @@
"title": "API",
"navLabel": "API",
"description": "HTTP API リファレンスとエンドポイントの動作。"
},
"security": {
"title": "セキュリティ",
"navLabel": "セキュリティ",
"description": "セキュリティポリシーと脆弱性の報告手順。"
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions ui/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,11 @@
"title": "API",
"navLabel": "API",
"description": "HTTP API 参考和端点行为。"
},
"security": {
"title": "安全",
"navLabel": "安全",
"description": "安全政策和漏洞报告指南。"
}
}
},
Expand Down