From a0db1322484b78335ebeb83a0b548a9deeb4b876 Mon Sep 17 00:00:00 2001
From: Andrei Kurilov <18027129+akurilov@users.noreply.github.com>
Date: Sun, 30 Jun 2024 13:27:16 +0300
Subject: [PATCH] feat: public interests
---
helm/webapp/templates/ingress.yaml | 2 +-
web/sub-details.js | 11 -----------
web/sub.html | 2 +-
web/sub.js | 25 +++++++++++++++++++++----
4 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/helm/webapp/templates/ingress.yaml b/helm/webapp/templates/ingress.yaml
index a0cd166..2204c6b 100644
--- a/helm/webapp/templates/ingress.yaml
+++ b/helm/webapp/templates/ingress.yaml
@@ -24,7 +24,7 @@ metadata:
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/configuration-snippet: |
- more_set_headers "etag: f1c2188";
+ more_set_headers "etag: 9ffa673";
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
diff --git a/web/sub-details.js b/web/sub-details.js
index 2c1c13e..1b61dd6 100644
--- a/web/sub-details.js
+++ b/web/sub-details.js
@@ -126,17 +126,6 @@ function loadSubDetailsById(id) {
document.getElementById("sub-discovered-sources").style.display = "block";
document.getElementById("button-follow").style.display = "block";
const headers = getAuthHeaders();
- const authProvider = localStorage.getItem(keyAuthProvider);
- const subFeedLinkElement = document.getElementById("sub-feed-link");
- switch (authProvider) {
- case "Telegram": {
- subFeedLinkElement.href = "https://t.me/AwakariBot";
- break;
- }
- default:
- subFeedLinkElement.href = `https://reader.awakari.com/v1/sub/rss/${id}`;
- break;
- }
Subscriptions
.fetch(id, headers)
.then(resp => resp ? resp.json() : null)
diff --git a/web/sub.html b/web/sub.html
index 02673d0..85099d2 100644
--- a/web/sub.html
+++ b/web/sub.html
@@ -42,7 +42,7 @@
-
+
diff --git a/web/sub.js b/web/sub.js
index cd297dc..a39116b 100644
--- a/web/sub.js
+++ b/web/sub.js
@@ -1,6 +1,10 @@
const templateSub = (sub) => `
+
+ ${sub.public ? '🔉': ''}
+ ${sub.hasOwnProperty("followers")? sub.followers : '' }
+
${sub.description}
@@ -49,7 +53,7 @@ function load() {
});
const urlParams = new URLSearchParams(window.location.search);
- loadSubscriptions(urlParams.get("filter"), false);
+ loadSubscriptions(urlParams.get("filter"), urlParams.get("own"));
}
function loadSubscriptions(filter, ownOnly) {
@@ -89,6 +93,17 @@ function loadSubscriptions(filter, ownOnly) {
} else {
document.getElementById("filter").value = filter;
}
+
+ if (ownOnly == null) {
+ ownOnly = document.getElementById("own").checked;
+ } else if (ownOnly === true || ownOnly === "true") {
+ ownOnly = true;
+ document.getElementById("own").checked = true;
+ } else {
+ ownOnly = false;
+ document.getElementById("own").checked = false;
+ }
+
document.getElementById("wait").style.display = "block";
const headers = getAuthHeaders();
@@ -117,7 +132,8 @@ function loadSubscriptions(filter, ownOnly) {
btnPrev.removeAttribute("disabled");
if (subs.length > 0) {
btnPrev.onclick = () => {
- window.location.assign(`sub.html?cursor=${subs[0].id}&order=ASC&filter=${encodeURIComponent(filter)}`)
+ const sub = subs[0];
+ window.location.assign(`sub.html?cursor=${sub.id}&followers=${sub.hasOwnProperty('followers')? sub.followers : '0'}&order=ASC&filter=${encodeURIComponent(filter)}&own=${ownOnly}`)
}
} else {
btnPrev.onclick = () => {
@@ -131,7 +147,8 @@ function loadSubscriptions(filter, ownOnly) {
if (subs.length === pageLimit) {
btnNext.removeAttribute("disabled");
btnNext.onclick = () => {
- window.location.assign(`sub.html?cursor=${subs[pageLimit - 1].id}&order=DESC&filter=${encodeURIComponent(filter)}`)
+ const sub = subs[pageLimit - 1];
+ window.location.assign(`sub.html?cursor=${sub.id}&followers=${sub.hasOwnProperty('followers')? sub.followers : '0'}&order=DESC&filter=${encodeURIComponent(filter)}&own=${ownOnly}`)
}
} else {
btnNext.disabled = "disabled";
@@ -155,7 +172,7 @@ function loadSubscriptions(filter, ownOnly) {
}
} else if (order === "ASC") {
// back to the beginning
- window.location.assign(`sub.html?filter=${encodeURIComponent(filter)}`);
+ window.location.assign(`sub.html?filter=${encodeURIComponent(filter)}&own=${ownOnly}`);
}
}
}