Compare commits

..

No commits in common. 'c9' and 'i9-beta' have entirely different histories.
c9 ... i9-beta

@ -0,0 +1,34 @@
From 7e3e59a4ab72c7fdcedf00e28247f565cdc3f84d Mon Sep 17 00:00:00 2001
From: Alexey Berezhok <alexey.berezhok@softline.com>
Date: Mon, 21 Aug 2023 16:56:22 +0300
Subject: [PATCH] Added yandex disk webdav support
---
src/goabackend/goayandexprovider.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/goabackend/goayandexprovider.c b/src/goabackend/goayandexprovider.c
index ab74283..acaa599 100644
--- a/src/goabackend/goayandexprovider.c
+++ b/src/goabackend/goayandexprovider.c
@@ -99,7 +99,7 @@ get_scope (GoaOAuth2Provider *oauth2_provider)
static guint
get_credentials_generation (GoaProvider *provider)
{
- return 24;
+ return 34;
}
static const gchar *
@@ -284,7 +284,7 @@ build_object (GoaProvider *provider,
/* Files */
files_enabled = g_key_file_get_boolean (key_file, group, "FilesEnabled", NULL);
- uri_drive = g_strconcat ("https://cloud-api.yandex.net/v1/disk", NULL);
+ uri_drive = g_strconcat ("davs://webdav.yandex.ru/", NULL);
goa_object_skeleton_attach_files (object, uri_drive, files_enabled, FALSE);
g_free (uri_drive);
--
2.39.1

@ -0,0 +1,773 @@
From 3ad24eb010fbc7d7d888093e82e76a3b6089cb6c Mon Sep 17 00:00:00 2001
From: tigro <tigro@msvsphere-os.ru>
Date: Wed, 3 Apr 2024 14:25:09 +0300
Subject: [PATCH] Added yandex provider prebuild version
---
config.h.in | 13 +
configure.ac | 27 ++
data/icons/scalable/Makefile.am | 1 +
data/icons/scalable/Makefile.in | 1 +
data/icons/scalable/goa-account-yandex.svg | 45 +++
data/icons/symbolic/Makefile.am | 1 +
data/icons/symbolic/Makefile.in | 1 +
.../symbolic/goa-account-yandex-symbolic.svg | 45 +++
src/goabackend/Makefile.am | 1 +
src/goabackend/Makefile.in | 14 +
src/goabackend/goaprovider.c | 4 +
src/goabackend/goayandexprovider.c | 369 ++++++++++++++++++
src/goabackend/goayandexprovider.h | 37 ++
13 files changed, 559 insertions(+)
create mode 100644 data/icons/scalable/goa-account-yandex.svg
create mode 100644 data/icons/symbolic/goa-account-yandex-symbolic.svg
create mode 100644 src/goabackend/goayandexprovider.c
create mode 100644 src/goabackend/goayandexprovider.h
diff --git a/config.h.in b/config.h.in
index f0b0354..40ca01d 100644
--- a/config.h.in
+++ b/config.h.in
@@ -70,6 +70,19 @@
/* ProviderType and extension point name */
#undef GOA_GOOGLE_NAME
+/* Yandex OAuth 2.0 client id */
+#undef GOA_YANDEX_CLIENT_ID
+
+/* Yandex OAuth 2.0 client secret */
+#undef GOA_YANDEX_CLIENT_SECRET
+
+/* Enable Yandex data provider */
+#undef GOA_YANDEX_ENABLED
+
+/* ProviderType and extension point name */
+#undef GOA_YANDEX_NAME
+
+
/* Enable IMAP/SMTP data provider */
#undef GOA_IMAP_SMTP_ENABLED
diff --git a/configure.ac b/configure.ac
index 70962d6..8e1ffda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -265,6 +265,32 @@ if test "$enable_google" != "no"; then
fi
AM_CONDITIONAL(GOOGLE_ENABLED, [test x$enable_google != xno])
+# Yandex
+AC_DEFINE(GOA_YANDEX_NAME, ["yandex"], [ProviderType and extension point name])
+AC_ARG_ENABLE([yandex],
+ [AS_HELP_STRING([--enable-yandex], [Enable Yandex provider])],
+ [],
+ [enable_yandex=yes])
+AC_ARG_WITH(yandex-client-id,
+ [AS_HELP_STRING([--with-yandex-client-id], [Yandex OAuth 2.0 client id])],
+ [],
+ [])
+AC_ARG_WITH(yandex-client-secret,
+ [AS_HELP_STRING([--with-yandex-client-secret], [Yandex OAuth 2.0 client secret])],
+ [],
+ [])
+if test "$with_yandex_client_id" = ""; then
+ with_yandex_client_id=8ef866ab7a1f4d3b8fcb58510d422fbc
+fi
+if test "$with_yandex_client_secret" = ""; then
+ with_yandex_client_secret=aa8be6b692dc4465b1fa40ae6ec7a377
+fi
+AC_DEFINE_UNQUOTED(GOA_YANDEX_CLIENT_ID, ["$with_yandex_client_id"], [Yandex OAuth 2.0 client id])
+AC_DEFINE_UNQUOTED(GOA_YANDEX_CLIENT_SECRET, ["$with_yandex_client_secret"], [Yandex OAuth 2.0 client secret])
+if test "$enable_yadnex" != "no"; then
+ AC_DEFINE(GOA_YANDEX_ENABLED, 1, [Enable Yandex data provider])
+fi
+
# IMAP/SMTP
AC_DEFINE(GOA_IMAP_SMTP_NAME, ["imap_smtp"], [ProviderType and extension point name])
AC_ARG_ENABLE([imap-smtp],
@@ -557,6 +583,7 @@ echo "
Flickr provider: ${enable_flickr} (OAuth 1.0, key:${with_flickr_consumer_key} secret:${with_flickr_consumer_secret})
Foursquare provider: ${enable_foursquare} (id:${with_foursquare_client_id})
Google provider: ${enable_google} (OAuth 2.0, id:${with_google_client_id} secret:${with_google_client_secret})
+ Yandex provider: ${enable_yandex} (OAuth 2.0, id:${with_yandex_client_id} secret:${with_yandex_client_secret})
IMAP/SMTP provider: ${enable_imap_smtp}
Media Server provider: ${enable_media_server}
Microsoft Exchange provider: ${enable_exchange}
diff --git a/data/icons/scalable/Makefile.am b/data/icons/scalable/Makefile.am
index 5721dd5..0a8b5f7 100644
--- a/data/icons/scalable/Makefile.am
+++ b/data/icons/scalable/Makefile.am
@@ -12,6 +12,7 @@ icon_DATA = \
goa-account-msn.svg \
goa-account-owncloud.svg \
goa-account-foursquare.svg \
+ goa-account-yandex.svg \
$(NULL)
EXTRA_DIST = \
diff --git a/data/icons/scalable/Makefile.in b/data/icons/scalable/Makefile.in
index 9e2632e..f2a5368 100644
--- a/data/icons/scalable/Makefile.in
+++ b/data/icons/scalable/Makefile.in
@@ -375,6 +375,7 @@ icon_DATA = \
goa-account-msn.svg \
goa-account-owncloud.svg \
goa-account-foursquare.svg \
+ goa-account-yandex.svg \
$(NULL)
EXTRA_DIST = \
diff --git a/data/icons/scalable/goa-account-yandex.svg b/data/icons/scalable/goa-account-yandex.svg
new file mode 100644
index 0000000..dd7624f
--- /dev/null
+++ b/data/icons/scalable/goa-account-yandex.svg
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ width="128"
+ height="128"
+ fill="none"
+ version="1.1"
+ id="svg6"
+ sodipodi:docname="goa-account-yandex.svg"
+ inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ id="namedview8"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ showgrid="false"
+ inkscape:zoom="3.1041667"
+ inkscape:cx="6.6040268"
+ inkscape:cy="32.214765"
+ inkscape:window-width="1600"
+ inkscape:window-height="831"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6"
+ units="px" />
+ <path
+ d="m 2.8068309,62.777027 c 0,-33.16674 26.8792921,-60.0520375 60.0520371,-60.0520375 33.160731,0 60.052032,26.8852975 60.052032,60.0520375 0,33.166747 -26.891301,60.052043 -60.052032,60.052043 -33.172745,0 -60.0520371,-26.885296 -60.0520371,-60.052043 z"
+ fill="#fc3f1d"
+ id="path2"
+ style="stroke-width:6.0052" />
+ <path
+ d="m 72.133795,26.165699 h -7.118289 c -13.050211,0 -19.91428,6.609848 -19.91428,16.355126 0,11.016409 4.745529,16.177946 14.490817,22.79549 l 8.050452,5.423463 -23.134456,34.566882 H 27.220758 L 47.982446,74.383659 C 36.041588,65.824765 29.339297,57.512386 29.339297,43.452989 c 0,-17.626257 12.287531,-29.659558 35.591462,-29.659558 H 88.065216 V 105.22192 H 72.133795 Z"
+ fill="#ffffff"
+ id="path4"
+ style="stroke-width:7.70379" />
+</svg>
diff --git a/data/icons/symbolic/Makefile.am b/data/icons/symbolic/Makefile.am
index 1ba8100..5f555b7 100644
--- a/data/icons/symbolic/Makefile.am
+++ b/data/icons/symbolic/Makefile.am
@@ -11,6 +11,7 @@ icon_DATA = \
goa-account-msn-symbolic.svg \
goa-account-owncloud-symbolic.svg \
goa-account-foursquare-symbolic.svg \
+ goa-account-yandex-symbolic.svg \
$(NULL)
EXTRA_DIST = \
diff --git a/data/icons/symbolic/Makefile.in b/data/icons/symbolic/Makefile.in
index b1d4415..35ffa14 100644
--- a/data/icons/symbolic/Makefile.in
+++ b/data/icons/symbolic/Makefile.in
@@ -374,6 +374,7 @@ icon_DATA = \
goa-account-msn-symbolic.svg \
goa-account-owncloud-symbolic.svg \
goa-account-foursquare-symbolic.svg \
+ goa-account-yandex.svg \
$(NULL)
EXTRA_DIST = \
diff --git a/data/icons/symbolic/goa-account-yandex-symbolic.svg b/data/icons/symbolic/goa-account-yandex-symbolic.svg
new file mode 100644
index 0000000..528713f
--- /dev/null
+++ b/data/icons/symbolic/goa-account-yandex-symbolic.svg
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ width="16"
+ height="16"
+ fill="none"
+ version="1.1"
+ id="svg6"
+ sodipodi:docname="goa-account-yandex.svg"
+ inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ id="namedview8"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ showgrid="false"
+ inkscape:zoom="24.833333"
+ inkscape:cx="19.42953"
+ inkscape:cy="12"
+ inkscape:window-width="1600"
+ inkscape:window-height="831"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6"
+ units="px" />
+ <path
+ d="m 1.1935759,7.6916685 c 0,-3.8106297 3.0882453,-6.8995649 6.8995649,-6.8995649 3.8099392,0 6.8995642,3.0889352 6.8995642,6.8995649 0,3.8106305 -3.089625,6.8995655 -6.8995642,6.8995655 -3.8113196,0 -6.8995649,-3.088935 -6.8995649,-6.8995655 z"
+ fill="#fc3f1d"
+ id="path2"
+ style="stroke-width:0.689956" />
+ <path
+ d="m 9.0981498,3.9138576 h -0.803668 c -1.4733923,0 -2.2483582,0.7462635 -2.2483582,1.8465241 0,1.2437728 0.5357789,1.8265194 1.6360394,2.5736529 L 8.5910746,8.9463533 5.9791511,12.849017 H 4.0273847 L 6.3714179,9.3577547 C 5.0232728,8.3914394 4.2665717,7.4529564 4.2665717,5.8656241 c 0,-1.9900365 1.3872851,-3.348619 4.0183427,-3.348619 H 10.896837 V 12.83945 H 9.0981498 Z"
+ fill="#ffffff"
+ id="path4"
+ style="stroke-width:0.869772" />
+</svg>
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index c7e00a4..90d5bd7 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -91,6 +91,7 @@ libgoa_backend_1_0_la_SOURCES = \
goaobjectskeletonutils.h goaobjectskeletonutils.c \
goautils.h goautils.c \
nautilus-floating-bar.h nautilus-floating-bar.c \
+ goayandexprovider.h goayandexprovider.c \
$(top_builddir)/src/goaidentity/org.gnome.Identity.c \
$(top_srcdir)/src/goaidentity/goaidentitymanagererror.c \
$(NULL)
diff --git a/src/goabackend/Makefile.in b/src/goabackend/Makefile.in
index 608b214..4444c0b 100644
--- a/src/goabackend/Makefile.in
+++ b/src/goabackend/Makefile.in
@@ -181,6 +181,7 @@ am__libgoa_backend_1_0_la_SOURCES_DIST = goabackend.h \
goaoauth2provider-priv.h goaoauth2provider-web-extension.h \
goaoauth2provider-web-view.h goaoauth2provider.c \
goagoogleprovider.h goagoogleprovider.c goafacebookprovider.h \
+ goayandexprovider.h goayandexprovider.c \
goafacebookprovider.c goaimapsmtpprovider.h \
goaimapsmtpprovider.c goamediaserverprovider.h \
goamediaserverprovider.c goaowncloudprovider.h \
@@ -216,6 +217,7 @@ am_libgoa_backend_1_0_la_OBJECTS = \
libgoa_backend_1_0_la-goaoauthprovider.lo \
libgoa_backend_1_0_la-goaoauth2provider.lo \
libgoa_backend_1_0_la-goagoogleprovider.lo \
+ libgoa_backend_1_0_la-goayandexprovider.lo \
libgoa_backend_1_0_la-goafacebookprovider.lo \
libgoa_backend_1_0_la-goaimapsmtpprovider.lo \
libgoa_backend_1_0_la-goamediaserverprovider.lo \
@@ -285,6 +287,7 @@ am__depfiles_remade = \
./$(DEPDIR)/libgoa_backend_1_0_la-goaflickrprovider.Plo \
./$(DEPDIR)/libgoa_backend_1_0_la-goafoursquareprovider.Plo \
./$(DEPDIR)/libgoa_backend_1_0_la-goagoogleprovider.Plo \
+ ./$(DEPDIR)/libgoa_backend_1_0_la-goayandexprovider.Plo \
./$(DEPDIR)/libgoa_backend_1_0_la-goahttpclient.Plo \
./$(DEPDIR)/libgoa_backend_1_0_la-goaidentitymanagererror.Plo \
./$(DEPDIR)/libgoa_backend_1_0_la-goaimapauthlogin.Plo \
@@ -618,6 +621,7 @@ libgoa_backend_1_0_la_SOURCES = goabackend.h goabackendenums-priv.h \
goaoauth2provider-priv.h goaoauth2provider-web-extension.h \
goaoauth2provider-web-view.h goaoauth2provider.c \
goagoogleprovider.h goagoogleprovider.c goafacebookprovider.h \
+ goayandexprovider.h goayandexprovider.c \
goafacebookprovider.c goaimapsmtpprovider.h \
goaimapsmtpprovider.c goamediaserverprovider.h \
goamediaserverprovider.c goaowncloudprovider.h \
@@ -839,6 +843,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgoa_backend_1_0_la-goaflickrprovider.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgoa_backend_1_0_la-goafoursquareprovider.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgoa_backend_1_0_la-goagoogleprovider.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgoa_backend_1_0_la-goayandexprovider.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgoa_backend_1_0_la-goahttpclient.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgoa_backend_1_0_la-goaidentitymanagererror.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgoa_backend_1_0_la-goaimapauthlogin.Plo@am__quote@ # am--include-marker
@@ -1003,6 +1008,13 @@ libgoa_backend_1_0_la-goagoogleprovider.lo: goagoogleprovider.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgoa_backend_1_0_la_CFLAGS) $(CFLAGS) -c -o libgoa_backend_1_0_la-goagoogleprovider.lo `test -f 'goagoogleprovider.c' || echo '$(srcdir)/'`goagoogleprovider.c
+libgoa_backend_1_0_la-goayandexprovider.lo: goayandexprovider.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgoa_backend_1_0_la_CFLAGS) $(CFLAGS) -MT libgoa_backend_1_0_la-goayandexprovider.lo -MD -MP -MF $(DEPDIR)/libgoa_backend_1_0_la-goayandexprovider.Tpo -c -o libgoa_backend_1_0_la-goayandexprovider.lo `test -f 'goayandexprovider.c' || echo '$(srcdir)/'`goayandexprovider.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgoa_backend_1_0_la-goayandexprovider.Tpo $(DEPDIR)/libgoa_backend_1_0_la-goayandexprovider.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='goayandexprovider.c' object='libgoa_backend_1_0_la-goayandexprovider.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgoa_backend_1_0_la_CFLAGS) $(CFLAGS) -c -o libgoa_backend_1_0_la-goayandexprovider.lo `test -f 'goayandexprovider.c' || echo '$(srcdir)/'`goayandexprovider.c
+
libgoa_backend_1_0_la-goafacebookprovider.lo: goafacebookprovider.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgoa_backend_1_0_la_CFLAGS) $(CFLAGS) -MT libgoa_backend_1_0_la-goafacebookprovider.lo -MD -MP -MF $(DEPDIR)/libgoa_backend_1_0_la-goafacebookprovider.Tpo -c -o libgoa_backend_1_0_la-goafacebookprovider.lo `test -f 'goafacebookprovider.c' || echo '$(srcdir)/'`goafacebookprovider.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgoa_backend_1_0_la-goafacebookprovider.Tpo $(DEPDIR)/libgoa_backend_1_0_la-goafacebookprovider.Plo
@@ -1335,6 +1347,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goaflickrprovider.Plo
-rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goafoursquareprovider.Plo
-rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goagoogleprovider.Plo
+ -rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goayandexprovider.Plo
-rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goahttpclient.Plo
-rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goaidentitymanagererror.Plo
-rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goaimapauthlogin.Plo
@@ -1417,6 +1430,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goaflickrprovider.Plo
-rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goafoursquareprovider.Plo
-rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goagoogleprovider.Plo
+ -rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goayandexprovider.Plo
-rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goahttpclient.Plo
-rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goaidentitymanagererror.Plo
-rm -f ./$(DEPDIR)/libgoa_backend_1_0_la-goaimapauthlogin.Plo
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index 9712cd2..c00782c 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -31,6 +31,7 @@
#include "goawindowsliveprovider.h"
#include "goamediaserverprovider.h"
#include "goalastfmprovider.h"
+#include "goayandexprovider.h"
#ifdef GOA_FEDORA_ENABLED
#include "goafedoraprovider.h"
@@ -934,6 +935,9 @@ static struct
* important because it affects the order in which they are
* returned by goa_provider_get_all.
*/
+#ifdef GOA_YANDEX_ENABLED
+ { GOA_YANDEX_NAME, goa_yandex_provider_get_type },
+#endif
#ifdef GOA_GOOGLE_ENABLED
{ GOA_GOOGLE_NAME, goa_google_provider_get_type },
#endif
diff --git a/src/goabackend/goayandexprovider.c b/src/goabackend/goayandexprovider.c
new file mode 100644
index 0000000..ab74283
--- /dev/null
+++ b/src/goabackend/goayandexprovider.c
@@ -0,0 +1,369 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright © 2011 2017 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+#include <glib/gi18n-lib.h>
+
+#include <rest/oauth-proxy.h>
+#include <json-glib/json-glib.h>
+
+#include "goaprovider.h"
+#include "goaprovider-priv.h"
+#include "goaoauth2provider.h"
+#include "goayandexprovider.h"
+#include "goaobjectskeletonutils.h"
+#include "goarestproxy.h"
+
+struct _GoaYandexProvider
+{
+ GoaOAuth2Provider parent_instance;
+};
+
+G_DEFINE_TYPE_WITH_CODE (GoaYandexProvider, goa_yandex_provider, GOA_TYPE_OAUTH2_PROVIDER,
+ goa_provider_ensure_extension_points_registered ();
+ g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME,
+ g_define_type_id,
+ GOA_YANDEX_NAME,
+ 0));
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static const gchar *
+get_provider_type (GoaProvider *provider)
+{
+ return GOA_YANDEX_NAME;
+}
+
+static gchar *
+get_provider_name (GoaProvider *provider,
+ GoaObject *object)
+{
+ return g_strdup (_("Yandex"));
+}
+
+static GoaProviderGroup
+get_provider_group (GoaProvider *provider)
+{
+ return GOA_PROVIDER_GROUP_BRANDED;
+}
+
+static GoaProviderFeatures
+get_provider_features (GoaProvider *provider)
+{
+ return GOA_PROVIDER_FEATURE_BRANDED |
+ GOA_PROVIDER_FEATURE_MAIL |
+ GOA_PROVIDER_FEATURE_CALENDAR |
+// GOA_PROVIDER_FEATURE_CONTACTS |
+ GOA_PROVIDER_FEATURE_FILES;
+}
+
+static const gchar *
+get_authorization_uri (GoaOAuth2Provider *oauth2_provider)
+{
+ return "https://oauth.yandex.ru/authorize";
+}
+
+static const gchar *
+get_token_uri (GoaOAuth2Provider *oauth2_provider)
+{
+ return "https://oauth.yandex.ru/token";
+}
+
+static const gchar *
+get_redirect_uri (GoaOAuth2Provider *oauth2_provider)
+{
+ return "http://localhost";
+}
+
+static const gchar *
+get_scope (GoaOAuth2Provider *oauth2_provider)
+{
+ return "login:email login:info mail:imap_full mail:imap_ro mail:smtp calendar:all yadisk:disk cloud_api:disk.read cloud_api:disk.write";
+}
+
+static guint
+get_credentials_generation (GoaProvider *provider)
+{
+ return 24;
+}
+
+static const gchar *
+get_client_id (GoaOAuth2Provider *oauth2_provider)
+{
+ return GOA_YANDEX_CLIENT_ID;
+}
+
+static const gchar *
+get_client_secret (GoaOAuth2Provider *oauth2_provider)
+{
+ return GOA_YANDEX_CLIENT_SECRET;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static gchar *
+get_identity_sync (GoaOAuth2Provider *oauth2_provider,
+ const gchar *access_token,
+ gchar **out_presentation_identity,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GError *identity_error = NULL;
+ RestProxy *proxy = NULL;
+ RestProxyCall *call = NULL;
+ JsonParser *parser = NULL;
+ JsonObject *json_object;
+ gchar *ret = NULL;
+ gchar *id = NULL;
+
+ /* TODO: cancellable */
+
+ proxy = goa_rest_proxy_new ("https://login.yandex.ru/info", FALSE);
+ call = rest_proxy_new_call (proxy);
+ rest_proxy_call_set_method (call, "GET");
+ rest_proxy_call_add_param (call, "oauth_token", access_token);
+
+ if (!rest_proxy_call_sync (call, error))
+ goto out;
+ if (rest_proxy_call_get_status_code (call) != 200)
+ {
+ g_set_error (error,
+ GOA_ERROR,
+ GOA_ERROR_FAILED,
+ _("Expected status 200 when requesting your identity, instead got status %d (%s)"),
+ rest_proxy_call_get_status_code (call),
+ rest_proxy_call_get_status_message (call));
+ goto out;
+ }
+
+ parser = json_parser_new ();
+ if (!json_parser_load_from_data (parser,
+ rest_proxy_call_get_payload (call),
+ rest_proxy_call_get_payload_length (call),
+ &identity_error))
+ {
+ g_warning ("json_parser_load_from_data() failed: %s (%s, %d)",
+ identity_error->message,
+ g_quark_to_string (identity_error->domain),
+ identity_error->code);
+ g_set_error (error,
+ GOA_ERROR,
+ GOA_ERROR_FAILED,
+ _("Could not parse response"));
+ goto out;
+ }
+
+ json_object = json_node_get_object (json_parser_get_root (parser));
+ if (!json_object_has_member (json_object, "default_email"))
+ {
+ g_warning ("Did not find emails in JSON data");
+ g_set_error (error,
+ GOA_ERROR,
+ GOA_ERROR_FAILED,
+ _("Could not parse response"));
+ goto out;
+ }
+
+ id = g_strdup (json_object_get_string_member (json_object, "default_email"));
+
+ ret = id;
+ id = NULL;
+ if (out_presentation_identity != NULL)
+ *out_presentation_identity = g_strdup(ret);
+
+ out:
+ g_clear_object (&parser);
+ g_clear_error (&identity_error);
+ g_clear_object (&call);
+ g_clear_object (&proxy);
+ g_free (id);
+ return ret;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static gboolean
+is_identity_node (GoaOAuth2Provider *oauth2_provider, WebKitDOMHTMLInputElement *element)
+{
+ return FALSE;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static gboolean
+build_object (GoaProvider *provider,
+ GoaObjectSkeleton *object,
+ GKeyFile *key_file,
+ const gchar *group,
+ GDBusConnection *connection,
+ gboolean just_added,
+ GError **error)
+{
+ GoaAccount *account = NULL;
+ GoaMail *mail = NULL;
+ gchar *uri_drive;
+ gchar *uri_caldav;
+ gchar *uri_carddav;
+ gboolean ret = FALSE;
+ gboolean mail_enabled;
+ gboolean files_enabled;
+ gboolean calendar_enabled;
+ gboolean contacts_enabled;
+ const gchar *email_address;
+
+ /* Chain up */
+ if (!GOA_PROVIDER_CLASS (goa_yandex_provider_parent_class)->build_object (provider,
+ object,
+ key_file,
+ group,
+ connection,
+ just_added,
+ error))
+ goto out;
+
+ account = goa_object_get_account (GOA_OBJECT (object));
+ email_address = goa_account_get_identity (account);
+
+ /* Email */
+ mail = goa_object_get_mail (GOA_OBJECT (object));
+ mail_enabled = g_key_file_get_boolean (key_file, group, "MailEnabled", NULL);
+ if (mail_enabled)
+ {
+ if (mail == NULL)
+ {
+ mail = goa_mail_skeleton_new ();
+ g_object_set (G_OBJECT (mail),
+ "email-address", email_address,
+ "imap-supported", TRUE,
+ "imap-host", "imap.yandex.ru",
+ "imap-user-name", email_address,
+ "imap-use-ssl", TRUE,
+ "smtp-supported", TRUE,
+ "smtp-host", "smtp.yandex.ru",
+ "smtp-user-name", email_address,
+ "smtp-use-auth", TRUE,
+ "smtp-auth-xoauth2", TRUE,
+ "smtp-use-ssl", TRUE,
+ "smtp-use-tls", TRUE,
+ NULL);
+ goa_object_skeleton_set_mail (object, mail);
+ }
+ }
+ else
+ {
+ if (mail != NULL)
+ goa_object_skeleton_set_mail (object, NULL);
+ }
+
+ /* Calendar */
+ calendar_enabled = g_key_file_get_boolean (key_file, group, "CalendarEnabled", NULL);
+ uri_caldav = g_strconcat ("https://caldav.yandex.ru/", NULL);
+ goa_object_skeleton_attach_calendar (object, uri_caldav, calendar_enabled, FALSE);
+ g_free (uri_caldav);
+
+ /* Contacts */
+ // contacts_enabled = g_key_file_get_boolean (key_file, group, "ContactsEnabled", NULL);
+ // uri_carddav = g_strconcat ("https://carddav.yandex.ru/", NULL);
+ // goa_object_skeleton_attach_contacts (object, uri_carddav, contacts_enabled, FALSE);
+ // g_free (uri_carddav);
+
+ /* Files */
+ files_enabled = g_key_file_get_boolean (key_file, group, "FilesEnabled", NULL);
+ uri_drive = g_strconcat ("https://cloud-api.yandex.net/v1/disk", NULL);
+ goa_object_skeleton_attach_files (object, uri_drive, files_enabled, FALSE);
+ g_free (uri_drive);
+
+
+ if (just_added)
+ {
+ goa_account_set_mail_disabled (account, !mail_enabled);
+ goa_account_set_calendar_disabled (account, !calendar_enabled);
+ goa_account_set_contacts_disabled (account, !contacts_enabled);
+ goa_account_set_files_disabled (account, !files_enabled);
+
+ g_signal_connect (account,
+ "notify::mail-disabled",
+ G_CALLBACK (goa_util_account_notify_property_cb),
+ (gpointer) "MailEnabled");
+ g_signal_connect (account,
+ "notify::calendar-disabled",
+ G_CALLBACK (goa_util_account_notify_property_cb),
+ (gpointer) "CalendarEnabled");
+ // g_signal_connect (account,
+ // "notify::contacts-disabled",
+ // G_CALLBACK (goa_util_account_notify_property_cb),
+ // (gpointer) "ContactsEnabled");
+ g_signal_connect (account,
+ "notify::files-disabled",
+ G_CALLBACK (goa_util_account_notify_property_cb),
+ (gpointer) "FilesEnabled");
+ }
+
+ ret = TRUE;
+
+ out:
+ g_clear_object (&mail);
+ g_clear_object (&account);
+ return ret;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+add_account_key_values (GoaOAuth2Provider *oauth2_provider,
+ GVariantBuilder *builder)
+{
+ g_variant_builder_add (builder, "{ss}", "MailEnabled", "true");
+ g_variant_builder_add (builder, "{ss}", "CalendarEnabled", "true");
+ // g_variant_builder_add (builder, "{ss}", "ContactsEnabled", "true");
+ g_variant_builder_add (builder, "{ss}", "FilesEnabled", "true");
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+goa_yandex_provider_init (GoaYandexProvider *self)
+{
+
+}
+
+static void
+goa_yandex_provider_class_init (GoaYandexProviderClass *klass)
+{
+ GoaProviderClass *provider_class;
+ GoaOAuth2ProviderClass *oauth2_class;
+
+ provider_class = GOA_PROVIDER_CLASS (klass);
+ provider_class->get_provider_type = get_provider_type;
+ provider_class->get_provider_name = get_provider_name;
+ provider_class->get_provider_group = get_provider_group;
+ provider_class->get_provider_features = get_provider_features;
+ provider_class->build_object = build_object;
+ provider_class->get_credentials_generation = get_credentials_generation;
+
+ oauth2_class = GOA_OAUTH2_PROVIDER_CLASS (klass);
+ oauth2_class->get_authorization_uri = get_authorization_uri;
+ oauth2_class->get_client_id = get_client_id;
+ oauth2_class->get_client_secret = get_client_secret;
+ oauth2_class->get_identity_sync = get_identity_sync;
+ oauth2_class->get_redirect_uri = get_redirect_uri;
+ oauth2_class->get_scope = get_scope;
+ oauth2_class->is_identity_node = is_identity_node;
+ oauth2_class->get_token_uri = get_token_uri;
+ oauth2_class->add_account_key_values = add_account_key_values;
+}
diff --git a/src/goabackend/goayandexprovider.h b/src/goabackend/goayandexprovider.h
new file mode 100644
index 0000000..bd4315f
--- /dev/null
+++ b/src/goabackend/goayandexprovider.h
@@ -0,0 +1,37 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright © 2011 2017 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GOA_BACKEND_INSIDE_GOA_BACKEND_H__) && !defined (GOA_BACKEND_COMPILATION)
+#error "Only <goabackend/goabackend.h> can be included directly."
+#endif
+
+#ifndef __GOA_YANDEX_PROVIDER_H__
+#define __GOA_YANDEX_PROVIDER_H__
+
+#include <glib-object.h>
+
+#include "goaoauth2provider-priv.h"
+
+G_BEGIN_DECLS
+
+#define GOA_TYPE_YANDEX_PROVIDER (goa_yandex_provider_get_type ())
+G_DECLARE_FINAL_TYPE (GoaYandexProvider, goa_yandex_provider, GOA, YANDEX_PROVIDER, GoaOAuth2Provider);
+
+G_END_DECLS
+
+#endif /* __GOA_YANDEX_PROVIDER_H__ */
--
2.44.0

@ -0,0 +1,49 @@
From 5bbb3baca5f77b0f2148cb3b3efdeda61de4e121 Mon Sep 17 00:00:00 2001
From: Alexey Berezhok <alexey.berezhok@softline.com>
Date: Mon, 18 Sep 2023 21:39:04 +0300
Subject: [PATCH] Fix bug when two accounts of yandex disk displayed as one
---
src/goabackend/goayandexprovider.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/goabackend/goayandexprovider.c b/src/goabackend/goayandexprovider.c
index acaa599..fc78421 100644
--- a/src/goabackend/goayandexprovider.c
+++ b/src/goabackend/goayandexprovider.c
@@ -99,7 +99,7 @@ get_scope (GoaOAuth2Provider *oauth2_provider)
static guint
get_credentials_generation (GoaProvider *provider)
{
- return 34;
+ return 36;
}
static const gchar *
@@ -225,6 +225,7 @@ build_object (GoaProvider *provider,
gboolean calendar_enabled;
gboolean contacts_enabled;
const gchar *email_address;
+ gchar *u_name, *u_name_pos;
/* Chain up */
if (!GOA_PROVIDER_CLASS (goa_yandex_provider_parent_class)->build_object (provider,
@@ -284,8 +285,14 @@ build_object (GoaProvider *provider,
/* Files */
files_enabled = g_key_file_get_boolean (key_file, group, "FilesEnabled", NULL);
- uri_drive = g_strconcat ("davs://webdav.yandex.ru/", NULL);
+ u_name = g_strdup(email_address);
+ u_name_pos = g_utf8_strchr(u_name, -1, '@');
+ if (u_name_pos){
+ *u_name_pos = '\0';
+ }
+ uri_drive = g_strconcat ("davs://", u_name, "@webdav.yandex.ru/", NULL);
goa_object_skeleton_attach_files (object, uri_drive, files_enabled, FALSE);
+ g_free (u_name);
g_free (uri_drive);
--
2.39.1

@ -0,0 +1,114 @@
From a807776cb1574a3a9ffbff9550b7cbf4a82846c5 Mon Sep 17 00:00:00 2001
From: Alexey Berezhok <aberezhok@msvsphere-os.ru>
Date: Mon, 15 Apr 2024 13:56:33 +0300
Subject: [PATCH] Removed deprecated code form yandex provider
---
configure.ac | 4 ++--
src/goabackend/goaoauth2handler.c | 6 ++++++
src/goabackend/goayandexprovider.c | 19 +++++--------------
3 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/configure.ac b/configure.ac
index 02c84a6..a8184e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -280,10 +280,10 @@ AC_ARG_WITH(yandex-client-secret,
[],
[])
if test "$with_yandex_client_id" = ""; then
- with_yandex_client_id=8ef866ab7a1f4d3b8fcb58510d422fbc
+ with_yandex_client_id=aab3f89a0d504003bfa3bb5326f68575
fi
if test "$with_yandex_client_secret" = ""; then
- with_yandex_client_secret=aa8be6b692dc4465b1fa40ae6ec7a377
+ with_yandex_client_secret=4e6f4755f2ec457e9a80f0f43683fc32
fi
AC_DEFINE_UNQUOTED(GOA_YANDEX_CLIENT_ID, ["$with_yandex_client_id"], [Yandex OAuth 2.0 client id])
AC_DEFINE_UNQUOTED(GOA_YANDEX_CLIENT_SECRET, ["$with_yandex_client_secret"], [Yandex OAuth 2.0 client secret])
diff --git a/src/goabackend/goaoauth2handler.c b/src/goabackend/goaoauth2handler.c
index c5a86cb..20c89bc 100644
--- a/src/goabackend/goaoauth2handler.c
+++ b/src/goabackend/goaoauth2handler.c
@@ -59,6 +59,12 @@ oauth2_providers[] =
.client_id = GOA_WINDOWS_LIVE_CLIENT_ID,
.provider = GOA_WINDOWS_LIVE_NAME,
},
+#endif
+#ifdef GOA_YANDEX_ENABLED
+ {
+ .client_id = GOA_YANDEX_CLIENT_ID,
+ .provider = GOA_YANDEX_NAME,
+ },
#endif
{ NULL, NULL },
};
diff --git a/src/goabackend/goayandexprovider.c b/src/goabackend/goayandexprovider.c
index fc78421..7f8ebdf 100644
--- a/src/goabackend/goayandexprovider.c
+++ b/src/goabackend/goayandexprovider.c
@@ -87,7 +87,7 @@ get_token_uri (GoaOAuth2Provider *oauth2_provider)
static const gchar *
get_redirect_uri (GoaOAuth2Provider *oauth2_provider)
{
- return "http://localhost";
+ return "goa-oauth2://localhost/"GOA_YANDEX_CLIENT_ID;
}
static const gchar *
@@ -99,7 +99,7 @@ get_scope (GoaOAuth2Provider *oauth2_provider)
static guint
get_credentials_generation (GoaProvider *provider)
{
- return 36;
+ return 37;
}
static const gchar *
@@ -171,7 +171,7 @@ get_identity_sync (GoaOAuth2Provider *oauth2_provider,
json_object = json_node_get_object (json_parser_get_root (parser));
if (!json_object_has_member (json_object, "default_email"))
{
- g_warning ("Did not find emails in JSON data");
+ g_warning ("Did not find emails in JSON data (for yandex)");
g_set_error (error,
GOA_ERROR,
GOA_ERROR_FAILED,
@@ -197,14 +197,6 @@ get_identity_sync (GoaOAuth2Provider *oauth2_provider,
/* ---------------------------------------------------------------------------------------------------- */
-static gboolean
-is_identity_node (GoaOAuth2Provider *oauth2_provider, WebKitDOMHTMLInputElement *element)
-{
- return FALSE;
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
static gboolean
build_object (GoaProvider *provider,
GoaObjectSkeleton *object,
@@ -270,7 +262,7 @@ build_object (GoaProvider *provider,
if (mail != NULL)
goa_object_skeleton_set_mail (object, NULL);
}
-
+
/* Calendar */
calendar_enabled = g_key_file_get_boolean (key_file, group, "CalendarEnabled", NULL);
uri_caldav = g_strconcat ("https://caldav.yandex.ru/", NULL);
@@ -368,9 +360,8 @@ goa_yandex_provider_class_init (GoaYandexProviderClass *klass)
oauth2_class->get_client_id = get_client_id;
oauth2_class->get_client_secret = get_client_secret;
oauth2_class->get_identity_sync = get_identity_sync;
- oauth2_class->get_redirect_uri = get_redirect_uri;
oauth2_class->get_scope = get_scope;
- oauth2_class->is_identity_node = is_identity_node;
oauth2_class->get_token_uri = get_token_uri;
oauth2_class->add_account_key_values = add_account_key_values;
+ oauth2_class->get_redirect_uri = get_redirect_uri;
}
--
2.43.0

File diff suppressed because it is too large Load Diff

@ -0,0 +1,690 @@
diff --git a/data/org.gnome.online-accounts.gschema.xml b/data/org.gnome.online-accounts.gschema.xml
index 46b79b2..4419d61 100644
--- a/data/org.gnome.online-accounts.gschema.xml
+++ b/data/org.gnome.online-accounts.gschema.xml
@@ -6,6 +6,8 @@
<summary>List of providers that are allowed to be loaded</summary>
<description>
A list of strings representing the providers that are allowed to be loaded (default: 'all'). This is only evaluated on startup.
+
+ Deprecated: use goa.conf in the system config directory instead, with a key [providers] enable=all instead. The key is comma-separated list of the provider names.
</description>
</key>
</schema>
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index c7e00a4..68795f1 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -12,6 +12,7 @@ AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"GoaBackend\" \
-DGOA_BACKEND_COMPILATION \
-DGOA_API_IS_SUBJECT_TO_CHANGE \
+ -DGOA_CONF_FILENAME=\""$(sysconfdir)/goa.conf"\" \
-DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \
-DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \
-DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
diff --git a/src/goabackend/goaexchangeprovider.c b/src/goabackend/goaexchangeprovider.c
index 46d4314..826549e 100644
--- a/src/goabackend/goaexchangeprovider.c
+++ b/src/goabackend/goaexchangeprovider.c
@@ -86,6 +86,8 @@ build_object (GoaProvider *provider,
GoaExchange *exchange = NULL;
GoaMail *mail = NULL;
GoaPasswordBased *password_based = NULL;
+ GKeyFile *goa_conf;
+ const gchar *provider_type;
gboolean calendar_enabled;
gboolean contacts_enabled;
gboolean mail_enabled;
@@ -115,11 +117,14 @@ build_object (GoaProvider *provider,
NULL);
}
+ provider_type = goa_provider_get_provider_type (provider);
+ goa_conf = goa_util_open_goa_conf ();
account = goa_object_get_account (GOA_OBJECT (object));
/* Email */
mail = goa_object_get_mail (GOA_OBJECT (object));
- mail_enabled = g_key_file_get_boolean (key_file, group, "MailEnabled", NULL);
+ mail_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_MAIL) &&
+ g_key_file_get_boolean (key_file, group, "MailEnabled", NULL);
if (mail_enabled)
{
if (mail == NULL)
@@ -139,13 +144,17 @@ build_object (GoaProvider *provider,
}
/* Calendar */
- calendar_enabled = g_key_file_get_boolean (key_file, group, "CalendarEnabled", NULL);
+ calendar_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_CALENDAR) &&
+ g_key_file_get_boolean (key_file, group, "CalendarEnabled", NULL);
goa_object_skeleton_attach_calendar (object, NULL, calendar_enabled, FALSE);
/* Contacts */
- contacts_enabled = g_key_file_get_boolean (key_file, group, "ContactsEnabled", NULL);
+ contacts_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_CONTACTS) &&
+ g_key_file_get_boolean (key_file, group, "ContactsEnabled", NULL);
goa_object_skeleton_attach_contacts (object, NULL, contacts_enabled, FALSE);
+ g_clear_pointer (&goa_conf, g_key_file_free);
+
/* Exchange */
exchange = goa_object_get_exchange (GOA_OBJECT (object));
if (exchange == NULL)
diff --git a/src/goabackend/goafacebookprovider.c b/src/goabackend/goafacebookprovider.c
index c1d35d0..80ee5e2 100644
--- a/src/goabackend/goafacebookprovider.c
+++ b/src/goabackend/goafacebookprovider.c
@@ -253,6 +253,8 @@ build_object (GoaProvider *provider,
GError **error)
{
GoaAccount *account = NULL;
+ GKeyFile *goa_conf;
+ const gchar *provider_type;
gboolean photos_enabled;
gboolean maps_enabled;
gboolean ret = FALSE;
@@ -267,10 +269,13 @@ build_object (GoaProvider *provider,
error))
goto out;
+ provider_type = goa_provider_get_provider_type (provider);
+ goa_conf = goa_util_open_goa_conf ();
account = goa_object_get_account (GOA_OBJECT (object));
/* Photos */
- photos_enabled = g_key_file_get_boolean (key_file, group, "PhotosEnabled", NULL);
+ photos_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_PHOTOS) &&
+ g_key_file_get_boolean (key_file, group, "PhotosEnabled", NULL);
goa_object_skeleton_attach_photos (object, photos_enabled);
if (just_added)
@@ -284,9 +289,12 @@ build_object (GoaProvider *provider,
}
/* Maps */
- maps_enabled = g_key_file_get_boolean (key_file, group, "MapsEnabled", NULL);
+ maps_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_MAPS) &&
+ g_key_file_get_boolean (key_file, group, "MapsEnabled", NULL);
goa_object_skeleton_attach_maps (object, maps_enabled);
+ g_clear_pointer (&goa_conf, g_key_file_free);
+
if (just_added)
{
goa_account_set_maps_disabled (account, !maps_enabled);
diff --git a/src/goabackend/goafedoraprovider.c b/src/goabackend/goafedoraprovider.c
index 36cb808..cbc8062 100644
--- a/src/goabackend/goafedoraprovider.c
+++ b/src/goabackend/goafedoraprovider.c
@@ -348,6 +348,8 @@ build_object (GoaProvider *provider,
{
GoaAccount *account;
GoaTicketing *ticketing = NULL;
+ GKeyFile *goa_conf;
+ const gchar *provider_type;
gboolean ticketing_enabled;
gboolean ret = FALSE;
@@ -360,10 +362,15 @@ build_object (GoaProvider *provider,
error))
goto out;
+ provider_type = goa_provider_get_provider_type (provider);
+ goa_conf = goa_util_open_goa_conf ();
account = goa_object_get_account (GOA_OBJECT (object));
ticketing = goa_object_get_ticketing (GOA_OBJECT (object));
- ticketing_enabled = g_key_file_get_boolean (key_file, group, "TicketingEnabled", NULL);
+ ticketing_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_TICKETING) &&
+ g_key_file_get_boolean (key_file, group, "TicketingEnabled", NULL);
+
+ g_clear_pointer (&goa_conf, g_key_file_free);
if (ticketing_enabled)
{
diff --git a/src/goabackend/goafoursquareprovider.c b/src/goabackend/goafoursquareprovider.c
index def21cb..98a5431 100644
--- a/src/goabackend/goafoursquareprovider.c
+++ b/src/goabackend/goafoursquareprovider.c
@@ -261,6 +261,8 @@ build_object (GoaProvider *provider,
GError **error)
{
GoaAccount *account = NULL;
+ GKeyFile *goa_conf;
+ const gchar *provider_type;
gboolean maps_enabled;
gboolean ret = FALSE;
@@ -274,12 +276,17 @@ build_object (GoaProvider *provider,
error))
goto out;
+ provider_type = goa_provider_get_provider_type (provider);
+ goa_conf = goa_util_open_goa_conf ();
account = goa_object_get_account (GOA_OBJECT (object));
/* Maps */
- maps_enabled = g_key_file_get_boolean (key_file, group, "MapsEnabled", NULL);
+ maps_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_MAPS) &&
+ g_key_file_get_boolean (key_file, group, "MapsEnabled", NULL);
goa_object_skeleton_attach_maps (object, maps_enabled);
+ g_clear_pointer (&goa_conf, g_key_file_free);
+
if (just_added)
{
goa_account_set_maps_disabled (account, !maps_enabled);
diff --git a/src/goabackend/goagoogleprovider.c b/src/goabackend/goagoogleprovider.c
index 0fb40c3..7a4a717 100644
--- a/src/goabackend/goagoogleprovider.c
+++ b/src/goabackend/goagoogleprovider.c
@@ -271,6 +271,8 @@ build_object (GoaProvider *provider,
{
GoaAccount *account = NULL;
GoaMail *mail = NULL;
+ GKeyFile *goa_conf;
+ const gchar *provider_type;
gchar *uri_caldav;
gchar *uri_drive;
gboolean ret = FALSE;
@@ -291,12 +293,15 @@ build_object (GoaProvider *provider,
error))
goto out;
+ provider_type = goa_provider_get_provider_type (provider);
+ goa_conf = goa_util_open_goa_conf ();
account = goa_object_get_account (GOA_OBJECT (object));
email_address = goa_account_get_identity (account);
/* Email */
mail = goa_object_get_mail (GOA_OBJECT (object));
- mail_enabled = g_key_file_get_boolean (key_file, group, "MailEnabled", NULL);
+ mail_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_MAIL) &&
+ g_key_file_get_boolean (key_file, group, "MailEnabled", NULL);
if (mail_enabled)
{
if (mail == NULL)
@@ -326,28 +331,34 @@ build_object (GoaProvider *provider,
}
/* Calendar */
- calendar_enabled = g_key_file_get_boolean (key_file, group, "CalendarEnabled", NULL);
+ calendar_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_CALENDAR) &&
+ g_key_file_get_boolean (key_file, group, "CalendarEnabled", NULL);
uri_caldav = g_strconcat ("https://apidata.googleusercontent.com/caldav/v2/", email_address, "/user", NULL);
goa_object_skeleton_attach_calendar (object, uri_caldav, calendar_enabled, FALSE);
g_free (uri_caldav);
/* Contacts */
- contacts_enabled = g_key_file_get_boolean (key_file, group, "ContactsEnabled", NULL);
+ contacts_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_CONTACTS) &&
+ g_key_file_get_boolean (key_file, group, "ContactsEnabled", NULL);
goa_object_skeleton_attach_contacts (object,
"https://www.googleapis.com/.well-known/carddav",
contacts_enabled,
FALSE);
/* Files */
- files_enabled = g_key_file_get_boolean (key_file, group, "FilesEnabled", NULL);
+ files_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_FILES) &&
+ g_key_file_get_boolean (key_file, group, "FilesEnabled", NULL);
uri_drive = g_strconcat ("google-drive://", email_address, "/", NULL);
goa_object_skeleton_attach_files (object, uri_drive, files_enabled, FALSE);
g_free (uri_drive);
/* Printers */
- printers_enabled = g_key_file_get_boolean (key_file, group, "PrintersEnabled", NULL);
+ printers_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_PRINTERS) &&
+ g_key_file_get_boolean (key_file, group, "PrintersEnabled", NULL);
goa_object_skeleton_attach_printers (object, printers_enabled);
+ g_clear_pointer (&goa_conf, g_key_file_free);
+
if (just_added)
{
goa_account_set_mail_disabled (account, !mail_enabled);
diff --git a/src/goabackend/goaimapsmtpprovider.c b/src/goabackend/goaimapsmtpprovider.c
index 811d48c..abaa4d9 100644
--- a/src/goabackend/goaimapsmtpprovider.c
+++ b/src/goabackend/goaimapsmtpprovider.c
@@ -90,6 +90,8 @@ build_object (GoaProvider *provider,
GoaAccount *account = NULL;
GoaMail *mail = NULL;
GoaPasswordBased *password_based = NULL;
+ GKeyFile *goa_conf;
+ const gchar *provider_type;
gboolean enabled;
gboolean imap_accept_ssl_errors;
gboolean imap_use_ssl;
@@ -132,11 +134,17 @@ build_object (GoaProvider *provider,
NULL);
}
+ provider_type = goa_provider_get_provider_type (provider);
+ goa_conf = goa_util_open_goa_conf ();
account = goa_object_get_account (GOA_OBJECT (object));
/* Email */
mail = goa_object_get_mail (GOA_OBJECT (object));
- enabled = g_key_file_get_boolean (key_file, group, "Enabled", NULL);
+ enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_MAIL) &&
+ g_key_file_get_boolean (key_file, group, "Enabled", NULL);
+
+ g_clear_pointer (&goa_conf, g_key_file_free);
+
if (enabled)
{
if (mail == NULL)
diff --git a/src/goabackend/goakerberosprovider.c b/src/goabackend/goakerberosprovider.c
index b3ffc3f..a43dc74 100644
--- a/src/goabackend/goakerberosprovider.c
+++ b/src/goabackend/goakerberosprovider.c
@@ -380,6 +380,8 @@ build_object (GoaProvider *provider,
{
GoaAccount *account;
GoaTicketing *ticketing = NULL;
+ GKeyFile *goa_conf;
+ const gchar *provider_type;
gboolean ticketing_enabled;
gboolean ret = FALSE;
@@ -392,10 +394,15 @@ build_object (GoaProvider *provider,
error))
goto out;
+ provider_type = goa_provider_get_provider_type (provider);
+ goa_conf = goa_util_open_goa_conf ();
account = goa_object_get_account (GOA_OBJECT (object));
ticketing = goa_object_get_ticketing (GOA_OBJECT (object));
- ticketing_enabled = g_key_file_get_boolean (key_file, group, "TicketingEnabled", NULL);
+ ticketing_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_TICKETING) &&
+ g_key_file_get_boolean (key_file, group, "TicketingEnabled", NULL);
+
+ g_clear_pointer (&goa_conf, g_key_file_free);
if (ticketing_enabled)
{
diff --git a/src/goabackend/goalastfmprovider.c b/src/goabackend/goalastfmprovider.c
index cb9a6f2..1cddadf 100644
--- a/src/goabackend/goalastfmprovider.c
+++ b/src/goabackend/goalastfmprovider.c
@@ -100,6 +100,8 @@ build_object (GoaProvider *provider,
{
GoaAccount *account;
GoaMusic *music = NULL;
+ GKeyFile *goa_conf;
+ const gchar *provider_type;
gboolean music_enabled;
gboolean ret = FALSE;
@@ -115,11 +117,17 @@ build_object (GoaProvider *provider,
error))
goto out;
+ provider_type = goa_provider_get_provider_type (provider);
+ goa_conf = goa_util_open_goa_conf ();
account = goa_object_get_account (GOA_OBJECT (object));
/* Music */
music = goa_object_get_music (GOA_OBJECT (object));
- music_enabled = g_key_file_get_boolean (key_file, group, "MusicEnabled", NULL);
+ music_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_MUSIC) &&
+ g_key_file_get_boolean (key_file, group, "MusicEnabled", NULL);
+
+ g_clear_pointer (&goa_conf, g_key_file_free);
+
if (music_enabled)
{
if (music == NULL)
diff --git a/src/goabackend/goamediaserverprovider.c b/src/goabackend/goamediaserverprovider.c
index 9ffd2a0..7c2d61c 100644
--- a/src/goabackend/goamediaserverprovider.c
+++ b/src/goabackend/goamediaserverprovider.c
@@ -88,6 +88,8 @@ build_object (GoaProvider *provider,
gboolean ret;
GoaAccount *account;
GoaMediaServer *mediaserver;
+ GKeyFile *goa_conf;
+ const gchar *provider_type;
const gchar *udn;
gboolean photos_enabled;
@@ -106,13 +108,18 @@ build_object (GoaProvider *provider,
error))
goto out;
+ provider_type = goa_provider_get_provider_type (provider);
+ goa_conf = goa_util_open_goa_conf ();
account = goa_object_get_account (GOA_OBJECT (object));
udn = goa_account_get_identity (account);
/* Photos */
- photos_enabled = g_key_file_get_boolean (key_file, group, "PhotosEnabled", NULL);
+ photos_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_PHOTOS) &&
+ g_key_file_get_boolean (key_file, group, "PhotosEnabled", NULL);
goa_object_skeleton_attach_photos (object, photos_enabled);
+ g_clear_pointer (&goa_conf, g_key_file_free);
+
/* Media Server */
mediaserver = goa_object_get_media_server (GOA_OBJECT (object));
if (mediaserver == NULL)
diff --git a/src/goabackend/goaowncloudprovider.c b/src/goabackend/goaowncloudprovider.c
index d142966..b996e48 100644
--- a/src/goabackend/goaowncloudprovider.c
+++ b/src/goabackend/goaowncloudprovider.c
@@ -136,6 +136,8 @@ build_object (GoaProvider *provider,
GError **error)
{
GoaAccount *account = NULL;
+ GKeyFile *goa_conf;
+ const gchar *provider_type;
gchar *uri_caldav;
gchar *uri_carddav;
gchar *uri_webdav;
@@ -173,6 +175,8 @@ build_object (GoaProvider *provider,
NULL);
}
+ provider_type = goa_provider_get_provider_type (provider);
+ goa_conf = goa_util_open_goa_conf ();
account = goa_object_get_account (GOA_OBJECT (object));
identity = goa_account_get_identity (account);
uri_string = g_key_file_get_string (key_file, group, "Uri", NULL);
@@ -183,23 +187,28 @@ build_object (GoaProvider *provider,
accept_ssl_errors = g_key_file_get_boolean (key_file, group, "AcceptSslErrors", NULL);
/* Calendar */
- calendar_enabled = g_key_file_get_boolean (key_file, group, "CalendarEnabled", NULL);
+ calendar_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_CALENDAR) &&
+ g_key_file_get_boolean (key_file, group, "CalendarEnabled", NULL);
uri_caldav = uri_to_string_with_path (uri, CALDAV_ENDPOINT);
goa_object_skeleton_attach_calendar (object, uri_caldav, calendar_enabled, accept_ssl_errors);
g_free (uri_caldav);
/* Contacts */
- contacts_enabled = g_key_file_get_boolean (key_file, group, "ContactsEnabled", NULL);
+ contacts_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_CONTACTS) &&
+ g_key_file_get_boolean (key_file, group, "ContactsEnabled", NULL);
uri_carddav = uri_to_string_with_path (uri, CARDDAV_ENDPOINT);
goa_object_skeleton_attach_contacts (object, uri_carddav, contacts_enabled, accept_ssl_errors);
g_free (uri_carddav);
/* Files */
- files_enabled = g_key_file_get_boolean (key_file, group, "FilesEnabled", NULL);
+ files_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_FILES) &&
+ g_key_file_get_boolean (key_file, group, "FilesEnabled", NULL);
uri_webdav = get_webdav_uri (uri);
goa_object_skeleton_attach_files (object, uri_webdav, files_enabled, accept_ssl_errors);
g_free (uri_webdav);
+ g_clear_pointer (&goa_conf, g_key_file_free);
+
if (just_added)
{
goa_account_set_calendar_disabled (account, !calendar_enabled);
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index 9712cd2..d178209 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -375,6 +375,151 @@ goa_provider_get_provider_group (GoaProvider *self)
return GOA_PROVIDER_GET_CLASS (self)->get_provider_group (self);
}
+static const gchar *
+goa_get_feature_alias (GoaProviderFeatures feature)
+{
+ switch (feature) {
+ case GOA_PROVIDER_FEATURE_MAIL:
+ return "mail";
+ case GOA_PROVIDER_FEATURE_CALENDAR:
+ return "calendar";
+ case GOA_PROVIDER_FEATURE_CONTACTS:
+ return "contacts";
+ case GOA_PROVIDER_FEATURE_CHAT:
+ return "chat";
+ case GOA_PROVIDER_FEATURE_DOCUMENTS:
+ return "documents";
+ case GOA_PROVIDER_FEATURE_PHOTOS:
+ return "photos";
+ case GOA_PROVIDER_FEATURE_FILES:
+ return "files";
+ case GOA_PROVIDER_FEATURE_TICKETING:
+ return "ticketing";
+ case GOA_PROVIDER_FEATURE_READ_LATER:
+ return "read-later";
+ case GOA_PROVIDER_FEATURE_PRINTERS:
+ return "printers";
+ case GOA_PROVIDER_FEATURE_MAPS:
+ return "maps";
+ case GOA_PROVIDER_FEATURE_MUSIC:
+ return "music";
+ case GOA_PROVIDER_FEATURE_TODO:
+ return "todo";
+ case GOA_PROVIDER_FEATURE_BRANDED:
+ case GOA_PROVIDER_FEATURE_INVALID:
+ break;
+ }
+ return NULL;
+}
+
+/*
+ * goa_util_open_goa_conf:
+ *
+ * Reads goa.conf file from the system config directory and
+ * returns it for use for example by goa_util_provider_feature_is_enabled().
+ * It returns %NULL, when the file cannot be opened.
+ *
+ * Free the returned #GKeyFile with g_key_file_free(), when no longer needed.
+ *
+ * Returns: (nullable) (transfer full): a new #GKeyFile containing goa.conf
+ * file, or %NULL, when it cannot be opened.
+ *
+ * Since: 3.40.0-7 / RHEL-40831
+ */
+GKeyFile *
+goa_util_open_goa_conf (void)
+{
+ GKeyFile *goa_conf;
+ GError *error = NULL;
+
+ goa_conf = g_key_file_new ();
+ if (!g_key_file_load_from_file (goa_conf, GOA_CONF_FILENAME, G_KEY_FILE_NONE, &error))
+ {
+ g_debug ("Failed to load '%s': %s", GOA_CONF_FILENAME, error ? error->message : "Unknown error");
+ g_clear_error (&error);
+ g_key_file_free (goa_conf);
+ goa_conf = NULL;
+ }
+
+ return goa_conf;
+}
+
+/*
+ * goa_util_provider_feature_is_enabled:
+ * @goa_conf: (nullable): a #GKeyFile with loaded goa.conf file, or %NULL
+ * @provider_type: a provider type string
+ * @feature: a feature to check, one of %GoaProviderFeatures
+ *
+ * Checks in the @goa_conf, whether the @provider_type can use
+ * the @feature. The @goa_conf is a %GKeyFile returned by
+ * goa_util_open_goa_conf(), it can be %NULL, in which case
+ * the @feature is considered enabled.
+ *
+ * Returns: %TRUE, when the @feature is enabled, %FALSE otherwise
+ *
+ * Since: 3.40.0-7 / RHEL-40831
+ */
+gboolean
+goa_util_provider_feature_is_enabled (GKeyFile *goa_conf,
+ const gchar *provider_type,
+ GoaProviderFeatures feature)
+{
+ GError *error = NULL;
+ const gchar *feature_alias;
+ gboolean enabled;
+
+ if (!goa_conf)
+ return TRUE;
+
+ g_return_val_if_fail (provider_type != NULL, TRUE);
+
+ feature_alias = goa_get_feature_alias (feature);
+ g_return_val_if_fail (feature_alias != NULL, TRUE);
+
+ enabled = g_key_file_get_boolean (goa_conf, provider_type, feature_alias, &error);
+ if (error)
+ {
+ g_clear_error (&error);
+ enabled = g_key_file_get_boolean (goa_conf, "all", feature_alias, &error);
+ if (error)
+ {
+ g_clear_error (&error);
+ enabled = TRUE;
+ }
+ }
+
+ return enabled;
+}
+
+static GoaProviderFeatures
+goa_provider_filter_features (GoaProvider *self,
+ GoaProviderFeatures features)
+{
+ GKeyFile *goa_conf;
+ const gchar *provider_type;
+ guint i;
+
+ goa_conf = goa_util_open_goa_conf ();
+ if (!goa_conf)
+ return features;
+
+ provider_type = goa_provider_get_provider_type (self);
+
+ for (i = 0; provider_features_info[i].property != NULL; i++)
+ {
+ GoaProviderFeatures feature = provider_features_info[i].feature;
+ if ((features & feature) != 0 &&
+ !goa_util_provider_feature_is_enabled (goa_conf, provider_type, feature))
+ {
+ features = features & (~feature);
+ }
+ }
+
+ g_key_file_free (goa_conf);
+
+ return features;
+}
+
/**
* goa_provider_get_provider_features:
* @self: A #GoaProvider.
@@ -391,7 +536,7 @@ goa_provider_get_provider_features (GoaProvider *self)
{
g_return_val_if_fail (GOA_IS_PROVIDER (self), GOA_PROVIDER_FEATURE_INVALID);
g_return_val_if_fail (GOA_PROVIDER_GET_CLASS (self)->get_provider_features != NULL, GOA_PROVIDER_FEATURE_INVALID);
- return GOA_PROVIDER_GET_CLASS (self)->get_provider_features (self);
+ return goa_provider_filter_features (self, GOA_PROVIDER_GET_CLASS (self)->get_provider_features (self));
}
/* ---------------------------------------------------------------------------------------------------- */
@@ -979,14 +1124,35 @@ goa_provider_ensure_builtins_loaded (void)
if (g_once_init_enter (&once_init_value))
{
- GSettings *settings;
- gchar **whitelisted_providers;
+ GKeyFile *goa_conf;
+ gchar **whitelisted_providers = NULL;
guint i;
guint j;
gboolean all = FALSE;
- settings = g_settings_new (GOA_SETTINGS_SCHEMA);
- whitelisted_providers = g_settings_get_strv (settings, GOA_SETTINGS_WHITELISTED_PROVIDERS);
+ goa_conf = goa_util_open_goa_conf ();
+ if (goa_conf)
+ {
+ whitelisted_providers = g_key_file_get_string_list (goa_conf, "providers", "enable", NULL, NULL);
+ /* Let the empty array be like 'all' */
+ if (whitelisted_providers && !*whitelisted_providers)
+ {
+ g_strfreev (whitelisted_providers);
+ whitelisted_providers = g_new0 (gchar *, 2);
+ whitelisted_providers[0] = g_strdup ("all");
+ whitelisted_providers[1] = NULL;
+ }
+ g_clear_pointer (&goa_conf, g_key_file_free);
+ }
+
+ if (!whitelisted_providers)
+ {
+ GSettings *settings;
+
+ settings = g_settings_new (GOA_SETTINGS_SCHEMA);
+ whitelisted_providers = g_settings_get_strv (settings, GOA_SETTINGS_WHITELISTED_PROVIDERS);
+ g_object_unref (settings);
+ }
/* Enable everything if there is 'all'. */
for (i = 0; whitelisted_providers[i] != NULL; i++)
@@ -1025,7 +1191,6 @@ goa_provider_ensure_builtins_loaded (void)
cleanup:
g_strfreev (whitelisted_providers);
- g_object_unref (settings);
g_once_init_leave (&once_init_value, 1);
}
}
diff --git a/src/goabackend/goaprovider.h b/src/goabackend/goaprovider.h
index c4bcf91..e7e8a78 100644
--- a/src/goabackend/goaprovider.h
+++ b/src/goabackend/goaprovider.h
@@ -109,6 +109,11 @@ GtkWidget *goa_util_add_row_switch_from_keyfile_with_blurb (GtkGrid *grid,
const gchar *key,
const gchar *blurb);
+GKeyFile * goa_util_open_goa_conf (void);
+gboolean goa_util_provider_feature_is_enabled (GKeyFile *goa_conf,
+ const gchar *provider_type,
+ GoaProviderFeatures feature);
+
G_END_DECLS
#endif /* __GOA_PROVIDER_H__ */
diff --git a/src/goabackend/goawindowsliveprovider.c b/src/goabackend/goawindowsliveprovider.c
index 0ac5efb..628988d 100644
--- a/src/goabackend/goawindowsliveprovider.c
+++ b/src/goabackend/goawindowsliveprovider.c
@@ -244,6 +244,8 @@ build_object (GoaProvider *provider,
{
GoaAccount *account = NULL;
GoaMail *mail = NULL;
+ GKeyFile *goa_conf;
+ const gchar *provider_type;
gboolean mail_enabled;
gboolean ret = FALSE;
const gchar *email_address;
@@ -258,12 +260,18 @@ build_object (GoaProvider *provider,
error))
goto out;
+ provider_type = goa_provider_get_provider_type (provider);
+ goa_conf = goa_util_open_goa_conf ();
account = goa_object_get_account (GOA_OBJECT (object));
email_address = goa_account_get_presentation_identity (account);
/* Email */
mail = goa_object_get_mail (GOA_OBJECT (object));
- mail_enabled = g_key_file_get_boolean (key_file, group, "MailEnabled", NULL);
+ mail_enabled = goa_util_provider_feature_is_enabled (goa_conf, provider_type, GOA_PROVIDER_FEATURE_MAIL) &&
+ g_key_file_get_boolean (key_file, group, "MailEnabled", NULL);
+
+ g_clear_pointer (&goa_conf, g_key_file_free);
+
if (mail_enabled)
{
if (mail == NULL)

@ -2,11 +2,10 @@
%global glib2_version 2.52 %global glib2_version 2.52
%global gtk3_version 3.19.12 %global gtk3_version 3.19.12
%global libsoup_version 2.42 %global libsoup_version 2.42
%global webkit2gtk3_version 2.26.0
Name: gnome-online-accounts Name: gnome-online-accounts
Version: 3.40.0 Version: 3.40.0
Release: 3%{?dist} Release: 7%{?dist}.inferit
Summary: Single sign-on framework for GNOME Summary: Single sign-on framework for GNOME
License: LGPLv2+ License: LGPLv2+
@ -14,13 +13,23 @@ URL: https://wiki.gnome.org/Projects/GnomeOnlineAccounts
Source0: https://download.gnome.org/sources/gnome-online-accounts/3.40/%{name}-%{version}.tar.xz Source0: https://download.gnome.org/sources/gnome-online-accounts/3.40/%{name}-%{version}.tar.xz
# https://pagure.io/fedora-workstation/issue/83 # https://pagure.io/fedora-workstation/issue/83
Patch: 0001-Remove-Documents-support.patch Patch1: 0001-Remove-Documents-support.patch
# https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/issues/63 # https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/issues/63
# https://bugzilla.redhat.com/show_bug.cgi?id=1913641 # https://bugzilla.redhat.com/show_bug.cgi?id=1913641
Patch: 0001-google-Remove-Photos-support.patch Patch2: 0001-google-Remove-Photos-support.patch
Patch: kerberos-fixes.patch Patch3: kerberos-fixes.patch
Patch4: 0003-Drop-dependency-on-WebKitGTK-139.patch
Patch5: 0004-Restrict-Services.patch
# MSVSphere
Patch1000: 0001-Added-yandex-provider-prebuild-version.patch
Patch1001: 0001-Added-yandex-disk-webdav-support.patch
Patch1002: 0001-Fix-bug-when-two-accounts-of-yandex-disk-displayed-a.patch
Patch1003: 0001-Removed-deprecated-code-form-yandex-provider.patch
Obsoletes: gnome-online-accounts-oauth2 < 3.40.0-5
BuildRequires: pkgconfig(gcr-3) BuildRequires: pkgconfig(gcr-3)
BuildRequires: pkgconfig(gio-2.0) >= %{glib2_version} BuildRequires: pkgconfig(gio-2.0) >= %{glib2_version}
@ -31,7 +40,6 @@ BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: gettext >= %{gettext_version} BuildRequires: gettext >= %{gettext_version}
BuildRequires: gtk-doc BuildRequires: gtk-doc
BuildRequires: krb5-devel BuildRequires: krb5-devel
BuildRequires: pkgconfig(webkit2gtk-4.0) >= %{webkit2gtk3_version}
BuildRequires: pkgconfig(json-glib-1.0) BuildRequires: pkgconfig(json-glib-1.0)
BuildRequires: pkgconfig(libsecret-1) >= 0.7 BuildRequires: pkgconfig(libsecret-1) >= 0.7
BuildRequires: pkgconfig(libsoup-2.4) >= %{libsoup_version} BuildRequires: pkgconfig(libsoup-2.4) >= %{libsoup_version}
@ -40,11 +48,12 @@ BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: vala BuildRequires: vala
BuildRequires: make BuildRequires: make
BuildRequires: git BuildRequires: git
BuildRequires: autoconf
BuildRequires: automake
Requires: glib2%{?_isa} >= %{glib2_version} Requires: glib2%{?_isa} >= %{glib2_version}
Requires: gtk3%{?_isa} >= %{gtk3_version} Requires: gtk3%{?_isa} >= %{gtk3_version}
Requires: libsoup%{?_isa} >= %{libsoup_version} Requires: libsoup%{?_isa} >= %{libsoup_version}
Requires: webkit2gtk3%{?_isa} >= %{webkit2gtk3_version}
%description %description
GNOME Online Accounts provides interfaces so that applications and libraries GNOME Online Accounts provides interfaces so that applications and libraries
@ -61,10 +70,26 @@ The %{name}-devel package contains libraries and header files for
developing applications that use %{name}. developing applications that use %{name}.
%prep %prep
%autosetup -S git %setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%build %build
aclocal -I m4
autoheader
automake
libtoolize
autoconf
%configure \ %configure \
--disable-fedora \
--disable-facebook \ --disable-facebook \
--disable-flickr \ --disable-flickr \
--disable-foursquare \ --disable-foursquare \
@ -74,7 +99,6 @@ developing applications that use %{name}.
--disable-static \ --disable-static \
--enable-compile-warnings=yes \ --enable-compile-warnings=yes \
--enable-documentation \ --enable-documentation \
--enable-fedora \
--enable-exchange \ --enable-exchange \
--enable-google \ --enable-google \
--enable-gtk-doc \ --enable-gtk-doc \
@ -102,10 +126,10 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
%{_libdir}/libgoa-backend-1.0.so.1 %{_libdir}/libgoa-backend-1.0.so.1
%{_libdir}/libgoa-backend-1.0.so.1.0.0 %{_libdir}/libgoa-backend-1.0.so.1.0.0
%dir %{_libdir}/goa-1.0 %dir %{_libdir}/goa-1.0
%dir %{_libdir}/goa-1.0/web-extensions
%{_libdir}/goa-1.0/web-extensions/libgoawebextension.so
%{_prefix}/libexec/goa-daemon %{_prefix}/libexec/goa-daemon
%{_prefix}/libexec/goa-identity-service %{_prefix}/libexec/goa-identity-service
%{_prefix}/libexec/goa-oauth2-handler
%{_datadir}/applications/org.gnome.OnlineAccounts.OAuth2.desktop
%{_datadir}/dbus-1/services/org.gnome.OnlineAccounts.service %{_datadir}/dbus-1/services/org.gnome.OnlineAccounts.service
%{_datadir}/dbus-1/services/org.gnome.Identity.service %{_datadir}/dbus-1/services/org.gnome.Identity.service
%{_datadir}/icons/hicolor/*/apps/goa-*.svg %{_datadir}/icons/hicolor/*/apps/goa-*.svg
@ -127,6 +151,28 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
%{_datadir}/vala/ %{_datadir}/vala/
%changelog %changelog
* Wed Jun 12 2024 Milan Crha <mcrha@redhat.com> - 3.40.0-7
- Resolves: RHEL-40831 (Use /etc/goa.conf to disable features for providers and whole providers)
* Tue Apr 16 2024 Arkady L. Shane <tigro@msvsphere-os.ru> - 3.40.0-6.inferit.1
- Update Yandex patch
* Wed Apr 3 2024 Arkady L. Shane <tigro@msvsphere-os.ru> - 3.40.0-6.inferit
- Added Yandex support
* Wed Nov 15 2023 Milan Crha <mcrha@redhat.com> - 3.40.0-6
- Related: RHEL-10492 (Add margin around OAuth2 prompt content)
* Wed Nov 08 2023 Milan Crha <mcrha@redhat.com> - 3.40.0-5
- Resolves: RHEL-10492 (Move account types that depend on WebKitGTK into separate optional subpackage)
- backport upstream fix to use external browser for OAuth2
* Wed Oct 11 2023 Milan Crha <mcrha@redhat.com> - 3.40.0-4
- Resolves: RHEL-10492 (Move account types that depend on WebKitGTK into separate optional subpackage)
* Fri Sep 22 2023 MSVSphere Packaging Team <packager@msvsphere-os.ru> - 3.40.0-3
- Rebuilt for MSVSphere 9.3 beta
* Tue Jun 06 2023 Ray Strode <rstrode@redhat.com> - 3.40.0-3 * Tue Jun 06 2023 Ray Strode <rstrode@redhat.com> - 3.40.0-3
- Backport various kerberos fixes from upstream - Backport various kerberos fixes from upstream
Resolves: #2177765 Resolves: #2177765

Loading…
Cancel
Save