diff options
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/adapter/services/mail_service.py | 3 | ||||
-rw-r--r-- | service/pixelated/config/services.py | 3 | ||||
-rw-r--r-- | service/pixelated/resources/root_resource.py | 7 |
3 files changed, 10 insertions, 3 deletions
diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py index 44c4c145..53f7615e 100644 --- a/service/pixelated/adapter/services/mail_service.py +++ b/service/pixelated/adapter/services/mail_service.py @@ -23,10 +23,11 @@ import os class MailService(object): - def __init__(self, mail_sender, mail_store, search_engine): + def __init__(self, mail_sender, mail_store, search_engine, account_email): self.mail_store = mail_store self.search_engine = search_engine self.mail_sender = mail_sender + self.account_email = account_email @defer.inlineCallbacks def all_mails(self): diff --git a/service/pixelated/config/services.py b/service/pixelated/config/services.py index 35429c01..b70bb3f9 100644 --- a/service/pixelated/config/services.py +++ b/service/pixelated/config/services.py @@ -60,7 +60,8 @@ class Services(object): return MailService( pixelated_mail_sender, leap_session.mail_store, - search_engine) + search_engine, + leap_session.account_email()) def setup_draft_service(self, mail_store): return DraftService(mail_store) diff --git a/service/pixelated/resources/root_resource.py b/service/pixelated/resources/root_resource.py index e6046eae..7bb7b3ad 100644 --- a/service/pixelated/resources/root_resource.py +++ b/service/pixelated/resources/root_resource.py @@ -1,5 +1,6 @@ import os import requests +from string import Template from pixelated.resources.attachments_resource import AttachmentsResource from pixelated.resources.contacts_resource import ContactsResource from pixelated.resources.features_resource import FeaturesResource @@ -22,6 +23,7 @@ class RootResource(Resource): Resource.__init__(self) self._startup_assets_folder = self._get_startup_folder() self._static_folder = self._get_static_folder() + self._html_template = open(os.path.join(self._static_folder, 'index.html')).read() self._startup_mode() def _startup_mode(self): @@ -34,6 +36,8 @@ class RootResource(Resource): return Resource.getChild(self, path, request) def initialize(self, keymanager, search_engine, mail_service, draft_service, feedback_service): + self.account_email = mail_service.account_email + self.putChild('assets', File(self._static_folder)) self.putChild('keys', KeysResource(keymanager)) self.putChild('attachment', AttachmentsResource(mail_service)) @@ -67,4 +71,5 @@ class RootResource(Resource): if self._is_starting(): return open(os.path.join(self._startup_assets_folder, 'Interstitial.html')).read() else: - return open(os.path.join(self._static_folder, 'index.html')).read() + response = Template(self._html_template).safe_substitute(account_email=self.account_email) + return str(response) |