-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
282 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
cache: 'pip' | ||
|
||
- run: make install-dev | ||
|
||
- run: make lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
venv | ||
/static/*.min.js | ||
.env | ||
sqlite |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pyright==1.1.355 | ||
pyright==1.1.356 | ||
ruff==0.3.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from typing import Literal | ||
|
||
from fastapi import APIRouter, Response | ||
from fastapi.responses import PlainTextResponse | ||
|
||
router = APIRouter( | ||
prefix="", | ||
tags=["Miscellaneous"], | ||
) | ||
|
||
|
||
@router.get( | ||
"/healthz", | ||
response_model=Literal["OK"], | ||
) | ||
async def health_check(): | ||
return Response( | ||
"OK", | ||
media_type="text/plain", | ||
) | ||
|
||
|
||
@router.get( | ||
"/robots.txt", | ||
response_class=PlainTextResponse, | ||
) | ||
async def get_robots_txt(): | ||
return PlainTextResponse( | ||
"User-agent: *\nDisallow: /html-api", | ||
media_type="text/plain", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,30 @@ | ||
from typing import Literal | ||
|
||
from fastapi import APIRouter, Query, Response | ||
from fastapi import APIRouter | ||
from fastapi.requests import Request | ||
from fastapi.responses import HTMLResponse | ||
|
||
from text_search_app.search_indexes.algolia import get_items | ||
from text_search_app.search_indexes import indexes | ||
from text_search_app.templates import make_template_response | ||
|
||
router = APIRouter( | ||
prefix="", | ||
tags=["Front-end HTML pages"], | ||
) | ||
|
||
|
||
@router.get( | ||
"/healthz", | ||
response_model=Literal["OK"], | ||
tags=["Others"], | ||
) | ||
async def health_check(): | ||
return Response( | ||
"OK", | ||
media_type="text/plain", | ||
) | ||
|
||
|
||
@router.get( | ||
"/robots.txt", | ||
tags=["Others"], | ||
) | ||
async def get_robots_txt(): | ||
return Response( | ||
"User-agent: *\nDisallow: /html-api", | ||
media_type="text/plain", | ||
) | ||
|
||
|
||
@router.get( | ||
"/", | ||
response_class=HTMLResponse, | ||
tags=["Front-end HTML pages"], | ||
) | ||
async def get_index_html( | ||
request: Request, | ||
search_query: str = Query( | ||
default="", | ||
), | ||
# TODO: later one could add a search_query query params to preserve the user state | ||
): | ||
return make_template_response( | ||
"index", | ||
request, | ||
{ | ||
"items": get_items(search_query), | ||
"items": indexes.get_items( | ||
search_query=None, | ||
), | ||
}, | ||
) |
Oops, something went wrong.