Skip to content

Commit

Permalink
[fix] description theme not matching preference
Browse files Browse the repository at this point in the history
`attributedDescription` contains styles (font colors) which depend on the current theme (light and dark). Our payload did not contain the `userInterfaceTheme` property and our proxy server defaulted it to being set to `USER_INTERFACE_THEME_DARK`. Leading to issues where users who have the light theme enabled, were shown text colors which were not readable.

Related issues:
- #181
  • Loading branch information
drunkwinter committed Feb 27, 2023
1 parent a80c32a commit b0b1336
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion account-proxy/lib/innertubeApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const generateApiRequestData = function (clientParams) {
"screenWidthPoints": 834,
"screenHeightPoints": 1051,
"utcOffsetMinutes": 120,
"userInterfaceTheme": "USER_INTERFACE_THEME_DARK",
"userInterfaceTheme": clientParams.userInterfaceTheme,
"connectionType": "CONN_CELLULAR_4G",
"mainAppWebInfo": {
"graftUrl": "https://www.youtube.com/watch?v=" + clientParams.videoId,
Expand Down
1 change: 1 addition & 0 deletions account-proxy/lib/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class YouTubeClientParams {
this.signatureTimestamp = 18834;
this.hl = 'en';
this.startTimeSecs = 0;
this.userInterfaceTheme = 'USER_INTERFACE_THEME_DARK';
this.includeNext = false;
}

Expand Down
8 changes: 6 additions & 2 deletions src/components/strategies/next.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { getYtcfgValue, isConfirmed, isEmbed } from '../../utils';
import { innertube, proxy } from '../endpoints';

export default function getUnlockStrategies(videoId, lastPlayerUnlockReason) {
const client = getYtcfgValue('INNERTUBE_CONTEXT');
const clientName = getYtcfgValue('INNERTUBE_CLIENT_NAME') || 'WEB';
const clientVersion = getYtcfgValue('INNERTUBE_CLIENT_VERSION') || '2.20220203.04.00';
const hl = getYtcfgValue('HL');
const userInterfaceTheme = client.userInterfaceTheme;

return [
/**
Expand All @@ -18,9 +20,10 @@ export default function getUnlockStrategies(videoId, lastPlayerUnlockReason) {
payload: {
context: {
client: {
clientName: clientName,
clientVersion: clientVersion,
clientName,
clientVersion,
hl,
userInterfaceTheme,
},
},
videoId,
Expand All @@ -41,6 +44,7 @@ export default function getUnlockStrategies(videoId, lastPlayerUnlockReason) {
clientName,
clientVersion,
hl,
userInterfaceTheme,
isEmbed: +isEmbed,
isConfirmed: +isConfirmed,
},
Expand Down

0 comments on commit b0b1336

Please sign in to comment.