[epiphany] Move gsb data to meson_options.txt



commit fac4f182c94aec7b0cb531983a7eadc708e16143
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Mon Sep 21 13:48:40 2020 +0200

    Move gsb data to meson_options.txt
    
    Move gsb_api_key to meson_options.txt so we can provide the necessary support within flatpak, but can 
disable it for the rest.
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/-/issues/682

 data/org.gnome.epiphany.gschema.xml | 5 -----
 embed/ephy-embed-shell.c            | 4 +---
 lib/ephy-prefs.h                    | 2 --
 meson.build                         | 7 +++++++
 meson_options.txt                   | 7 +++++++
 5 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index d1341d4bf..4bb014c21 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -186,11 +186,6 @@
                        <summary>Enable safe browsing</summary>
                        <description>Whether to enable safe browsing. Safe browsing operates via Google Safe 
Browsing API v4.</description>
                </key>
-               <key type="s" name="gsb-api-key">
-                       <default>'AIzaSyAtuURrRblYXvwCyDC5ZFq0mEw1x4VN6KA'</default>
-                       <summary>Google Safe Browsing API key</summary>
-                       <description>The API key used to access the Google Safe Browsing API v4.</description>
-               </key>
                <key type="b" name="enable-itp">
                        <default>true</default>
                        <summary>Enable Intelligent Tracking Prevention (ITP)</summary>
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 8abcbcea3..c2881ffbb 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -638,12 +638,10 @@ ephy_embed_shell_get_global_gsb_service (EphyEmbedShell *shell)
   g_assert (EPHY_IS_EMBED_SHELL (shell));
 
   if (!priv->global_gsb_service) {
-    g_autofree char *api_key = NULL;
     g_autofree char *db_path = NULL;
 
-    api_key = g_settings_get_string (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_GSB_API_KEY);
     db_path = g_build_filename (ephy_default_cache_dir (), EPHY_GSB_FILE, NULL);
-    priv->global_gsb_service = ephy_gsb_service_new (api_key, db_path);
+    priv->global_gsb_service = ephy_gsb_service_new (GSB_API_KEY, db_path);
   }
 
   return priv->global_gsb_service;
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 6158df1e0..87af7a11d 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -107,7 +107,6 @@ static const char * const ephy_prefs_state_schema[] = {
 #define EPHY_PREFS_WEB_REMEMBER_PASSWORDS           "remember-passwords"
 #define EPHY_PREFS_WEB_ENABLE_SITE_SPECIFIC_QUIRKS  "enable-site-specific-quirks"
 #define EPHY_PREFS_WEB_ENABLE_SAFE_BROWSING         "enable-safe-browsing"
-#define EPHY_PREFS_WEB_GSB_API_KEY                  "gsb-api-key"
 #define EPHY_PREFS_WEB_ENABLE_ITP                   "enable-itp"
 #define EPHY_PREFS_WEB_ENABLE_WEBSITE_DATA_STORAGE  "enable-website-data-storage"
 #define EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL           "default-zoom-level"
@@ -137,7 +136,6 @@ static const char * const ephy_prefs_web_schema[] = {
   EPHY_PREFS_WEB_REMEMBER_PASSWORDS,
   EPHY_PREFS_WEB_ENABLE_SITE_SPECIFIC_QUIRKS,
   EPHY_PREFS_WEB_ENABLE_SAFE_BROWSING,
-  EPHY_PREFS_WEB_GSB_API_KEY,
   EPHY_PREFS_WEB_ENABLE_ITP,
   EPHY_PREFS_WEB_ENABLE_WEBSITE_DATA_STORAGE,
   EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL,
diff --git a/meson.build b/meson.build
index da852ceb5..977b49d8c 100644
--- a/meson.build
+++ b/meson.build
@@ -67,6 +67,12 @@ conf.set('EPHY_MICRO_VERSION', 0)
 
 conf.set_quoted('VERSION', '@VCS_TAG@')
 
+gsb_api_key = get_option('gsb_api_key')
+conf.set_quoted('GSB_API_KEY', gsb_api_key)
+if gsb_api_key != ''
+  message('GSB API Key provided')
+endif
+
 config_h = declare_dependency(
   sources: vcs_tag(
     input: configure_file(
@@ -128,3 +134,4 @@ subdir('src')
 subdir('tests')
 
 meson.add_install_script('post_install.py')
+
diff --git a/meson_options.txt b/meson_options.txt
index 512ef4079..43e58e2a0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -27,3 +27,10 @@ option('unit_tests',
   value: 'enabled',
   description: 'Enable unit tests'
 )
+
+option('gsb_api_key',
+  type: 'string',
+  value: '',
+  description: 'The API key used to access the Google Safe Browsing API v4'
+)
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]