diff --git a/app/routes.py b/app/routes.py index 53ce2b6..9446735 100644 --- a/app/routes.py +++ b/app/routes.py @@ -11,6 +11,7 @@ templates = Jinja2Templates(directory=settings.TEMPLATE_DIR) router = APIRouter() +URL_REPO = "https://api.github.com/repos/rooyca/ghtree/contents/app/data" @router.get("/") def index(request: Request): @@ -24,11 +25,14 @@ def index(request: Request): @router.get("/v2/{username}") def get_user_markdown(request: Request, username: str): - # check if a file with username exists in data folder + # check if a file with username exists in repo try: - print(username) - with open(f"app/data/{username}.md", "r") as f: - data = f.read() + response = requests.get(URL_REPO) + data = response.json() + for item in data: + if item.get("name") == f"{username}.md": + url = item.get("download_url") + break except FileNotFoundError: return templates.TemplateResponse("404.html", { "request": request, @@ -36,7 +40,7 @@ def get_user_markdown(request: Request, username: str): "status_code": 404, "text": "NOPE", }) - parsed_data = parse_markdown(data) + parsed_data = parse_markdown(requests.get(url).text) return templates.TemplateResponse("v2_user.html", { "request": request, diff --git a/app/static/css/main.css b/app/static/css/main.css index 2be3cf8..9d3496c 100644 --- a/app/static/css/main.css +++ b/app/static/css/main.css @@ -955,6 +955,10 @@ video { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; } +.font-sans { + font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; +} + .text-3xl { font-size: 1.875rem; line-height: 2.25rem; @@ -997,10 +1001,18 @@ video { font-style: italic; } +.leading-normal { + line-height: 1.5; +} + .tracking-wide { letter-spacing: 0.025em; } +.tracking-wider { + letter-spacing: 0.05em; +} + .text-black { --tw-text-opacity: 1; color: rgb(0 0 0 / var(--tw-text-opacity)); @@ -1051,6 +1063,11 @@ video { color: rgb(212 212 216 / var(--tw-text-opacity)); } +.antialiased { + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + .opacity-25 { opacity: 0.25; }