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
parent
37b9ece904
commit
63ad0642ae
|
@ -120,7 +120,7 @@ std::shared_ptr<Auth> OAuth::Login(QWidget *parent, const std::string &service)
|
||||||
{
|
{
|
||||||
for (auto &a : loginCBs) {
|
for (auto &a : loginCBs) {
|
||||||
if (service.find(a.def.service) != std::string::npos) {
|
if (service.find(a.def.service) != std::string::npos) {
|
||||||
return a.login(parent);
|
return a.login(parent, service);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,9 @@ class OAuth : public Auth {
|
||||||
public:
|
public:
|
||||||
inline OAuth(const Def &d) : Auth(d) {}
|
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;
|
typedef std::function<void()> delete_cookies_cb;
|
||||||
|
|
||||||
static std::shared_ptr<Auth> Login(QWidget *parent,
|
static std::shared_ptr<Auth> Login(QWidget *parent,
|
||||||
|
|
|
@ -225,7 +225,7 @@ bool RestreamAuth::RetryLogin()
|
||||||
QT_TO_UTF8(login.GetCode()), true);
|
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);
|
OAuthLogin login(parent, RESTREAM_AUTH_URL, false);
|
||||||
cef->add_popup_whitelist_url("about:blank", &login);
|
cef->add_popup_whitelist_url("about:blank", &login);
|
||||||
|
|
|
@ -29,5 +29,6 @@ class RestreamAuth : public OAuthStreamKey {
|
||||||
public:
|
public:
|
||||||
RestreamAuth(const Def &d);
|
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);
|
||||||
};
|
};
|
||||||
|
|
|
@ -423,7 +423,7 @@ bool TwitchAuth::RetryLogin()
|
||||||
QT_TO_UTF8(login.GetCode()), true);
|
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);
|
OAuthLogin login(parent, TWITCH_AUTH_URL, false);
|
||||||
if (login.exec() == QDialog::Rejected) {
|
if (login.exec() == QDialog::Rejected) {
|
||||||
|
|
|
@ -38,7 +38,8 @@ class TwitchAuth : public OAuthStreamKey {
|
||||||
public:
|
public:
|
||||||
TwitchAuth(const Def &d);
|
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;
|
QTimer uiLoadTimer;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue