Initial commit
This commit is contained in:
commit
c0a4ae0069
3 changed files with 56 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
captcha-helper
|
10
.gitlab.yml
Normal file
10
.gitlab.yml
Normal file
|
@ -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
|
45
captcha-helper.vala
Normal file
45
captcha-helper.vala
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue