Exemple #1
0
class PostReplies(CRUDMixin, db.Model):
    __tablename__ = "post_replies"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    post_id = db.Column(db.String, db.ForeignKey('thread.id'),
                        default=None)  # post that people replied to
    reply_ids = db.Column(db.String,
                          default="[]")  # posts that replied to post_id
Exemple #2
0
class AddressBook(CRUDMixin, db.Model):
    __tablename__ = "address_book"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    address = db.Column(db.String, unique=True, default=None)
    label = db.Column(db.String, default=None)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #3
0
class AdminMessageStore(CRUDMixin, db.Model):
    __tablename__ = "admin_message_store"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    message_id = db.Column(db.String, unique=True, default=None)
    time_added = db.Column(db.DateTime, default=None)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #4
0
class Flags(CRUDMixin, db.Model):
    __tablename__ = "flags"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    name = db.Column(db.String, default=None)
    flag_extension = db.Column(db.String, default=None)
    flag_base64 = db.Column(db.String, default=None)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #5
0
class DeletedMessages(CRUDMixin, db.Model):
    __tablename__ = "deleted_message"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    message_id = db.Column(db.String, unique=True, default=None)
    address_from = db.Column(db.String, default=None)
    address_to = db.Column(db.String, default=None)
    expires_time = db.Column(db.Integer, default=None)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #6
0
class SessionInfo(CRUDMixin, db.Model):
    __tablename__ = "session_info"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    session_id = db.Column(db.String, unique=True, default=None)
    request_rate_ts = db.Column(db.Float, default=0.0)
    request_rate_amt = db.Column(db.Integer, default=0)
    verified = db.Column(db.Boolean, default=None)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #7
0
class PostCards(CRUDMixin, db.Model):
    __tablename__ = "post_card"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    message_id = db.Column(db.String, default=None)
    thread_id = db.Column(db.String, default=None)
    card_html = db.Column(db.String, default=None)
    regenerate = db.Column(db.Boolean, default=False)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #8
0
class UploadSites(CRUDMixin, db.Model):
    __tablename__ = "upload_sites"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    domain = db.Column(db.String, default=None)
    type = db.Column(db.String, default=None)
    uri = db.Column(db.String, default=None)
    download_prefix = db.Column(db.String, default=None)
    response = db.Column(db.String, default=None)
    direct_dl_url = db.Column(db.Boolean, default=None)
    extra_curl_options = db.Column(db.String, default=None)
    upload_word = db.Column(db.String, default=None)
    form_name = db.Column(db.String, default=None)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #9
0
class Alembic(CRUDMixin, db.Model):
    __tablename__ = "alembic_version"
    __table_args__ = {
        'extend_existing': True
    }

    version_num = db.Column(db.String(32), primary_key=True, nullable=False, default=VERSION_ALEMBIC)

    def __repr__(self):
        return "<{cls}(version_num={s.version_num})>".format(
            s=self, cls=self.__class__.__name__)
Exemple #10
0
class ModLog(CRUDMixin, db.Model):
    __tablename__ = "mod_log"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    message_id = db.Column(db.String, default=None)
    timestamp = db.Column(db.Float, default=None)
    description = db.Column(db.String, default=None)
    user_from = db.Column(db.String, default=None)
    board_address = db.Column(db.String, default=None)
    thread_hash = db.Column(db.String, default=None)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #11
0
class UploadProgress(CRUDMixin, db.Model):
    __tablename__ = "upload_progress"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    upload_id = db.Column(db.String, unique=True, default=None)
    uploading = db.Column(db.Boolean, default=None)
    subject = db.Column(db.String, default=None)
    total_size_bytes = db.Column(db.Integer, default=None)
    progress_size_bytes = db.Column(db.Integer, default=0)
    progress_percent = db.Column(db.Float, default=0)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #12
0
class Identity(CRUDMixin, db.Model):
    __tablename__ = "identity"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    address = db.Column(db.String, unique=True, default=None)
    label = db.Column(db.String, default=None)
    passphrase_base64 = db.Column(db.String, default=None)
    total_messages = db.Column(db.Integer, default=0)
    unread_messages = db.Column(db.Integer, default=0)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #13
