Skip to content

Commit a1cea3c

Browse files
committed
add help to how to grant acces with static image help
1 parent aa4c4d3 commit a1cea3c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from starlette.applications import Starlette
2+
from starlette.routing import Mount
3+
from starlette.staticfiles import StaticFiles
24
from starlette.responses import PlainTextResponse
35
from starlette.routing import Route
46
from starlette.templating import Jinja2Templates
@@ -262,7 +264,7 @@ async def githubcallback(request):
262264
try:
263265
if req["message"] == "Must have admin rights to Repository.":
264266
return HTMLResponse(
265-
"You must have admin rights to the Repository. Go to your repo settings and make sure you're an admin then try again.\nNote you may need to logout/log in again (or use incognito mode) to reset your session",
267+
"<h1>Oops sorry please click 'grant' first- here's what you need to do:</h1><p>It looks like you forgot to click 'Grant' access during the oauth flow. You must first grant access to <em>your</em> repo/organisation (and have admin rights to that Repository).<br />How? Follow these steps:<br />Try again using incognito mode, and remember to first click 'Grant' next to your organisation name, and <em>then</em> press the green 'Authorize' button. <a href='/'>Open this link in incognito mode and try again.</a><br />Note: You can revoke access at any time by visiting https://github.com/organizations/<your-organization-name/settings/oauth_application_policy</p><br /><img src='/static/grant-permissions-how-to.png' style='max-width: 500px' />",
266268
status_code=403,
267269
)
268270
except Exception as e:
@@ -765,6 +767,7 @@ async def robots(request: Request):
765767
Route("/githubcallback", githubcallback, methods=["GET"]),
766768
Route("/heroku-alternatives", blog, methods=["GET"]),
767769
Route("/notify", notify, methods=["GET"]),
770+
Mount("/static", app=StaticFiles(directory="static"), name="static"),
768771
Route("/{path:path}", catch_all),
769772
]
770773

58.8 KB
Loading

0 commit comments

Comments
 (0)