Commit 3be03bc9 authored by Adrien Plazas's avatar Adrien Plazas
Browse files

Merge branch 'pureos-source-safe' into 'pureos/byzantium'

debian: Patch flagging applications from PureOS as safe

See merge request !20
parents 12f3135b 070f6d83
Pipeline #71138 passed with stages
in 6 minutes and 3 seconds
From 166c6ef7d009aa6a3d7527f934881099aae0ce6e Mon Sep 17 00:00:00 2001
From: Adrien Plazas <kekun.plazas@laposte.net>
Date: Mon, 13 Sep 2021 13:31:13 +0200
Subject: [PATCH] Flag applications from PureOS as safe
---
src/gs-app-context-bar.c | 6 ++++++
src/gs-safety-context-dialog.c | 18 ++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/src/gs-app-context-bar.c b/src/gs-app-context-bar.c
index 6799a26b4..9895c3041 100644
--- a/src/gs-app-context-bar.c
+++ b/src/gs-app-context-bar.c
@@ -405,6 +405,12 @@ update_safety_tile (GsAppContextBar *self)
* https://gitlab.gnome.org/GNOME/gnome-software/-/issues/new */
description = g_strjoinv (_("; "), (gchar **) descriptions->pdata);
+ if (g_str_has_prefix (gs_app_get_origin_appstream (self->app), "pureos-")) {
+ chosen_rating = SAFETY_SAFE;
+ g_ptr_array_set_size (descriptions, 0);
+ g_ptr_array_add (descriptions, (gpointer) _("Trusted source"));
+ }
+
/* Update the UI. */
switch (chosen_rating) {
case SAFETY_SAFE:
diff --git a/src/gs-safety-context-dialog.c b/src/gs-safety-context-dialog.c
index 02cc49789..82c9a0238 100644
--- a/src/gs-safety-context-dialog.c
+++ b/src/gs-safety-context-dialog.c
@@ -112,6 +112,7 @@ update_permissions_list (GsSafetyContextDialog *self)
GsAppPermissions permissions;
GtkStyleContext *context;
GsContextDialogRowImportance chosen_rating;
+ gboolean trusted_source;
/* Treat everything as safe to begin with, and downgrade its safety
* based on app properties. */
@@ -123,6 +124,20 @@ update_permissions_list (GsSafetyContextDialog *self)
if (self->app == NULL)
return;
+ trusted_source = g_str_has_prefix (gs_app_get_origin_appstream (self->app), "pureos-");
+
+ add_permission_row (self->permissions_list, &chosen_rating,
+ !trusted_source,
+ GS_CONTEXT_DIALOG_ROW_IMPORTANCE_WARNING,
+ "dialog-warning-symbolic",
+ /* Translators: This refers to source repository. */
+ _("Unknown Source"),
+ _("This application comes from an unknown source and might be unsafe"),
+ "test-pass-symbolic",
+ /* Translators: This refers to source repository. */
+ _("Trusted Source"),
+ _("This application comes from a trusted source"));
+
permissions = gs_app_get_permissions (self->app);
/* Handle unknown permissions. */
@@ -326,6 +341,9 @@ update_permissions_list (GsSafetyContextDialog *self)
_("The developer of this app has been verified to be who they say they are"),
NULL, NULL, NULL);
+ if (trusted_source)
+ chosen_rating = GS_CONTEXT_DIALOG_ROW_IMPORTANCE_UNIMPORTANT;
+
/* Update the UI. */
switch (chosen_rating) {
case GS_CONTEXT_DIALOG_ROW_IMPORTANCE_UNIMPORTANT:
--
2.30.2
......@@ -16,3 +16,4 @@ rebrand/0004-Rebrand-the-application.patch
ensure-icons-exist/0001-icon-Ensure-icon-files-exist.patch
ensure-icons-exist/0002-app-Ensure-themed-icons-exist.patch
appstream-Support-Purism-form_factor.patch
Flag-applications-from-PureOS-as-safe.patch
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment