Ver Fonte

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.)
Yuriy Chumak há 4 anos atrás
pai
commit
63ad0642ae
6 ficheiros alterados com 10 adições e 6 exclusões
  1. 1 1
      UI/auth-oauth.cpp
  2. 3 1
      UI/auth-oauth.hpp
  3. 1 1
      UI/auth-restream.cpp
  4. 2 1
      UI/auth-restream.hpp
  5. 1 1
      UI/auth-twitch.cpp
  6. 2 1
      UI/auth-twitch.hpp

+ 1 - 1
UI/auth-oauth.cpp

@@ -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);
 		}
 	}
 

+ 3 - 1
UI/auth-oauth.hpp

@@ -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,

+ 1 - 1
UI/auth-restream.cpp

@@ -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);

+ 2 - 1
UI/auth-restream.hpp

@@ -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);
 };

+ 1 - 1
UI/auth-twitch.cpp

@@ -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) {

+ 2 - 1
UI/auth-twitch.hpp

@@ -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;