[gnome-software/mwleeds/pwa-plugin: 129/132] fixup! Revive webapp support




commit 5312970b0a846c138006a824d92e9b490bc98e5b
Author: Phaedrus Leeds <mwleeds protonmail com>
Date:   Tue Feb 8 08:57:52 2022 -0800

    fixup! Revive webapp support

 lib/gs-plugin-loader.c                |  4 +---
 plugins/epiphany/gs-plugin-epiphany.c | 10 +++++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index fe9acfb19..6c65e41fa 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -1053,9 +1053,7 @@ gs_plugin_loader_app_is_valid (GsApp               *app,
                         gs_plugin_loader_get_app_str (app));
                return FALSE;
        }
-       /* web apps usually don't have summaries */
-       if (gs_app_get_kind (app) != AS_COMPONENT_KIND_WEB_APP &&
-           gs_app_get_summary (app) == NULL) {
+       if (gs_app_get_summary (app) == NULL) {
                g_debug ("app invalid as no summary %s",
                         gs_plugin_loader_get_app_str (app));
                return FALSE;
diff --git a/plugins/epiphany/gs-plugin-epiphany.c b/plugins/epiphany/gs-plugin-epiphany.c
index 263b89510..154348506 100644
--- a/plugins/epiphany/gs-plugin-epiphany.c
+++ b/plugins/epiphany/gs-plugin-epiphany.c
@@ -336,6 +336,7 @@ list_installed_apps_thread_cb (GTask        *task,
                const gchar *url = NULL;
                g_autofree char *icon_path = NULL;
                const gchar *exec;
+               const gchar *host;
                int argc;
                g_auto(GStrv) argv = NULL;
                guint64 install_date = 0;
@@ -343,6 +344,7 @@ list_installed_apps_thread_cb (GTask        *task,
                g_autoptr(GDesktopAppInfo) desktop_info = NULL;
                g_autoptr(GFileInfo) file_info = NULL;
                g_autoptr(GFile) desktop_file = NULL;
+               g_autoptr(GUri) uri = NULL;
 
                g_debug ("%s: Working on installed web app %s", G_STRFUNC, desktop_file_id);
 
@@ -360,7 +362,7 @@ list_installed_apps_thread_cb (GTask        *task,
                        g_assert (argc > 0);
                        url = argv[argc - 1];
                }
-               if (!url || !g_uri_is_valid (url, G_URI_FLAGS_NONE, NULL)) {
+               if (!url || !(uri = g_uri_parse (url, G_URI_FLAGS_NONE, NULL))) {
                        g_warning ("Failed to parse URL for web app %s", desktop_file_id);
                        continue;
                }
@@ -384,6 +386,12 @@ list_installed_apps_thread_cb (GTask        *task,
                gs_app_set_name (app, GS_APP_QUALITY_NORMAL, name);
                gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, url);
 
+               /* Use the domain name as a fallback summary.
+                * FIXME: Fetch the summary from the site's webapp manifest.
+                */
+               host = g_uri_get_host (uri);
+               gs_app_set_summary (app, host ? host : url);
+
                if (icon_path) {
                        g_autoptr(GFile) icon_file = g_file_new_for_path (icon_path);
                        g_autoptr(GIcon) icon = g_file_icon_new (icon_file);


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