chg: [Flask] add prefix in config to flask routes

This commit is contained in:
Terrtia 2018-09-20 10:38:19 +02:00
parent 2e763ba0aa
commit 5eadc2755f
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
14 changed files with 34 additions and 12 deletions

View file

@ -32,6 +32,8 @@ sender_port = 1337
##### Flask ##### ##### Flask #####
[Flask] [Flask]
#Proxying requests to the app
baseUrl = /
#Number of logs to display in the dashboard #Number of logs to display in the dashboard
max_dashboard_logs = 15 max_dashboard_logs = 15
#Maximum number of character to display in the toolip #Maximum number of character to display in the toolip

View file

@ -12,6 +12,7 @@ import Flask_config
app = Flask_config.app app = Flask_config.app
cfg = Flask_config.cfg cfg = Flask_config.cfg
baseUrl = Flask_config.baseUrl
MODULENAME = Blueprint('MODULENAME', __name__, template_folder='templates') MODULENAME = Blueprint('MODULENAME', __name__, template_folder='templates')
@ -27,4 +28,4 @@ def MODULENAME_page():
# ========= REGISTRATION ========= # ========= REGISTRATION =========
app.register_blueprint(MODULENAME) app.register_blueprint(MODULENAME, url_prefix=baseUrl)

View file

@ -25,8 +25,12 @@ import Flask_config
# CONFIG # # CONFIG #
cfg = Flask_config.cfg 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 = Flask_config.app
app.config['MAX_CONTENT_LENGTH'] = 900 * 1024 * 1024 app.config['MAX_CONTENT_LENGTH'] = 900 * 1024 * 1024

View file

@ -135,6 +135,11 @@ if HiveApi != False:
print('The Hive not connected') print('The Hive not connected')
# VARIABLES # # 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_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 max_preview_modal = int(cfg.get("Flask", "max_preview_modal")) # Maximum number of character to display in the modal

View file

@ -39,6 +39,7 @@ import Flask_config
app = Flask_config.app app = Flask_config.app
cfg = Flask_config.cfg cfg = Flask_config.cfg
baseUrl = Flask_config.baseUrl
r_serv_tags = Flask_config.r_serv_tags r_serv_tags = Flask_config.r_serv_tags
r_serv_metadata = Flask_config.r_serv_metadata r_serv_metadata = Flask_config.r_serv_metadata
r_serv_db = Flask_config.r_serv_db r_serv_db = Flask_config.r_serv_db
@ -585,4 +586,4 @@ def disable_hive_auto_alert():
return edit_tag_export() return edit_tag_export()
# ========= REGISTRATION ========= # ========= REGISTRATION =========
app.register_blueprint(PasteSubmit) app.register_blueprint(PasteSubmit, url_prefix=baseUrl)

View file

@ -21,6 +21,7 @@ import Flask_config
app = Flask_config.app app = Flask_config.app
cfg = Flask_config.cfg cfg = Flask_config.cfg
baseUrl = Flask_config.baseUrl
r_serv_tags = Flask_config.r_serv_tags r_serv_tags = Flask_config.r_serv_tags
r_serv_metadata = Flask_config.r_serv_metadata r_serv_metadata = Flask_config.r_serv_metadata
r_serv_statistics = Flask_config.r_serv_statistics r_serv_statistics = Flask_config.r_serv_statistics
@ -865,4 +866,4 @@ def tag_galaxy_info():
return 'INVALID INPUT' return 'INVALID INPUT'
# ========= REGISTRATION ========= # ========= REGISTRATION =========
app.register_blueprint(Tags) app.register_blueprint(Tags, url_prefix=baseUrl)

View file

@ -18,6 +18,7 @@ import Flask_config
app = Flask_config.app app = Flask_config.app
cfg = Flask_config.cfg cfg = Flask_config.cfg
baseUrl = Flask_config.baseUrl
max_preview_char = Flask_config.max_preview_char max_preview_char = Flask_config.max_preview_char
max_preview_modal = Flask_config.max_preview_modal max_preview_modal = Flask_config.max_preview_modal
r_serv_metadata = Flask_config.r_serv_metadata r_serv_metadata = Flask_config.r_serv_metadata
@ -177,4 +178,4 @@ def getImportantPasteByModule():
# ========= REGISTRATION ========= # ========= REGISTRATION =========
app.register_blueprint(browsepastes) app.register_blueprint(browsepastes, url_prefix=baseUrl)

View file

@ -19,6 +19,7 @@ import Flask_config
app = Flask_config.app app = Flask_config.app
cfg = Flask_config.cfg cfg = Flask_config.cfg
baseUrl = Flask_config.baseUrl
r_serv = Flask_config.r_serv r_serv = Flask_config.r_serv
r_serv_log = Flask_config.r_serv_log r_serv_log = Flask_config.r_serv_log
@ -167,4 +168,4 @@ def index():
log_select=log_select, selected=max_dashboard_logs) log_select=log_select, selected=max_dashboard_logs)
# ========= REGISTRATION ========= # ========= REGISTRATION =========
app.register_blueprint(dashboard) app.register_blueprint(dashboard, url_prefix=baseUrl)

