Browse Source

allow theme error detection to be disabled via config option

sisyphus
Dustin Falgout 8 years ago
parent
commit
fafed9d700
  1. 10
      data/lightdm-webkit2-greeter.conf
  2. 62
      src/webkit2-extension.c

10
data/lightdm-webkit2-greeter.conf

@ -1,8 +1,9 @@
#
# [greeter]
# debug_mode = Greeter theme debug mode.
# secure_mode = Don't allow themes to make remote http requests.
# detect_theme_errors = Provide an option to load a fallback theme when theme errors are detected.
# screensaver_timeout = Blank the screen after this many seconds of inactivity.
# secure_mode = Don't allow themes to make remote http requests.
# time_format = A moment.js format string so the greeter can generate localized time for display.
# time_language = Language to use when displaying the time or "auto" to use the system's language.
# webkit_theme = Webkit theme to use.
@ -12,22 +13,23 @@
[greeter]
debug_mode = false
secure_mode = true
detect_theme_errors = true
screensaver_timeout = 300
secure_mode = true
time_format = LT
time_language = auto
webkit_theme = antergos
#
# [branding]
# background_images = Path to directory that contains background images for use by themes.
# logo = Path to logo image for use by greeter themes.
# user_image = Default user image/avatar. This is used by themes for users that have no .face image.
# background_images = Path to directory that contains background images for use by themes.
#
# NOTE: Paths must be accessible to the lightdm system user account (so they cannot be anywhere in /home)
#
[branding]
background_images = /usr/share/backgrounds
logo = /usr/share/lightdm-webkit/themes/antergos/img/antergos.png
user_image = /usr/share/lightdm-webkit/themes/antergos/img/antergos-logo-user.png
background_images = /usr/share/backgrounds

62
src/webkit2-extension.c

@ -94,6 +94,7 @@ static JSClassRef
static gboolean secure_mode;
static gboolean secure_mode_checked = FALSE;
static gboolean SESSION_STARTING = FALSE;
static gboolean detect_theme_errors;
static WebKitWebExtension *WEB_EXTENSION;
@ -1786,8 +1787,15 @@ autologin_timer_expired_cb(LightDMGreeter *greeter, WebKitWebExtension *extensio
static gboolean
get_config_option_as_bool(const gchar *section, const gchar *key, GError *err) {
return g_key_file_get_boolean(keyfile, section, key, &err);
get_config_option_as_bool(const gchar *section, const gchar *key, GError **err) {
GError *err_tmp = NULL;
gboolean result = g_key_file_get_boolean(keyfile, section, key, &err_tmp);
if (NULL != err_tmp) {
g_propagate_error(err, err_tmp);
}
return result;
}
@ -1949,22 +1957,9 @@ page_created_cb(WebKitWebExtension *extension,
WebKitWebPage *web_page,
gpointer user_data) {
GError *err = NULL;
// save the page_id (global variable)
page_id = webkit_web_page_get_id(web_page);
// Make sure secure_mode variable has been set
if (FALSE == secure_mode_checked) {
secure_mode = get_config_option_as_bool("greeter", "secure_mode", err);
secure_mode_checked = TRUE;
if (NULL != err) {
// Use default value
secure_mode = TRUE;
}
}
g_signal_connect(web_page, "send-request", G_CALLBACK(web_page_send_request_cb), NULL);
g_signal_connect(web_page, "console-message-sent", G_CALLBACK(web_page_console_message_sent_cb), NULL);
}
@ -1973,9 +1968,36 @@ page_created_cb(WebKitWebExtension *extension,
G_MODULE_EXPORT void
webkit_web_extension_initialize(WebKitWebExtension *extension) {
LightDMGreeter *greeter = lightdm_greeter_new();
GError *err = NULL;
WEB_EXTENSION = extension;
/* load greeter settings from config file */
keyfile = g_key_file_new();
g_key_file_load_from_file(
keyfile,
CONFIG_DIR "/lightdm-webkit2-greeter.conf",
G_KEY_FILE_NONE,
NULL
);
secure_mode = get_config_option_as_bool("greeter", "secure_mode", &err);
if (NULL != err) {
// Use default value
secure_mode = TRUE;
g_clear_error(&err);
}
detect_theme_errors = get_config_option_as_bool("greeter", "detect_theme_errors", &err);
if (NULL != err) {
// Use default value
detect_theme_errors = TRUE;
g_error_free(err);
}
g_signal_connect(
G_OBJECT(greeter),
"authentication-complete",
@ -2023,16 +2045,6 @@ webkit_web_extension_initialize(WebKitWebExtension *extension) {
* Wait until it makes it into Debian Stable before making the change.
*/
lightdm_greeter_connect_sync(greeter, NULL);
/* load greeter settings from config file */
keyfile = g_key_file_new();
g_key_file_load_from_file(
keyfile,
CONFIG_DIR "/lightdm-webkit2-greeter.conf",
G_KEY_FILE_NONE,
NULL
);
}
/* vim: set ts=4 sw=4 tw=0 noet : */

Loading…
Cancel
Save