Skip to content

Commit

Permalink
Add youtubeKeygen alias to googleKeygen
Browse files Browse the repository at this point in the history
...in --set twitch.* contexts.
  • Loading branch information
zorael committed Jul 18, 2023
1 parent 50b41b4 commit cff3bbf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions source/kameloso/platform.d
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ Pid execvp(/*const*/ string[] args) @system
"twitch.keygen",
"twitch.superKeygen",
"twitch.googleKeygen",
"twitch.youtubeKeygen",
"twitch.spotifyKeygen"))
{
toRemove ~= i;
Expand Down
14 changes: 12 additions & 2 deletions source/kameloso/plugins/twitch/base.d
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ public:
+/
bool googleKeygen = false;

/++
Runtime "alias" to [googleKeygen].
+/
bool youtubeKeygen = false;

/++
Whether or not to start a captive session for requesting Spotify
access tokens.
Expand Down Expand Up @@ -2671,6 +2676,7 @@ void start(TwitchPlugin plugin)
plugin.twitchSettings.keygen ||
plugin.twitchSettings.superKeygen ||
plugin.twitchSettings.googleKeygen ||
plugin.twitchSettings.youtubeKeygen ||
plugin.twitchSettings.spotifyKeygen;

if (!plugin.state.server.address.endsWith(".twitch.tv"))
Expand Down Expand Up @@ -2728,13 +2734,15 @@ void start(TwitchPlugin plugin)
needSeparator = true;
}

if (plugin.twitchSettings.googleKeygen)
if (plugin.twitchSettings.googleKeygen ||
plugin.twitchSettings.youtubeKeygen)
{
import kameloso.plugins.twitch.google : requestGoogleKeys;
if (needSeparator) logger.trace(separator);
requestGoogleKeys(plugin);
if (*plugin.state.abort) return;
plugin.twitchSettings.googleKeygen = false;
plugin.twitchSettings.youtubeKeygen = false;
needSeparator = true;
}

Expand All @@ -2749,11 +2757,12 @@ void start(TwitchPlugin plugin)

// Remove custom Twitch settings so we can reconnect without jumping
// back into keygens.
static immutable string[4] settingsToPop =
static immutable string[5] settingsToPop =
[
"twitch.keygen",
"twitch.superKeygen",
"twitch.googleKeygen",
"twitch.youtubeKeygen",
"twitch.spotifyKeygen",
];

Expand Down Expand Up @@ -4238,6 +4247,7 @@ package:
twitchSettings.keygen ||
twitchSettings.superKeygen ||
twitchSettings.googleKeygen ||
twitchSettings.youtubeKeygen ||
twitchSettings.spotifyKeygen);
}

Expand Down

0 comments on commit cff3bbf

Please sign in to comment.