0
class Chan(CRUDMixin, db.Model):
    __tablename__ = "chan"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    access = db.Column(db.String, default=None)
    type = db.Column(db.String, default=None)
    passphrase = db.Column(db.String, unique=True, default=None)
    address = db.Column(db.String, unique=True, default=None)
    primary_addresses = db.Column(db.String, default="[]")
    secondary_addresses = db.Column(db.String, default="[]")
    tertiary_addresses = db.Column(db.String, default="[]")
    restricted_addresses = db.Column(db.String, default="[]")
    rules = db.Column(db.String, default="{}")
    pgp_passphrase_msg = db.Column(db.String, default="")
    pgp_passphrase_attach = db.Column(db.String, default="")
    pgp_passphrase_steg = db.Column(db.String, default="")
    label = db.Column(db.String, default=None)
    description = db.Column(db.String, default=None)
    is_setup = db.Column(db.Boolean, default=False)
    timestamp_sent = db.Column(db.Integer, default=0)
    timestamp_received = db.Column(db.Integer, default=0)
    default_from_address = db.Column(db.String, default=None)
    allow_css = db.Column(db.Boolean, default=False)
    last_post_number = db.Column(db.Integer, default=0)
    regenerate_numbers = db.Column(db.Boolean, default=False)

    # List-specific
    list = db.Column(db.String, default="{}")
    list_timestamp_changed = db.Column(db.Integer, default=0)
    list_message_id_owner = db.Column(db.String, default=None)
    list_message_expires_time_owner = db.Column(db.Integer, default=None)
    list_message_timestamp_utc_owner = db.Column(db.Integer, default=None)
    list_message_id_user = db.Column(db.String, default=None)
    list_message_expires_time_user = db.Column(db.Integer, default=None)
    list_message_timestamp_utc_user = db.Column(db.Integer, default=None)
    list_send = db.Column(db.Boolean, default=False)

    threads = relationship("Threads", back_populates="chan")

    # Not used, can be removed
    image_banner_base64 = db.Column(db.String, default=None)
    image_banner_timestamp_utc = db.Column(db.Integer, default=0)
    image_spoiler_base64 = db.Column(db.String, default=None)
    image_spoiler_timestamp_utc = db.Column(db.Integer, default=0)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #14
0
class Command(CRUDMixin, db.Model):
    __tablename__ = "command"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    timestamp_utc = db.Column(db.Integer, default=None)
    action = db.Column(db.String, default=None)
    action_type = db.Column(db.String, default=None)
    do_not_send = db.Column(db.Boolean, default=False)
    chan_address = db.Column(db.String, default=None)
    thread_id = db.Column(db.String, default=None)
    message_id = db.Column(db.String, default=None)
    options = db.Column(db.String, default="{}")

    # Thread options
    thread_sticky = db.Column(db.Boolean, default=False)
    thread_sticky_timestamp_utc = db.Column(db.Integer, default=0)
    thread_lock = db.Column(db.Boolean, default=False)
    thread_lock_ts = db.Column(db.Integer, default=0)
    thread_lock_timestamp_utc = db.Column(db.Integer, default=0)
    thread_anchor = db.Column(db.Boolean, default=False)
    thread_anchor_ts = db.Column(db.Integer, default=0)
    thread_anchor_timestamp_utc = db.Column(db.Integer, default=0)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #15
