mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
add option to block channels
This commit is contained in:
parent
4d9e6865ce
commit
b46555fbcd
4 changed files with 54 additions and 25 deletions
|
@ -286,6 +286,17 @@
|
|||
</div>
|
||||
<br />
|
||||
</div>
|
||||
<h2 class="text-center" v-t="'actions.blocked_channels'"></h2>
|
||||
<label class="pref" for="blockedChannels">
|
||||
<strong v-t="'actions.blocked_channels'" />
|
||||
<input
|
||||
id="blockedChannels"
|
||||
v-model="blockedChannels"
|
||||
@change="onChange($event)"
|
||||
class="input w-auto mr-2"
|
||||
type="text"
|
||||
/>
|
||||
</label>
|
||||
<h2 id="instancesList" v-t="'actions.instances_list'" />
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -403,6 +414,7 @@ export default {
|
|||
disableLBRY: false,
|
||||
proxyLBRY: false,
|
||||
password: null,
|
||||
blockedChannels: "",
|
||||
};
|
||||
},
|
||||
activated() {
|
||||
|
@ -492,6 +504,7 @@ export default {
|
|||
this.enabledCodecs = this.getPreferenceString("enabledCodecs", "vp9,avc").split(",");
|
||||
this.disableLBRY = this.getPreferenceBoolean("disableLBRY", false);
|
||||
this.proxyLBRY = this.getPreferenceBoolean("proxyLBRY", false);
|
||||
this.blockedChannels = this.getPreferenceString("blockedChannels", "");
|
||||
if (this.selectedLanguage != "en") {
|
||||
try {
|
||||
this.CountryMap = await import(`../utils/CountryMaps/${this.selectedLanguage}.json`).then(
|
||||
|
@ -549,6 +562,7 @@ export default {
|
|||
localStorage.setItem("enabledCodecs", this.enabledCodecs.join(","));
|
||||
localStorage.setItem("disableLBRY", this.disableLBRY);
|
||||
localStorage.setItem("proxyLBRY", this.proxyLBRY);
|
||||
localStorage.setItem("blockedChannels", this.blockedChannels);
|
||||
|
||||
if (shouldReload) window.location.reload();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
<div v-if="results" class="video-grid">
|
||||
<template v-for="result in results.items" :key="result.url">
|
||||
<div v-if="!isBlocked(result)">
|
||||
<VideoItem v-if="shouldUseVideoItem(result)" :video="result" height="94" width="168" />
|
||||
<div v-if="!shouldUseVideoItem(result)">
|
||||
<router-link :to="result.url">
|
||||
|
@ -47,6 +48,7 @@
|
|||
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -138,6 +140,13 @@ export default {
|
|||
return true;
|
||||
}
|
||||
},
|
||||
isBlocked(result) {
|
||||
if (!result.uploaderUrl) {
|
||||
// item is a channel
|
||||
return this.isChannelBlocked(result.url.replace("/channel/", ""));
|
||||
}
|
||||
return this.isChannelBlocked(result.uploaderUrl.replace("/channel/", ""));
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -97,7 +97,8 @@
|
|||
"confirm_reset_preferences": "Are you sure you want to reset your preferences?",
|
||||
"backup_preferences": "Backup preferences",
|
||||
"restore_preferences": "Restore preferences",
|
||||
"back_to_home": "Back to home"
|
||||
"back_to_home": "Back to home",
|
||||
"blocked_channels": "Blocked channels"
|
||||
},
|
||||
"comment": {
|
||||
"pinned_by": "Pinned by",
|
||||
|
|
|
@ -231,6 +231,11 @@ const mixin = {
|
|||
elem.click();
|
||||
elem.remove();
|
||||
},
|
||||
isChannelBlocked(channelId) {
|
||||
const blockedChannels = localStorage.getItem("blockedChannels");
|
||||
if (!blockedChannels) return false;
|
||||
return blockedChannels.split(",").includes(channelId);
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
theme() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue