commit c0a4ae0069b2118778a55d652acb070ebd383f57 Author: Finn Date: Tue Jul 6 11:22:27 2021 -0700 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..554a3b3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +captcha-helper diff --git a/.gitlab.yml b/.gitlab.yml new file mode 100644 index 0000000..b014ba2 --- /dev/null +++ b/.gitlab.yml @@ -0,0 +1,10 @@ +build: + image: debian:latest + before_script: + - apt-get update + - apt-get install -y valac libwebkit2gtk-4.0-dev + script: + - valac --pkg gtk+-3.0 --pkg webkit2gtk-4.0 captcha-helper.vala + artifacts: + paths: + - captcha-helper diff --git a/captcha-helper.vala b/captcha-helper.vala new file mode 100644 index 0000000..524c42a --- /dev/null +++ b/captcha-helper.vala @@ -0,0 +1,45 @@ +using Gtk; +using WebKit; + +public class ValaBrowser : Window { + + private const string TITLE = "Signal Captcha Helper"; + private const string DEFAULT_URL = "https://signalcaptchas.org/registration/generate.html"; + + private WebView web_view; + + public ValaBrowser () { + this.title = ValaBrowser.TITLE; + set_default_size (450, 600); + + this.web_view = new WebView (); + this.web_view.web_context.register_uri_scheme("signalcaptcha", token_issued); + 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(); + } + + public void start () { + show_all (); + this.web_view.load_uri (DEFAULT_URL); + } + + public static int main (string[] args) { + Gtk.init (ref args); + + var browser = new ValaBrowser (); + browser.start(); + + Gtk.main (); + + return 0; + } +}