aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2023-08-31 16:08:55 -0400
committerB. Stack <bgstack15@gmail.com>2023-08-31 16:08:55 -0400
commit49993ae89fbe028df386635104ce11b1309a303d (patch)
treef575a3e2cb8983c76ccd74cc95740a49c5158dea
parentclean up (diff)
downloadnewspipe-49993ae89fbe028df386635104ce11b1309a303d.tar.gz
newspipe-49993ae89fbe028df386635104ce11b1309a303d.tar.bz2
newspipe-49993ae89fbe028df386635104ce11b1309a303d.zip
add prefix to jsreverse-proxy
-rw-r--r--newspipe/static/js/articles.js6
-rw-r--r--newspipe/static/js/config.js7
-rw-r--r--newspipe/templates/layout.html1
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>
bgstack15