summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/pixelated/resources/login_resource.py20
-rw-r--r--service/pixelated/resources/root_resource.py13
-rw-r--r--service/setup.py4
-rw-r--r--service/templates/Interstitial.html6
-rw-r--r--service/templates/login.html10
-rw-r--r--service/test/unit/resources/test_login_resource.py2
-rw-r--r--web-ui/public/signup.html6
7 files changed, 14 insertions, 47 deletions
diff --git a/service/pixelated/resources/login_resource.py b/service/pixelated/resources/login_resource.py
index 2ca85af9..4318752e 100644
--- a/service/pixelated/resources/login_resource.py
+++ b/service/pixelated/resources/login_resource.py
@@ -35,22 +35,6 @@ from twisted.web.template import Element, XMLFile, renderElement, renderer
log = Logger()
-def _get_startup_folder():
- path = os.path.dirname(os.path.abspath(__file__))
- return os.path.join(path, '..', 'assets')
-
-
-def _get_public_folder():
- static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "web-ui", "public"))
- # this is a workaround for packaging
- if not os.path.exists(static_folder):
- static_folder = os.path.abspath(
- os.path.join(os.path.abspath(__file__), "..", "..", "..", "..", "web-ui", "public"))
- if not os.path.exists(static_folder):
- static_folder = os.path.join('/', 'usr', 'share', 'pixelated-user-agent')
- return static_folder
-
-
def _get_static_folder():
static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "web-ui", "public"))
# this is a workaround for packaging
@@ -124,15 +108,11 @@ class LoginResource(BaseResource):
def __init__(self, services_factory, provider=None, disclaimer_banner=None, authenticator=None):
BaseResource.__init__(self, services_factory)
self._static_folder = _get_static_folder()
- self._public_folder = _get_public_folder()
- self._startup_folder = _get_startup_folder()
self._disclaimer_banner = disclaimer_banner
self._provider = provider
self._authenticator = authenticator or Authenticator(provider)
self._bootstrap_user_services = BootstrapUserServices(services_factory, provider)
- self.putChild('startup-assets', File(self._startup_folder))
- self.putChild('public-assets', File(self._public_folder))
with open(pkg_resources.resource_filename('templates', 'Interstitial.html')) as f:
self.interstitial = f.read()
diff --git a/service/pixelated/resources/root_resource.py b/service/pixelated/resources/root_resource.py
index e6a25e00..8253a5c1 100644
--- a/service/pixelated/resources/root_resource.py
+++ b/service/pixelated/resources/root_resource.py
@@ -48,8 +48,6 @@ class RootResource(BaseResource):
def __init__(self, services_factory, templates_folder, static_folder, public=False):
BaseResource.__init__(self, services_factory)
self._public = public
- self._assets_folder = self._get_assets_folder()
- self._startup_assets_folder = self._get_startup_folder()
self._static_folder = static_folder
self._services_factory = services_factory
with open(pkg_resources.resource_filename('templates', 'Interstitial.html')) as f:
@@ -59,8 +57,6 @@ class RootResource(BaseResource):
self._startup_mode()
def _startup_mode(self):
- self.putChildProtected('assets', File(self._assets_folder))
- self.putChildPublic('startup-assets', File(pkg_resources.resource_filename('templates', '.')))
self.putChildPublic('static', File(self._static_folder))
self._mode = MODE_STARTUP
logger.debug('Root in STARTUP mode. %s' % self)
@@ -120,12 +116,3 @@ class RootResource(BaseResource):
self._inbox_resource.initialize()
self._mode = MODE_RUNNING
logger.debug('Root in RUNNING mode. %s' % self)
-
- def _get_assets_folder(self):
- pixelated_path = os.path.dirname(os.path.abspath(pixelated.__file__))
- return os.path.join(pixelated_path, '..', '..', 'web-ui', 'public')
-
- # TODO: use the public folder for this
- def _get_startup_folder(self):
- path = os.path.dirname(os.path.abspath(__file__))
- return os.path.join(path, '..', 'assets')
diff --git a/service/setup.py b/service/setup.py
index d7fd1607..da706ed3 100644
--- a/service/setup.py
+++ b/service/setup.py
@@ -41,11 +41,11 @@ setup(name='pixelated-user-agent',
'pixelated.adapter.mailstore.maintenance',
'pixelated.bitmask_libraries',
'pixelated.config',
- 'pixelated.assets',
'pixelated.certificates',
'pixelated.support',
'pixelated.resources',
- 'pixelated.extensions'
+ 'pixelated.extensions',
+ 'templates'
],
install_requires=[],
entry_points={
diff --git a/service/templates/Interstitial.html b/service/templates/Interstitial.html
index bc6cc738..7787a1c5 100644
--- a/service/templates/Interstitial.html
+++ b/service/templates/Interstitial.html
@@ -4,15 +4,15 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
- <script src="startup-assets/snap.svg-min.js"></script>
- <script src="startup-assets/jquery-2.1.3.min.js"></script>
+ <script src="static/snap.svg-min.js"></script>
+ <script src="static/jquery-2.1.3.min.js"></script>
</head>
<body style="border: 0px; padding: 0px; margin: 0px;background-color: #808181">
<section id="hive-section" style="background-color: #808181;" name="hive-section">
<svg id="hive" style="width: 100%; height: 100%;"></svg>
</section>
- <script src="startup-assets/Interstitial.js"></script>
+ <script src="static/Interstitial.js"></script>
</body>
</html>
diff --git a/service/templates/login.html b/service/templates/login.html
index c2f5e78e..c60e9305 100644
--- a/service/templates/login.html
+++ b/service/templates/login.html
@@ -3,16 +3,16 @@
<head>
<title>Pixelated - Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link rel="icon" type="image/png" href="/startup-assets/favicon.png" />
- <link rel="stylesheet" type="text/css" href="/startup-assets/normalize.min.css" />
- <link rel="stylesheet" type="text/css" href="/startup-assets/pixelated.css" />
- <link rel="stylesheet" type="text/css" href="/startup-assets/opensans.css" />
+ <link rel="icon" type="image/png" href="/static/favicon.png" />
+ <link rel="stylesheet" type="text/css" href="/static/normalize.min.css" />
+ <link rel="stylesheet" type="text/css" href="/static/pixelated.css" />
+ <link rel="stylesheet" type="text/css" href="/static/opensans.css" />
</head>
<body>
<div class="content">
<div class="login">
- <img class="logo" src="/startup-assets/pixelated-logo-orange.svg" alt="Pixelated logo"/>
+ <img class="logo" src="/static/pixelated-logo-orange.svg" alt="Pixelated logo"/>
<p t:render="error_msg" class="error" ></p>
diff --git a/service/test/unit/resources/test_login_resource.py b/service/test/unit/resources/test_login_resource.py
index 696b0c46..fcf76f5a 100644
--- a/service/test/unit/resources/test_login_resource.py
+++ b/service/test/unit/resources/test_login_resource.py
@@ -235,7 +235,7 @@ class TestLoginPOST(unittest.TestCase):
def assert_interstitial_in_response(_):
mock_authenticate.assert_called_once_with(self.username, self.password)
- interstitial_js_in_template = '<script src="startup-assets/Interstitial.js"></script>'
+ interstitial_js_in_template = '<script src="static/Interstitial.js"></script>'
self.assertIn(interstitial_js_in_template, self.request.written[0])
d.addCallback(assert_interstitial_in_response)
diff --git a/web-ui/public/signup.html b/web-ui/public/signup.html
index 9bc6cdad..a1d4bef9 100644
--- a/web-ui/public/signup.html
+++ b/web-ui/public/signup.html
@@ -6,14 +6,14 @@
<title>Pixelated Mail</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
- <link rel="stylesheet" type="text/css" href="/startup-assets/normalize.min.css" />
- <link rel="stylesheet" type="text/css" href="/public-assets/signup.css" />
+ <link rel="stylesheet" type="text/css" href="/static/normalize.min.css" />
+ <link rel="stylesheet" type="text/css" href="/static/signup.css" />
</head>
<body>
<header><img src="images/pixelated-logo-orange.svg" alt="Pixelated" class="logo"/></header>
<div class="message">
<div id="app"></div>
- <script src="/public-assets/signup.js"></script>
+ <script src="/static/signup.js"></script>
</div>
</body>
</html>