diff --git a/website/app/__init__.py b/website/app/__init__.py index 9af0b8d..ffa5b8c 100644 --- a/website/app/__init__.py +++ b/website/app/__init__.py @@ -2,6 +2,7 @@ from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_wtf import CSRFProtect from flask_migrate import Migrate +from flask_session import Session from config import config as Config import os @@ -10,6 +11,7 @@ import os db = SQLAlchemy() csrf = CSRFProtect() migrate = Migrate() +sess = Session() def create_app(): app = Flask(__name__) @@ -22,6 +24,8 @@ def create_app(): db.init_app(app) csrf.init_app(app) migrate.init_app(app, db, render_as_batch=True) + app.config["SESSION_SQLALCHEMY"] = db + sess.init_app(app) from .home import home_blueprint app.register_blueprint(home_blueprint, url_prefix="/") diff --git a/website/app/templates/query.html b/website/app/templates/query.html index d1f04b7..ff1d8bc 100644 --- a/website/app/templates/query.html +++ b/website/app/templates/query.html @@ -49,10 +49,63 @@
-
-
-
-

Results

+
+ + + + + - -
-

Errors

-
-
- -
-
-
-
-
Results
-
Errors
-
-
[Go Back Top] {% endblock %} @@ -109,6 +156,7 @@ const modules_res = ref({}) const progress = ref(0) const status_site = ref() + const json_tab = ref(true) function actionQuery(){ @@ -148,18 +196,35 @@ modules_res.value = loc } + function active_tab(is_json){ + if(is_json){ + json_tab.value = true + if ( !document.getElementById("tab-json").classList.contains("active") ){ + document.getElementById("tab-json").classList.add("active") + document.getElementById("tab-parser").classList.remove("active") + } + }else{ + json_tab.value = false + if ( !document.getElementById("tab-parser").classList.contains("active") ){ + document.getElementById("tab-parser").classList.add("active") + document.getElementById("tab-json").classList.remove("active") + } + } + } + onMounted(() => { actionQuery() }) - return { message_list, progress, status_site, is_searching, modules_res, - generateCoreFormatUI + json_tab, + generateCoreFormatUI, + active_tab } } }).mount('.container') diff --git a/website/config.py b/website/config.py index 864b2de..9d64b43 100644 --- a/website/config.py +++ b/website/config.py @@ -8,6 +8,8 @@ class Config: class DevelopmentConfig(Config): DEBUG = True SQLALCHEMY_DATABASE_URI = "sqlite:///misp-module.sqlite" + SESSION_TYPE = "sqlalchemy" + SESSION_SQLALCHEMY_TABLE = "flask_sessions" @classmethod def init_app(cls, app):