kopia lustrzana https://github.com/halcy/Mastodon.py
390: GTS version fallback
rodzic
13725053a3
commit
716665181c
|
@ -616,7 +616,10 @@ class Mastodon():
|
|||
version_string = version_string.split(" ")[0]
|
||||
try:
|
||||
# Attempt to split at + and check if the part after parses as a version string, to account for hometown
|
||||
parse_version_string(version_string.split("+")[1])
|
||||
ver_parts = parse_version_string(version_string.split("+")[1])
|
||||
# If the parsed version is less than 1.0, assume it's GoToSocial and return the *first* part
|
||||
if ver_parts[0] < 1:
|
||||
return version_string.split("+")[0]
|
||||
return version_string.split("+")[1]
|
||||
except:
|
||||
# If this fails, assume that if there is a +, what is before that is the masto version (or that there is no +)
|
||||
|
|
|
@ -95,3 +95,4 @@ def test_version_parsing(api):
|
|||
assert parse_version_string(api._Mastodon__normalize_version_string("3.5.1+chitter6.6.6")) == (3, 5, 1)
|
||||
assert parse_version_string(api._Mastodon__normalize_version_string("3.5.0 (compatible; Pleroma 1.2.3)")) == (3, 5, 0)
|
||||
assert parse_version_string(api._Mastodon__normalize_version_string("3.2.1rc3 (compatible; Akkoma 3.2.4+shinychariot)")) == (3, 2, 1)
|
||||
assert parse_version_string(api._Mastodon__normalize_version_string("3.5.3+0.17.3+git-6f4cb2f")) == (3, 5, 3)
|
||||
|
|
Ładowanie…
Reference in New Issue