Skip to content

Commit

Permalink
feat: add software info popup
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice committed Jul 1, 2022
1 parent 842ceb5 commit 6655062
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
10 changes: 10 additions & 0 deletions src/common/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,14 @@ std::wstring get_port_mapping_name(DWORD pid) {
return port_mapping_name + std::to_wstring(pid);
}

std::string proxinject_copyright(const std::string &version) {
return "proxinject " + version + "\n\n" + "Copyright (c) PragmaTwice\n" +
"Licensed under the Apache License, Version 2.0";
}

std::string proxinject_description =
"A socks5 proxy injection tool for Windows: just select some processes "
"and make them proxy-able!\nPlease visit "
"https://github.com/PragmaTwice/proxinject for more information.";

#endif
11 changes: 2 additions & 9 deletions src/injector/injector_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,11 @@ int main(int argc, char *argv[]) {
ArgumentParser parser("proxinjector-cli", proxinject_version,
argparse::default_arguments::help);

parser.add_description(
"A socks5 proxy injection tool for Windows: just select some processes "
"and make them proxy-able!\nPlease visit "
"https://github.com/PragmaTwice/proxinject for more information.");
parser.add_description(proxinject_description);

parser.add_argument("-v", "--version")
.action([&](const auto & /*unused*/) {
std::cout << "proxinject " << proxinject_version << std::endl;
std::cout << std::endl;
std::cout << "Copyright (c) PragmaTwice" << std::endl;
std::cout << "Licensed under the Apache License, Version 2.0"
<< std::endl;
std::cout << proxinject_copyright(proxinject_version) << std::endl;
std::exit(0);
})
.default_value(false)
Expand Down
3 changes: 1 addition & 2 deletions src/injector/injector_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "server.hpp"
#include "text_box.hpp"
#include "utils.hpp"
#include "version.hpp"

void do_server(injector_server &server, ce::view &view,
process_vector &process_vec, auto &...elements) {
Expand All @@ -45,7 +44,7 @@ int main(int argc, char *argv[]) {
process_vector process_vec;

ce::app app(argc, argv, "proxinject", "proxinject");
ce::window win(app.name() + " " + proxinject_version);
ce::window win(app.name());
win.on_close = [&app]() { app.stop(); };

ce::view view(win);
Expand Down
11 changes: 10 additions & 1 deletion src/injector/injector_gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "server.hpp"
#include "text_box.hpp"
#include "utils.hpp"
#include "version.hpp"
#include <elements.hpp>
#include <sstream>

Expand All @@ -29,6 +30,7 @@ auto constexpr bg_color = ce::rgba(35, 35, 37, 255);
constexpr auto bred = ce::colors::red.opacity(0.4);
constexpr auto bblue = ce::colors::blue.opacity(0.4);
constexpr auto brblue = ce::colors::royal_blue.opacity(0.4);
constexpr auto bcblue = ce::colors::cornflower_blue.opacity(0.4);

using process_vector = std::vector<std::pair<DWORD, std::string>>;

Expand Down Expand Up @@ -170,6 +172,12 @@ auto make_controls(injector_server &server, ce::view &view,

auto log_box = share(selectable_text_box(""));

auto info_button = icon_button(icons::info, 1.2, bcblue);
info_button.on_click = [&view](bool) {
view.add(message_box1(view, proxinject_copyright(proxinject_version),
icons::info, [] {}));
};

// clang-format off
return std::make_tuple(
margin({10, 10, 10, 10},
Expand All @@ -196,7 +204,8 @@ auto make_controls(injector_server &server, ce::view &view,
hmin_size(100, addr_input),
left_margin(5, hsize(100, port_input)),
left_margin(10, hold(proxy_toggle)),
left_margin(5, log_toggle)
left_margin(5, log_toggle),
left_margin(8, info_button)
),
top_margin(10,
vmin_size(250,
Expand Down

0 comments on commit 6655062

Please sign in to comment.