feat: launch arg to start logged in as a supplied user (#5626)
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
- Minor: Removed experimental IRC support. (#5547)
|
- Minor: Removed experimental IRC support. (#5547)
|
||||||
- Minor: Moderators can now see which mods start and cancel raids. (#5563)
|
- Minor: Moderators can now see which mods start and cancel raids. (#5563)
|
||||||
- Minor: The emote popup now reloads when Twitch emotes are reloaded. (#5580)
|
- Minor: The emote popup now reloads when Twitch emotes are reloaded. (#5580)
|
||||||
|
- Minor: Added `--login <username>` CLI argument to specify which account to start logged in as. (#5626)
|
||||||
- Bugfix: Fixed tab move animation occasionally failing to start after closing a tab. (#5426, #5612)
|
- Bugfix: Fixed tab move animation occasionally failing to start after closing a tab. (#5426, #5612)
|
||||||
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
|
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
|
||||||
- Bugfix: Fixed restricted users usernames not being clickable. (#5405)
|
- Bugfix: Fixed restricted users usernames not being clickable. (#5405)
|
||||||
|
|||||||
@@ -117,6 +117,13 @@ Args::Args(const QApplication &app, const Paths &paths)
|
|||||||
"safe-mode", "Starts Chatterino without loading Plugins and always "
|
"safe-mode", "Starts Chatterino without loading Plugins and always "
|
||||||
"show the settings button.");
|
"show the settings button.");
|
||||||
|
|
||||||
|
QCommandLineOption loginOption(
|
||||||
|
"login",
|
||||||
|
"Starts Chatterino logged in as the account matching the supplied "
|
||||||
|
"username. If the supplied username does not match any account "
|
||||||
|
"Chatterino starts logged in as anonymous.",
|
||||||
|
"username");
|
||||||
|
|
||||||
// Channel layout
|
// Channel layout
|
||||||
auto channelLayout = QCommandLineOption(
|
auto channelLayout = QCommandLineOption(
|
||||||
{"c", "channels"},
|
{"c", "channels"},
|
||||||
@@ -142,6 +149,7 @@ Args::Args(const QApplication &app, const Paths &paths)
|
|||||||
parentWindowIdOption,
|
parentWindowIdOption,
|
||||||
verboseOption,
|
verboseOption,
|
||||||
safeModeOption,
|
safeModeOption,
|
||||||
|
loginOption,
|
||||||
channelLayout,
|
channelLayout,
|
||||||
activateOption,
|
activateOption,
|
||||||
});
|
});
|
||||||
@@ -197,6 +205,11 @@ Args::Args(const QApplication &app, const Paths &paths)
|
|||||||
this->safeMode = true;
|
this->safeMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parser.isSet(loginOption))
|
||||||
|
{
|
||||||
|
this->initialLogin = parser.value(loginOption);
|
||||||
|
}
|
||||||
|
|
||||||
if (parser.isSet(activateOption))
|
if (parser.isSet(activateOption))
|
||||||
{
|
{
|
||||||
this->activateChannel =
|
this->activateChannel =
|
||||||
@@ -206,6 +219,7 @@ Args::Args(const QApplication &app, const Paths &paths)
|
|||||||
this->currentArguments_ = extractCommandLine(parser, {
|
this->currentArguments_ = extractCommandLine(parser, {
|
||||||
verboseOption,
|
verboseOption,
|
||||||
safeModeOption,
|
safeModeOption,
|
||||||
|
loginOption,
|
||||||
channelLayout,
|
channelLayout,
|
||||||
activateOption,
|
activateOption,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public:
|
|||||||
bool dontLoadMainWindow{};
|
bool dontLoadMainWindow{};
|
||||||
std::optional<WindowLayout> customChannelLayout;
|
std::optional<WindowLayout> customChannelLayout;
|
||||||
std::optional<Channel> activateChannel;
|
std::optional<Channel> activateChannel;
|
||||||
|
std::optional<QString> initialLogin;
|
||||||
bool verbose{};
|
bool verbose{};
|
||||||
bool safeMode{};
|
bool safeMode{};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "providers/twitch/TwitchAccountManager.hpp"
|
#include "providers/twitch/TwitchAccountManager.hpp"
|
||||||
|
|
||||||
|
#include "Application.hpp"
|
||||||
|
#include "common/Args.hpp"
|
||||||
#include "common/Common.hpp"
|
#include "common/Common.hpp"
|
||||||
#include "common/QLogging.hpp"
|
#include "common/QLogging.hpp"
|
||||||
#include "providers/twitch/api/Helix.hpp"
|
#include "providers/twitch/api/Helix.hpp"
|
||||||
@@ -144,6 +146,11 @@ void TwitchAccountManager::reloadUsers()
|
|||||||
|
|
||||||
void TwitchAccountManager::load()
|
void TwitchAccountManager::load()
|
||||||
{
|
{
|
||||||
|
if (getApp()->getArgs().initialLogin.has_value())
|
||||||
|
{
|
||||||
|
this->currentUsername = getApp()->getArgs().initialLogin.value();
|
||||||
|
}
|
||||||
|
|
||||||
this->reloadUsers();
|
this->reloadUsers();
|
||||||
|
|
||||||
this->currentUsername.connect([this](const QString &newUsername) {
|
this->currentUsername.connect([this](const QString &newUsername) {
|
||||||
|
|||||||
Reference in New Issue
Block a user