Merge pull request #1664 from thecashewtrader/watch-on-youtube-button

Add Watch on YouTube button
This commit is contained in:
Kavin 2022-11-06 00:45:32 +00:00 committed by GitHub
commit 06412fc10b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 52 additions and 5 deletions

View File

@ -30,11 +30,13 @@
v-if="channel.id" v-if="channel.id"
:href="`${apiUrl()}/feed/unauthenticated/rss?channels=${channel.id}`" :href="`${apiUrl()}/feed/unauthenticated/rss?channels=${channel.id}`"
target="_blank" target="_blank"
class="btn flex-col ml-3" class="btn flex-col mx-3"
> >
<font-awesome-icon icon="rss" /> <font-awesome-icon icon="rss" />
</a> </a>
<WatchOnYouTubeButton :link="`https://youtube.com/channel/${this.channel.id}`" />
<div class="flex mt-4 mb-2"> <div class="flex mt-4 mb-2">
<button <button
v-for="(tab, index) in tabs" v-for="(tab, index) in tabs"
@ -65,11 +67,13 @@
<script> <script>
import ErrorHandler from "./ErrorHandler.vue"; import ErrorHandler from "./ErrorHandler.vue";
import ContentItem from "./ContentItem.vue"; import ContentItem from "./ContentItem.vue";
import WatchOnYouTubeButton from "./WatchOnYouTubeButton.vue";
export default { export default {
components: { components: {
ErrorHandler, ErrorHandler,
ContentItem, ContentItem,
WatchOnYouTubeButton,
}, },
data() { data() {
return { return {

View File

@ -20,9 +20,10 @@
<button class="btn mr-1" @click="downloadPlaylistAsTxt"> <button class="btn mr-1" @click="downloadPlaylistAsTxt">
{{ $t("actions.download_as_txt") }} {{ $t("actions.download_as_txt") }}
</button> </button>
<a class="btn" :href="getRssUrl"> <a class="btn mr-1" :href="getRssUrl">
<font-awesome-icon icon="rss" /> <font-awesome-icon icon="rss" />
</a> </a>
<WatchOnYouTubeButton :link="`https://www.youtube.com/playlist?list=${this.$route.query.list}`" />
</div> </div>
</div> </div>
@ -47,11 +48,13 @@
<script> <script>
import ErrorHandler from "./ErrorHandler.vue"; import ErrorHandler from "./ErrorHandler.vue";
import VideoItem from "./VideoItem.vue"; import VideoItem from "./VideoItem.vue";
import WatchOnYouTubeButton from "./WatchOnYouTubeButton.vue";
export default { export default {
components: { components: {
ErrorHandler, ErrorHandler,
VideoItem, VideoItem,
WatchOnYouTubeButton,
}, },
data() { data() {
return { return {

View File

@ -96,6 +96,16 @@
@change="onChange($event)" @change="onChange($event)"
/> />
</label> </label>
<label class="pref" for="chkShowWatchOnYouTube">
<strong v-t="'actions.show_watch_on_youtube'" />
<input
id="chkShowWatchOnYouTube"
v-model="showWatchOnYouTube"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
<label class="pref" for="chkStoreSearchHistory"> <label class="pref" for="chkStoreSearchHistory">
<strong v-t="'actions.store_search_history'" /> <strong v-t="'actions.store_search_history'" />
<input <input
@ -368,6 +378,7 @@ export default {
minimizeComments: false, minimizeComments: false,
minimizeDescription: false, minimizeDescription: false,
minimizeRecommendations: false, minimizeRecommendations: false,
showWatchOnYouTube: false,
watchHistory: false, watchHistory: false,
searchHistory: false, searchHistory: false,
hideWatched: false, hideWatched: false,
@ -504,6 +515,7 @@ export default {
this.minimizeComments = this.getPreferenceBoolean("minimizeComments", false); this.minimizeComments = this.getPreferenceBoolean("minimizeComments", false);
this.minimizeDescription = this.getPreferenceBoolean("minimizeDescription", false); this.minimizeDescription = this.getPreferenceBoolean("minimizeDescription", false);
this.minimizeRecommendations = this.getPreferenceBoolean("minimizeRecommendations", false); this.minimizeRecommendations = this.getPreferenceBoolean("minimizeRecommendations", false);
this.showWatchOnYouTube = this.getPreferenceBoolean("showWatchOnYouTube", false);
this.watchHistory = this.getPreferenceBoolean("watchHistory", false); this.watchHistory = this.getPreferenceBoolean("watchHistory", false);
this.searchHistory = this.getPreferenceBoolean("searchHistory", false); this.searchHistory = this.getPreferenceBoolean("searchHistory", false);
this.selectedLanguage = this.getPreferenceString("hl", await this.defaultLanguage); this.selectedLanguage = this.getPreferenceString("hl", await this.defaultLanguage);
@ -531,7 +543,7 @@ export default {
this.getPreferenceString("theme", "dark") !== this.selectedTheme || this.getPreferenceString("theme", "dark") !== this.selectedTheme ||
this.getPreferenceBoolean("watchHistory", false) != this.watchHistory || this.getPreferenceBoolean("watchHistory", false) != this.watchHistory ||
this.getPreferenceString("hl", await this.defaultLanguage) !== this.selectedLanguage || this.getPreferenceString("hl", await this.defaultLanguage) !== this.selectedLanguage ||
this.getPreferenceString("enabledCodecs", "av1,vp9,avc") !== this.enabledCodecs.join(",") this.getPreferenceString("enabledCodecs", "vp9,avc") !== this.enabledCodecs.join(",")
) )
shouldReload = true; shouldReload = true;
@ -563,6 +575,7 @@ export default {
localStorage.setItem("minimizeComments", this.minimizeComments); localStorage.setItem("minimizeComments", this.minimizeComments);
localStorage.setItem("minimizeDescription", this.minimizeDescription); localStorage.setItem("minimizeDescription", this.minimizeDescription);
localStorage.setItem("minimizeRecommendations", this.minimizeRecommendations); localStorage.setItem("minimizeRecommendations", this.minimizeRecommendations);
localStorage.setItem("showWatchOnYouTube", this.showWatchOnYouTube);
localStorage.setItem("watchHistory", this.watchHistory); localStorage.setItem("watchHistory", this.watchHistory);
localStorage.setItem("searchHistory", this.searchHistory); localStorage.setItem("searchHistory", this.searchHistory);
if (!this.searchHistory) localStorage.removeItem("search_history"); if (!this.searchHistory) localStorage.removeItem("search_history");

View File

@ -0,0 +1,22 @@
<script>
export default {
props: {
link: String,
},
};
</script>
<template>
<template v-if="this.getPreferenceBoolean('showWatchOnYouTube', false)">
<!-- For large screens -->
<a :href="link" class="btn lt-lg:hidden">
<i18n-t keypath="player.watch_on" tag="strong">
<font-awesome-icon class="mx-1.5" :icon="['fab', 'youtube']" />
</i18n-t>
</a>
<!-- For small screens -->
<a :href="link" class="btn lg:hidden">
<font-awesome-icon class="mx-1.5" :icon="['fab', 'youtube']" />
</a>
</template>
</template>

View File

@ -108,7 +108,8 @@
> >
<font-awesome-icon icon="rss" /> <font-awesome-icon icon="rss" />
</a> </a>
<!-- watch on youtube button --> <WatchOnYouTubeButton :link="`https://youtu.be/${getVideoId()}`" />
<!-- Share Dialog -->
<button class="btn" @click="showShareModal = !showShareModal"> <button class="btn" @click="showShareModal = !showShareModal">
<i18n-t class="lt-lg:hidden" keypath="actions.share" tag="strong"></i18n-t> <i18n-t class="lt-lg:hidden" keypath="actions.share" tag="strong"></i18n-t>
<font-awesome-icon class="mx-1.5" icon="fa-share" /> <font-awesome-icon class="mx-1.5" icon="fa-share" />
@ -223,6 +224,7 @@ import ChaptersBar from "./ChaptersBar.vue";
import PlaylistAddModal from "./PlaylistAddModal.vue"; import PlaylistAddModal from "./PlaylistAddModal.vue";
import ShareModal from "./ShareModal.vue"; import ShareModal from "./ShareModal.vue";
import PlaylistVideos from "./PlaylistVideos.vue"; import PlaylistVideos from "./PlaylistVideos.vue";
import WatchOnYouTubeButton from "./WatchOnYouTubeButton.vue";
export default { export default {
name: "App", name: "App",
@ -235,6 +237,7 @@ export default {
PlaylistAddModal, PlaylistAddModal,
ShareModal, ShareModal,
PlaylistVideos, PlaylistVideos,
WatchOnYouTubeButton,
}, },
data() { data() {
const smallViewQuery = window.matchMedia("(max-width: 640px)"); const smallViewQuery = window.matchMedia("(max-width: 640px)");

View File

@ -90,6 +90,7 @@
"delete_account": "Delete Account", "delete_account": "Delete Account",
"logout": "Logout from this device", "logout": "Logout from this device",
"minimize_recommendations_default": "Minimize Recommendations by default", "minimize_recommendations_default": "Minimize Recommendations by default",
"show_watch_on_youtube": "Show Watch on YouTube button",
"invalidate_session": "Logout all devices", "invalidate_session": "Logout all devices",
"different_auth_instance": "Use a different instance for authentication", "different_auth_instance": "Use a different instance for authentication",
"instance_auth_selection": "Autentication Instance Selection", "instance_auth_selection": "Autentication Instance Selection",

View File

@ -21,7 +21,7 @@ import {
faServer, faServer,
faDonate, faDonate,
} from "@fortawesome/free-solid-svg-icons"; } from "@fortawesome/free-solid-svg-icons";
import { faGithub, faBitcoin } from "@fortawesome/free-brands-svg-icons"; import { faGithub, faBitcoin, faYoutube } from "@fortawesome/free-brands-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
library.add( library.add(
faEye, faEye,
@ -31,6 +31,7 @@ library.add(
faCheck, faCheck,
faHeart, faHeart,
faHeadphones, faHeadphones,
faYoutube,
faRss, faRss,
faChevronLeft, faChevronLeft,
faLevelDownAlt, faLevelDownAlt,