aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-03 21:00:25 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-03 21:00:25 +0100
commit4367d8d1df461806946e756370c9cb73e94f1a1a (patch)
tree409615a775d77f32b04c2bf266c11021ba058b22
parentcarpy tests for alembic... (diff)
downloadnewspipe-4367d8d1df461806946e756370c9cb73e94f1a1a.tar.gz
newspipe-4367d8d1df461806946e756370c9cb73e94f1a1a.tar.bz2
newspipe-4367d8d1df461806946e756370c9cb73e94f1a1a.zip
It is now possible to give the address of a CDN server through the configuratin file (or a system variable).
-rw-r--r--app.json1
-rw-r--r--package.json1
-rw-r--r--src/conf.py2
-rw-r--r--src/conf/conf.cfg-sample2
-rw-r--r--src/web/templates/home.html2
-rw-r--r--src/web/views/views.py2
6 files changed, 7 insertions, 3 deletions
diff --git a/app.json b/app.json
index 41d695c6..164eff7e 100644
--- a/app.json
+++ b/app.json
@@ -13,6 +13,7 @@
},
"env": {
"HEROKU": "1",
+ "CDN_ADDRESS": "https://cdn.cedricbonhomme.org/",
"ADMIN_EMAIL": "root@jarr.localhost",
"ADMIN_PASSWORD": "password",
"NOTIFICATION_EMAIL": "JARR@no-reply.com",
diff --git a/package.json b/package.json
index ed1475fb..2ad26f07 100644
--- a/package.json
+++ b/package.json
@@ -36,7 +36,6 @@
"watchify": "^2.1.1"
},
"scripts": {
- "postinstall": "npm install;npm run",
"start": "watchify -o src/web/static/js/bundle.min.js -v -d src/web/js/app.js",
"build": "browserify . -t [envify --NODE_ENV production] | uglifyjs -cm > src/web/static/js/bundle.min.js"
},
diff --git a/src/conf.py b/src/conf.py
index 8acdeef6..8ee77ceb 100644
--- a/src/conf.py
+++ b/src/conf.py
@@ -107,6 +107,8 @@ WEBSERVER_HOST = config.get('webserver', 'host')
WEBSERVER_PORT = config.getint('webserver', 'port')
WEBSERVER_SECRET = config.get('webserver', 'secret')
+CDN_ADDRESS = config.get('cdn', 'address')
+
NOTIFICATION_EMAIL = config.get('notification', 'notification_email')
NOTIFICATION_HOST = config.get('notification', 'host')
NOTIFICATION_PORT = config.getint('notification', 'port')
diff --git a/src/conf/conf.cfg-sample b/src/conf/conf.cfg-sample
index 98114c8a..2bcbca74 100644
--- a/src/conf/conf.cfg-sample
+++ b/src/conf/conf.cfg-sample
@@ -2,6 +2,8 @@
host = 127.0.0.1
port = 5000
secret = a secret only you know
+[cdn]
+address = https://cdn.cedricbonhomme.org/
[misc]
platform_url = http://127.0.0.1:5000/
admin_email =
diff --git a/src/web/templates/home.html b/src/web/templates/home.html
index c2966be7..fcb2a042 100644
--- a/src/web/templates/home.html
+++ b/src/web/templates/home.html
@@ -18,5 +18,5 @@
<body>
<section id="jarrapp" />
</body>
- <script type="text/javascript" src="{{ url_for('static', filename = 'js/bundle.min.js') }}"></script>
+ <script type="text/javascript" src="{% if cdn != '' %}{{ cdn }}bundle.min.js{% else %}{{ url_for('static', filename = 'js/bundle.min.js') }}{% endif %}"></script>
</html>
diff --git a/src/web/views/views.py b/src/web/views/views.py
index 223f96e9..88f3f8ce 100644
--- a/src/web/views/views.py
+++ b/src/web/views/views.py
@@ -237,7 +237,7 @@ from flask import jsonify
@login_required
@etag_match
def home():
- return render_template('home.html')
+ return render_template('home.html', cdn=conf.CDN_ADDRESS)
@app.route('/menu')
bgstack15