diff --git a/barkshark_social/enums.py b/barkshark_social/enums.py index 3b05a94..582e9ec 100644 --- a/barkshark_social/enums.py +++ b/barkshark_social/enums.py @@ -1,4 +1,4 @@ -from blib import IntEnum, StrEnum +from blib import IntEnum class PermissionLevel(IntEnum): @@ -8,10 +8,3 @@ class PermissionLevel(IntEnum): MODERATOR = 30 ADMIN = 40 OWNER = 50 - - -class SassOutputStyle(StrEnum): - NESTED = "nested" - EXPANDED = "expanded" - COMPACT = "compact" - COMPRESSED = "compressed" diff --git a/barkshark_social/middleware.py b/barkshark_social/middleware.py index 38319ac..2765a4a 100644 --- a/barkshark_social/middleware.py +++ b/barkshark_social/middleware.py @@ -5,8 +5,8 @@ import logging import traceback from aputils import Message, Signature, SignatureFailureError -from basgi import Client, HttpError, Request -from blib import JsonBase +from basgi import Client, Request +from blib import HttpError, JsonBase from typing import TYPE_CHECKING from .database.connection import Connection diff --git a/barkshark_social/routes/activitypub.py b/barkshark_social/routes/activitypub.py index 5073adb..e20cacf 100644 --- a/barkshark_social/routes/activitypub.py +++ b/barkshark_social/routes/activitypub.py @@ -1,7 +1,8 @@ import asyncio from aputils import Attachment, Message, ObjectType -from basgi import HttpError, Request, Response, router +from basgi import Request, Response, router +from blib import HttpError from ..processors import process_message diff --git a/barkshark_social/routes/frontend.py b/barkshark_social/routes/frontend.py index 6e54eec..434a9ea 100644 --- a/barkshark_social/routes/frontend.py +++ b/barkshark_social/routes/frontend.py @@ -1,6 +1,6 @@ from argon2.exceptions import VerifyMismatchError -from basgi import HttpError, FileResponse, Request, Response, TemplateResponse, router -from blib import HttpDate +from basgi import FileResponse, Request, Response, TemplateResponse, router +from blib import HttpDate, HttpError from datetime import timedelta from ..misc import get_resource @@ -85,7 +85,8 @@ async def handle_logout_get(request: Request) -> Response: with request.app.state.database.session(True) as s: s.del_cookie(cookie.value) - response.delete_cookie(cookie) + response.cookies.append(cookie) + response.delete_cookie(cname) except KeyError: pass diff --git a/barkshark_social/routes/misc.py b/barkshark_social/routes/misc.py index 5827a53..178f3e7 100644 --- a/barkshark_social/routes/misc.py +++ b/barkshark_social/routes/misc.py @@ -1,5 +1,6 @@ from aputils import HostMeta, HostMetaJson, Nodeinfo, NodeinfoProtocol, Webfinger, WellKnownNodeinfo -from basgi import HttpError, Request, Response, router +from basgi import Request, Response, router +from blib import HttpError from .. import __version__ diff --git a/barkshark_social/server.py b/barkshark_social/server.py index f7d60a4..26dd75b 100644 --- a/barkshark_social/server.py +++ b/barkshark_social/server.py @@ -6,6 +6,7 @@ import sys from aputils import Signer, register_validator from argon2 import PasswordHasher +from blib import HttpError from bsql import Database from pathlib import Path from typing import Any @@ -19,7 +20,6 @@ from .translations import Translations from basgi import ( Application as App, - HttpError, Request, Response, Template, @@ -40,9 +40,12 @@ class Application(App[Request, RequestState, AppState]): self.state.setup(cfg_path, language) self.error_handlers[HttpError] = self.handle_http_exception - self.add_static("/static", get_resource("frontend/static")) self.client.useragent = f"BarksharkSocial/{__version__} (https://{self.config.web_host})" + self.add_static( + "/static", get_resource("frontend/static"), cached = not self.state.config.dev + ) + self.on_request.connect(mw.FrontendAuthMiddleware) self.on_request.connect(mw.ActivitypubAuthMiddleware) diff --git a/pyproject.toml b/pyproject.toml index 443a5c2..2976b6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,14 +37,13 @@ classifiers = [ requires-python = ">= 3.11" dependencies = [ "argon2-cffi == 23.1.0", - "barkshark-sql == 0.1.3", + "barkshark-lib >= 0.1.1", + "barkshark-sql == 0.1.4", "click == 8.1.7", "pymemcache == 4.0.0", "pyyaml == 6.0.1", - "uvicorn[standard] == 0.29.0", - "barkshark-asgi @ https://git.barkshark.xyz/barkshark/basgi/archive/main.tar.gz", - "barkshark-lib @ https://git.barkshark.xyz/barkshark/blib/archive/main.tar.gz" + "barkshark-asgi[uvicorn] @ https://git.barkshark.xyz/barkshark/basgi/archive/main.tar.gz", ] [project.urls]