Forráskód Böngészése

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 6 éve
szülő
commit
9ffe7f5f94
1 módosított fájl, 9 hozzáadás és 1 törlés
  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);
 		throw ErrorInfo("Failed to parse json", error);
 
 
 	error = json["error"].string_value();
 	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());
 		throw ErrorInfo(error, json["error_description"].string_value());
+	}
 
 
 	name = json["name"].string_value();
 	name = json["name"].string_value();
 	key_ = json["stream_key"].string_value();
 	key_ = json["stream_key"].string_value();