mirror of
https://github.com/uowuo/abaddon.git
synced 2024-11-10 06:00:10 +00:00
Merge branch 'master' into stages
This commit is contained in:
commit
cf5c94947b
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,6 +3,9 @@
|
|||||||
##
|
##
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# Build directory contents
|
||||||
|
build/*
|
||||||
|
|
||||||
# User-specific files
|
# User-specific files
|
||||||
*.rsuser
|
*.rsuser
|
||||||
*.suo
|
*.suo
|
||||||
|
7
.lapce/gen_compile_commands.sh
Executable file
7
.lapce/gen_compile_commands.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Use this script to create the compile_commands.json file.
|
||||||
|
# This is necessary for clangd completion.
|
||||||
|
|
||||||
|
cmake . -B build \
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug \
|
||||||
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=True
|
24
.lapce/run.toml
Normal file
24
.lapce/run.toml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# The run config is used for both run mode and debug mode
|
||||||
|
|
||||||
|
[[configs]]
|
||||||
|
name = "cmake-debug"
|
||||||
|
program = "sh"
|
||||||
|
args = [".lapce/gen_compile_commands.sh"]
|
||||||
|
|
||||||
|
[configs.env]
|
||||||
|
CC = "/usr/bin/clang"
|
||||||
|
CXX = "/usr/bin/clang++"
|
||||||
|
|
||||||
|
[[configs]]
|
||||||
|
name = "cmake"
|
||||||
|
program = "cmake"
|
||||||
|
args = ["--build", "build"]
|
||||||
|
|
||||||
|
[configs.env]
|
||||||
|
CC = "/usr/bin/clang"
|
||||||
|
CXX = "/usr/bin/clang++"
|
||||||
|
|
||||||
|
[[configs]]
|
||||||
|
name = "run"
|
||||||
|
type = "lldb"
|
||||||
|
program = "build/abaddon"
|
1
compile_commands.json
Symbolic link
1
compile_commands.json
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
build/compile_commands.json
|
@ -32,22 +32,11 @@ std::optional<std::pair<std::string, std::string>> ParseCookie(const Glib::ustri
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::optional<Glib::ustring> GetJavascriptFileFromAppPage(const Glib::ustring &contents) {
|
std::optional<Glib::ustring> GetJavascriptFileFromAppPage(const Glib::ustring &contents) {
|
||||||
auto regex = Glib::Regex::create(R"(/assets/\w+\.?\w{20}\.js)");
|
auto regex = Glib::Regex::create(R"(/assets/sentry.*?\.js)");
|
||||||
std::vector<Glib::ustring> matches;
|
|
||||||
|
|
||||||
// regex->match_all doesnt work for some reason
|
|
||||||
int start_position = 0;
|
|
||||||
Glib::MatchInfo match;
|
Glib::MatchInfo match;
|
||||||
while (regex->match(contents, start_position, match)) {
|
if (regex->match(contents, match)) {
|
||||||
const auto str = match.fetch(0);
|
return match.fetch(0);
|
||||||
matches.push_back(str);
|
|
||||||
int foo;
|
|
||||||
match.fetch_pos(0, start_position, foo);
|
|
||||||
start_position += str.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (matches.size() >= 8) {
|
|
||||||
return matches[matches.size() - 8];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
@ -67,7 +56,7 @@ std::optional<uint32_t> GetBuildNumberFromJSURL(const Glib::ustring &url, const
|
|||||||
auto res = req.execute();
|
auto res = req.execute();
|
||||||
if (res.error) return {};
|
if (res.error) return {};
|
||||||
|
|
||||||
auto regex = Glib::Regex::create(R"(Build Number: "\).concat\("(\d+))");
|
auto regex = Glib::Regex::create(R"(buildNumber",\(.="(\d+))");
|
||||||
Glib::MatchInfo match;
|
Glib::MatchInfo match;
|
||||||
Glib::ustring string = res.text;
|
Glib::ustring string = res.text;
|
||||||
if (regex->match(string, match)) {
|
if (regex->match(string, match)) {
|
||||||
@ -130,6 +119,9 @@ void DiscordStartupDialog::RunAsync() {
|
|||||||
auto js_url = GetJavascriptFileFromAppPage(app_page);
|
auto js_url = GetJavascriptFileFromAppPage(app_page);
|
||||||
if (js_url.has_value()) {
|
if (js_url.has_value()) {
|
||||||
m_build_number = GetBuildNumberFromJSURL(*js_url, *opt_cookie);
|
m_build_number = GetBuildNumberFromJSURL(*js_url, *opt_cookie);
|
||||||
|
if (m_build_number.has_value()) {
|
||||||
|
spdlog::get("discord")->debug("Found build number: {}", *m_build_number);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_dispatcher.emit();
|
m_dispatcher.emit();
|
||||||
|
Loading…
Reference in New Issue
Block a user