diff options
-rw-r--r-- | newspipe/static/js/articles.js | 6 | ||||
-rw-r--r-- | newspipe/static/js/config.js | 7 | ||||
-rw-r--r-- | newspipe/templates/layout.html | 1 |
3 files changed, 11 insertions, 3 deletions
diff --git a/newspipe/static/js/articles.js b/newspipe/static/js/articles.js index f1cee6e7..29ebac2e 100644 --- a/newspipe/static/js/articles.js +++ b/newspipe/static/js/articles.js @@ -86,7 +86,7 @@ Array.prototype.map.call(nodes, function(node) { } // sends the updates to the server - fetch(API_ROOT + "article/" + article_id, { + fetch(prefix + API_ROOT + "article/" + article_id, { method: "PUT", headers: { 'Content-Type': 'application/json', @@ -157,7 +157,7 @@ Array.prototype.map.call(nodes, function(node) { } // sends the updates to the server - fetch(API_ROOT + "article/" + article_id, { + fetch(prefix + API_ROOT + "article/" + article_id, { method: "PUT", headers: { 'Content-Type': 'application/json', @@ -189,7 +189,7 @@ Array.prototype.map.call(nodes, function(node) { data = JSON.stringify(data); // sends the updates to the server - fetch(API_ROOT + "articles", { + fetch(prefix + API_ROOT + "articles", { method: "DELETE", headers: { 'Content-Type': 'application/json', diff --git a/newspipe/static/js/config.js b/newspipe/static/js/config.js new file mode 100644 index 00000000..7fad4388 --- /dev/null +++ b/newspipe/static/js/config.js @@ -0,0 +1,7 @@ +/* + * Set variables here for the javascript used by newspipe. + */ +var prefix = "/newspipe"; + +/* Set exactly one trailing slash on prefix. */ +prefix = prefix.replace(/\/+$/,"/"); diff --git a/newspipe/templates/layout.html b/newspipe/templates/layout.html index 90919a7a..466ff4e2 100644 --- a/newspipe/templates/layout.html +++ b/newspipe/templates/layout.html @@ -150,6 +150,7 @@ {% block content %}{% endblock %} <!-- Placed at the end of the document so the pages load faster --> + <script type="text/javascript" src="{{ url_for('static', filename = 'js/config.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename = 'js/articles.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename = 'js/feed.js') }}"></script> </body> |