put baseurl into config

This commit is contained in:
2019-05-02 05:25:36 +02:00
parent b85794af20
commit 5903d9bbd2
2 changed files with 4 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ def load():
_config.add_section('smtp') _config.add_section('smtp')
_config['pushover']['apikey'] = '' _config['pushover']['apikey'] = ''
_config['general']['secretkey'] = '' _config['general']['secretkey'] = ''
_config['general']['baseurl'] = ''
_config['smtp']['server'] = '' _config['smtp']['server'] = ''
_config['smtp']['username'] = '' _config['smtp']['username'] = ''
_config['smtp']['password'] = '' _config['smtp']['password'] = ''

View File

@@ -69,7 +69,7 @@ class Informer(object):
text = news.content text = news.content
for attachment in news.attachments: for attachment in news.attachments:
fid, fname = attachment.localpath.split('/') fid, fname = attachment.localpath.split('/')
text += '''<br>Attachment {0}: https://files.hyttioaoa.de/{1} <br>'''.format(fname, attachment.localpath) text += '''<br>Attachment {0}: {2}/{1} <br>'''.format(fname, attachment.localpath, cfg['general']['baseurl'])
parsed_date = dateparser.parse(news.date) parsed_date = dateparser.parse(news.date)
now = datetime.datetime.now() now = datetime.datetime.now()
parsed_date += datetime.timedelta(hours=now.hour, minutes=now.minute) parsed_date += datetime.timedelta(hours=now.hour, minutes=now.minute)
@@ -107,7 +107,7 @@ class Informer(object):
text = '<html> <head> <meta charset="utf-8" /> </head> <body>{}</body></html>'.format(text) text = '<html> <head> <meta charset="utf-8" /> </head> <body>{}</body></html>'.format(text)
with open(fpath, 'w+') as f: with open(fpath, 'w+') as f:
f.write(text) f.write(text)
return 'https://files.hyttioaoa.de/{}.html'.format(filename) return '{}/{}.html'.format(cfg['general']['baseurl'], filename)
def _notify_news_mail(self, news): def _notify_news_mail(self, news):
# Import the email modules we'll need # Import the email modules we'll need
@@ -166,7 +166,7 @@ class Informer(object):
text = hw.text text = hw.text
for attachment in hw.attachments: for attachment in hw.attachments:
fid, fname = attachment.localpath.split('/') fid, fname = attachment.localpath.split('/')
text += '''<br>Attachment {0}: https://files.hyttioaoa.de/{1}<br>'''.format(fname, attachment.localpath) text += '''<br>Attachment {0}: {2}/{1}<br>'''.format(fname, attachment.localpath, cfg['general']['baseurl'])
if len(text) > 900: if len(text) > 900:
url = self._make_site(text) url = self._make_site(text)
shorttext = text[:900] shorttext = text[:900]