Exemple #1
0
def configure_app(app, archive, debug):
    app.debug = debug
    if app.debug:
        print("WARNING: DEBUG MODE IS ENABLED!")
    app.config["PROPAGATE_EXCEPTIONS"] = True

    path = extract_archive(archive)
    reader = Reader(path)

    top = flask._app_ctx_stack
    top.channels = reader.compile_channels()
    top.groups = reader.compile_groups()
    top.dms = reader.compile_dm_messages()
    top.dm_users = reader.compile_dm_users()
    top.mpims = reader.compile_mpim_messages()
    top.mpim_users = reader.compile_mpim_users()
Exemple #2
0
def configure_app(app, archive, channels, no_sidebar, no_external_references, debug):
    app.debug = debug
    app.no_sidebar = no_sidebar
    app.no_external_references = no_external_references
    if app.debug:
        print("WARNING: DEBUG MODE IS ENABLED!")
    app.config["PROPAGATE_EXCEPTIONS"] = True

    path = extract_archive(archive)
    reader = Reader(path)

    top = flask._app_ctx_stack
    top.channels = reader.compile_channels(channels)
    top.groups = reader.compile_groups()
    top.dms = reader.compile_dm_messages()
    top.dm_users = reader.compile_dm_users()
    top.mpims = reader.compile_mpim_messages()
    top.mpim_users = reader.compile_mpim_users()
Exemple #3
0
def configure_app(app, archive, channels, no_sidebar, no_external_references,
                  debug):
    app.debug = debug
    app.no_sidebar = no_sidebar
    app.no_external_references = no_external_references
    if app.debug:
        print("WARNING: DEBUG MODE IS ENABLED!")
    app.config["PROPAGATE_EXCEPTIONS"] = True

    path = extract_archive(archive)
    reader = Reader(path)

    top = flask._app_ctx_stack
    top.channels = reader.compile_channels(channels)
    top.groups = reader.compile_groups()
    top.dms = reader.compile_dm_messages()
    top.dm_users = reader.compile_dm_users()
    top.mpims = reader.compile_mpim_messages()
    top.mpim_users = reader.compile_mpim_users()
    top.root_dir = path
Exemple #4
0
def configure_app(app, archive, channels, no_sidebar, no_external_references,
                  debug, meilisearch_host, meilisearch_master_key):
    app.debug = debug
    app.no_sidebar = no_sidebar
    app.no_external_references = no_external_references
    if app.debug:
        print("WARNING: DEBUG MODE IS ENABLED!")
    app.config["PROPAGATE_EXCEPTIONS"] = True

    path = extract_archive(archive)
    reader = Reader(path)

    top = flask._app_ctx_stack
    top.channels = reader.compile_channels(channels)
    top.groups = reader.compile_groups()
    top.dms = reader.compile_dm_messages()
    top.dm_users = reader.compile_dm_users()
    top.mpims = reader.compile_mpim_messages()
    top.mpim_users = reader.compile_mpim_users()
    top.meilisearch_host = meilisearch_host
    top.meilisearch_master_key = meilisearch_master_key

    message_channel_index = {}
    for channelname in top.channels.keys():
        for index, message in enumerate(top.channels[channelname]):
            if message.client_msg_id is None:
                continue
            message_channel_index[message.client_msg_id] = (channelname, index)

    message_group_index = {}
    for groupname in top.groups.keys():
        for index, message in enumerate(top.groups[groupname]):
            if message.client_msg_id is None:
                continue
            message_group_index[message.client_msg_id] = (groupname, index)

    top.message_channel_index = message_channel_index
    top.message_group_index = message_group_index
Exemple #5
0
from slackviewer.app import app as application
from slackviewer.archive import extract_archive
from slackviewer.reader import Reader
from slackviewer.appconfig import set_env_params

import os

try:
    from flask import _app_ctx_stack as stack
except ImportError:
    from flask import _request_ctx_stack as stack

set_env_params()

path = extract_archive(os.environ.get("SEV_ARCHIVE"))
reader = Reader(path)
stack.channels = reader.compile_channels(os.environ.get("SEV_CHANNELS", None))
stack.groups = reader.compile_groups()
stack.dms = reader.compile_dm_messages()
stack.dm_users = reader.compile_dm_users()
stack.mpims = reader.compile_mpim_messages()
stack.mpim_users = reader.compile_mpim_users()

if __name__ == '__main__':
    if not application.is_test:
        application.run(host=os.environ.get("SEV_IP", '0.0.0.0'),
                        port=os.environ.get("SEV_PORT", 5000))