#!/usr/bin/env python3 # -*- coding: utf-8 -*- from flask import Flask, render_template, send_from_directory, jsonify, redirect from app.decorators import auth from app.blueprints.ioc import ioc_bp from app.blueprints.whitelist import whitelist_bp from app.blueprints.config import config_bp from app.blueprints.misp import misp_bp from app.blueprints.watchers import watchers_bp from app.blueprints.update import update_bp import datetime import secrets import jwt from app.utils import read_config from sys import path app = Flask(__name__, template_folder="../../app/backend/dist") app.config["SECRET_KEY"] = secrets.token_bytes(32) @app.route("/", methods=["GET"]) @auth.login_required def main(): """ Return the index.html generated by Vue """ return render_template("index.html") @app.route("/api/get-token", methods=["GET"]) @auth.login_required def get_token(): """ Return the JWT token for API requests. """ token = jwt.encode({"exp": datetime.datetime.now() + datetime.timedelta(hours=24)}, app.config["SECRET_KEY"]) return jsonify({ "token": token.decode("utf8") if type(token) == bytes else token }) @app.route("/
/