add barkshark-lib

This commit is contained in:
Izalia Mae 2024-04-19 22:12:32 -04:00
parent 026f5bd11d
commit e6c8ed5504
7 changed files with 19 additions and 21 deletions

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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__

View file

@ -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)

View file

@ -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]