UI: Check CEF available when loading auth
This commit is contained in:
parent
28860411dd
commit
484c3847fc
@ -213,6 +213,8 @@ public:
|
|||||||
|
|
||||||
void MixerAuth::LoadUI()
|
void MixerAuth::LoadUI()
|
||||||
{
|
{
|
||||||
|
if (!cef)
|
||||||
|
return;
|
||||||
if (uiLoaded)
|
if (uiLoaded)
|
||||||
return;
|
return;
|
||||||
if (!GetChannelInfo())
|
if (!GetChannelInfo())
|
||||||
@ -261,6 +263,9 @@ void MixerAuth::LoadUI()
|
|||||||
|
|
||||||
bool MixerAuth::RetryLogin()
|
bool MixerAuth::RetryLogin()
|
||||||
{
|
{
|
||||||
|
if (!cef)
|
||||||
|
return false;
|
||||||
|
|
||||||
OAuthLogin login(OBSBasic::Get(), MIXER_AUTH_URL, false);
|
OAuthLogin login(OBSBasic::Get(), MIXER_AUTH_URL, false);
|
||||||
cef->add_popup_whitelist_url("about:blank", &login);
|
cef->add_popup_whitelist_url("about:blank", &login);
|
||||||
|
|
||||||
@ -278,6 +283,10 @@ bool MixerAuth::RetryLogin()
|
|||||||
|
|
||||||
std::shared_ptr<Auth> MixerAuth::Login(QWidget *parent)
|
std::shared_ptr<Auth> MixerAuth::Login(QWidget *parent)
|
||||||
{
|
{
|
||||||
|
if (!cef) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
OAuthLogin login(parent, MIXER_AUTH_URL, false);
|
OAuthLogin login(parent, MIXER_AUTH_URL, false);
|
||||||
cef->add_popup_whitelist_url("about:blank", &login);
|
cef->add_popup_whitelist_url("about:blank", &login);
|
||||||
|
|
||||||
|
@ -26,6 +26,10 @@ OAuthLogin::OAuthLogin(QWidget *parent, const std::string &url, bool token)
|
|||||||
: QDialog (parent),
|
: QDialog (parent),
|
||||||
get_token (token)
|
get_token (token)
|
||||||
{
|
{
|
||||||
|
if (!cef) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setWindowTitle("Auth");
|
setWindowTitle("Auth");
|
||||||
setMinimumSize(400, 400);
|
setMinimumSize(400, 400);
|
||||||
resize(700, 700);
|
resize(700, 700);
|
||||||
@ -66,6 +70,15 @@ OAuthLogin::~OAuthLogin()
|
|||||||
delete cefWidget;
|
delete cefWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int OAuthLogin::exec()
|
||||||
|
{
|
||||||
|
if (cefWidget) {
|
||||||
|
return QDialog::exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
return QDialog::Rejected;
|
||||||
|
}
|
||||||
|
|
||||||
void OAuthLogin::urlChanged(const QString &url)
|
void OAuthLogin::urlChanged(const QString &url)
|
||||||
{
|
{
|
||||||
std::string uri = get_token ? "access_token=" : "code=";
|
std::string uri = get_token ? "access_token=" : "code=";
|
||||||
|
@ -23,6 +23,8 @@ public:
|
|||||||
inline QString GetCode() const {return code;}
|
inline QString GetCode() const {return code;}
|
||||||
inline bool LoadFail() const {return fail;}
|
inline bool LoadFail() const {return fail;}
|
||||||
|
|
||||||
|
virtual int exec() override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void urlChanged(const QString &url);
|
void urlChanged(const QString &url);
|
||||||
};
|
};
|
||||||
|
@ -42,6 +42,9 @@ static Auth::Def twitchDef = {
|
|||||||
TwitchAuth::TwitchAuth(const Def &d)
|
TwitchAuth::TwitchAuth(const Def &d)
|
||||||
: OAuthStreamKey(d)
|
: OAuthStreamKey(d)
|
||||||
{
|
{
|
||||||
|
if (!cef)
|
||||||
|
return;
|
||||||
|
|
||||||
cef->add_popup_whitelist_url(
|
cef->add_popup_whitelist_url(
|
||||||
"https://twitch.tv/popout/frankerfacez/chat?ffz-settings",
|
"https://twitch.tv/popout/frankerfacez/chat?ffz-settings",
|
||||||
this);
|
this);
|
||||||
@ -194,6 +197,8 @@ static const char *referrer_script2 = "'; }});";
|
|||||||
|
|
||||||
void TwitchAuth::LoadUI()
|
void TwitchAuth::LoadUI()
|
||||||
{
|
{
|
||||||
|
if (!cef)
|
||||||
|
return;
|
||||||
if (uiLoaded)
|
if (uiLoaded)
|
||||||
return;
|
return;
|
||||||
if (!GetChannelInfo())
|
if (!GetChannelInfo())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user