Refactor hysteria endpoints

This commit is contained in:
Iam54r1n4
2025-01-30 20:34:20 +00:00
parent 14fe10c586
commit c996f2414d

View File

@ -6,7 +6,7 @@ import cli_api
router = APIRouter() router = APIRouter()
@router.get('/install', response_model=DetailResponse, summary='Install Hysteria2') @router.post('/install', response_model=DetailResponse, summary='Install Hysteria2')
async def install(body: InstallInputBody): async def install(body: InstallInputBody):
""" """
Installs Hysteria2 on the given port and uses the provided or default SNI value. Installs Hysteria2 on the given port and uses the provided or default SNI value.
@ -27,7 +27,7 @@ async def install(body: InstallInputBody):
raise HTTPException(status_code=400, detail=f'Error: {str(e)}') raise HTTPException(status_code=400, detail=f'Error: {str(e)}')
@router.get('/uninstall', response_model=DetailResponse, summary='Uninstall Hysteria2') @router.delete('/uninstall', response_model=DetailResponse, summary='Uninstall Hysteria2')
async def uninstall(): async def uninstall():
""" """
Uninstalls Hysteria2. Uninstalls Hysteria2.
@ -45,7 +45,7 @@ async def uninstall():
raise HTTPException(status_code=400, detail=f'Error: {str(e)}') raise HTTPException(status_code=400, detail=f'Error: {str(e)}')
@router.get('/update', response_model=DetailResponse, summary='Update Hysteria2') @router.patch('/update', response_model=DetailResponse, summary='Update Hysteria2')
async def update(): async def update():
""" """
Updates Hysteria2. Updates Hysteria2.