UI: Specify exact service to auth login callbacks

(Jim note: This gives the ability for auth login callbacks to know which
specific service type is being used. For example, with something like
YouTube, there's multiple variants: RTMP, RTMPS, and HLS. This way, the
service login callback can determine how it wants to treat the login
procedure depending on the specific type of service.)
master
Yuriy Chumak 2021-06-27 05:01:50 -07:00 committed by jp9000
parent 37b9ece904
commit 63ad0642ae
6 changed files with 10 additions and 6 deletions

View File

@ -120,7 +120,7 @@ std::shared_ptr<Auth> OAuth::Login(QWidget *parent, const std::string &service)
{
for (auto &a : loginCBs) {
if (service.find(a.def.service) != std::string::npos) {
return a.login(parent);
return a.login(parent, service);
}
}

View File

@ -35,7 +35,9 @@ class OAuth : public Auth {
public:
inline OAuth(const Def &d) : Auth(d) {}
typedef std::function<std::shared_ptr<Auth>(QWidget *)> login_cb;
typedef std::function<std::shared_ptr<Auth>(
QWidget *, const std::string &service_name)>
login_cb;
typedef std::function<void()> delete_cookies_cb;
static std::shared_ptr<Auth> Login(QWidget *parent,

View File

@ -225,7 +225,7 @@ bool RestreamAuth::RetryLogin()
QT_TO_UTF8(login.GetCode()), true);
}
std::shared_ptr<Auth> RestreamAuth::Login(QWidget *parent)
std::shared_ptr<Auth> RestreamAuth::Login(QWidget *parent, const std::string &)
{
OAuthLogin login(parent, RESTREAM_AUTH_URL, false);
cef->add_popup_whitelist_url("about:blank", &login);

View File

@ -29,5 +29,6 @@ class RestreamAuth : public OAuthStreamKey {
public:
RestreamAuth(const Def &d);
static std::shared_ptr<Auth> Login(QWidget *parent);
static std::shared_ptr<Auth> Login(QWidget *parent,
const std::string &service_name);
};

View File

@ -423,7 +423,7 @@ bool TwitchAuth::RetryLogin()
QT_TO_UTF8(login.GetCode()), true);
}
std::shared_ptr<Auth> TwitchAuth::Login(QWidget *parent)
std::shared_ptr<Auth> TwitchAuth::Login(QWidget *parent, const std::string &)
{
OAuthLogin login(parent, TWITCH_AUTH_URL, false);
if (login.exec() == QDialog::Rejected) {

View File

@ -38,7 +38,8 @@ class TwitchAuth : public OAuthStreamKey {
public:
TwitchAuth(const Def &d);
static std::shared_ptr<Auth> Login(QWidget *parent);
static std::shared_ptr<Auth> Login(QWidget *parent,
const std::string &service_name);
QTimer uiLoadTimer;