rename to frontend.py & backend.py
This commit is contained in:
parent
bd2599c91a
commit
c612a9dee0
6
db.py
6
db.py
|
@ -5,14 +5,14 @@ import jwt
|
||||||
from os import path, urandom
|
from os import path, urandom
|
||||||
from pylibscrypt import scrypt_mcf, scrypt_mcf_check
|
from pylibscrypt import scrypt_mcf, scrypt_mcf_check
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import ticketfrei
|
import backend
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
|
|
||||||
|
|
||||||
class DB(object):
|
class DB(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.config = ticketfrei.get_config()
|
self.config = backend.get_config()
|
||||||
self.logger = ticketfrei.get_logger(self.config)
|
self.logger = backend.get_logger(self.config)
|
||||||
dbfile = path.join(path.dirname(path.abspath(__file__)),
|
dbfile = path.join(path.dirname(path.abspath(__file__)),
|
||||||
'ticketfrei.sqlite')
|
'ticketfrei.sqlite')
|
||||||
self.conn = sqlite3.connect(dbfile)
|
self.conn = sqlite3.connect(dbfile)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import base64
|
||||||
import bottle
|
import bottle
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import sendmail
|
import sendmail
|
||||||
import ticketfrei
|
import backend
|
||||||
import jwt
|
import jwt
|
||||||
import pylibscrypt
|
import pylibscrypt
|
||||||
import smtplib
|
import smtplib
|
||||||
|
@ -345,7 +345,7 @@ class StripPathMiddleware(object):
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
global config
|
global config
|
||||||
config = ticketfrei.get_config()
|
config = backend.get_config()
|
||||||
|
|
||||||
global db
|
global db
|
||||||
global secret
|
global secret
|
||||||
|
|
|
@ -6,7 +6,7 @@ import time
|
||||||
import trigger
|
import trigger
|
||||||
import datetime
|
import datetime
|
||||||
import email
|
import email
|
||||||
import ticketfrei
|
import backend
|
||||||
import imaplib
|
import imaplib
|
||||||
import report
|
import report
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class Mailbot(object):
|
||||||
:param config: (dictionary) config.toml as a dictionary of dictionaries
|
:param config: (dictionary) config.toml as a dictionary of dictionaries
|
||||||
"""
|
"""
|
||||||
self.config = config
|
self.config = config
|
||||||
self.logger = ticketfrei.get_logger(config)
|
self.logger = backend.get_logger(config)
|
||||||
|
|
||||||
self.history_path = history_path
|
self.history_path = history_path
|
||||||
self.last_mail = self.get_history(self.history_path)
|
self.last_mail = self.get_history(self.history_path)
|
||||||
|
@ -56,7 +56,7 @@ class Mailbot(object):
|
||||||
def repost(self, status):
|
def repost(self, status):
|
||||||
"""
|
"""
|
||||||
E-Mails don't have to be reposted - they already reached everyone on the mailing list.
|
E-Mails don't have to be reposted - they already reached everyone on the mailing list.
|
||||||
The function still needs to be here because ticketfrei.py assumes it, and take the
|
The function still needs to be here because backend.py assumes it, and take the
|
||||||
report object they want to give us.
|
report object they want to give us.
|
||||||
|
|
||||||
:param status: (report.Report object)
|
:param status: (report.Report object)
|
||||||
|
@ -171,7 +171,7 @@ class Mailbot(object):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
config = ticketfrei.get_config()
|
config = backend.get_config()
|
||||||
|
|
||||||
# initialise trigger
|
# initialise trigger
|
||||||
trigger = trigger.Trigger(config)
|
trigger = trigger.Trigger(config)
|
||||||
|
|
|
@ -8,12 +8,12 @@ import time
|
||||||
import trigger
|
import trigger
|
||||||
import sendmail
|
import sendmail
|
||||||
import report
|
import report
|
||||||
import ticketfrei
|
import backend
|
||||||
|
|
||||||
class RetootBot(object):
|
class RetootBot(object):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.logger = ticketfrei.get_logger(config)
|
self.logger = backend.get_logger(config)
|
||||||
self.client_id = self.register()
|
self.client_id = self.register()
|
||||||
self.m = self.login()
|
self.m = self.login()
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ class RetootBot(object):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
config = ticketfrei.get_config()
|
config = backend.get_config()
|
||||||
|
|
||||||
trigger = trigger.Trigger(config)
|
trigger = trigger.Trigger(config)
|
||||||
bot = RetootBot(config)
|
bot = RetootBot(config)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import requests
|
||||||
import trigger
|
import trigger
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import report
|
import report
|
||||||
import ticketfrei
|
import backend
|
||||||
import sendmail
|
import sendmail
|
||||||
|
|
||||||
class RetweetBot(object):
|
class RetweetBot(object):
|
||||||
|
@ -29,7 +29,7 @@ class RetweetBot(object):
|
||||||
Tweet
|
Tweet
|
||||||
"""
|
"""
|
||||||
self.config = config
|
self.config = config
|
||||||
self.logger = ticketfrei.get_logger(config)
|
self.logger = backend.get_logger(config)
|
||||||
|
|
||||||
# initialize API access
|
# initialize API access
|
||||||
keys = self.get_api_keys()
|
keys = self.get_api_keys()
|
||||||
|
@ -200,7 +200,7 @@ class RetweetBot(object):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
config = ticketfrei.get_config()
|
config = backend.get_config()
|
||||||
|
|
||||||
# initialise trigger
|
# initialise trigger
|
||||||
trigger = trigger.Trigger(config)
|
trigger = trigger.Trigger(config)
|
||||||
|
|
|
@ -66,8 +66,8 @@ class Mailer(object):
|
||||||
|
|
||||||
# For testing:
|
# For testing:
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import ticketfrei
|
import backend
|
||||||
config = ticketfrei.get_config()
|
config = backend.get_config()
|
||||||
|
|
||||||
m = Mailer(config)
|
m = Mailer(config)
|
||||||
print(m.send("This is a test mail.", m.fromaddr, "Test"))
|
print(m.send("This is a test mail.", m.fromaddr, "Test"))
|
||||||
|
|
|
@ -57,8 +57,8 @@ class Trigger(object):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import ticketfrei
|
import backend
|
||||||
config = ticketfrei.get_config()
|
config = backend.get_config()
|
||||||
|
|
||||||
print("testing the trigger")
|
print("testing the trigger")
|
||||||
trigger = Trigger(config)
|
trigger = Trigger(config)
|
||||||
|
|
Loading…
Reference in a new issue