Skip to content

Commit

Permalink
Merge pull request #3 from Rooyca/personal
Browse files Browse the repository at this point in the history
update(fix): looking for files in repo
  • Loading branch information
Rooyca authored Jun 6, 2024
2 parents a721f23 + 1a50597 commit 3a88f99
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -24,19 +25,22 @@ 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,
"page_title": "GHTree | Not Found",
"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,
Expand Down
17 changes: 17 additions & 0 deletions app/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 3a88f99

Please sign in to comment.