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



commit bf41c4350d3f759f5d0f5a02b98b2aa74dc96f9d
Author: Phaedrus Leeds <mwleeds protonmail com>
Date:   Tue Mar 8 10:46:34 2022 -0800

    fixup! Revive webapp support

 plugins/epiphany/gs-plugin-epiphany.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
---
diff --git a/plugins/epiphany/gs-plugin-epiphany.c b/plugins/epiphany/gs-plugin-epiphany.c
index 958ed23a0..5c905d443 100644
--- a/plugins/epiphany/gs-plugin-epiphany.c
+++ b/plugins/epiphany/gs-plugin-epiphany.c
@@ -380,6 +380,35 @@ gs_plugin_epiphany_list_installed_apps_async (GsPlugin            *plugin,
                                list_installed_apps_thread_cb, g_steal_pointer (&task));
 }
 
+/* Run in @worker */
+static void
+set_license_from_hostname (GsApp      *app,
+                          const char *hostname)
+{
+       if (gs_app_get_license (app) != NULL)
+               return;
+
+       if (hostname == NULL || *hostname == '\0')
+               return;
+
+       if (g_str_equal (hostname, "app.diagrams.net"))
+               gs_app_set_license (app, GS_APP_QUALITY_NORMAL, "Apache-2.0");
+       else if (g_str_equal (hostname, "pinafore.social"))
+               gs_app_set_license (app, GS_APP_QUALITY_NORMAL, "AGPL-3.0-only");
+       else if (g_str_equal (hostname, "snapdrop.net"))
+               gs_app_set_license (app, GS_APP_QUALITY_NORMAL, "GPL-3.0-only");
+       else if (g_str_equal (hostname, "stackedit.io"))
+               gs_app_set_license (app, GS_APP_QUALITY_NORMAL, "Apache-2.0");
+       else if (g_str_equal (hostname, "squoosh.app"))
+               gs_app_set_license (app, GS_APP_QUALITY_NORMAL, "Apache-2.0");
+       else if (g_str_equal (hostname, "excalidraw.com"))
+               gs_app_set_license (app, GS_APP_QUALITY_NORMAL, "MIT");
+       else if (g_str_equal (hostname, "discourse.gnome.org"))
+               gs_app_set_license (app, GS_APP_QUALITY_NORMAL, "GPL-2.0-or-later");
+       else if (g_str_equal (hostname, "discourse.flathub.org"))
+               gs_app_set_license (app, GS_APP_QUALITY_NORMAL, "GPL-2.0-or-later");
+}
+
 /* Run in @worker */
 static GsApp *
 gs_epiphany_create_app (GsPluginEpiphany *self,
@@ -508,6 +537,8 @@ list_installed_apps_thread_cb (GTask        *task,
                host = g_uri_get_host (uri);
                gs_app_set_summary (app, GS_APP_QUALITY_LOWEST, host ? host : url);
 
+               set_license_from_hostname (app, host);
+
                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]