mirror of https://github.com/CIRCL/AIL-framework
chg: [Flask] add prefix in config to flask routes
parent
2e763ba0aa
commit
5eadc2755f
|
@ -32,6 +32,8 @@ sender_port = 1337
|
|||
|
||||
##### Flask #####
|
||||
[Flask]
|
||||
#Proxying requests to the app
|
||||
baseUrl = /
|
||||
#Number of logs to display in the dashboard
|
||||
max_dashboard_logs = 15
|
||||
#Maximum number of character to display in the toolip
|
||||
|
|
|
@ -12,6 +12,7 @@ import Flask_config
|
|||
|
||||
app = Flask_config.app
|
||||
cfg = Flask_config.cfg
|
||||
baseUrl = Flask_config.baseUrl
|
||||
|
||||
MODULENAME = Blueprint('MODULENAME', __name__, template_folder='templates')
|
||||
|
||||
|
@ -27,4 +28,4 @@ def MODULENAME_page():
|
|||
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(MODULENAME)
|
||||
app.register_blueprint(MODULENAME, url_prefix=baseUrl)
|
||||
|
|
|
@ -25,8 +25,12 @@ import Flask_config
|
|||
|
||||
# CONFIG #
|
||||
cfg = Flask_config.cfg
|
||||
baseUrl = cfg.get("Flask", "baseurl")
|
||||
baseUrl = baseUrl.replace('/', '')
|
||||
if baseUrl != '':
|
||||
baseUrl = '/'+baseUrl
|
||||
|
||||
Flask_config.app = Flask(__name__, static_url_path='/static/')
|
||||
Flask_config.app = Flask(__name__, static_url_path=baseUrl+'/static/')
|
||||
app = Flask_config.app
|
||||
app.config['MAX_CONTENT_LENGTH'] = 900 * 1024 * 1024
|
||||
|
||||
|
|
|
@ -135,6 +135,11 @@ if HiveApi != False:
|
|||
print('The Hive not connected')
|
||||
|
||||
# VARIABLES #
|
||||
baseUrl = cfg.get("Flask", "baseurl")
|
||||
baseUrl = baseUrl.replace('/', '')
|
||||
if baseUrl != '':
|
||||
baseUrl = '/'+baseUrl
|
||||
|
||||
max_preview_char = int(cfg.get("Flask", "max_preview_char")) # Maximum number of character to display in the tooltip
|
||||
max_preview_modal = int(cfg.get("Flask", "max_preview_modal")) # Maximum number of character to display in the modal
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ import Flask_config
|
|||
|
||||
app = Flask_config.app
|
||||
cfg = Flask_config.cfg
|
||||
baseUrl = Flask_config.baseUrl
|
||||
r_serv_tags = Flask_config.r_serv_tags
|
||||
r_serv_metadata = Flask_config.r_serv_metadata
|
||||
r_serv_db = Flask_config.r_serv_db
|
||||
|
@ -585,4 +586,4 @@ def disable_hive_auto_alert():
|
|||
return edit_tag_export()
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(PasteSubmit)
|
||||
app.register_blueprint(PasteSubmit, url_prefix=baseUrl)
|
||||
|
|
|
@ -21,6 +21,7 @@ import Flask_config
|
|||
|
||||
app = Flask_config.app
|
||||
cfg = Flask_config.cfg
|
||||
baseUrl = Flask_config.baseUrl
|
||||
r_serv_tags = Flask_config.r_serv_tags
|
||||
r_serv_metadata = Flask_config.r_serv_metadata
|
||||
r_serv_statistics = Flask_config.r_serv_statistics
|
||||
|
@ -865,4 +866,4 @@ def tag_galaxy_info():
|
|||
return 'INVALID INPUT'
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(Tags)
|
||||
app.register_blueprint(Tags, url_prefix=baseUrl)
|
||||
|
|
|
@ -18,6 +18,7 @@ import Flask_config
|
|||
|
||||
app = Flask_config.app
|
||||
cfg = Flask_config.cfg
|
||||
baseUrl = Flask_config.baseUrl
|
||||
max_preview_char = Flask_config.max_preview_char
|
||||
max_preview_modal = Flask_config.max_preview_modal
|
||||
r_serv_metadata = Flask_config.r_serv_metadata
|
||||
|
@ -177,4 +178,4 @@ def getImportantPasteByModule():
|
|||
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(browsepastes)
|
||||
app.register_blueprint(browsepastes, url_prefix=baseUrl)
|
||||
|
|
|
@ -19,6 +19,7 @@ import Flask_config
|
|||
|
||||
app = Flask_config.app
|
||||
cfg = Flask_config.cfg
|
||||
baseUrl = Flask_config.baseUrl
|
||||
r_serv = Flask_config.r_serv
|
||||
r_serv_log = Flask_config.r_serv_log
|
||||
|
||||
|
@ -167,4 +168,4 @@ def index():
|
|||
log_select=log_select, selected=max_dashboard_logs)
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(dashboard)
|
||||
app.register_blueprint(dashboard, url_prefix=baseUrl)
|
||||
|
|
|
@ -21,6 +21,7 @@ import Flask_config
|
|||
|
||||
app = Flask_config.app
|
||||
cfg = Flask_config.cfg
|
||||
baseUrl = Flask_config.baseUrl
|
||||
r_serv_pasteName = Flask_config.r_serv_pasteName
|
||||
r_serv_metadata = Flask_config.r_serv_metadata
|
||||
max_preview_char = Flask_config.max_preview_char
|
||||
|
@ -241,4 +242,4 @@ def get_more_search_result():
|
|||
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(searches)
|
||||
app.register_blueprint(searches, url_prefix=baseUrl)
|
||||
|
|
|
@ -18,6 +18,7 @@ import Flask_config
|
|||
|
||||
app = Flask_config.app
|
||||
cfg = Flask_config.cfg
|
||||
baseUrl = Flask_config.baseUrl
|
||||
r_serv_charts = Flask_config.r_serv_charts
|
||||
r_serv_sentiment = Flask_config.r_serv_sentiment
|
||||
|
||||
|
@ -142,4 +143,4 @@ def sentiment_analysis_plot_tool_getdata():
|
|||
return jsonify(to_return)
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(sentiments)
|
||||
app.register_blueprint(sentiments, url_prefix=baseUrl)
|
||||
|
|
|
@ -20,6 +20,7 @@ import Flask_config
|
|||
|
||||
app = Flask_config.app
|
||||
cfg = Flask_config.cfg
|
||||
baseUrl = Flask_config.baseUrl
|
||||
r_serv_pasteName = Flask_config.r_serv_pasteName
|
||||
r_serv_metadata = Flask_config.r_serv_metadata
|
||||
r_serv_tags = Flask_config.r_serv_tags
|
||||
|
@ -271,4 +272,4 @@ def send_file_to_vt():
|
|||
return redirect(url_for('showsavedpastes.showsavedpaste', paste=paste))
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(showsavedpastes)
|
||||
app.register_blueprint(showsavedpastes, url_prefix=baseUrl)
|
||||
|
|
|
@ -21,6 +21,7 @@ import Flask_config
|
|||
|
||||
app = Flask_config.app
|
||||
cfg = Flask_config.cfg
|
||||
baseUrl = Flask_config.baseUrl
|
||||
r_serv_term = Flask_config.r_serv_term
|
||||
r_serv_cred = Flask_config.r_serv_cred
|
||||
|
||||
|
@ -605,4 +606,4 @@ def cred_management_action():
|
|||
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(terms)
|
||||
app.register_blueprint(terms, url_prefix=baseUrl)
|
||||
|
|
|
@ -15,6 +15,7 @@ import Flask_config
|
|||
|
||||
app = Flask_config.app
|
||||
cfg = Flask_config.cfg
|
||||
baseUrl = Flask_config.baseUrl
|
||||
r_serv_charts = Flask_config.r_serv_charts
|
||||
|
||||
trendings = Blueprint('trendings', __name__, template_folder='templates')
|
||||
|
@ -78,4 +79,4 @@ def trending():
|
|||
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(trendings)
|
||||
app.register_blueprint(trendings, url_prefix=baseUrl)
|
||||
|
|
|
@ -15,6 +15,7 @@ import Flask_config
|
|||
|
||||
app = Flask_config.app
|
||||
cfg = Flask_config.cfg
|
||||
baseUrl = Flask_config.baseUrl
|
||||
r_serv_charts = Flask_config.r_serv_charts
|
||||
|
||||
trendingmodules = Blueprint('trendingmodules', __name__, template_folder='templates')
|
||||
|
@ -125,4 +126,4 @@ def moduletrending():
|
|||
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(trendingmodules)
|
||||
app.register_blueprint(trendingmodules, url_prefix=baseUrl)
|
||||
|
|
Loading…
Reference in New Issue