-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: ポータル機能を router へ分離 * refactor: single API テストを分離 * fix: リファクタリングの混入を削除 * fix: `portal` → `portal_page` にリネーム
- Loading branch information
Showing
5 changed files
with
36 additions
and
22 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
test/e2e/__snapshots__/test_openapi/test_OpenAPIの形が変わっていないことを確認.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""ポータルページ機能を提供する API Router""" | ||
|
||
from fastapi import APIRouter | ||
from fastapi.responses import HTMLResponse | ||
|
||
from voicevox_engine.engine_manifest.EngineManifest import EngineManifest | ||
|
||
|
||
def generate_portal_page_router(engine_manifest_data: EngineManifest) -> APIRouter: | ||
"""ポータルページ API Router を生成する""" | ||
router = APIRouter() | ||
|
||
@router.get("/", response_class=HTMLResponse, tags=["その他"]) | ||
async def get_portal_page() -> str: | ||
"""ポータルページを返します。""" | ||
engine_name = engine_manifest_data.name | ||
|
||
return f""" | ||
<html> | ||
<head> | ||
<title>{engine_name}</title> | ||
</head> | ||
<body> | ||
<h1>{engine_name}</h1> | ||
{engine_name} へようこそ! | ||
<ul> | ||
<li><a href='/setting'>設定</a></li> | ||
<li><a href='/docs'>API ドキュメント</a></li> | ||
</ul></body></html> | ||
""" | ||
|
||
return router |