فهرست منبع

UI: If Twitch account disconnected, retry login

If the user disconnects OBS from their Twitch account on their Twitch
settings panel, then try asking the user if they'd like to reconnect
before throwing an error.
jp9000 7 سال پیش
والد
کامیت
9ffe7f5f94
1فایلهای تغییر یافته به همراه9 افزوده شده و 1 حذف شده
  1. 9 1
      UI/auth-twitch.cpp

+ 9 - 1
UI/auth-twitch.cpp

@@ -102,8 +102,16 @@ try {
 		throw ErrorInfo("Failed to parse json", error);
 
 	error = json["error"].string_value();
-	if (!error.empty())
+	if (!error.empty()) {
+		if (error == "Unauthorized") {
+			if (RetryLogin()) {
+				return GetChannelInfo();
+			}
+			throw ErrorInfo(error,
+					json["message"].string_value());
+		}
 		throw ErrorInfo(error, json["error_description"].string_value());
+	}
 
 	name = json["name"].string_value();
 	key_ = json["stream_key"].string_value();