diff options
22 files changed, 260 insertions, 1 deletions
diff --git a/poetry.lock b/poetry.lock index d98419f..66c5265 100644 --- a/poetry.lock +++ b/poetry.lock @@ -763,6 +763,23 @@ test = ["async-timeout", "pytest", "pytest-asyncio (>=0.17)", "pytest-trio", "te trio = ["async_generator", "trio"] [[package]] +name = "jinja2" +version = "3.1.4" +description = "A very fast and expressive template engine." +optional = false +python-versions = ">=3.7" +files = [ + {file = "jinja2-3.1.4-py3-none-any.whl", hash = "sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d"}, + {file = "jinja2-3.1.4.tar.gz", hash = "sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369"}, +] + +[package.dependencies] +MarkupSafe = ">=2.0" + +[package.extras] +i18n = ["Babel (>=2.7)"] + +[[package]] name = "keyring" version = "24.3.1" description = "Store and access your passwords safely." @@ -2047,4 +2064,4 @@ test = ["pytest"] [metadata] lock-version = "2.0" python-versions = "^3.12.0" -content-hash = "23165f45d667eb70355dbd76143922d5c819535437346e810485276b8bd6755c" +content-hash = "2acca58e64603a36a7576b7b4655bc08ddc0f9207ebcafac5a45c3fb8a6a6261" diff --git a/pyproject.toml b/pyproject.toml index 50f1b28..5ebe28d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,7 @@ python = "^3.12.0" alembic = {version = "^1.13.2", extras = ["tz"]} fastapi = "^0.112.0" httpx = "^0.23.3" +jinja2 = "^3.1.4" sqlalchemy = {version = "^2.0.32", extras = ["asyncio"]} psycopg = {version = "^3.2.1", extras = ["binary"]} pydantic = "^2.8.2" diff --git a/thallium-backend/requirements.txt b/thallium-backend/requirements.txt index d06fbbb..e8dedf7 100644 --- a/thallium-backend/requirements.txt +++ b/thallium-backend/requirements.txt @@ -90,6 +90,9 @@ httpx==0.23.3 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0 idna==3.7 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0" \ --hash=sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc \ --hash=sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0 +jinja2==3.1.4 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0" \ + --hash=sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369 \ + --hash=sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d mako==1.3.5 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0" \ --hash=sha256:260f1dbc3a519453a9c856dedfe4beb4e50bd5a26d96386cb6c80856556bb91a \ --hash=sha256:48dbc20568c1d276a2698b36d968fa76161bf127194907ea6fc594fa81f943bc diff --git a/thallium-backend/src/app.py b/thallium-backend/src/app.py index d3a29e0..ee2fad7 100644 --- a/thallium-backend/src/app.py +++ b/thallium-backend/src/app.py @@ -5,6 +5,7 @@ from collections.abc import Awaitable, Callable from fastapi import FastAPI, Request, Response from fastapi.exceptions import RequestValidationError from fastapi.responses import JSONResponse +from fastapi.staticfiles import StaticFiles from src.routes import top_level_router from src.settings import CONFIG @@ -12,6 +13,7 @@ from src.settings import CONFIG log = logging.getLogger(__name__) fastapi_app = FastAPI(debug=CONFIG.debug, root_path=CONFIG.app_prefix) +fastapi_app.mount("/static", StaticFiles(directory="src/static"), name="static") fastapi_app.include_router(top_level_router) diff --git a/thallium-backend/src/settings.py b/thallium-backend/src/settings.py index 62accab..672d8ae 100644 --- a/thallium-backend/src/settings.py +++ b/thallium-backend/src/settings.py @@ -6,6 +6,7 @@ import httpx import pydantic import pydantic_settings from fastapi import Depends +from fastapi.templating import Jinja2Templates from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine log = getLogger(__name__) @@ -30,6 +31,7 @@ class _Config( printful_token: pydantic.SecretStr app_prefix: str = "" + templates: Jinja2Templates = Jinja2Templates(directory="src/templates") CONFIG = _Config() diff --git a/thallium-backend/src/static/base.css b/thallium-backend/src/static/base.css new file mode 100644 index 0000000..aba5aaf --- /dev/null +++ b/thallium-backend/src/static/base.css @@ -0,0 +1,173 @@ +:root { + --docs-light: #2D3134; + --docs-dark: #23272A; + --blurple: #7289DA; + --docs-text-light: #92d6ff; + --docs-input-background: #0f141a; + --docs-text-teal: #c1f0f1; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +html { + height: 100%; +} + +body { + font-family: "Hind", "Helvetica", "Arial", sans-serif; + display: flex; + align-items: center; + justify-content: center; + height: 100%; +} + +h1, +p { + margin: 0; + padding: 0; + line-height: 125%; +} + +h1 { + margin-bottom: 15px; + font-size: 26px; +} + +a { + color: var(--blurple); + text-decoration: none; +} + +.main-box { + display: flex; + flex-direction: column; + max-width: 512px; + background-color: white; + border-radius: 15px; + overflow: hidden; + box-shadow: 5px 7px 40px rgba(0, 0, 0, 0.432); +} + +.header-box { + display: flex; + flex-direction: column; + justify-content: center; + height: 120px; + width: auto; + padding: 15px; + background-color: var(--docs-light); +} + +.header-content { + align-self: center; +} + +.header-content > h1 { + color: white; + font-size: 75px; + font-weight: bold; + letter-spacing: -1px; + line-height: 1; + margin-bottom: -10px; +} + +.header-content > p { + flex-direction: column; + color: #CAD6FF; + font-size: 25px; + font-weight: bold; + letter-spacing: -1px; + line-height: 1; + text-align: center; +} + +.logo-box > a { + display: flex; + justify-content: center; + height: 120px; + width: auto; + padding: 15px; + background-color: var(--docs-light); +} + +.content-box { + flex-direction: row; + height: auto; + padding: 25px 25px 0 25px; + background-color: var(--docs-dark); + color: #fff; +} + +#api-token { + background-color: var(--docs-input-background); + font-family: monospace; + font-size: 18px; + text-align: center; + padding: 5px 6px 5px 5px; + width: 100%; + color: var(--docs-text-teal); + border: #758ad4 1px solid; + border-radius: 5px; + cursor: pointer; + transition: 0.3s; + text-overflow: ellipsis; +} + +#api-token:focus { + outline: 0 solid white; +} + +button { + float: right; + padding: 0 10px 0 20px; + font-family: monospace; + font-size: 20px; + font-weight: 600; + border-radius: 5px; + background-color: var(--blurple); + border: none; + transition: 0.3s; + cursor: pointer; + color: white; + margin-left: -2.5%; + clip-path: polygon(10% 0%, 100% 0%, 100% 100%, 10% 100%); + +} + +#token-div { + display: flex; + transition: 0.3s; +} + +#token-div:hover > button { + background-color: #333c5c; +} + +#token-div:hover > #api-token { + border-color: #333c5c; +} + +#api-token:focus-visible { + border-color: forestgreen !important; +} + +#api-token:focus-visible ~ #token-button { + background-color: forestgreen; +} + +#api-token:focus-visible ~ #token-button > span { + display: none +} + +#api-token:focus-visible ~ #token-button:after { + content: "Copied"; +} + + +ul { + margin: 20px; +} diff --git a/thallium-backend/src/static/favicons/README.md b/thallium-backend/src/static/favicons/README.md new file mode 100644 index 0000000..054dbcf --- /dev/null +++ b/thallium-backend/src/static/favicons/README.md @@ -0,0 +1,23 @@ +# Your Favicon Package + +This package was generated with [RealFaviconGenerator](https://realfavicongenerator.net/) [v0.16](https://realfavicongenerator.net/change_log#v0.16) + +## Install instructions + +To install this package: + +Extract this package in <code><web site>/static/favicons/</code>. If your site is <code>http://www.example.com</code>, you should be able to access a file named <code>http://www.example.com/static/favicons/favicon.ico</code>. + +Insert the following code in the `head` section of your pages: + + <link rel="apple-touch-icon" sizes="180x180" href="/static/favicons/apple-touch-icon.png?v=9B9vkE5q7O"> + <link rel="icon" type="image/png" sizes="32x32" href="/static/favicons/favicon-32x32.png?v=9B9vkE5q7O"> + <link rel="icon" type="image/png" sizes="16x16" href="/static/favicons/favicon-16x16.png?v=9B9vkE5q7O"> + <link rel="manifest" href="/static/favicons/site.webmanifest?v=9B9vkE5q7O"> + <link rel="mask-icon" href="/static/favicons/safari-pinned-tab.svg?v=9B9vkE5q7O" color="#7289da"> + <link rel="shortcut icon" href="/static/favicons/favicon.ico?v=9B9vkE5q7O"> + <meta name="msapplication-TileColor" content="#7289da"> + <meta name="msapplication-config" content="/static/favicons/browserconfig.xml?v=9B9vkE5q7O"> + <meta name="theme-color" content="#7289da"> + +*Optional* - Check your favicon with the [favicon checker](https://realfavicongenerator.net/favicon_checker) diff --git a/thallium-backend/src/static/favicons/android-chrome-192x192.png b/thallium-backend/src/static/favicons/android-chrome-192x192.png Binary files differnew file mode 100644 index 0000000..5b8e4de --- /dev/null +++ b/thallium-backend/src/static/favicons/android-chrome-192x192.png diff --git a/thallium-backend/src/static/favicons/android-chrome-512x512.png b/thallium-backend/src/static/favicons/android-chrome-512x512.png Binary files differnew file mode 100644 index 0000000..260d57e --- /dev/null +++ b/thallium-backend/src/static/favicons/android-chrome-512x512.png diff --git a/thallium-backend/src/static/favicons/apple-touch-icon.png b/thallium-backend/src/static/favicons/apple-touch-icon.png Binary files differnew file mode 100644 index 0000000..bcee3b3 --- /dev/null +++ b/thallium-backend/src/static/favicons/apple-touch-icon.png diff --git a/thallium-backend/src/static/favicons/browserconfig.xml b/thallium-backend/src/static/favicons/browserconfig.xml new file mode 100644 index 0000000..c0529c4 --- /dev/null +++ b/thallium-backend/src/static/favicons/browserconfig.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<browserconfig> + <msapplication> + <tile> + <square150x150logo src="/static/favicons/mstile-150x150.png?v=9B9vkE5q7O"/> + <TileColor>#7289da</TileColor> + </tile> + </msapplication> +</browserconfig> diff --git a/thallium-backend/src/static/favicons/favicon-16x16.png b/thallium-backend/src/static/favicons/favicon-16x16.png Binary files differnew file mode 100644 index 0000000..97d9d7e --- /dev/null +++ b/thallium-backend/src/static/favicons/favicon-16x16.png diff --git a/thallium-backend/src/static/favicons/favicon-32x32.png b/thallium-backend/src/static/favicons/favicon-32x32.png Binary files differnew file mode 100644 index 0000000..9acca4b --- /dev/null +++ b/thallium-backend/src/static/favicons/favicon-32x32.png diff --git a/thallium-backend/src/static/favicons/favicon.ico b/thallium-backend/src/static/favicons/favicon.ico Binary files differnew file mode 100644 index 0000000..6f2da14 --- /dev/null +++ b/thallium-backend/src/static/favicons/favicon.ico diff --git a/thallium-backend/src/static/favicons/html_code.html b/thallium-backend/src/static/favicons/html_code.html new file mode 100644 index 0000000..564d5ea --- /dev/null +++ b/thallium-backend/src/static/favicons/html_code.html @@ -0,0 +1,9 @@ +<link rel="apple-touch-icon" sizes="180x180" href="/static/favicons/apple-touch-icon.png?v=9B9vkE5q7O"> +<link rel="icon" type="image/png" sizes="32x32" href="/static/favicons/favicon-32x32.png?v=9B9vkE5q7O"> +<link rel="icon" type="image/png" sizes="16x16" href="/static/favicons/favicon-16x16.png?v=9B9vkE5q7O"> +<link rel="manifest" href="/static/favicons/site.webmanifest?v=9B9vkE5q7O"> +<link rel="mask-icon" href="/static/favicons/safari-pinned-tab.svg?v=9B9vkE5q7O" color="#7289da"> +<link rel="shortcut icon" href="/static/favicons/favicon.ico?v=9B9vkE5q7O"> +<meta name="msapplication-TileColor" content="#7289da"> +<meta name="msapplication-config" content="/static/favicons/browserconfig.xml?v=9B9vkE5q7O"> +<meta name="theme-color" content="#7289da"> diff --git a/thallium-backend/src/static/favicons/mstile-144x144.png b/thallium-backend/src/static/favicons/mstile-144x144.png Binary files differnew file mode 100644 index 0000000..734c4d1 --- /dev/null +++ b/thallium-backend/src/static/favicons/mstile-144x144.png diff --git a/thallium-backend/src/static/favicons/mstile-150x150.png b/thallium-backend/src/static/favicons/mstile-150x150.png Binary files differnew file mode 100644 index 0000000..c0f2947 --- /dev/null +++ b/thallium-backend/src/static/favicons/mstile-150x150.png diff --git a/thallium-backend/src/static/favicons/mstile-310x150.png b/thallium-backend/src/static/favicons/mstile-310x150.png Binary files differnew file mode 100644 index 0000000..6806f40 --- /dev/null +++ b/thallium-backend/src/static/favicons/mstile-310x150.png diff --git a/thallium-backend/src/static/favicons/mstile-310x310.png b/thallium-backend/src/static/favicons/mstile-310x310.png Binary files differnew file mode 100644 index 0000000..1be6d14 --- /dev/null +++ b/thallium-backend/src/static/favicons/mstile-310x310.png diff --git a/thallium-backend/src/static/favicons/mstile-70x70.png b/thallium-backend/src/static/favicons/mstile-70x70.png Binary files differnew file mode 100644 index 0000000..1916fac --- /dev/null +++ b/thallium-backend/src/static/favicons/mstile-70x70.png diff --git a/thallium-backend/src/static/favicons/safari-pinned-tab.svg b/thallium-backend/src/static/favicons/safari-pinned-tab.svg new file mode 100644 index 0000000..3206487 --- /dev/null +++ b/thallium-backend/src/static/favicons/safari-pinned-tab.svg @@ -0,0 +1 @@ +<svg version="1" xmlns="http://www.w3.org/2000/svg" width="933.333" height="933.333" viewBox="0 0 700.000000 700.000000"><path d="M321.8.5c-.1.1-5.1.6-10.9.9-5.8.4-11.5.8-12.5 1-1 .2-5.5.7-9.9 1.1-4.4.4-8.9.9-10 1-31.2 5.2-44.4 8.9-60.5 16.7-13.5 6.7-22.9 15.5-28.2 26.8-3 6.3-5.4 13.2-4.8 14.2.1.2-.3 1.5-.8 2.9-1.8 4.6-2.5 19.7-2.6 56.1l-.1 35.8 3 .1c1.6 0 39.3.1 83.8.1H349l.1 2.9c0 1.6.1 5.8.1 9.4 0 3.6-.1 7.1-.1 7.8-.1 1-24.3 1.2-118.3 1.3-65.1 0-121.4.3-125.3.7-22.8 2.2-45.8 13.2-62.1 29.5-18.7 18.8-28.9 42.9-36 84.7-1.9 11.8-2.4 14.6-3 19.5-.3 3-.8 7.1-1.1 9-.9 6.9-1 40.7-.2 49 1.6 16.2 4.8 36.3 7.4 47 .8 3 1.6 6.6 1.8 8 2 10.6 7.7 28.1 12.8 38.8C38 492 56 508 81.8 515.2c7.2 2 10.1 2.2 43.2 2.2l35.5.1.2-42.5c.1-23.4.4-44.1.7-46 5.8-39.1 34.7-73.8 71.6-85.8 16.7-5.4 16.2-5.4 119-5.7 50.9-.1 94.1-.6 96-1 7.7-1.5 20.6-6.6 28.1-11.1 18.5-11.2 31.9-29.6 38.1-52.1 2.1-7.7 2.1-9.2 2.3-97.5.2-93.5.1-95.2-4.1-107.6-7.7-22.9-29.1-44.1-54.7-54.4-6.8-2.7-17.3-5.8-21.7-6.3-1.9-.3-5.7-.9-8.5-1.5-2.7-.5-7.2-1.2-10-1.6-2.7-.3-6.1-.7-7.5-.9-1.4-.2-6.1-.7-10.5-1.1-4.4-.4-9.3-.9-11-1.1-3.6-.5-66.2-1.3-66.7-.8zm-59.1 51.9c6.3 1.7 10.7 4.3 14.9 8.8 9.2 9.8 11.4 23.5 5.8 35.5-3.1 6.5-8 11.4-14.9 15.1-4.2 2.2-6.3 2.7-13 2.7s-8.9-.4-13.5-2.7c-9.4-4.6-14.9-11.1-17.3-20.8-4.4-17.1 6.4-34.9 23.7-39.1 4.9-1.1 8.7-1 14.3.5z"/><path d="M538.6 178.9c-.3.4-.6 19.5-.7 42.3-.1 36.1-.4 42.7-2 50.4-3.3 16.1-8.7 28.6-17.7 41.3-6.9 9.7-11.8 14.9-21.2 22.2-4.1 3.3-8 6.3-8.6 6.8-.6.5-5.8 3.2-11.5 5.9-10.7 5.2-21.3 8.5-30.9 9.8-3 .4-46.9.8-97.5.9-50.6.1-93.6.5-95.5.9-22.7 4.5-40 15.1-53.5 32.6-7.9 10.3-14.8 25.5-16 35.7-.4 2.6-.9 5.6-1.1 6.6-1.1 3.7-.5 174.1.6 180.2 1.4 7.7 1.2 7 3.9 14 10.2 27 40.7 48.6 85.7 60.6 12.3 3.3 12.2 3.2 23.4 5.5 25.9 5.3 63.4 6.6 89 3 29.7-4.1 58.5-12.3 79.5-22.6 29.8-14.5 46.8-34.3 51.3-59.5.4-2.2.7-20.4.7-40.5v-36.4l-83.5-.1h-83.5v-9.8c0-5.7.4-10.1 1-10.5.5-.4 59-.7 130-.8 71 0 131-.4 133.4-.8 20.3-3.4 35.2-13.4 47.8-32.4 5.8-8.6 14.4-26.8 18.8-39.5 1.3-4 3.2-9.2 4.1-11.7 4.9-13.7 10.4-40.1 12-57.5.8-9 .8-34.1 0-42.5-1.3-14.1-1.8-17.9-2.6-23-.5-3-1.1-7.1-1.4-9-.8-5.2-4.3-22.3-6.6-32-1.1-4.7-2.3-9.4-2.5-10.5-3.1-13.5-13.8-38-20.9-47.8-6.8-9.6-19.3-21.7-22.4-21.7-.6 0-1.2-.4-1.4-.8-.7-1.9-13.6-6.7-23.3-8.8-4.3-.9-76.4-1.4-76.9-.5zm-81.2 405.7c6.8 3.3 12.5 9.3 15.4 16.4 3.2 7.7 2.6 19.6-1.3 26.9-5.8 10.6-15.5 16.4-27.5 16.5-9 .1-16.7-3-22.5-9.1-9.1-9.3-11.6-24-6.3-35.5 7.5-16.2 26.3-23 42.2-15.2z"/></svg> diff --git a/thallium-backend/src/static/favicons/site.webmanifest b/thallium-backend/src/static/favicons/site.webmanifest new file mode 100644 index 0000000..1c59aa6 --- /dev/null +++ b/thallium-backend/src/static/favicons/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "Python Discord", + "short_name": "Python Discord", + "icons": [ + { + "src": "/static/favicons/android-chrome-192x192.png?v=9B9vkE5q7O", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/static/favicons/android-chrome-512x512.png?v=9B9vkE5q7O", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#7289da", + "background_color": "#7289da", + "display": "standalone" +} |