mirror of
https://github.com/TeamPiped/Piped.git
synced 2025-12-26 06:30:21 +00:00
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:
21
src/main.js
21
src/main.js
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user