Skip to content

Commit

Permalink
add page for other orgs
Browse files Browse the repository at this point in the history
  • Loading branch information
KTachibanaM committed Nov 7, 2024
1 parent 8db190d commit 48f7db4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
31 changes: 25 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,39 @@ def workflow_status_to_emoji(workflow_status: str) -> str:
return workflow_status_to_emoji_map.get(workflow_status, "❓")


@app.get("/")
async def _root(request: Request):
res = await get_res(settings.ui_default_org, settings.ui_default_excluded_repos.split(","), settings.github_token)
@app.get("/api/{org}")
async def _api(org: str, e: Annotated[list[str], Query()] = []) -> list[RepoResult]:
return await get_res(org, e, settings.github_token)


@app.get("/org/{org}")
async def _org(request: Request, org: str, e: Annotated[list[str], Query()] = []):
res = await get_res(org, e, settings.github_token)
return templates.TemplateResponse(
request=request,
name="index.html",
context={
"res": res,
"org": org,
"auto_refresh": False,
"time_ago": time_ago,
"workflow_status_to_emoji": workflow_status_to_emoji
}
)


@app.get("/api/{org}")
async def _api(org: str, e: Annotated[list[str], Query()] = []) -> list[RepoResult]:
return await get_res(org, e, settings.github_token)
@app.get("/")
async def _root(request: Request):
org = settings.ui_default_org
res = await get_res(org, settings.ui_default_excluded_repos.split(","), settings.github_token)
return templates.TemplateResponse(
request=request,
name="index.html",
context={
"res": res,
"org": org,
"auto_refresh": True,
"time_ago": time_ago,
"workflow_status_to_emoji": workflow_status_to_emoji
}
)
6 changes: 5 additions & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>GitHub Org Actions</title>
{% if auto_refresh %}
<title>🔄 {{ org }} | GitHub Org Actions</title>
<meta http-equiv="refresh" content="10">
{% else %}
<title>{{ org }} | GitHub Org Actions</title>
{% endif %}
<!-- url_for returns http (insecure) links for styles.css so need this to upgrade to https otherwise browser gives mixed content warning and won't load styles.css -->
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/sekai-soft/galerie/static/base.css">
Expand Down

0 comments on commit 48f7db4

Please sign in to comment.