summaryrefslogtreecommitdiff
path: root/src/startup.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2023-10-26 19:54:44 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2023-10-26 19:54:44 -0400
commit2d9988b1be556acb1fb45d6dea04d0b9f3f820bc (patch)
tree9d7a8898a9bb6a778945971f206698f31bcdacc2 /src/startup.cpp
parent9a5e820f6d781fe003b5a8111906f9a3519bad2b (diff)
downloadabaddon-portaudio-2d9988b1be556acb1fb45d6dea04d0b9f3f820bc.tar.gz
abaddon-portaudio-2d9988b1be556acb1fb45d6dea04d0b9f3f820bc.zip
fix fetching build number (closes #243)
Diffstat (limited to 'src/startup.cpp')
-rw-r--r--src/startup.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/startup.cpp b/src/startup.cpp
index 06d6402..89e29a5 100644
--- a/src/startup.cpp
+++ b/src/startup.cpp
@@ -29,10 +29,22 @@ std::optional<std::pair<std::string, std::string>> ParseCookie(const Glib::ustri
}
std::optional<Glib::ustring> GetJavascriptFileFromAppPage(const Glib::ustring &contents) {
- auto regex = Glib::Regex::create(R"(app-mount.*(/assets/[\w\d]*.js).*/assets/[\w\d]*.js)");
+ auto regex = Glib::Regex::create(R"(/assets/\w{20}.js)");
+ std::vector<Glib::ustring> matches;
+
+ // regex->match_all doesnt work for some reason
+ int start_position = 0;
Glib::MatchInfo match;
- if (regex->match(contents, match)) {
- return match.fetch(1);
+ while (regex->match(contents, start_position, match)) {
+ const auto str = match.fetch(0);
+ matches.push_back(str);
+ int foo;
+ match.fetch_pos(0, start_position, foo);
+ start_position += str.size();
+ }
+
+ if (matches.size() >= 6) {
+ return matches[matches.size() - 6];
}
return {};
@@ -52,7 +64,7 @@ std::optional<uint32_t> GetBuildNumberFromJSURL(const Glib::ustring &url, const
auto res = req.execute();
if (res.error) return {};
- auto regex = Glib::Regex::create(R"("buildNumber",null!==\(t="(\d+)\"\))");
+ auto regex = Glib::Regex::create("buildNumber:\"(\\d+)\"");
Glib::MatchInfo match;
Glib::ustring string = res.text;
if (regex->match(string, match)) {