mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
import
This commit is contained in:
commit
5650752fcf
1 changed files with 5 additions and 9 deletions
14
src/main.js
14
src/main.js
|
@ -208,21 +208,17 @@ const mixin = {
|
||||||
return localSubscriptions.includes(channelId);
|
return localSubscriptions.includes(channelId);
|
||||||
},
|
},
|
||||||
handleLocalSubscriptions(channelId) {
|
handleLocalSubscriptions(channelId) {
|
||||||
var localSubscriptions = this.getLocalSubscriptions();
|
var localSubscriptions = this.getLocalSubscriptions() ?? [];
|
||||||
if (localSubscriptions == null || localSubscriptions.size == 0) localSubscriptions = [channelId];
|
if (localSubscriptions.includes(channelId))
|
||||||
else if (localSubscriptions.includes(channelId))
|
|
||||||
localSubscriptions.splice(localSubscriptions.indexOf(channelId));
|
localSubscriptions.splice(localSubscriptions.indexOf(channelId));
|
||||||
else localSubscriptions.push(channelId);
|
else localSubscriptions.push(channelId);
|
||||||
|
// Sort for better cache hits
|
||||||
|
localSubscriptions.sort();
|
||||||
localStorage.setItem("localSubscriptions", JSON.stringify(localSubscriptions));
|
localStorage.setItem("localSubscriptions", JSON.stringify(localSubscriptions));
|
||||||
},
|
},
|
||||||
getUnauthenticatedChannels() {
|
getUnauthenticatedChannels() {
|
||||||
const localSubscriptions = this.getLocalSubscriptions();
|
const localSubscriptions = this.getLocalSubscriptions();
|
||||||
var channels = "";
|
return localSubscriptions.join(",");
|
||||||
localSubscriptions.forEach((element, index) => {
|
|
||||||
channels += element;
|
|
||||||
if (localSubscriptions.size != index) channels += ",";
|
|
||||||
});
|
|
||||||
return channels;
|
|
||||||
},
|
},
|
||||||
importSubscriptionsLocally(newChannels) {
|
importSubscriptionsLocally(newChannels) {
|
||||||
const subscriptions = this.getLocalSubscriptions().concat(newChannels);
|
const subscriptions = this.getLocalSubscriptions().concat(newChannels);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue