mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-29 21:07:52 -05:00
Fix Twitch token being treated as invalid after load with broken config
This commit is contained in:
@@ -233,7 +233,11 @@ void TwitchToken::Load(obs_data_t *obj)
|
||||
{
|
||||
Item::Load(obj);
|
||||
_token = obs_data_get_string(obj, "token");
|
||||
_userID = obs_data_get_string(obj, "userID");
|
||||
if (obs_data_has_user_value(obj, "userID")) {
|
||||
_userID = obs_data_get_string(obj, "userID");
|
||||
} else {
|
||||
_userID = {};
|
||||
}
|
||||
obs_data_set_default_bool(obj, "validateEventSubTimestamps", true);
|
||||
_validateEventSubTimestamps =
|
||||
obs_data_get_bool(obj, "validateEventSubTimestamps");
|
||||
@@ -396,6 +400,10 @@ bool TwitchToken::IsValid(bool forceUpdate) const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_userID) {
|
||||
_userID = id;
|
||||
}
|
||||
|
||||
_lastValidityCheckResult = true;
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
mutable std::string _lastValidityCheckValue;
|
||||
mutable bool _lastValidityCheckResult = false;
|
||||
mutable std::chrono::system_clock::time_point _lastValidityCheckTime;
|
||||
std::optional<std::string> _userID;
|
||||
mutable std::optional<std::string> _userID;
|
||||
std::set<TokenOption> _tokenOptions = TokenOption::GetAllTokenOptions();
|
||||
std::shared_ptr<EventSub> _eventSub;
|
||||
bool _validateEventSubTimestamps = false;
|
||||
|
||||
Reference in New Issue
Block a user