0
class GlobalSettings(CRUDMixin, db.Model):
    __tablename__ = "settings_global"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    theme = db.Column(db.String, default="Frosty")
    discard_message_ids = db.Column(db.String, default="[]")
    clear_inventory = db.Column(db.Boolean, default=False)
    messages_per_mailbox_page = db.Column(db.Integer, default=5)
    messages_current = db.Column(db.Integer, default=0)
    messages_older = db.Column(db.Integer, default=0)
    messages_newer = db.Column(db.Integer, default=0)
    chan_update_display_number = db.Column(db.Integer, default=5)
    max_download_size = db.Column(db.Float, default=0.0)
    max_extract_size = db.Column(db.Float, default=20.0)
    allow_net_file_size_check = db.Column(db.Boolean, default=True)
    allow_net_book_quote = db.Column(db.Boolean, default=True)
    allow_net_ntp = db.Column(db.Boolean, default=False)
    never_auto_download_unencrypted = db.Column(db.Boolean, default=True)
    auto_dl_from_unknown_upload_sites = db.Column(db.Boolean, default=False)
    delete_sent_identity_msgs = db.Column(db.Boolean, default=False)
    enable_captcha = db.Column(db.Boolean, default=False)
    enable_verification = db.Column(db.Boolean, default=False)
    home_page_msg = db.Column(db.String, default=HOME_MESSAGE)
    html_head = db.Column(db.String, default="")
    html_body = db.Column(db.String, default="")
    results_per_page_board = db.Column(db.Integer, default=15)
    results_per_page_recent = db.Column(db.Integer, default=35)
    results_per_page_search = db.Column(db.Integer, default=35)
    results_per_page_overboard = db.Column(db.Integer, default=64)
    results_per_page_catalog = db.Column(db.Integer, default=64)
    results_per_page_mod_log = db.Column(db.Integer, default=30)

    # Security
    enable_page_rate_limit = db.Column(db.Boolean, default=False)
    max_requests_per_period = db.Column(db.Integer, default=10)
    rate_limit_period_seconds = db.Column(db.Integer, default=60)
    hide_all_board_list_passphrases = db.Column(db.Boolean, default=False)

    # Kiosk Mode
    enable_kiosk_mode = db.Column(db.Boolean, default=False)
    kiosk_login_to_view = db.Column(db.Boolean, default=False)
    kiosk_allow_posting = db.Column(db.Boolean, default=False)
    kiosk_disable_bm_attach = db.Column(db.Boolean, default=False)
    kiosk_allow_download = db.Column(db.Boolean, default=False)
    kiosk_post_rate_limit = db.Column(db.Integer, default=50)
    kiosk_attempts_login = db.Column(db.Integer, default=5)
    kiosk_ban_login_sec = db.Column(db.Integer, default=300)
    kiosk_only_admin_access_mod_log = db.Column(db.Boolean, default=False)

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #16
0
class Threads(CRUDMixin, db.Model):
    __tablename__ = "thread"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    chan_id = db.Column(db.Integer, db.ForeignKey('chan.id'), default=None)
    thread_hash = db.Column(db.String, unique=True, default=None)
    thread_hash_short = db.Column(db.String, default=None)
    op_sha256_hash = db.Column(db.String, default=None)  # The hash of the OP
    default_from_address = db.Column(db.String, default=None)
    subject = db.Column(db.String, default=None)
    timestamp_sent = db.Column(db.Integer, default=0)
    timestamp_received = db.Column(db.Integer, default=0)
    stickied_local = db.Column(db.Boolean, default=False)
    locked_local = db.Column(db.Boolean, default=False)
    locked_local_ts = db.Column(db.Integer, default=0)
    anchored_local = db.Column(db.Boolean, default=False)
    anchored_local_ts = db.Column(db.Integer, default=0)

    chan = relationship("Chan", back_populates="threads")
    messages = relationship("Messages", back_populates="thread")

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)
Exemple #17
0
class Messages(CRUDMixin, db.Model):
    __tablename__ = "message"
    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, unique=True, primary_key=True)
    thread_id = db.Column(db.String, db.ForeignKey('thread.id'), default=None)
    message_id = db.Column(db.String, default=None)
    post_id = db.Column(db.String, default=None)
    post_number = db.Column(db.Integer, default=None)
    expires_time = db.Column(db.Integer, default=None)
    address_from = db.Column(db.String, default=None)
    timestamp_received = db.Column(db.Integer, default=0)
    timestamp_sent = db.Column(db.Integer, default=0)
    is_op = db.Column(db.Boolean, default=None)  # Is this message an OP or not
    message_sha256_hash = db.Column(
        db.String, default=None)  # This message payload SHA256 hash
    sage = db.Column(db.Boolean, default=False)
    subject = db.Column(db.String, default=None)
    message = db.Column(db.String, default=None)
    nation = db.Column(db.String, default=None)
    nation_base64 = db.Column(db.String, default=None)
    nation_name = db.Column(db.String, default=None)
    file_decoded = db.Column(db.String, default=None)
    file_filename = db.Column(db.String, default=None)
    file_extension = db.Column(db.String, default=None)
    file_url = db.Column(db.String, default=None)
    file_upload_settings = db.Column(db.String, default="{}")
    file_extracts_start_base64 = db.Column(db.String, default=None)
    file_size = db.Column(db.Float, default=None)
    file_amount = db.Column(db.Integer, default=None)
    file_do_not_download = db.Column(db.Boolean, default=False)
    file_currently_downloading = db.Column(db.Boolean, default=False)
    file_progress = db.Column(db.String, default="")
    file_download_successful = db.Column(db.Boolean, default=False)
    file_sha256_hash = db.Column(db.String, default=None)
    file_enc_cipher = db.Column(db.String, default=None)
    file_enc_key_bytes = db.Column(db.Integer, default=None)
    file_enc_password = db.Column(db.String, default=None)
    file_sha256_hashes_match = db.Column(db.Boolean, default=None)
    file_order = db.Column(db.String, default="[]")
    upload_filename = db.Column(db.String, default=None)
    saved_file_filename = db.Column(db.String, default=None)
    saved_image_thumb_filename = db.Column(db.String, default=None)
    media_info = db.Column(db.String, default="{}")
    media_width = db.Column(db.Integer, default=None)
    media_height = db.Column(db.Integer, default=None)
    image1_spoiler = db.Column(db.Boolean, default=None)
    image2_spoiler = db.Column(db.Boolean, default=None)
    image3_spoiler = db.Column(db.Boolean, default=None)
    image4_spoiler = db.Column(db.Boolean, default=None)
    message_original = db.Column(db.String, default=None)
    message_steg = db.Column(db.String, default="{}")
    popup_html = db.Column(db.String, default="")
    regenerate_popup_html = db.Column(db.Boolean, default=False)

    thread = relationship("Threads", back_populates="messages")

    def __repr__(self):
        return "<{cls}(id={rep.id})>".format(cls=self.__class__.__name__,
                                             rep=self)