Add a helper to handle captive portal logins
Add a small DBus-activated GtkApplication that embeds a WebKitWebView and implements some minimal logic to see if the login succeeds. It will try to connect to a custom NM-provided url (the portal login page), if one exists, or to www.gnome.org in the normal case of a portal doing redirect. https://bugzilla.gnome.org/show_bug.cgi?id=704416
This commit is contained in:
@ -199,6 +199,21 @@ nodist_gnome_shell_extension_prefs_SOURCES = \
|
||||
gnome_shell_extension_prefs_CPPFLAGS = $(gnome_shell_cflags)
|
||||
gnome_shell_extension_prefs_LDADD = libgnome-shell-js.la $(GNOME_SHELL_LIBS)
|
||||
|
||||
if HAVE_NETWORKMANAGER
|
||||
|
||||
libexec_PROGRAMS += gnome-shell-portal-helper
|
||||
gnome_shell_portal_helper_SOURCES = \
|
||||
gnome-shell-portal-helper.c \
|
||||
$(NULL)
|
||||
nodist_gnome_shell_portal_helper_SOURCES = \
|
||||
$(top_builddir)/js/js-resources.c \
|
||||
$(top_builddir)/js/js-resources.h \
|
||||
$(NULL)
|
||||
gnome_shell_portal_helper_CPPFLAGS = $(gnome_shell_cflags)
|
||||
gnome_shell_portal_helper_LDADD = libgnome-shell-js.la $(GNOME_SHELL_LIBS)
|
||||
|
||||
endif
|
||||
|
||||
########################################
|
||||
|
||||
libgnome_shell_js_la_SOURCES = \
|
||||
|
52
src/gnome-shell-portal-helper.c
Normal file
52
src/gnome-shell-portal-helper.c
Normal file
@ -0,0 +1,52 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <girepository.h>
|
||||
#include <gjs/gjs.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
const char *search_path[] = { "resource:///org/gnome/shell", NULL };
|
||||
GError *error = NULL;
|
||||
GjsContext *context;
|
||||
int status;
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
g_irepository_prepend_search_path (GNOME_SHELL_PKGLIBDIR);
|
||||
|
||||
context = g_object_new (GJS_TYPE_CONTEXT,
|
||||
"search-path", search_path,
|
||||
NULL);
|
||||
|
||||
if (!gjs_context_define_string_array(context, "ARGV",
|
||||
argc, (const char**)argv,
|
||||
&error))
|
||||
{
|
||||
g_message("Failed to define ARGV: %s", error->message);
|
||||
g_error_free (error);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (!gjs_context_eval (context,
|
||||
"const Main = imports.portalHelper.main; Main.main(ARGV);",
|
||||
-1,
|
||||
"<main>",
|
||||
&status,
|
||||
&error))
|
||||
{
|
||||
g_message ("Execution of main.js threw exception: %s", error->message);
|
||||
g_error_free (error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user