Convert text file line endings to LF.
This commit is contained in:
parent
67d5db425f
commit
1ee9c1bfa7
166 changed files with 33162 additions and 33162 deletions
|
@ -1,21 +1,21 @@
|
|||
from .alts import *
|
||||
from .badges import *
|
||||
from .clients import *
|
||||
from .comment import *
|
||||
from .domains import *
|
||||
from .flags import *
|
||||
from .user import *
|
||||
from .userblock import *
|
||||
from .submission import *
|
||||
from .votes import *
|
||||
from .domains import *
|
||||
from .subscriptions import *
|
||||
from files.__main__ import app
|
||||
from .mod_logs import *
|
||||
from .award import *
|
||||
from .marsey import *
|
||||
from .sub_block import *
|
||||
from .saves import *
|
||||
from .views import *
|
||||
from .notifications import *
|
||||
from .alts import *
|
||||
from .badges import *
|
||||
from .clients import *
|
||||
from .comment import *
|
||||
from .domains import *
|
||||
from .flags import *
|
||||
from .user import *
|
||||
from .userblock import *
|
||||
from .submission import *
|
||||
from .votes import *
|
||||
from .domains import *
|
||||
from .subscriptions import *
|
||||
from files.__main__ import app
|
||||
from .mod_logs import *
|
||||
from .award import *
|
||||
from .marsey import *
|
||||
from .sub_block import *
|
||||
from .saves import *
|
||||
from .views import *
|
||||
from .notifications import *
|
||||
from .follows import *
|
|
@ -1,14 +1,14 @@
|
|||
from sqlalchemy import *
|
||||
from files.__main__ import Base
|
||||
|
||||
|
||||
class Alt(Base):
|
||||
__tablename__ = "alts"
|
||||
|
||||
user1 = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
user2 = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
is_manual = Column(Boolean, default=False)
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
return f"<Alt(id={self.id})>"
|
||||
from sqlalchemy import *
|
||||
from files.__main__ import Base
|
||||
|
||||
|
||||
class Alt(Base):
|
||||
__tablename__ = "alts"
|
||||
|
||||
user1 = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
user2 = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
is_manual = Column(Boolean, default=False)
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
return f"<Alt(id={self.id})>"
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from os import environ
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import *
|
||||
|
||||
class AwardRelationship(Base):
|
||||
|
||||
__tablename__ = "award_relationships"
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"))
|
||||
submission_id = Column(Integer, ForeignKey("submissions.id"))
|
||||
comment_id = Column(Integer, ForeignKey("comments.id"))
|
||||
kind = Column(String)
|
||||
|
||||
user = relationship("User", primaryjoin="AwardRelationship.user_id==User.id", viewonly=True)
|
||||
post = relationship("Submission", primaryjoin="AwardRelationship.submission_id==Submission.id", viewonly=True)
|
||||
comment = relationship("Comment", primaryjoin="AwardRelationship.comment_id==Comment.id", viewonly=True)
|
||||
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def type(self):
|
||||
return AWARDS[self.kind]
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def title(self):
|
||||
return self.type['title']
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def class_list(self):
|
||||
return self.type['icon']+' '+self.type['color']
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from os import environ
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import *
|
||||
|
||||
class AwardRelationship(Base):
|
||||
|
||||
__tablename__ = "award_relationships"
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"))
|
||||
submission_id = Column(Integer, ForeignKey("submissions.id"))
|
||||
comment_id = Column(Integer, ForeignKey("comments.id"))
|
||||
kind = Column(String)
|
||||
|
||||
user = relationship("User", primaryjoin="AwardRelationship.user_id==User.id", viewonly=True)
|
||||
post = relationship("Submission", primaryjoin="AwardRelationship.submission_id==Submission.id", viewonly=True)
|
||||
comment = relationship("Comment", primaryjoin="AwardRelationship.comment_id==Comment.id", viewonly=True)
|
||||
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def type(self):
|
||||
return AWARDS[self.kind]
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def title(self):
|
||||
return self.type['title']
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def class_list(self):
|
||||
return self.type['icon']+' '+self.type['color']
|
||||
|
|
|
@ -1,73 +1,73 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base, app
|
||||
from os import environ
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import *
|
||||
from datetime import datetime
|
||||
from json import loads
|
||||
|
||||
class BadgeDef(Base):
|
||||
__tablename__ = "badge_defs"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
name = Column(String)
|
||||
description = Column(String)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<BadgeDef(id={self.id})>"
|
||||
|
||||
|
||||
class Badge(Base):
|
||||
|
||||
__tablename__ = "badges"
|
||||
|
||||
user_id = Column(Integer, ForeignKey('users.id'), primary_key=True)
|
||||
badge_id = Column(Integer, ForeignKey('badge_defs.id'), primary_key=True)
|
||||
description = Column(String)
|
||||
url = Column(String)
|
||||
|
||||
user = relationship("User", viewonly=True)
|
||||
badge = relationship("BadgeDef", primaryjoin="foreign(Badge.badge_id) == remote(BadgeDef.id)", viewonly=True)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Badge(user_id={self.user_id}, badge_id={self.badge_id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def text(self):
|
||||
if self.name == "Chud":
|
||||
ti = self.user.agendaposter
|
||||
if ti: text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
|
||||
else: text = self.badge.description + " permanently"
|
||||
elif self.badge_id in {94,95,96,97,98,109}:
|
||||
if self.badge_id == 94: ti = self.user.progressivestack
|
||||
elif self.badge_id == 95: ti = self.user.bird
|
||||
elif self.badge_id == 96: ti = self.user.flairchanged
|
||||
elif self.badge_id == 97: ti = self.user.longpost
|
||||
elif self.badge_id == 98: ti = self.user.marseyawarded
|
||||
elif self.badge_id == 109: ti = self.user.rehab
|
||||
text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
|
||||
elif self.description: text = self.description
|
||||
elif self.badge.description: text = self.badge.description
|
||||
else: return self.name
|
||||
return f'{self.name} - {text}'
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def name(self):
|
||||
return self.badge.name
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def path(self):
|
||||
return f"/assets/images/badges/{self.badge_id}.webp"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def json(self):
|
||||
return {'text': self.text,
|
||||
'name': self.name,
|
||||
'url': self.url,
|
||||
'icon_url':self.path
|
||||
}
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base, app
|
||||
from os import environ
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import *
|
||||
from datetime import datetime
|
||||
from json import loads
|
||||
|
||||
class BadgeDef(Base):
|
||||
__tablename__ = "badge_defs"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
name = Column(String)
|
||||
description = Column(String)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<BadgeDef(id={self.id})>"
|
||||
|
||||
|
||||
class Badge(Base):
|
||||
|
||||
__tablename__ = "badges"
|
||||
|
||||
user_id = Column(Integer, ForeignKey('users.id'), primary_key=True)
|
||||
badge_id = Column(Integer, ForeignKey('badge_defs.id'), primary_key=True)
|
||||
description = Column(String)
|
||||
url = Column(String)
|
||||
|
||||
user = relationship("User", viewonly=True)
|
||||
badge = relationship("BadgeDef", primaryjoin="foreign(Badge.badge_id) == remote(BadgeDef.id)", viewonly=True)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Badge(user_id={self.user_id}, badge_id={self.badge_id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def text(self):
|
||||
if self.name == "Chud":
|
||||
ti = self.user.agendaposter
|
||||
if ti: text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
|
||||
else: text = self.badge.description + " permanently"
|
||||
elif self.badge_id in {94,95,96,97,98,109}:
|
||||
if self.badge_id == 94: ti = self.user.progressivestack
|
||||
elif self.badge_id == 95: ti = self.user.bird
|
||||
elif self.badge_id == 96: ti = self.user.flairchanged
|
||||
elif self.badge_id == 97: ti = self.user.longpost
|
||||
elif self.badge_id == 98: ti = self.user.marseyawarded
|
||||
elif self.badge_id == 109: ti = self.user.rehab
|
||||
text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
|
||||
elif self.description: text = self.description
|
||||
elif self.badge.description: text = self.badge.description
|
||||
else: return self.name
|
||||
return f'{self.name} - {text}'
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def name(self):
|
||||
return self.badge.name
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def path(self):
|
||||
return f"/assets/images/badges/{self.badge_id}.webp"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def json(self):
|
||||
return {'text': self.text,
|
||||
'name': self.name,
|
||||
'url': self.url,
|
||||
'icon_url':self.path
|
||||
}
|
||||
|
|
|
@ -1,84 +1,84 @@
|
|||
from flask import *
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from .submission import Submission
|
||||
from .comment import Comment
|
||||
from files.__main__ import Base
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import *
|
||||
import time
|
||||
|
||||
class OauthApp(Base):
|
||||
|
||||
__tablename__ = "oauth_apps"
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
client_id = Column(String)
|
||||
app_name = Column(String)
|
||||
redirect_uri = Column(String)
|
||||
description = Column(String)
|
||||
author_id = Column(Integer, ForeignKey("users.id"))
|
||||
|
||||
author = relationship("User", viewonly=True)
|
||||
|
||||
def __repr__(self): return f"<OauthApp(id={self.id})>"
|
||||
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_date(self):
|
||||
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_datetime(self):
|
||||
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def permalink(self): return f"/admin/app/{self.id}"
|
||||
|
||||
@lazy
|
||||
def idlist(self, page=1):
|
||||
|
||||
posts = g.db.query(Submission.id).filter_by(app_id=self.id)
|
||||
|
||||
posts=posts.order_by(Submission.created_utc.desc())
|
||||
|
||||
posts=posts.offset(100*(page-1)).limit(101)
|
||||
|
||||
return [x[0] for x in posts.all()]
|
||||
|
||||
@lazy
|
||||
def comments_idlist(self, page=1):
|
||||
|
||||
posts = g.db.query(Comment.id).filter_by(app_id=self.id)
|
||||
|
||||
posts=posts.order_by(Comment.created_utc.desc())
|
||||
|
||||
posts=posts.offset(100*(page-1)).limit(101)
|
||||
|
||||
return [x[0] for x in posts.all()]
|
||||
|
||||
|
||||
|
||||
class ClientAuth(Base):
|
||||
|
||||
__tablename__ = "client_auths"
|
||||
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
oauth_client = Column(Integer, ForeignKey("oauth_apps.id"), primary_key=True)
|
||||
access_token = Column(String)
|
||||
|
||||
user = relationship("User", viewonly=True)
|
||||
application = relationship("OauthApp", viewonly=True)
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_date(self):
|
||||
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_datetime(self):
|
||||
from flask import *
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from .submission import Submission
|
||||
from .comment import Comment
|
||||
from files.__main__ import Base
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import *
|
||||
import time
|
||||
|
||||
class OauthApp(Base):
|
||||
|
||||
__tablename__ = "oauth_apps"
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
client_id = Column(String)
|
||||
app_name = Column(String)
|
||||
redirect_uri = Column(String)
|
||||
description = Column(String)
|
||||
author_id = Column(Integer, ForeignKey("users.id"))
|
||||
|
||||
author = relationship("User", viewonly=True)
|
||||
|
||||
def __repr__(self): return f"<OauthApp(id={self.id})>"
|
||||
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_date(self):
|
||||
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_datetime(self):
|
||||
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def permalink(self): return f"/admin/app/{self.id}"
|
||||
|
||||
@lazy
|
||||
def idlist(self, page=1):
|
||||
|
||||
posts = g.db.query(Submission.id).filter_by(app_id=self.id)
|
||||
|
||||
posts=posts.order_by(Submission.created_utc.desc())
|
||||
|
||||
posts=posts.offset(100*(page-1)).limit(101)
|
||||
|
||||
return [x[0] for x in posts.all()]
|
||||
|
||||
@lazy
|
||||
def comments_idlist(self, page=1):
|
||||
|
||||
posts = g.db.query(Comment.id).filter_by(app_id=self.id)
|
||||
|
||||
posts=posts.order_by(Comment.created_utc.desc())
|
||||
|
||||
posts=posts.offset(100*(page-1)).limit(101)
|
||||
|
||||
return [x[0] for x in posts.all()]
|
||||
|
||||
|
||||
|
||||
class ClientAuth(Base):
|
||||
|
||||
__tablename__ = "client_auths"
|
||||
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
oauth_client = Column(Integer, ForeignKey("oauth_apps.id"), primary_key=True)
|
||||
access_token = Column(String)
|
||||
|
||||
user = relationship("User", viewonly=True)
|
||||
application = relationship("OauthApp", viewonly=True)
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_date(self):
|
||||
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_datetime(self):
|
||||
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
|
|
@ -1,8 +1,8 @@
|
|||
from sqlalchemy import *
|
||||
from files.__main__ import Base
|
||||
|
||||
class BannedDomain(Base):
|
||||
|
||||
__tablename__ = "banneddomains"
|
||||
domain = Column(String, primary_key=True)
|
||||
from sqlalchemy import *
|
||||
from files.__main__ import Base
|
||||
|
||||
class BannedDomain(Base):
|
||||
|
||||
__tablename__ = "banneddomains"
|
||||
domain = Column(String, primary_key=True)
|
||||
reason = Column(String)
|
|
@ -1,71 +1,71 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import *
|
||||
import time
|
||||
|
||||
class Flag(Base):
|
||||
|
||||
__tablename__ = "flags"
|
||||
|
||||
post_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
reason = Column(String)
|
||||
created_utc = Column(Integer)
|
||||
|
||||
user = relationship("User", primaryjoin = "Flag.user_id == User.id", uselist = False, viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Flag(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_date(self):
|
||||
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_datetime(self):
|
||||
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
|
||||
|
||||
@lazy
|
||||
def realreason(self, v):
|
||||
return censor_slurs(self.reason, v)
|
||||
|
||||
|
||||
class CommentFlag(Base):
|
||||
|
||||
__tablename__ = "commentflags"
|
||||
|
||||
comment_id = Column(Integer, ForeignKey("comments.id"), primary_key=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
reason = Column(String)
|
||||
created_utc = Column(Integer)
|
||||
|
||||
user = relationship("User", primaryjoin = "CommentFlag.user_id == User.id", uselist = False, viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<CommentFlag(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_date(self):
|
||||
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_datetime(self):
|
||||
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
|
||||
|
||||
@lazy
|
||||
def realreason(self, v):
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import *
|
||||
import time
|
||||
|
||||
class Flag(Base):
|
||||
|
||||
__tablename__ = "flags"
|
||||
|
||||
post_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
reason = Column(String)
|
||||
created_utc = Column(Integer)
|
||||
|
||||
user = relationship("User", primaryjoin = "Flag.user_id == User.id", uselist = False, viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Flag(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_date(self):
|
||||
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_datetime(self):
|
||||
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
|
||||
|
||||
@lazy
|
||||
def realreason(self, v):
|
||||
return censor_slurs(self.reason, v)
|
||||
|
||||
|
||||
class CommentFlag(Base):
|
||||
|
||||
__tablename__ = "commentflags"
|
||||
|
||||
comment_id = Column(Integer, ForeignKey("comments.id"), primary_key=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
reason = Column(String)
|
||||
created_utc = Column(Integer)
|
||||
|
||||
user = relationship("User", primaryjoin = "CommentFlag.user_id == User.id", uselist = False, viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<CommentFlag(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_date(self):
|
||||
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_datetime(self):
|
||||
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
|
||||
|
||||
@lazy
|
||||
def realreason(self, v):
|
||||
return censor_slurs(self.reason, v)
|
|
@ -1,424 +1,424 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
import time
|
||||
from files.helpers.lazy import lazy
|
||||
from os import environ
|
||||
from copy import deepcopy
|
||||
from files.helpers.const import *
|
||||
|
||||
class ModAction(Base):
|
||||
__tablename__ = "modactions"
|
||||
id = Column(Integer, primary_key=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"))
|
||||
kind = Column(String)
|
||||
target_user_id = Column(Integer, ForeignKey("users.id"))
|
||||
target_submission_id = Column(Integer, ForeignKey("submissions.id"))
|
||||
target_comment_id = Column(Integer, ForeignKey("comments.id"))
|
||||
_note=Column(String)
|
||||
created_utc = Column(Integer)
|
||||
|
||||
user = relationship("User", primaryjoin="User.id==ModAction.user_id", viewonly=True)
|
||||
target_user = relationship("User", primaryjoin="User.id==ModAction.target_user_id", viewonly=True)
|
||||
target_post = relationship("Submission", viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<ModAction(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def age_string(self):
|
||||
|
||||
age = int(time.time()) - self.created_utc
|
||||
|
||||
if age < 60:
|
||||
return "just now"
|
||||
elif age < 3600:
|
||||
minutes = int(age / 60)
|
||||
return f"{minutes}m ago"
|
||||
elif age < 86400:
|
||||
hours = int(age / 3600)
|
||||
return f"{hours}hr ago"
|
||||
elif age < 2678400:
|
||||
days = int(age / 86400)
|
||||
return f"{days}d ago"
|
||||
|
||||
now = time.gmtime()
|
||||
ctd = time.gmtime(self.created_utc)
|
||||
|
||||
months = now.tm_mon - ctd.tm_mon + 12 * (now.tm_year - ctd.tm_year)
|
||||
if now.tm_mday < ctd.tm_mday:
|
||||
months -= 1
|
||||
|
||||
if months < 12:
|
||||
return f"{months}mo ago"
|
||||
else:
|
||||
years = int(months / 12)
|
||||
return f"{years}yr ago"
|
||||
|
||||
|
||||
@property
|
||||
def note(self):
|
||||
|
||||
if self.kind=="ban_user":
|
||||
if self.target_post: return f'for <a href="{self.target_post.permalink}">post</a>'
|
||||
elif self.target_comment_id: return f'for <a href="/comment/{self.target_comment_id}">comment</a>'
|
||||
else: return self._note
|
||||
else:
|
||||
return self._note or ""
|
||||
|
||||
@note.setter
|
||||
def note(self, x):
|
||||
self._note=x
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def string(self):
|
||||
|
||||
output = ACTIONTYPES[self.kind]["str"].format(self=self, cc=CC_TITLE)
|
||||
|
||||
if self.note: output += f" <i>({self.note})</i>"
|
||||
|
||||
return output
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def target_link(self):
|
||||
if self.target_user: return f'<a href="{self.target_user.url}">{self.target_user.username}</a>'
|
||||
elif self.target_post:
|
||||
if self.target_post.club: return f'<a href="{self.target_post.permalink}">{CC} ONLY</a>'
|
||||
return f'<a href="{self.target_post.permalink}">{self.target_post.title_html}</a>'
|
||||
elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}?context=8#context">comment</a>'
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def icon(self):
|
||||
return ACTIONTYPES[self.kind]['icon']
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def color(self):
|
||||
return ACTIONTYPES[self.kind]['color']
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def permalink(self):
|
||||
return f"/log/{self.id}"
|
||||
|
||||
ACTIONTYPES = {
|
||||
'agendaposter': {
|
||||
"str": 'set chud theme on {self.target_link}',
|
||||
"icon": 'fa-snooze',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'approve_app': {
|
||||
"str": 'approved an application by {self.target_link}',
|
||||
"icon": 'fa-robot',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'badge_grant': {
|
||||
"str": 'granted badge to {self.target_link}',
|
||||
"icon": 'fa-badge',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'badge_remove': {
|
||||
"str": 'removed badge from {self.target_link}',
|
||||
"icon": 'fa-badge',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'ban_comment': {
|
||||
"str": 'removed {self.target_link}',
|
||||
"icon": 'fa-comment',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'ban_domain': {
|
||||
"str": 'banned a domain',
|
||||
"icon": 'fa-globe',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'ban_post': {
|
||||
"str": 'removed post {self.target_link}',
|
||||
"icon": 'fa-feather-alt',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'ban_user': {
|
||||
"str": 'banned user {self.target_link}',
|
||||
"icon": 'fa-user-slash',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'change_sidebar': {
|
||||
"str": 'changed the sidebar',
|
||||
"icon": 'fa-columns',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'check': {
|
||||
"str": 'gave {self.target_link} a checkmark',
|
||||
"icon": 'fa-badge-check',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'club_allow': {
|
||||
"str": 'allowed user {self.target_link} into the {cc}',
|
||||
"icon": 'fa-golf-club',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'club_ban': {
|
||||
"str": 'disallowed user {self.target_link} from the {cc}',
|
||||
"icon": 'fa-golf-club',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'delete_report': {
|
||||
"str": 'deleted report on {self.target_link}',
|
||||
"icon": 'fa-flag',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_Bots': {
|
||||
"str": 'disabled Bots',
|
||||
"icon": 'fa-robot',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_Fart mode': {
|
||||
"str": 'disabled fart mode',
|
||||
"icon": 'fa-gas-pump-slash',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_Read-only mode': {
|
||||
"str": 'disabled readonly mode',
|
||||
"icon": 'fa-book',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_Signups': {
|
||||
"str": 'disabled Signups',
|
||||
"icon": 'fa-users',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_under_attack': {
|
||||
"str": 'disabled under attack mode',
|
||||
"icon": 'fa-shield',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'distinguish_comment': {
|
||||
"str": 'distinguished {self.target_link}',
|
||||
"icon": 'fa-crown',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'distinguish_post': {
|
||||
"str": 'distinguished {self.target_link}',
|
||||
"icon": 'fa-crown',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'distribute': {
|
||||
"str": 'distributed bet winnings to voters on {self.target_link}',
|
||||
"icon": 'fa-dollar-sign',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'dump_cache': {
|
||||
"str": 'dumped cache',
|
||||
"icon": 'fa-trash-alt',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'edit_post': {
|
||||
"str": 'edited {self.target_link}',
|
||||
"icon": 'fa-edit',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'enable_Bots': {
|
||||
"str": 'enabled Bots',
|
||||
"icon": 'fa-robot',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_Fart mode': {
|
||||
"str": 'enabled fart mode',
|
||||
"icon": 'fa-gas-pump',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_Read-only mode': {
|
||||
"str": 'enabled readonly mode',
|
||||
"icon": 'fa-book',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_Signups': {
|
||||
"str": 'enabled Signups',
|
||||
"icon": 'fa-users',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_under_attack': {
|
||||
"str": 'enabled under attack mode',
|
||||
"icon": 'fa-shield',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'flair_post': {
|
||||
"str": 'set a flair on {self.target_link}',
|
||||
"icon": 'fa-tag',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'grant_awards': {
|
||||
"str": 'granted awards to {self.target_link}',
|
||||
"icon": 'fa-gift',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'link_accounts': {
|
||||
"str": 'linked {self.target_link}',
|
||||
"icon": 'fa-link',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'make_admin': {
|
||||
"str": 'made {self.target_link} admin',
|
||||
"icon": 'fa-user-crown',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'make_meme_admin': {
|
||||
"str": 'made {self.target_link} meme admin',
|
||||
"icon": 'fa-user-crown',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'monthly': {
|
||||
"str": 'distributed monthly marseybux',
|
||||
"icon": 'fa-sack-dollar',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'move_hole': {
|
||||
"str": 'moved {self.target_link} to <a href="/h/{self.target_post.sub}">/h/{self.target_post.sub}</a>',
|
||||
"icon": 'fa-manhole',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'nuke_user': {
|
||||
"str": 'removed all content of {self.target_link}',
|
||||
"icon": 'fa-radiation-alt',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'pin_comment': {
|
||||
"str": 'pinned a {self.target_link}',
|
||||
"icon": 'fa-thumbtack fa-rotate--45',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'pin_post': {
|
||||
"str": 'pinned post {self.target_link}',
|
||||
"icon": 'fa-thumbtack fa-rotate--45',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'purge_cache': {
|
||||
"str": 'purged cache',
|
||||
"icon": 'fa-memory',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'reject_app': {
|
||||
"str": 'rejected an application request by {self.target_link}',
|
||||
"icon": 'fa-robot',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'remove_admin': {
|
||||
"str": 'removed {self.target_link} as admin',
|
||||
"icon": 'fa-user-crown',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'remove_meme_admin': {
|
||||
"str": 'removed {self.target_link} as meme admin',
|
||||
"icon": 'fa-user-crown',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'revert': {
|
||||
"str": 'reverted {self.target_link} mod actions',
|
||||
"icon": 'fa-history',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'revoke_app': {
|
||||
"str": 'revoked an application by {self.target_link}',
|
||||
"icon": 'fa-robot',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'set_flair_locked': {
|
||||
"str": "set {self.target_link}'s flair (locked)",
|
||||
"icon": 'fa-award',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'set_flair_notlocked': {
|
||||
"str": "set {self.target_link}'s flair (not locked)",
|
||||
"icon": 'fa-award',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'set_nsfw': {
|
||||
"str": 'set nsfw on post {self.target_link}',
|
||||
"icon": 'fa-eye-evil',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'shadowban': {
|
||||
"str": 'shadowbanned {self.target_link}',
|
||||
"icon": 'fa-eye-slash',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'unagendaposter': {
|
||||
"str": 'removed chud theme from {self.target_link}',
|
||||
"icon": 'fa-snooze',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unban_comment': {
|
||||
"str": 'reinstated {self.target_link}',
|
||||
"icon": 'fa-comment',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unban_domain': {
|
||||
"str": 'unbanned a domain',
|
||||
"icon": 'fa-globe',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unban_post': {
|
||||
"str": 'reinstated post {self.target_link}',
|
||||
"icon": 'fa-feather-alt',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unban_user': {
|
||||
"str": 'unbanned user {self.target_link}',
|
||||
"icon": 'fa-user',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'uncheck': {
|
||||
"str": 'removed checkmark from {self.target_link}',
|
||||
"icon": 'fa-badge-check',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'undistinguish_comment': {
|
||||
"str": 'un-distinguished {self.target_link}',
|
||||
"icon": 'fa-crown',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'undistinguish_post': {
|
||||
"str": 'un-distinguished {self.target_link}',
|
||||
"icon": 'fa-crown',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'unnuke_user': {
|
||||
"str": 'approved all content of {self.target_link}',
|
||||
"icon": 'fa-radiation-alt',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unpin_comment': {
|
||||
"str": 'un-pinned a {self.target_link}',
|
||||
"icon": 'fa-thumbtack fa-rotate--45',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'unpin_post': {
|
||||
"str": 'un-pinned post {self.target_link}',
|
||||
"icon": 'fa-thumbtack fa-rotate--45',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'unset_nsfw': {
|
||||
"str": 'un-set nsfw on post {self.target_link}',
|
||||
"icon": 'fa-eye-evil',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unshadowban': {
|
||||
"str": 'unshadowbanned {self.target_link}',
|
||||
"icon": 'fa-eye',
|
||||
"color": 'bg-success'
|
||||
}
|
||||
}
|
||||
|
||||
ACTIONTYPES2 = deepcopy(ACTIONTYPES)
|
||||
ACTIONTYPES2.pop("shadowban")
|
||||
ACTIONTYPES2.pop("unshadowban")
|
||||
ACTIONTYPES2.pop("flair_post")
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
import time
|
||||
from files.helpers.lazy import lazy
|
||||
from os import environ
|
||||
from copy import deepcopy
|
||||
from files.helpers.const import *
|
||||
|
||||
class ModAction(Base):
|
||||
__tablename__ = "modactions"
|
||||
id = Column(Integer, primary_key=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"))
|
||||
kind = Column(String)
|
||||
target_user_id = Column(Integer, ForeignKey("users.id"))
|
||||
target_submission_id = Column(Integer, ForeignKey("submissions.id"))
|
||||
target_comment_id = Column(Integer, ForeignKey("comments.id"))
|
||||
_note=Column(String)
|
||||
created_utc = Column(Integer)
|
||||
|
||||
user = relationship("User", primaryjoin="User.id==ModAction.user_id", viewonly=True)
|
||||
target_user = relationship("User", primaryjoin="User.id==ModAction.target_user_id", viewonly=True)
|
||||
target_post = relationship("Submission", viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<ModAction(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def age_string(self):
|
||||
|
||||
age = int(time.time()) - self.created_utc
|
||||
|
||||
if age < 60:
|
||||
return "just now"
|
||||
elif age < 3600:
|
||||
minutes = int(age / 60)
|
||||
return f"{minutes}m ago"
|
||||
elif age < 86400:
|
||||
hours = int(age / 3600)
|
||||
return f"{hours}hr ago"
|
||||
elif age < 2678400:
|
||||
days = int(age / 86400)
|
||||
return f"{days}d ago"
|
||||
|
||||
now = time.gmtime()
|
||||
ctd = time.gmtime(self.created_utc)
|
||||
|
||||
months = now.tm_mon - ctd.tm_mon + 12 * (now.tm_year - ctd.tm_year)
|
||||
if now.tm_mday < ctd.tm_mday:
|
||||
months -= 1
|
||||
|
||||
if months < 12:
|
||||
return f"{months}mo ago"
|
||||
else:
|
||||
years = int(months / 12)
|
||||
return f"{years}yr ago"
|
||||
|
||||
|
||||
@property
|
||||
def note(self):
|
||||
|
||||
if self.kind=="ban_user":
|
||||
if self.target_post: return f'for <a href="{self.target_post.permalink}">post</a>'
|
||||
elif self.target_comment_id: return f'for <a href="/comment/{self.target_comment_id}">comment</a>'
|
||||
else: return self._note
|
||||
else:
|
||||
return self._note or ""
|
||||
|
||||
@note.setter
|
||||
def note(self, x):
|
||||
self._note=x
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def string(self):
|
||||
|
||||
output = ACTIONTYPES[self.kind]["str"].format(self=self, cc=CC_TITLE)
|
||||
|
||||
if self.note: output += f" <i>({self.note})</i>"
|
||||
|
||||
return output
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def target_link(self):
|
||||
if self.target_user: return f'<a href="{self.target_user.url}">{self.target_user.username}</a>'
|
||||
elif self.target_post:
|
||||
if self.target_post.club: return f'<a href="{self.target_post.permalink}">{CC} ONLY</a>'
|
||||
return f'<a href="{self.target_post.permalink}">{self.target_post.title_html}</a>'
|
||||
elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}?context=8#context">comment</a>'
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def icon(self):
|
||||
return ACTIONTYPES[self.kind]['icon']
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def color(self):
|
||||
return ACTIONTYPES[self.kind]['color']
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def permalink(self):
|
||||
return f"/log/{self.id}"
|
||||
|
||||
ACTIONTYPES = {
|
||||
'agendaposter': {
|
||||
"str": 'set chud theme on {self.target_link}',
|
||||
"icon": 'fa-snooze',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'approve_app': {
|
||||
"str": 'approved an application by {self.target_link}',
|
||||
"icon": 'fa-robot',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'badge_grant': {
|
||||
"str": 'granted badge to {self.target_link}',
|
||||
"icon": 'fa-badge',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'badge_remove': {
|
||||
"str": 'removed badge from {self.target_link}',
|
||||
"icon": 'fa-badge',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'ban_comment': {
|
||||
"str": 'removed {self.target_link}',
|
||||
"icon": 'fa-comment',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'ban_domain': {
|
||||
"str": 'banned a domain',
|
||||
"icon": 'fa-globe',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'ban_post': {
|
||||
"str": 'removed post {self.target_link}',
|
||||
"icon": 'fa-feather-alt',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'ban_user': {
|
||||
"str": 'banned user {self.target_link}',
|
||||
"icon": 'fa-user-slash',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'change_sidebar': {
|
||||
"str": 'changed the sidebar',
|
||||
"icon": 'fa-columns',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'check': {
|
||||
"str": 'gave {self.target_link} a checkmark',
|
||||
"icon": 'fa-badge-check',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'club_allow': {
|
||||
"str": 'allowed user {self.target_link} into the {cc}',
|
||||
"icon": 'fa-golf-club',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'club_ban': {
|
||||
"str": 'disallowed user {self.target_link} from the {cc}',
|
||||
"icon": 'fa-golf-club',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'delete_report': {
|
||||
"str": 'deleted report on {self.target_link}',
|
||||
"icon": 'fa-flag',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_Bots': {
|
||||
"str": 'disabled Bots',
|
||||
"icon": 'fa-robot',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_Fart mode': {
|
||||
"str": 'disabled fart mode',
|
||||
"icon": 'fa-gas-pump-slash',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_Read-only mode': {
|
||||
"str": 'disabled readonly mode',
|
||||
"icon": 'fa-book',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_Signups': {
|
||||
"str": 'disabled Signups',
|
||||
"icon": 'fa-users',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'disable_under_attack': {
|
||||
"str": 'disabled under attack mode',
|
||||
"icon": 'fa-shield',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'distinguish_comment': {
|
||||
"str": 'distinguished {self.target_link}',
|
||||
"icon": 'fa-crown',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'distinguish_post': {
|
||||
"str": 'distinguished {self.target_link}',
|
||||
"icon": 'fa-crown',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'distribute': {
|
||||
"str": 'distributed bet winnings to voters on {self.target_link}',
|
||||
"icon": 'fa-dollar-sign',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'dump_cache': {
|
||||
"str": 'dumped cache',
|
||||
"icon": 'fa-trash-alt',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'edit_post': {
|
||||
"str": 'edited {self.target_link}',
|
||||
"icon": 'fa-edit',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'enable_Bots': {
|
||||
"str": 'enabled Bots',
|
||||
"icon": 'fa-robot',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_Fart mode': {
|
||||
"str": 'enabled fart mode',
|
||||
"icon": 'fa-gas-pump',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_Read-only mode': {
|
||||
"str": 'enabled readonly mode',
|
||||
"icon": 'fa-book',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_Signups': {
|
||||
"str": 'enabled Signups',
|
||||
"icon": 'fa-users',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'enable_under_attack': {
|
||||
"str": 'enabled under attack mode',
|
||||
"icon": 'fa-shield',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'flair_post': {
|
||||
"str": 'set a flair on {self.target_link}',
|
||||
"icon": 'fa-tag',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'grant_awards': {
|
||||
"str": 'granted awards to {self.target_link}',
|
||||
"icon": 'fa-gift',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'link_accounts': {
|
||||
"str": 'linked {self.target_link}',
|
||||
"icon": 'fa-link',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'make_admin': {
|
||||
"str": 'made {self.target_link} admin',
|
||||
"icon": 'fa-user-crown',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'make_meme_admin': {
|
||||
"str": 'made {self.target_link} meme admin',
|
||||
"icon": 'fa-user-crown',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'monthly': {
|
||||
"str": 'distributed monthly marseybux',
|
||||
"icon": 'fa-sack-dollar',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'move_hole': {
|
||||
"str": 'moved {self.target_link} to <a href="/h/{self.target_post.sub}">/h/{self.target_post.sub}</a>',
|
||||
"icon": 'fa-manhole',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'nuke_user': {
|
||||
"str": 'removed all content of {self.target_link}',
|
||||
"icon": 'fa-radiation-alt',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'pin_comment': {
|
||||
"str": 'pinned a {self.target_link}',
|
||||
"icon": 'fa-thumbtack fa-rotate--45',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'pin_post': {
|
||||
"str": 'pinned post {self.target_link}',
|
||||
"icon": 'fa-thumbtack fa-rotate--45',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'purge_cache': {
|
||||
"str": 'purged cache',
|
||||
"icon": 'fa-memory',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'reject_app': {
|
||||
"str": 'rejected an application request by {self.target_link}',
|
||||
"icon": 'fa-robot',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'remove_admin': {
|
||||
"str": 'removed {self.target_link} as admin',
|
||||
"icon": 'fa-user-crown',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'remove_meme_admin': {
|
||||
"str": 'removed {self.target_link} as meme admin',
|
||||
"icon": 'fa-user-crown',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'revert': {
|
||||
"str": 'reverted {self.target_link} mod actions',
|
||||
"icon": 'fa-history',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'revoke_app': {
|
||||
"str": 'revoked an application by {self.target_link}',
|
||||
"icon": 'fa-robot',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'set_flair_locked': {
|
||||
"str": "set {self.target_link}'s flair (locked)",
|
||||
"icon": 'fa-award',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'set_flair_notlocked': {
|
||||
"str": "set {self.target_link}'s flair (not locked)",
|
||||
"icon": 'fa-award',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'set_nsfw': {
|
||||
"str": 'set nsfw on post {self.target_link}',
|
||||
"icon": 'fa-eye-evil',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'shadowban': {
|
||||
"str": 'shadowbanned {self.target_link}',
|
||||
"icon": 'fa-eye-slash',
|
||||
"color": 'bg-danger'
|
||||
},
|
||||
'unagendaposter': {
|
||||
"str": 'removed chud theme from {self.target_link}',
|
||||
"icon": 'fa-snooze',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unban_comment': {
|
||||
"str": 'reinstated {self.target_link}',
|
||||
"icon": 'fa-comment',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unban_domain': {
|
||||
"str": 'unbanned a domain',
|
||||
"icon": 'fa-globe',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unban_post': {
|
||||
"str": 'reinstated post {self.target_link}',
|
||||
"icon": 'fa-feather-alt',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unban_user': {
|
||||
"str": 'unbanned user {self.target_link}',
|
||||
"icon": 'fa-user',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'uncheck': {
|
||||
"str": 'removed checkmark from {self.target_link}',
|
||||
"icon": 'fa-badge-check',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'undistinguish_comment': {
|
||||
"str": 'un-distinguished {self.target_link}',
|
||||
"icon": 'fa-crown',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'undistinguish_post': {
|
||||
"str": 'un-distinguished {self.target_link}',
|
||||
"icon": 'fa-crown',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'unnuke_user': {
|
||||
"str": 'approved all content of {self.target_link}',
|
||||
"icon": 'fa-radiation-alt',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unpin_comment': {
|
||||
"str": 'un-pinned a {self.target_link}',
|
||||
"icon": 'fa-thumbtack fa-rotate--45',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'unpin_post': {
|
||||
"str": 'un-pinned post {self.target_link}',
|
||||
"icon": 'fa-thumbtack fa-rotate--45',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'unset_nsfw': {
|
||||
"str": 'un-set nsfw on post {self.target_link}',
|
||||
"icon": 'fa-eye-evil',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unshadowban': {
|
||||
"str": 'unshadowbanned {self.target_link}',
|
||||
"icon": 'fa-eye',
|
||||
"color": 'bg-success'
|
||||
}
|
||||
}
|
||||
|
||||
ACTIONTYPES2 = deepcopy(ACTIONTYPES)
|
||||
ACTIONTYPES2.pop("shadowban")
|
||||
ACTIONTYPES2.pop("unshadowban")
|
||||
ACTIONTYPES2.pop("flair_post")
|
||||
ACTIONTYPES2.pop("edit_post")
|
|
@ -1,16 +1,16 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
|
||||
class Subscription(Base):
|
||||
__tablename__ = "subscriptions"
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
submission_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True)
|
||||
|
||||
user = relationship("User", uselist=False, viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
|
||||
class Subscription(Base):
|
||||
__tablename__ = "subscriptions"
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
submission_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True)
|
||||
|
||||
user = relationship("User", uselist=False, viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Subscription(id={self.id})>"
|
File diff suppressed because it is too large
Load diff
|
@ -1,15 +1,15 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
|
||||
class UserBlock(Base):
|
||||
|
||||
__tablename__ = "userblocks"
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
target_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
|
||||
user = relationship("User", primaryjoin="User.id==UserBlock.user_id", viewonly=True)
|
||||
target = relationship("User", primaryjoin="User.id==UserBlock.target_id", viewonly=True)
|
||||
|
||||
def __repr__(self):
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
|
||||
class UserBlock(Base):
|
||||
|
||||
__tablename__ = "userblocks"
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
target_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
|
||||
user = relationship("User", primaryjoin="User.id==UserBlock.user_id", viewonly=True)
|
||||
target = relationship("User", primaryjoin="User.id==UserBlock.target_id", viewonly=True)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<UserBlock(user={self.user_id}, target={self.target_id})>"
|
|
@ -1,87 +1,87 @@
|
|||
from flask import *
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.helpers.lazy import lazy
|
||||
import time
|
||||
|
||||
class Vote(Base):
|
||||
|
||||
__tablename__ = "votes"
|
||||
|
||||
submission_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
vote_type = Column(Integer)
|
||||
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
|
||||
real = Column(Boolean, default=True)
|
||||
created_utc = Column(Integer)
|
||||
|
||||
user = relationship("User", lazy="subquery", viewonly=True)
|
||||
post = relationship("Submission", lazy="subquery", viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Vote(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def json_core(self):
|
||||
data={
|
||||
"user_id": self.user_id,
|
||||
"submission_id":self.submission_id,
|
||||
"vote_type":self.vote_type
|
||||
}
|
||||
return data
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def json(self):
|
||||
data=self.json_core
|
||||
data["user"]=self.user.json_core
|
||||
data["post"]=self.post.json_core
|
||||
|
||||
return data
|
||||
|
||||
|
||||
class CommentVote(Base):
|
||||
|
||||
__tablename__ = "commentvotes"
|
||||
|
||||
comment_id = Column(Integer, ForeignKey("comments.id"), primary_key=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
vote_type = Column(Integer)
|
||||
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
|
||||
real = Column(Boolean, default=True)
|
||||
created_utc = Column(Integer)
|
||||
|
||||
user = relationship("User", lazy="subquery")
|
||||
comment = relationship("Comment", lazy="subquery", viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<CommentVote(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def json_core(self):
|
||||
data={
|
||||
"user_id": self.user_id,
|
||||
"comment_id":self.comment_id,
|
||||
"vote_type":self.vote_type
|
||||
}
|
||||
return data
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def json(self):
|
||||
data=self.json_core
|
||||
data["user"]=self.user.json_core
|
||||
data["comment"]=self.comment.json_core
|
||||
|
||||
from flask import *
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from files.helpers.lazy import lazy
|
||||
import time
|
||||
|
||||
class Vote(Base):
|
||||
|
||||
__tablename__ = "votes"
|
||||
|
||||
submission_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
vote_type = Column(Integer)
|
||||
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
|
||||
real = Column(Boolean, default=True)
|
||||
created_utc = Column(Integer)
|
||||
|
||||
user = relationship("User", lazy="subquery", viewonly=True)
|
||||
post = relationship("Submission", lazy="subquery", viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Vote(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def json_core(self):
|
||||
data={
|
||||
"user_id": self.user_id,
|
||||
"submission_id":self.submission_id,
|
||||
"vote_type":self.vote_type
|
||||
}
|
||||
return data
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def json(self):
|
||||
data=self.json_core
|
||||
data["user"]=self.user.json_core
|
||||
data["post"]=self.post.json_core
|
||||
|
||||
return data
|
||||
|
||||
|
||||
class CommentVote(Base):
|
||||
|
||||
__tablename__ = "commentvotes"
|
||||
|
||||
comment_id = Column(Integer, ForeignKey("comments.id"), primary_key=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
vote_type = Column(Integer)
|
||||
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
|
||||
real = Column(Boolean, default=True)
|
||||
created_utc = Column(Integer)
|
||||
|
||||
user = relationship("User", lazy="subquery")
|
||||
comment = relationship("Comment", lazy="subquery", viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<CommentVote(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def json_core(self):
|
||||
data={
|
||||
"user_id": self.user_id,
|
||||
"comment_id":self.comment_id,
|
||||
"vote_type":self.vote_type
|
||||
}
|
||||
return data
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def json(self):
|
||||
data=self.json_core
|
||||
data["user"]=self.user.json_core
|
||||
data["comment"]=self.comment.json_core
|
||||
|
||||
return data
|
Loading…
Add table
Add a link
Reference in a new issue