View file

@ -21,6 +21,7 @@ import Flask_config
app = Flask_config.app app = Flask_config.app
cfg = Flask_config.cfg cfg = Flask_config.cfg
baseUrl = Flask_config.baseUrl
r_serv_pasteName = Flask_config.r_serv_pasteName r_serv_pasteName = Flask_config.r_serv_pasteName
r_serv_metadata = Flask_config.r_serv_metadata r_serv_metadata = Flask_config.r_serv_metadata
max_preview_char = Flask_config.max_preview_char max_preview_char = Flask_config.max_preview_char
@ -241,4 +242,4 @@ def get_more_search_result():
# ========= REGISTRATION ========= # ========= REGISTRATION =========
app.register_blueprint(searches) app.register_blueprint(searches, url_prefix=baseUrl)

View file

@ -18,6 +18,7 @@ import Flask_config
app = Flask_config.app app = Flask_config.app
cfg = Flask_config.cfg cfg = Flask_config.cfg
baseUrl = Flask_config.baseUrl
r_serv_charts = Flask_config.r_serv_charts r_serv_charts = Flask_config.r_serv_charts
r_serv_sentiment = Flask_config.r_serv_sentiment r_serv_sentiment = Flask_config.r_serv_sentiment
@ -142,4 +143,4 @@ def sentiment_analysis_plot_tool_getdata():
return jsonify(to_return) return jsonify(to_return)
# ========= REGISTRATION ========= # ========= REGISTRATION =========
app.register_blueprint(sentiments) app.register_blueprint(sentiments, url_prefix=baseUrl)

View file

@ -20,6 +20,7 @@ import Flask_config
app = Flask_config.app app = Flask_config.app
cfg = Flask_config.cfg cfg = Flask_config.cfg
baseUrl = Flask_config.baseUrl
r_serv_pasteName = Flask_config.r_serv_pasteName r_serv_pasteName = Flask_config.r_serv_pasteName
r_serv_metadata = Flask_config.r_serv_metadata r_serv_metadata = Flask_config.r_serv_metadata
r_serv_tags = Flask_config.r_serv_tags 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)) return redirect(url_for('showsavedpastes.showsavedpaste', paste=paste))
# ========= REGISTRATION ========= # ========= REGISTRATION =========
app.register_blueprint(showsavedpastes) app.register_blueprint(showsavedpastes, url_prefix=baseUrl)

View file

@ -21,6 +21,7 @@ import Flask_config
app = Flask_config.app app = Flask_config.app
cfg = Flask_config.cfg cfg = Flask_config.cfg
baseUrl = Flask_config.baseUrl
r_serv_term = Flask_config.r_serv_term r_serv_term = Flask_config.r_serv_term
r_serv_cred = Flask_config.r_serv_cred r_serv_cred = Flask_config.r_serv_cred
@ -605,4 +606,4 @@ def cred_management_action():
# ========= REGISTRATION ========= # ========= REGISTRATION =========
app.register_blueprint(terms) app.register_blueprint(terms, url_prefix=baseUrl)

View file

@ -15,6 +15,7 @@ import Flask_config
app = Flask_config.app app = Flask_config.app
cfg = Flask_config.cfg cfg = Flask_config.cfg
baseUrl = Flask_config.baseUrl
r_serv_charts = Flask_config.r_serv_charts r_serv_charts = Flask_config.r_serv_charts
trendings = Blueprint('trendings', __name__, template_folder='templates') trendings = Blueprint('trendings', __name__, template_folder='templates')
@ -78,4 +79,4 @@ def trending():
# ========= REGISTRATION ========= # ========= REGISTRATION =========
app.register_blueprint(trendings) app.register_blueprint(trendings, url_prefix=baseUrl)

View file

@ -15,6 +15,7 @@ import Flask_config
app = Flask_config.app app = Flask_config.app
cfg = Flask_config.cfg cfg = Flask_config.cfg
baseUrl = Flask_config.baseUrl
r_serv_charts = Flask_config.r_serv_charts r_serv_charts = Flask_config.r_serv_charts
trendingmodules = Blueprint('trendingmodules', __name__, template_folder='templates') trendingmodules = Blueprint('trendingmodules', __name__, template_folder='templates')
@ -125,4 +126,4 @@ def moduletrending():
# ========= REGISTRATION ========= # ========= REGISTRATION =========
app.register_blueprint(trendingmodules) app.register_blueprint(trendingmodules, url_prefix=baseUrl)