Skip to content

Commit

Permalink
feat(server): readme for prod
Browse files Browse the repository at this point in the history
Signed-off-by: John Andersen <johnandersen777@protonmail.com>
  • Loading branch information
johnandersen777 committed Dec 2, 2024
1 parent d3f037d commit 751d8e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "atprotobin"
version = "0.2.0"
version = "0.3.0"
description = "ATProto based pastebin"
readme = {file = "README.md", content-type = "text/markdown"}
authors = [
Expand Down
17 changes: 12 additions & 5 deletions src/atprotobin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pathlib
import textwrap
import contextlib
import urllib.request
from typing import Annotated

import markdown2
Expand All @@ -27,11 +28,17 @@

@contextlib.asynccontextmanager
async def lifespan(app: FastAPI):
markdown_content = pathlib.Path(
__file__
).parents[2].joinpath(
"README.md",
).read_text()
try:
# For when in local dev
markdown_content = pathlib.Path(
__file__
).parents[2].joinpath(
"README.md",
).read_text()
except:
markdown_content = urllib.request.urlopen(
"https://github.com/publicdomainrelay/atprotobin/raw/refs/heads/main/README.md",
).read().decode()
readme_markdown_html = markdown2.markdown(
markdown_content,
extras=[
Expand Down

0 comments on commit 751d8e5

Please sign in to comment.