2021-07-06 18:22:27 +00:00
|
|
|
using Gtk;
|
|
|
|
using WebKit;
|
|
|
|
|
|
|
|
public class ValaBrowser : Window {
|
|
|
|
|
|
|
|
private const string TITLE = "Signal Captcha Helper";
|
2022-05-16 22:41:06 +00:00
|
|
|
private const string CHALLENGE_URL = "https://signalcaptchas.org/challenge/generate.html";
|
|
|
|
private const string REGISTER_URL = "https://signalcaptchas.org/registration/generate.html";
|
2021-07-06 18:22:27 +00:00
|
|
|
|
|
|
|
private WebView web_view;
|
|
|
|
|
|
|
|
public ValaBrowser () {
|
|
|
|
this.title = ValaBrowser.TITLE;
|
2022-05-16 22:41:06 +00:00
|
|
|
set_default_size (500, 600);
|
2021-07-06 18:22:27 +00:00
|
|
|
|
|
|
|
this.web_view = new WebView ();
|
|
|
|
this.web_view.web_context.register_uri_scheme("signalcaptcha", token_issued);
|
2022-04-05 21:38:53 +00:00
|
|
|
this.web_view.web_context.clear_cache();
|
2021-07-06 18:22:27 +00:00
|
|
|
var scrolled_window = new ScrolledWindow (null, null);
|
|
|
|
scrolled_window.set_policy (PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
|
|
|
|
scrolled_window.add (this.web_view);
|
|
|
|
add (scrolled_window);
|
|
|
|
|
|
|
|
this.destroy.connect (Gtk.main_quit);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void token_issued(URISchemeRequest request) {
|
|
|
|
print(request.get_uri().substring(16) + "\n");
|
|
|
|
Gtk.main_quit();
|
|
|
|
}
|
|
|
|
|
2022-05-16 22:41:06 +00:00
|
|
|
public void start (string url) {
|
2021-07-06 18:22:27 +00:00
|
|
|
show_all ();
|
2022-05-16 22:41:06 +00:00
|
|
|
this.web_view.load_uri (url);
|
2021-07-06 18:22:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static int main (string[] args) {
|
|
|
|
Gtk.init (ref args);
|
|
|
|
|
|
|
|
var browser = new ValaBrowser ();
|
2022-05-16 22:41:06 +00:00
|
|
|
var url = REGISTER_URL;
|
|
|
|
|
|
|
|
if(args.length > 0) {
|
|
|
|
if(args[1] == "--challenge") {
|
|
|
|
url = CHALLENGE_URL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
browser.start(url);
|
2021-07-06 18:22:27 +00:00
|
|
|
|
|
|
|
Gtk.main ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|