unauthenticated subscriptions (#1270)

* hmm

* unauthenticated feed

* unauthenticated rss

* Small improvements to code.

* add unauthenticated subscriptions

* cleanup

* Sort subs locally.

* Fix some bugs and small improvements.

Co-authored-by: Kavin <20838718+FireMasterK@users.noreply.github.com>
This commit is contained in:
Bnyro
2022-08-01 16:16:06 +02:00
committed by GitHub
parent 1ebf153814
commit c51a3a828e
7 changed files with 118 additions and 64 deletions

View File

@@ -199,6 +199,27 @@ const mixin = {
});
}
},
getLocalSubscriptions() {
return JSON.parse(localStorage.getItem("localSubscriptions"));
},
isSubscribedLocally(channelId) {
const localSubscriptions = this.getLocalSubscriptions();
if (localSubscriptions == null) return false;
return localSubscriptions.includes(channelId);
},
handleLocalSubscriptions(channelId) {
var localSubscriptions = this.getLocalSubscriptions() ?? [];
if (localSubscriptions.includes(channelId))
localSubscriptions.splice(localSubscriptions.indexOf(channelId));
else localSubscriptions.push(channelId);
// Sort for better cache hits
localSubscriptions.sort();
localStorage.setItem("localSubscriptions", JSON.stringify(localSubscriptions));
},
getUnauthenticatedChannels() {
const localSubscriptions = this.getLocalSubscriptions();
return localSubscriptions.join(",");
},
},
computed: {
theme() {