Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/player/YoutubePlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ export default {
host: "https://www.youtube.com/iframe_api",
};

const host = "https://www.youtube.com";
const host = (
this.$store.state.settings.YTEmbedVariant === "youtube"
// eslint-disable-next-line no-alert
|| (this.$store.state.settings.YTEmbedVariant === "" && window.confirm(this.$t("views.settings.YTEmbedVariantPromptMsg")))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only legal because vue mounts once

Copy link
Copy Markdown
Contributor

@meiamsome meiamsome Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that browsing to a multiview page can trigger this confirmation pop-up once per video, and there's no way to tell what video each pop-up is for.

This is especially weird if you already have multiview state and then click a multiview link as you get confirmation for all the videos from the state, then asked if you want to replace the layout, and then confirmation for all the replacement videos.

It would IMO be better to display this as an in-page DOM question. Although that could be done as a follow-up potentially.

) ? "https://www.youtube.com" : "https://www.youtube-nocookie.com";

this.player = player(this.elementId, {
host,
Expand Down
7 changes: 7 additions & 0 deletions src/locales/en/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,13 @@ views:
hideMissingStreams: Hide Missing Streams
ignoredTopicsLabel: Ignored Topics
ignoredTopicsMsg: Hide videos with these topics from the Home and Favorites pages
YTEmbedVariantLabel: YouTube Player
YTEmbedVariantMsg: Change the player used to play YouTube videos. Might help alleviate playback throttling issues.
YTEmbedVariant:
- Ask every time
- YouTube default
- Privacy Enhanced Mode
YTEmbedVariantPromptMsg: Confirm to use default YouTube player, or cancel to use Privacy Enhanced Mode
theme: Theme
moreSettings: More Settings
app:
Expand Down
7 changes: 7 additions & 0 deletions src/locales/zh-TW/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ views:
hideMissingStreams: 隱藏已消失的實況
ignoredTopicsLabel: 隱藏指定內容標籤
ignoredTopicsMsg: 在首頁與我的收藏頁面中隱藏含有下列內容標籤的影片
YTEmbedVariantLabel: YouTube 播放器
YTEmbedVariantMsg: 更改用作播放 YouTube 的播放器。或許能舒緩播放限制。
YTEmbedVariant:
- 每次詢問
- YouTube 預設
- 隱私加強保護模式
YTEmbedVariantPromptMsg: 按確定採用 YouTube 預設播放器,取消則採用隱私加強保護模式
theme: 佈景主題
moreSettings: 更多設定
app:
Expand Down
5 changes: 3 additions & 2 deletions src/store/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import v8 from "./v8-20210714-multiview-content-reset";
import v9 from "./v9-2021097-mv-defaults";
import v10 from "./v10-20230401-fools";
import v11 from "./v11-20230402-foolsnomore";
import v12 from "./v12-20241231-ytembedvariant";

export const migrations: IMigration[] = [v2, v4, v5, v6, v7, v8, v9, v10, v11];
export const migrations: IMigration[] = [v2, v4, v5, v6, v7, v8, v9, v10, v11, v12];

export const VUEX_STATE_VERSION = 11;
export const VUEX_STATE_VERSION = 12;
12 changes: 12 additions & 0 deletions src/store/migrations/v12-20241231-ytembedvariant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { IMigration } from "vuex-persistedstate-migrate";

export default <IMigration>{
version: 12,
// set YTEmbedVariant to youtube by default
up: (state) => ({
...state,
settings: {
YTEmbedVariant: "youtube",
},
}),
};
5 changes: 5 additions & 0 deletions src/store/settings.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const initialState = {
ignoredTopics: [],
// Valid values: "grid" | "list" | "denseList"
homeViewMode: "grid",
YTEmbedVariant: "youtube",

// Live TL Window Settings
liveTlStickBottom: false,
Expand Down Expand Up @@ -105,6 +106,9 @@ const mutations = {
setScrollMode(state, val) {
state.scrollMode = val;
},
setYTEmbedVariant(state, val) {
state.YTEmbedVariant = val;
},
...createSimpleMutation([
"defaultOpen",
"liveTlStickBottom",
Expand All @@ -122,6 +126,7 @@ const mutations = {
"hidePlaceholder",
"hideMissing",
"homeViewMode",
"YTEmbedVariant",
]),
resetState(state) {
Object.assign(state, initialState);
Expand Down
1 change: 1 addition & 0 deletions src/utils/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export {
mdiMusic,
mdiPencil, // for changing language
mdiPlay,
mdiPlayNetwork,
mdiPlaylistMusic,
mdiPlaylistPlay,
mdiPlaylistPlus,
Expand Down
25 changes: 25 additions & 0 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,23 @@
:label="$t('views.settings.redirectModeLabel')"
:messages="$t('views.settings.redirectModeMsg')"
/>
<div class="mb-0 mt-6">
<v-icon style="margin-right: 9px">
{{ icons.mdiPlayNetwork }}
</v-icon>
<span class="text-body-1">{{ $t("views.settings.YTEmbedVariantLabel") }}</span>
</div>
<v-select
v-model="YTEmbedVariant"
prepend-icon=" "
class="mt-n4"
:items="[
{ text: $t('views.settings.YTEmbedVariant[0]'), value: '' },
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this to ask as value probably

{ text: $t('views.settings.YTEmbedVariant[1]'), value: 'youtube' },
{ text: $t('views.settings.YTEmbedVariant[2]'), value: 'youtube-nocookie' },
]"
:messages="$t('views.settings.YTEmbedVariantMsg')"
/>
</v-card-text>
</v-sheet>
</v-col>
Expand Down Expand Up @@ -334,6 +351,14 @@ export default {
this.$store.commit("setCurrentGridSize", val);
},
},
YTEmbedVariant: {
get() {
return this.$store.state.settings.YTEmbedVariant;
},
set(val) {
this.$store.commit("settings/setYTEmbedVariant", val);
},
},
useEnName: {
get() {
return this.$store.getters["settings/useEnName"];
Expand Down