[chore] format code
This commit is contained in:
parent
3eb22ce9db
commit
da6b51fc5f
5 changed files with 20 additions and 11 deletions
|
@ -13,6 +13,7 @@ from app.config import DB_PATH
|
|||
from app.config import DEBUG
|
||||
from app.config import SQLALCHEMY_DATABASE_URL
|
||||
|
||||
|
||||
engine = create_engine(
|
||||
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False, "timeout": 15}
|
||||
)
|
||||
|
|
|
@ -3,6 +3,7 @@ from pathlib import Path
|
|||
|
||||
from Crypto.PublicKey import RSA
|
||||
|
||||
|
||||
def get_pubkey_as_pem(key_path: Path) -> str:
|
||||
text = key_path.read_text()
|
||||
return RSA.import_key(text).public_key().export_key("PEM").decode("utf-8")
|
||||
|
|
|
@ -24,9 +24,11 @@ from sqlalchemy.orm import relationship
|
|||
from datetime import datetime as dtime
|
||||
from datetime import timezone
|
||||
|
||||
|
||||
def now() -> dtime:
|
||||
return dtime.now(timezone.utc)
|
||||
|
||||
|
||||
class Actor(Base, BaseActor):
|
||||
__tablename__ = "actor"
|
||||
|
||||
|
@ -43,6 +45,7 @@ class Actor(Base, BaseActor):
|
|||
is_blocked = Column(Boolean, nullable=False, default=False, server_default="0")
|
||||
is_deleted = Column(Boolean, nullable=False, default=False, server_default="0")
|
||||
|
||||
|
||||
class InboxObject(Base, BaseObject):
|
||||
__tablename__ = "inbox"
|
||||
|
||||
|
@ -90,6 +93,7 @@ class InboxObject(Base, BaseObject):
|
|||
uselist=False,
|
||||
)
|
||||
|
||||
|
||||
class OutboxObject(Base, BaseObject):
|
||||
__tablename__ = "outbox"
|
||||
|
||||
|
@ -147,6 +151,7 @@ class OutboxObject(Base, BaseObject):
|
|||
uselist=False,
|
||||
)
|
||||
|
||||
|
||||
class IncomingActivity(Base):
|
||||
__tablename__ = "ingress"
|
||||
|
||||
|
@ -156,6 +161,7 @@ class IncomingActivity(Base):
|
|||
ap_id = Column(String, nullable=True, index=True)
|
||||
ap_object = Column(JSON, nullable=True)
|
||||
|
||||
|
||||
class OutcomingActivity(Base):
|
||||
__tablename__ = "push"
|
||||
|
||||
|
@ -165,6 +171,7 @@ class OutcomingActivity(Base):
|
|||
ap_id = Column(String, nullable=True, index=True)
|
||||
ap_object = Column(JSON, nullable=True)
|
||||
|
||||
|
||||
class Follower(Base):
|
||||
__tablename__ = "follower"
|
||||
|
||||
|
@ -180,6 +187,7 @@ class Follower(Base):
|
|||
|
||||
ap_actor_id = Column(String, nullable=False, unique=True)
|
||||
|
||||
|
||||
class Following(Base):
|
||||
__tablename__ = "following"
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ async def inbox_prechecker(
|
|||
)
|
||||
).one_or_none()
|
||||
):
|
||||
|
||||
logger.info(f"Dropping unnecessary delete activity " +
|
||||
payload["actor"])
|
||||
raise fastapi.HTTPException(status_code=202)
|
||||
|
|
Loading…
Reference in a new issue