mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-14 22:45:47 +00:00
move api endpoints to status-api
This commit is contained in:
@ -58,7 +58,7 @@ class WebClient(Client):
|
||||
"""
|
||||
:return: full url for web service for ahriman service itself
|
||||
"""
|
||||
return f"{self.address}/api/v1/ahriman"
|
||||
return f"{self.address}/status-api/v1/ahriman"
|
||||
|
||||
@property
|
||||
def _login_url(self) -> str:
|
||||
@ -72,7 +72,7 @@ class WebClient(Client):
|
||||
"""
|
||||
:return: full url for web service for status
|
||||
"""
|
||||
return f"{self.address}/api/v1/status"
|
||||
return f"{self.address}/status-api/v1/status"
|
||||
|
||||
@staticmethod
|
||||
def parse_address(configuration: Configuration) -> str:
|
||||
@ -115,7 +115,7 @@ class WebClient(Client):
|
||||
:param base: package base to generate url
|
||||
:return: full url of web service for specific package base
|
||||
"""
|
||||
return f"{self.address}/api/v1/packages/{base}"
|
||||
return f"{self.address}/status-api/v1/packages/{base}"
|
||||
|
||||
def add(self, package: Package, status: BuildStatusEnum) -> None:
|
||||
"""
|
||||
|
@ -73,7 +73,7 @@ def auth_handler(validator: Auth) -> MiddlewareType:
|
||||
"""
|
||||
@middleware
|
||||
async def handle(request: Request, handler: HandlerType) -> StreamResponse:
|
||||
if request.path.startswith("/api"):
|
||||
if request.path.startswith("/status-api"):
|
||||
permission = UserAccess.Status
|
||||
elif request.method in ("GET", "HEAD", "OPTIONS"):
|
||||
permission = UserAccess.Read
|
||||
|
@ -34,23 +34,23 @@ def setup_routes(application: Application) -> None:
|
||||
|
||||
Available routes are:
|
||||
|
||||
GET / get build status page
|
||||
GET /index.html same as above
|
||||
GET / get build status page
|
||||
GET /index.html same as above
|
||||
|
||||
POST /login login to service
|
||||
POST /logout logout from service
|
||||
POST /login login to service
|
||||
POST /logout logout from service
|
||||
|
||||
GET /api/v1/ahriman get current service status
|
||||
POST /api/v1/ahriman update service status
|
||||
GET /status-api/v1/ahriman get current service status
|
||||
POST /status-api/v1/ahriman update service status
|
||||
|
||||
GET /api/v1/packages get all known packages
|
||||
POST /api/v1/packages force update every package from repository
|
||||
GET /status-api/v1/packages get all known packages
|
||||
POST /status-api/v1/packages force update every package from repository
|
||||
|
||||
DELETE /api/v1/package/:base delete package base from status page
|
||||
GET /api/v1/package/:base get package base status
|
||||
POST /api/v1/package/:base update package base status
|
||||
DELETE /status-api/v1/package/:base delete package base from status page
|
||||
GET /status-api/v1/package/:base get package base status
|
||||
POST /status-api/v1/package/:base update package base status
|
||||
|
||||
GET /api/v1/status get web service status itself
|
||||
GET /status-api/v1/status get web service status itself
|
||||
|
||||
:param application: web application instance
|
||||
"""
|
||||
@ -60,14 +60,14 @@ def setup_routes(application: Application) -> None:
|
||||
application.router.add_post("/login", LoginView)
|
||||
application.router.add_post("/logout", LogoutView)
|
||||
|
||||
application.router.add_get("/api/v1/ahriman", AhrimanView, allow_head=True)
|
||||
application.router.add_post("/api/v1/ahriman", AhrimanView)
|
||||
application.router.add_get("/status-api/v1/ahriman", AhrimanView, allow_head=True)
|
||||
application.router.add_post("/status-api/v1/ahriman", AhrimanView)
|
||||
|
||||
application.router.add_get("/api/v1/packages", PackagesView, allow_head=True)
|
||||
application.router.add_post("/api/v1/packages", PackagesView)
|
||||
application.router.add_get("/status-api/v1/packages", PackagesView, allow_head=True)
|
||||
application.router.add_post("/status-api/v1/packages", PackagesView)
|
||||
|
||||
application.router.add_delete("/api/v1/packages/{package}", PackageView)
|
||||
application.router.add_get("/api/v1/packages/{package}", PackageView, allow_head=True)
|
||||
application.router.add_post("/api/v1/packages/{package}", PackageView)
|
||||
application.router.add_delete("/status-api/v1/packages/{package}", PackageView)
|
||||
application.router.add_get("/status-api/v1/packages/{package}", PackageView, allow_head=True)
|
||||
application.router.add_post("/status-api/v1/packages/{package}", PackageView)
|
||||
|
||||
application.router.add_get("/api/v1/status", StatusView, allow_head=True)
|
||||
application.router.add_get("/status-api/v1/status", StatusView, allow_head=True)
|
||||
|
Reference in New Issue
Block a user