Moving of report templates
This commit is contained in:
@@ -11,14 +11,15 @@ confPath = "/config/" + confFileName
|
||||
dbPath = '/db/' + dbFileName
|
||||
|
||||
|
||||
pluginsPath = applicationPath + '/front/plugins'
|
||||
logPath = applicationPath + '/front/log'
|
||||
apiPath = applicationPath + '/front/api/'
|
||||
fullConfPath = applicationPath + confPath
|
||||
fullDbPath = applicationPath + dbPath
|
||||
vendorsPath = '/usr/share/arp-scan/ieee-oui.txt'
|
||||
|
||||
pluginsPath = applicationPath + '/front/plugins'
|
||||
logPath = applicationPath + '/front/log'
|
||||
apiPath = applicationPath + '/front/api/'
|
||||
reportTemplatesPath = applicationPath + '/front/report_templates/'
|
||||
fullConfPath = applicationPath + confPath
|
||||
fullDbPath = applicationPath + dbPath
|
||||
vendorsPath = '/usr/share/arp-scan/ieee-oui.txt'
|
||||
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
|
||||
@@ -7,7 +7,7 @@ from json2table import convert
|
||||
|
||||
# Register NetAlertX modules
|
||||
import conf
|
||||
from const import applicationPath, logPath, apiPath, confFileName
|
||||
from const import applicationPath, logPath, apiPath, confFileName, reportTemplatesPath
|
||||
from logger import logResult, mylog, print_log
|
||||
from helper import generate_mac_links, removeDuplicateNewLines, timeNowTZ, get_file_content, write_file, get_setting_value, get_timezone_offset
|
||||
|
||||
@@ -80,7 +80,7 @@ class Notification_obj:
|
||||
|
||||
# Open text Template
|
||||
mylog('verbose', ['[Notification] Open text Template'])
|
||||
template_file = open(applicationPath + '/back/report_template.txt', 'r')
|
||||
template_file = open(reportTemplatesPath + 'report_template.txt', 'r')
|
||||
mail_text = template_file.read()
|
||||
template_file.close()
|
||||
|
||||
@@ -89,12 +89,12 @@ class Notification_obj:
|
||||
|
||||
# select template type depoending if running latest version or an older one
|
||||
if conf.newVersionAvailable :
|
||||
template_file_path = '/back/report_template_new_version.html'
|
||||
template_file_path = reportTemplatesPath + 'report_template_new_version.html'
|
||||
else:
|
||||
template_file_path = '/back/report_template.html'
|
||||
template_file_path = reportTemplatesPath + 'report_template.html'
|
||||
|
||||
mylog('verbose', ['[Notification] Using template', template_file_path])
|
||||
template_file = open(applicationPath + template_file_path, 'r')
|
||||
template_file = open(template_file_path, 'r')
|
||||
mail_html = template_file.read()
|
||||
template_file.close()
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from collections import namedtuple
|
||||
|
||||
# Register NetAlertX modules
|
||||
import conf
|
||||
from const import pluginsPath, logPath, applicationPath
|
||||
from const import pluginsPath, logPath, applicationPath, reportTemplatesPath
|
||||
from logger import mylog
|
||||
from helper import timeNowTZ, updateState, get_file_content, write_file, get_setting, get_setting_value
|
||||
from api import update_api
|
||||
@@ -783,9 +783,9 @@ def handle_test(runType, db, pluginsState):
|
||||
mylog('minimal', ['[', timeNowTZ(), '] [Test] START Test: ', runType])
|
||||
|
||||
# Prepare test samples
|
||||
sample_txt = get_file_content(applicationPath + '/back/report_sample.txt')
|
||||
sample_html = get_file_content(applicationPath + '/back/report_sample.html')
|
||||
sample_json = json.loads(get_file_content(applicationPath + '/back/webhook_json_sample.json'))[0]["body"]["attachments"][0]["text"]
|
||||
sample_txt = get_file_content(reportTemplatesPath + 'report_sample.txt')
|
||||
sample_html = get_file_content(reportTemplatesPath + 'report_sample.html')
|
||||
sample_json = json.loads(get_file_content(reportTemplatesPath + 'webhook_json_sample.json'))[0]["body"]["attachments"][0]["text"]
|
||||
|
||||
# Create fake notification
|
||||
notification = Notification_obj(db)
|
||||
|
||||
Reference in New Issue
Block a user