From fd4b72d7f8b1b52c03951f2cb5021c4dec2655f2 Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sat, 28 Sep 2024 01:03:20 +0530 Subject: [PATCH 01/14] Add .flatpak-builder directory to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 427bbb26..22483d62 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ _build/ .DS_Store build-aux/flatpak/build build-aux/flatpak/.flatpak-builder +.flatpak-builder From 1c98a9aa3e7300c13e2efbf8b9696bb48930b56d Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sat, 28 Sep 2024 01:03:35 +0530 Subject: [PATCH 02/14] Update source for libpeas --- com.github.suzie97.communique.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/com.github.suzie97.communique.yml b/com.github.suzie97.communique.yml index 2a0918fc..1e9a3be6 100644 --- a/com.github.suzie97.communique.yml +++ b/com.github.suzie97.communique.yml @@ -41,9 +41,9 @@ modules: - name: libpeas buildsystem: meson sources: - - type: git - url: https://gitlab.gnome.org/GNOME/libpeas.git - branch: master + - type: archive + url: https://download.gnome.org/sources/libpeas/1.36/libpeas-1.36.0.tar.xz + sha256: 297cb9c2cccd8e8617623d1a3e8415b4530b8e5a893e3527bbfd1edd13237b4c - name: rest cleanup: From 6fe35542cceb9bf5dd8d3e3fc23fa55561b1a9e1 Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sat, 28 Sep 2024 13:10:26 +0530 Subject: [PATCH 03/14] Update platform and dependencies --- com.github.suzie97.communique.yml | 14 +++++++++----- meson.build | 8 ++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/com.github.suzie97.communique.yml b/com.github.suzie97.communique.yml index 1e9a3be6..feb7404f 100644 --- a/com.github.suzie97.communique.yml +++ b/com.github.suzie97.communique.yml @@ -5,7 +5,7 @@ app-id: com.github.suzie97.communique # we can use a convenient pre-made runtime and SDK. For this example, we'll be # using the runtime and SDK provided by elementary. runtime: io.elementary.Platform -runtime-version: '7' +runtime-version: '8' sdk: io.elementary.Sdk # This should match the exec line in your .desktop file and usually is the same @@ -51,16 +51,20 @@ modules: - '*.la' - '/lib/pkgconfig' - '/share' + buildsystem: meson + config-opts: + - '-Dgtk_doc=false' sources: - type: archive - url: "https://download.gnome.org/sources/rest/0.8/rest-0.8.1.tar.xz" - sha256: 0513aad38e5d3cedd4ae3c551634e3be1b9baaa79775e53b2dba9456f15b01c9 + url: https://download.gnome.org/sources/rest/0.9/rest-0.9.1.tar.xz + sha256: 9266a5c10ece383e193dfb7ffb07b509cc1f51521ab8dad76af96ed14212c2e3 - name: gnome-online-accounts + buildsystem: meson sources: - type: archive - url: https://download-fallback.gnome.org/sources/gnome-online-accounts/3.40/gnome-online-accounts-3.40.0.tar.xz - sha256: 585c4f979f6f543b77bfdb4fb01eb18ba25c2aec5b7866c676d929616fb2c3fa + url: https://download.gnome.org/sources/gnome-online-accounts/3.48/gnome-online-accounts-3.48.3.tar.xz + sha256: 37e4372c345c770f7172da3c605183a43081ea0e915ecc448fb2d65a38e9d565 - name: gumbo sources: diff --git a/meson.build b/meson.build index a5aa07de..1258cbd2 100644 --- a/meson.build +++ b/meson.build @@ -45,14 +45,14 @@ libcurl = c_compiler.find_library('curl') libnotify = dependency('libnotify') libpeas = dependency('libpeas-1.0') libsecret = dependency('libsecret-1') -libsoup = dependency('libsoup-2.4') +libsoup = dependency('libsoup-3.0') libxml = dependency('libxml-2.0') linux = vala_compiler.find_library('linux') posix = vala_compiler.find_library('posix') -rest = dependency('rest-0.7') +rest = dependency('rest-1.0') sqlite3 = dependency('sqlite3') -webkit2gtk = dependency('webkit2gtk-4.0') -webkitextension = dependency('webkit2gtk-web-extension-4.0') +webkit2gtk = dependency('webkit2gtk-4.1') +webkitextension = dependency('webkit2gtk-web-extension-4.1') libunity = dependency('unity', required: false) libgranite = dependency('granite') libhandy = dependency('libhandy-1') From 488e38ad29f1b65bff5fa23003aa9f1844170ee2 Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sat, 28 Sep 2024 19:59:40 +0530 Subject: [PATCH 04/14] Replace send_message calls with send_and_read from libsoup3 --- plugins/backend/bazqux/bazquxConnection.vala | 6 +++--- plugins/backend/feedbin/feedbinAPI.vala | 2 +- plugins/backend/feedhq/feedhqConnection.vala | 6 +++--- plugins/backend/fresh/freshConnection.vala | 6 +++--- plugins/backend/inoreader/InoReaderConnection.vala | 6 +++--- plugins/backend/local/localInterface.vala | 2 +- plugins/backend/local/localUtils.vala | 4 +++- plugins/backend/owncloud/OwncloudNewsMessage.vala | 3 ++- plugins/backend/ttrss/ttrssMessage.vala | 3 ++- plugins/share/Instapaper/InstapaperAPI.vala | 2 +- plugins/share/Pocket/PocketAPI.vala | 6 +++--- plugins/share/Wallabag/WallabagAPI.vala | 4 ++-- src/ContentGrabber/grabber.vala | 4 ++-- src/ContentGrabber/grabberUtils.vala | 8 +++++--- src/Utils.vala | 3 ++- 15 files changed, 36 insertions(+), 29 deletions(-) diff --git a/plugins/backend/bazqux/bazquxConnection.vala b/plugins/backend/bazqux/bazquxConnection.vala index f7b61aa9..aafc0a3a 100644 --- a/plugins/backend/bazqux/bazquxConnection.vala +++ b/plugins/backend/bazqux/bazquxConnection.vala @@ -50,7 +50,7 @@ public class FeedReader.bazquxConnection { var message = new Soup.Message("POST", "https://bazqux.com/accounts/ClientLogin/"); string message_string = "Email=" + m_username + "&Passwd=" + m_passwd; message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); - m_session.send_message(message); + m_session.send_and_read(message); string response = (string)message.response_body.flatten().data; try{ @@ -100,7 +100,7 @@ public class FeedReader.bazquxConnection { message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); } - m_session.send_message(message); + m_session.send_and_read(message); return Response() { status = message.status_code, @@ -114,7 +114,7 @@ public class FeedReader.bazquxConnection { string oldauth = "GoogleLogin auth=" + m_utils.getAccessToken(); message.request_headers.append("Authorization", oldauth); - m_session.send_message(message); + m_session.send_and_read(message); if((string)message.response_body.data == "OK") { diff --git a/plugins/backend/feedbin/feedbinAPI.vala b/plugins/backend/feedbin/feedbinAPI.vala index b4ec9218..2502db0d 100644 --- a/plugins/backend/feedbin/feedbinAPI.vala +++ b/plugins/backend/feedbin/feedbinAPI.vala @@ -78,7 +78,7 @@ public class FeedbinAPI : Object { message.request_body.append_take(input.data); } - m_session.send_message(message); + m_session.send_and_read(message); var status = message.status_code; if(status < 200 || status >= 400) { diff --git a/plugins/backend/feedhq/feedhqConnection.vala b/plugins/backend/feedhq/feedhqConnection.vala index f05ce268..6ac5c84e 100644 --- a/plugins/backend/feedhq/feedhqConnection.vala +++ b/plugins/backend/feedhq/feedhqConnection.vala @@ -50,7 +50,7 @@ public class FeedReader.FeedHQConnection { var message = new Soup.Message("POST", "https://feedhq.org/accounts/ClientLogin"); string message_string = "Email=" + m_username + "&Passwd=" + m_passwd; message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); - m_session.send_message(message); + m_session.send_and_read(message); string response = (string)message.response_body.flatten().data; try{ @@ -85,7 +85,7 @@ public class FeedReader.FeedHQConnection { string oldauth = "GoogleLogin auth=" + m_utils.getAccessToken(); message.request_headers.append("Authorization", oldauth); - m_session.send_message(message); + m_session.send_and_read(message); if(message.status_code != 200) { @@ -124,7 +124,7 @@ public class FeedReader.FeedHQConnection { message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string_post.data); } - m_session.send_message(message); + m_session.send_and_read(message); if(message.status_code != 200) { diff --git a/plugins/backend/fresh/freshConnection.vala b/plugins/backend/fresh/freshConnection.vala index 522bfe13..7262e522 100644 --- a/plugins/backend/fresh/freshConnection.vala +++ b/plugins/backend/fresh/freshConnection.vala @@ -46,7 +46,7 @@ public class FeedReader.freshConnection { msg.add("Passwd", m_utils.getPasswd()); message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, msg.get().data); - m_session.send_message(message); + m_session.send_and_read(message); if(message.status_code != 200) { @@ -92,7 +92,7 @@ public class FeedReader.freshConnection { message.request_headers.append("Content-Type", type); message.request_body.append_take(input.data); - m_session.send_message(message); + m_session.send_and_read(message); if(message.status_code != 200) { @@ -115,7 +115,7 @@ public class FeedReader.freshConnection { message.request_headers.append("DNT", "1"); } - m_session.send_message(message); + m_session.send_and_read(message); if(message.status_code != 200) { diff --git a/plugins/backend/inoreader/InoReaderConnection.vala b/plugins/backend/inoreader/InoReaderConnection.vala index 1a8e6306..2ac6cd4f 100644 --- a/plugins/backend/inoreader/InoReaderConnection.vala +++ b/plugins/backend/inoreader/InoReaderConnection.vala @@ -40,7 +40,7 @@ public class FeedReader.InoReaderConnection { + "&scope=" + "&grant_type=authorization_code"; message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); - m_session.send_message(message); + m_session.send_and_read(message); if(message.status_code != 200) { @@ -90,7 +90,7 @@ public class FeedReader.InoReaderConnection { + "&refresh_token=" + m_utils.getRefreshToken(); message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); - m_session.send_message(message); + m_session.send_and_read(message); if(message.status_code != 200) { @@ -156,7 +156,7 @@ public class FeedReader.InoReaderConnection { message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); } - m_session.send_message(message); + m_session.send_and_read(message); if(message.status_code != 200) { diff --git a/plugins/backend/local/localInterface.vala b/plugins/backend/local/localInterface.vala index 5419b6ae..ea9ec8d8 100644 --- a/plugins/backend/local/localInterface.vala +++ b/plugins/backend/local/localInterface.vala @@ -529,7 +529,7 @@ public class FeedReader.localInterface : FeedServerInterface { var session = new Soup.Session(); session.user_agent = Constants.USER_AGENT; session.timeout = 5; - session.send_message(msg); + session.send_and_read(msg); string xml = (string)msg.response_body.flatten().data; // parse diff --git a/plugins/backend/local/localUtils.vala b/plugins/backend/local/localUtils.vala index ecb0d046..7901a2d4 100644 --- a/plugins/backend/local/localUtils.vala +++ b/plugins/backend/local/localUtils.vala @@ -34,7 +34,9 @@ public class FeedReader.localUtils : GLib.Object { return null; } - uint status = session.send_message(msg); + session.send_and_read(msg); + uint status = msg.status_code; + if(status < 100 || status >= 400) { if(status < 100) diff --git a/plugins/backend/owncloud/OwncloudNewsMessage.vala b/plugins/backend/owncloud/OwncloudNewsMessage.vala index 952df63e..dcf0d4ad 100644 --- a/plugins/backend/owncloud/OwncloudNewsMessage.vala +++ b/plugins/backend/owncloud/OwncloudNewsMessage.vala @@ -136,7 +136,8 @@ public class FeedReader.OwnCloudNewsMessage : GLib.Object { m_message_soup.request_headers.append("DNT", "1"); } - var status = m_session.send_message(m_message_soup); + m_session.send_and_read(m_message_soup); + var status = m_message_soup.status_code; if(status == 401) // unauthorized diff --git a/plugins/backend/ttrss/ttrssMessage.vala b/plugins/backend/ttrss/ttrssMessage.vala index 367a478a..5e3d71ef 100644 --- a/plugins/backend/ttrss/ttrssMessage.vala +++ b/plugins/backend/ttrss/ttrssMessage.vala @@ -97,7 +97,8 @@ public class FeedReader.ttrssMessage : GLib.Object { m_message_soup.request_headers.append("DNT", "1"); } - var status_code = m_session.send_message(m_message_soup); + m_session.send_and_read(m_message_soup); + var status_code = m_message_soup.status_code; if(status_code == 401) // unauthorized diff --git a/plugins/share/Instapaper/InstapaperAPI.vala b/plugins/share/Instapaper/InstapaperAPI.vala index 40caa71c..a5974e7f 100644 --- a/plugins/share/Instapaper/InstapaperAPI.vala +++ b/plugins/share/Instapaper/InstapaperAPI.vala @@ -184,7 +184,7 @@ public class FeedReader.InstaAPI : ShareAccountInterface, Peas.ExtensionBase { message_soup.request_headers.append("DNT", "1"); } - session.send_message(message_soup); + session.send_and_read(message_soup); string response = (string)message_soup.response_body.flatten().data; if(response == null || response == "") diff --git a/plugins/share/Pocket/PocketAPI.vala b/plugins/share/Pocket/PocketAPI.vala index 37d195cc..50ec75dd 100644 --- a/plugins/share/Pocket/PocketAPI.vala +++ b/plugins/share/Pocket/PocketAPI.vala @@ -78,7 +78,7 @@ public class FeedReader.PocketAPI : ShareAccountInterface, Peas.ExtensionBase { message_soup.request_headers.append("DNT", "1"); } - session.send_message(message_soup); + session.send_and_read(message_soup); string response = (string)message_soup.response_body.flatten().data; return response.substring(response.index_of_char('=')+1); @@ -98,7 +98,7 @@ public class FeedReader.PocketAPI : ShareAccountInterface, Peas.ExtensionBase { message_soup.request_headers.append("DNT", "1"); } - session.send_message(message_soup); + session.send_and_read(message_soup); if((string)message_soup.response_body.flatten().data == null || (string)message_soup.response_body.flatten().data == "") @@ -183,7 +183,7 @@ public class FeedReader.PocketAPI : ShareAccountInterface, Peas.ExtensionBase { message_soup.request_headers.append("DNT", "1"); } - session.send_message(message_soup); + session.send_and_read(message_soup); if((string)message_soup.response_body.flatten().data == null || (string)message_soup.response_body.flatten().data == "") diff --git a/plugins/share/Wallabag/WallabagAPI.vala b/plugins/share/Wallabag/WallabagAPI.vala index 97b56e96..56d06956 100644 --- a/plugins/share/Wallabag/WallabagAPI.vala +++ b/plugins/share/Wallabag/WallabagAPI.vala @@ -40,7 +40,7 @@ public class FeedReader.WallabagAPI : ShareAccountInterface, Peas.ExtensionBase string url = baseURL + "oauth/v2/token"; var message_soup = new Soup.Message("POST", url); message_soup.set_request("application/x-www-form-urlencoded; charset=UTF8", Soup.MemoryUse.COPY, message.data); - session.send_message(message_soup); + session.send_and_read(message_soup); if((string)message_soup.response_body.flatten().data == null || (string)message_soup.response_body.flatten().data == "") @@ -154,7 +154,7 @@ public class FeedReader.WallabagAPI : ShareAccountInterface, Peas.ExtensionBase var message_soup = new Soup.Message("POST", baseURL + "api/entries.json"); message_soup.set_request("application/x-www-form-urlencoded; charset=UTF8", Soup.MemoryUse.COPY, message.data); message_soup.request_headers.append("Authorization", "Bearer " + settings.get_string("oauth-access-token")); - session.send_message(message_soup); + session.send_and_read(message_soup); if((string)message_soup.response_body.flatten().data == null || (string)message_soup.response_body.flatten().data == "") diff --git a/src/ContentGrabber/grabber.vala b/src/ContentGrabber/grabber.vala index f4ed6b91..57dc974d 100644 --- a/src/ContentGrabber/grabber.vala +++ b/src/ContentGrabber/grabber.vala @@ -204,7 +204,7 @@ public class FeedReader.Grabber : GLib.Object { return false; } - m_session.send_message(message); + m_session.send_and_read(message); var params = new GLib.HashTable(null, null); string? contentType = message.response_headers.get_content_type(out params); if(contentType != null) @@ -245,7 +245,7 @@ public class FeedReader.Grabber : GLib.Object { msg.request_headers.append("DNT", "1"); } - m_session.send_message(msg); + m_session.send_and_read(msg); msg.disconnect(handlerID); if(msg.response_body == null) diff --git a/src/ContentGrabber/grabberUtils.vala b/src/ContentGrabber/grabberUtils.vala index ecec2cf6..dc57cc6c 100644 --- a/src/ContentGrabber/grabberUtils.vala +++ b/src/ContentGrabber/grabberUtils.vala @@ -630,7 +630,9 @@ public class FeedReader.grabberUtils : GLib.Object { message_dlImg.request_headers.append("DNT", "1"); } - var status = session.send_message(message_dlImg); + session.send_and_read(message_dlImg); + var status = message_dlImg.status_code; + if(status == 200) { var params = new GLib.HashTable(null, null); @@ -772,7 +774,7 @@ public class FeedReader.grabberUtils : GLib.Object { { return null; } - session.send_message(message); + session.send_and_read(message); var params = new GLib.HashTable(null, null); string? contentType = message.response_headers.get_content_type(out params); size = message.response_headers.get_content_length(); @@ -781,7 +783,7 @@ public class FeedReader.grabberUtils : GLib.Object { { return null; } - session.send_message(message2); + session.send_and_read(message2); origSize = message2.response_headers.get_content_length(); if(contentType != null) { diff --git a/src/Utils.vala b/src/Utils.vala index 0aad6692..271e2e08 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -278,7 +278,8 @@ public class FeedReader.Utils : GLib.Object { return false; } - var status = getSession().send_message(message); + getSession().send_and_read(message); + var status = message.status_code; Logger.debug(@"Ping: status $status"); From be1cff135d0e52009e236fdde0b5f60d959e5401 Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sat, 28 Sep 2024 20:45:35 +0530 Subject: [PATCH 05/14] Replace response_body reading logic --- plugins/backend/bazqux/bazquxConnection.vala | 12 ++++++------ plugins/backend/feedhq/feedhqConnection.vala | 12 ++++++------ plugins/backend/fresh/freshConnection.vala | 12 ++++++------ .../backend/inoreader/InoReaderConnection.vala | 12 ++++++------ plugins/backend/local/localInterface.vala | 4 ++-- plugins/backend/local/localUtils.vala | 4 ++-- .../backend/owncloud/OwncloudNewsMessage.vala | 7 ++++--- plugins/backend/ttrss/ttrssMessage.vala | 7 ++++--- plugins/share/Instapaper/InstapaperAPI.vala | 4 ++-- plugins/share/Pocket/PocketAPI.vala | 18 +++++++++--------- plugins/share/Wallabag/WallabagAPI.vala | 12 ++++++------ src/ContentGrabber/grabber.vala | 8 ++++---- src/ContentGrabber/grabberUtils.vala | 6 +++--- 13 files changed, 60 insertions(+), 58 deletions(-) diff --git a/plugins/backend/bazqux/bazquxConnection.vala b/plugins/backend/bazqux/bazquxConnection.vala index aafc0a3a..a40bd6ff 100644 --- a/plugins/backend/bazqux/bazquxConnection.vala +++ b/plugins/backend/bazqux/bazquxConnection.vala @@ -50,8 +50,8 @@ public class FeedReader.bazquxConnection { var message = new Soup.Message("POST", "https://bazqux.com/accounts/ClientLogin/"); string message_string = "Email=" + m_username + "&Passwd=" + m_passwd; message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); - m_session.send_and_read(message); - string response = (string)message.response_body.flatten().data; + var response_body = m_session.send_and_read(message); + string response = (string)response_body.get_data(); try{ var regex = new Regex(".*\\w\\s.*\\w\\sAuth="); @@ -100,11 +100,11 @@ public class FeedReader.bazquxConnection { message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); } - m_session.send_and_read(message); + var response_body = m_session.send_and_read(message); return Response() { status = message.status_code, - data = (string)message.response_body.flatten().data + data = (string)response_body.get_data() }; } @@ -114,9 +114,9 @@ public class FeedReader.bazquxConnection { string oldauth = "GoogleLogin auth=" + m_utils.getAccessToken(); message.request_headers.append("Authorization", oldauth); - m_session.send_and_read(message); + var response_body = m_session.send_and_read(message); - if((string)message.response_body.data == "OK") + if((string)response_body.get_data() == "OK") { return true; } diff --git a/plugins/backend/feedhq/feedhqConnection.vala b/plugins/backend/feedhq/feedhqConnection.vala index 6ac5c84e..cf2e3c48 100644 --- a/plugins/backend/feedhq/feedhqConnection.vala +++ b/plugins/backend/feedhq/feedhqConnection.vala @@ -50,8 +50,8 @@ public class FeedReader.FeedHQConnection { var message = new Soup.Message("POST", "https://feedhq.org/accounts/ClientLogin"); string message_string = "Email=" + m_username + "&Passwd=" + m_passwd; message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); - m_session.send_and_read(message); - string response = (string)message.response_body.flatten().data; + var response_body = m_session.send_and_read(message); + string response = (string)response_body.get_data(); try{ var regex = new Regex(".*\\w\\s.*\\w\\sAuth="); @@ -85,7 +85,7 @@ public class FeedReader.FeedHQConnection { string oldauth = "GoogleLogin auth=" + m_utils.getAccessToken(); message.request_headers.append("Authorization", oldauth); - m_session.send_and_read(message); + var response_body = m_session.send_and_read(message); if(message.status_code != 200) { @@ -93,7 +93,7 @@ public class FeedReader.FeedHQConnection { return false; } - string response = (string)message.response_body.data; + string response = (string)response_body.get_data(); Logger.debug("FeedHQ post token : " + response); m_utils.setPostToken(response); @@ -124,7 +124,7 @@ public class FeedReader.FeedHQConnection { message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string_post.data); } - m_session.send_and_read(message); + var response_body = m_session.send_and_read(message); if(message.status_code != 200) { @@ -140,7 +140,7 @@ public class FeedReader.FeedHQConnection { return Response() { status = message.status_code, - data = (string)message.response_body.flatten().data + data = (string)response_body.get_data() }; } diff --git a/plugins/backend/fresh/freshConnection.vala b/plugins/backend/fresh/freshConnection.vala index 7262e522..2c4a60f0 100644 --- a/plugins/backend/fresh/freshConnection.vala +++ b/plugins/backend/fresh/freshConnection.vala @@ -46,7 +46,7 @@ public class FeedReader.freshConnection { msg.add("Passwd", m_utils.getPasswd()); message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, msg.get().data); - m_session.send_and_read(message); + var response_body = m_session.send_and_read(message); if(message.status_code != 200) { @@ -54,7 +54,7 @@ public class FeedReader.freshConnection { return LoginResponse.NO_CONNECTION; } - string response = (string)message.response_body.flatten().data; + string response = (string)response_body.get_data(); if(!response.has_prefix("SID=")) { @@ -92,7 +92,7 @@ public class FeedReader.freshConnection { message.request_headers.append("Content-Type", type); message.request_body.append_take(input.data); - m_session.send_and_read(message); + var response_body = m_session.send_and_read(message); if(message.status_code != 200) { @@ -101,7 +101,7 @@ public class FeedReader.freshConnection { return Response() { status = message.status_code, - data = (string)message.response_body.flatten().data + data = (string)response_body.get_data() }; } @@ -115,7 +115,7 @@ public class FeedReader.freshConnection { message.request_headers.append("DNT", "1"); } - m_session.send_and_read(message); + var response_body = m_session.send_and_read(message); if(message.status_code != 200) { @@ -124,7 +124,7 @@ public class FeedReader.freshConnection { return Response() { status = message.status_code, - data = (string)message.response_body.flatten().data + data = (string)response_body.get_data() }; } } diff --git a/plugins/backend/inoreader/InoReaderConnection.vala b/plugins/backend/inoreader/InoReaderConnection.vala index 2ac6cd4f..54a15b9d 100644 --- a/plugins/backend/inoreader/InoReaderConnection.vala +++ b/plugins/backend/inoreader/InoReaderConnection.vala @@ -40,14 +40,14 @@ public class FeedReader.InoReaderConnection { + "&scope=" + "&grant_type=authorization_code"; message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); - m_session.send_and_read(message); + var response_body = m_session.send_and_read(message); if(message.status_code != 200) { return LoginResponse.NO_CONNECTION; } - string response = (string)message.response_body.flatten().data; + string response = (string)response_body.get_data(); try { @@ -90,14 +90,14 @@ public class FeedReader.InoReaderConnection { + "&refresh_token=" + m_utils.getRefreshToken(); message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); - m_session.send_and_read(message); + var response_body = m_session.send_and_read(message); if(message.status_code != 200) { return LoginResponse.NO_CONNECTION; } - string response = (string)message.response_body.flatten().data; + string response = (string)response_body.get_data(); try { @@ -156,7 +156,7 @@ public class FeedReader.InoReaderConnection { message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); } - m_session.send_and_read(message); + var response_body = m_session.send_and_read(message); if(message.status_code != 200) { @@ -166,7 +166,7 @@ public class FeedReader.InoReaderConnection { return Response() { status = message.status_code, - data = (string)message.response_body.flatten().data + data = (string)response_body.get_data().data }; } diff --git a/plugins/backend/local/localInterface.vala b/plugins/backend/local/localInterface.vala index ea9ec8d8..bf9f72a5 100644 --- a/plugins/backend/local/localInterface.vala +++ b/plugins/backend/local/localInterface.vala @@ -529,8 +529,8 @@ public class FeedReader.localInterface : FeedServerInterface { var session = new Soup.Session(); session.user_agent = Constants.USER_AGENT; session.timeout = 5; - session.send_and_read(msg); - string xml = (string)msg.response_body.flatten().data; + var response_body = session.send_and_read(msg); + string xml = (string)response_body.get_data(); // parse Rss.Parser parser = new Rss.Parser(); diff --git a/plugins/backend/local/localUtils.vala b/plugins/backend/local/localUtils.vala index 7901a2d4..ce1062d3 100644 --- a/plugins/backend/local/localUtils.vala +++ b/plugins/backend/local/localUtils.vala @@ -34,7 +34,7 @@ public class FeedReader.localUtils : GLib.Object { return null; } - session.send_and_read(msg); + var response_body = session.send_and_read(msg); uint status = msg.status_code; if(status < 100 || status >= 400) @@ -53,7 +53,7 @@ public class FeedReader.localUtils : GLib.Object { Logger.warning(errmsg); return null; } - string xml = (string)msg.response_body.flatten().data; + string xml = (string)response_body.get_data(); string? url = null; // parse diff --git a/plugins/backend/owncloud/OwncloudNewsMessage.vala b/plugins/backend/owncloud/OwncloudNewsMessage.vala index dcf0d4ad..09bc7d64 100644 --- a/plugins/backend/owncloud/OwncloudNewsMessage.vala +++ b/plugins/backend/owncloud/OwncloudNewsMessage.vala @@ -17,6 +17,7 @@ public class FeedReader.OwnCloudNewsMessage : GLib.Object { private Soup.Session m_session; private Soup.Message m_message_soup; + private Bytes response_body; private GLib.StringBuilder m_message_string; private string m_contenttype; private Json.Parser m_parser; @@ -136,7 +137,7 @@ public class FeedReader.OwnCloudNewsMessage : GLib.Object { m_message_soup.request_headers.append("DNT", "1"); } - m_session.send_and_read(m_message_soup); + response_body = m_session.send_and_read(m_message_soup); var status = m_message_soup.status_code; if(status == 401) // unauthorized @@ -165,7 +166,7 @@ public class FeedReader.OwnCloudNewsMessage : GLib.Object { try { - m_parser.load_from_data((string)m_message_soup.response_body.flatten().data); + m_parser.load_from_data((string)response_body.get_data()); } catch(Error e) { @@ -201,6 +202,6 @@ public class FeedReader.OwnCloudNewsMessage : GLib.Object { public void printResponse() { - Logger.debug((string)m_message_soup.response_body.flatten().data); + Logger.debug((string)response_body.get_data()); } } diff --git a/plugins/backend/ttrss/ttrssMessage.vala b/plugins/backend/ttrss/ttrssMessage.vala index 5e3d71ef..bc5bc74a 100644 --- a/plugins/backend/ttrss/ttrssMessage.vala +++ b/plugins/backend/ttrss/ttrssMessage.vala @@ -17,6 +17,7 @@ public class FeedReader.ttrssMessage : GLib.Object { private Soup.Session m_session; private Soup.Message m_message_soup; + private Bytes response_body; private Json.Object m_request_object = new Json.Object(); private const string m_contenttype = "application/x-www-form-urlencoded"; private Json.Object m_response_object; @@ -97,7 +98,7 @@ public class FeedReader.ttrssMessage : GLib.Object { m_message_soup.request_headers.append("DNT", "1"); } - m_session.send_and_read(m_message_soup); + response_body = m_session.send_and_read(m_message_soup); var status_code = m_message_soup.status_code; if(status_code == 401) // unauthorized @@ -127,7 +128,7 @@ public class FeedReader.ttrssMessage : GLib.Object { var parser = new Json.Parser(); try { - parser.load_from_data((string)m_message_soup.response_body.flatten().data); + parser.load_from_data((string)response_body.get_data()); } catch(Error e) { @@ -220,7 +221,7 @@ public class FeedReader.ttrssMessage : GLib.Object { }); } var request = object_to_string(obj); - var response = (string)m_message_soup.response_body.flatten().data; + var response = (string)response_body.get_data(); Logger.error(@"$prefix\nURL: $url\nRequest object: $request\nResponse: $response"); } diff --git a/plugins/share/Instapaper/InstapaperAPI.vala b/plugins/share/Instapaper/InstapaperAPI.vala index a5974e7f..a61cad01 100644 --- a/plugins/share/Instapaper/InstapaperAPI.vala +++ b/plugins/share/Instapaper/InstapaperAPI.vala @@ -184,8 +184,8 @@ public class FeedReader.InstaAPI : ShareAccountInterface, Peas.ExtensionBase { message_soup.request_headers.append("DNT", "1"); } - session.send_and_read(message_soup); - string response = (string)message_soup.response_body.flatten().data; + var response_body = session.send_and_read(message_soup); + string response = (string)response_body.get_data(); if(response == null || response == "") { diff --git a/plugins/share/Pocket/PocketAPI.vala b/plugins/share/Pocket/PocketAPI.vala index 50ec75dd..52be2a5b 100644 --- a/plugins/share/Pocket/PocketAPI.vala +++ b/plugins/share/Pocket/PocketAPI.vala @@ -78,9 +78,9 @@ public class FeedReader.PocketAPI : ShareAccountInterface, Peas.ExtensionBase { message_soup.request_headers.append("DNT", "1"); } - session.send_and_read(message_soup); + var response_body = session.send_and_read(message_soup); - string response = (string)message_soup.response_body.flatten().data; + string response = (string)response_body.get_data(); return response.substring(response.index_of_char('=')+1); } @@ -98,15 +98,15 @@ public class FeedReader.PocketAPI : ShareAccountInterface, Peas.ExtensionBase { message_soup.request_headers.append("DNT", "1"); } - session.send_and_read(message_soup); + var response_body = session.send_and_read(message_soup); - if((string)message_soup.response_body.flatten().data == null - || (string)message_soup.response_body.flatten().data == "") + if((string)response_body.get_data() == null + || (string)response_body.get_data() == "") { return false; } - string response = (string)message_soup.response_body.flatten().data; + string response = (string)response_body.get_data(); Logger.debug(response); int tokenStart = response.index_of_char('=')+1; int tokenEnd = response.index_of_char('&', tokenStart); @@ -183,10 +183,10 @@ public class FeedReader.PocketAPI : ShareAccountInterface, Peas.ExtensionBase { message_soup.request_headers.append("DNT", "1"); } - session.send_and_read(message_soup); + var response_body = session.send_and_read(message_soup); - if((string)message_soup.response_body.flatten().data == null - || (string)message_soup.response_body.flatten().data == "") + if((string)response_body.get_data() == null + || (string)response_body.get_data() == "") { return false; } diff --git a/plugins/share/Wallabag/WallabagAPI.vala b/plugins/share/Wallabag/WallabagAPI.vala index 56d06956..bf3bc257 100644 --- a/plugins/share/Wallabag/WallabagAPI.vala +++ b/plugins/share/Wallabag/WallabagAPI.vala @@ -40,10 +40,10 @@ public class FeedReader.WallabagAPI : ShareAccountInterface, Peas.ExtensionBase string url = baseURL + "oauth/v2/token"; var message_soup = new Soup.Message("POST", url); message_soup.set_request("application/x-www-form-urlencoded; charset=UTF8", Soup.MemoryUse.COPY, message.data); - session.send_and_read(message_soup); + var response_body = session.send_and_read(message_soup); - if((string)message_soup.response_body.flatten().data == null - || (string)message_soup.response_body.flatten().data == "") + if((string)response_body.get_data() == null + || (string)response_body.get_data() == "") { Logger.error("WallabagAPI - getAccessToken: no response"); Logger.error(url); @@ -51,7 +51,7 @@ public class FeedReader.WallabagAPI : ShareAccountInterface, Peas.ExtensionBase return false; } - string response = (string)message_soup.response_body.flatten().data; + string response = (string)response_body.get_data(); Logger.debug(response); var parser = new Json.Parser(); @@ -156,8 +156,8 @@ public class FeedReader.WallabagAPI : ShareAccountInterface, Peas.ExtensionBase message_soup.request_headers.append("Authorization", "Bearer " + settings.get_string("oauth-access-token")); session.send_and_read(message_soup); - if((string)message_soup.response_body.flatten().data == null - || (string)message_soup.response_body.flatten().data == "") + if((string)response_body.get_data() == null + || (string)response_body.get_data() == "") { Logger.error("WallabagAPI - addBookmark: no response"); Logger.error(url); diff --git a/src/ContentGrabber/grabber.vala b/src/ContentGrabber/grabber.vala index 57dc974d..594dd147 100644 --- a/src/ContentGrabber/grabber.vala +++ b/src/ContentGrabber/grabber.vala @@ -245,22 +245,22 @@ public class FeedReader.Grabber : GLib.Object { msg.request_headers.append("DNT", "1"); } - m_session.send_and_read(msg); + var response_body = m_session.send_and_read(msg); msg.disconnect(handlerID); - if(msg.response_body == null) + if(response_body == null) { Logger.debug("Grabber: download failed - no response"); return false; } - if((string)msg.response_body.flatten().data == "") + if((string)response_body.get_data() == "") { Logger.debug("Grabber: download failed - empty response"); return false; } - m_rawHtml = (string)msg.response_body.flatten().data; + m_rawHtml = (string)response_body.get_data(); if(!m_rawHtml.validate()) { string needle = "content=\"text/html; charset="; diff --git a/src/ContentGrabber/grabberUtils.vala b/src/ContentGrabber/grabberUtils.vala index dc57cc6c..2387a56a 100644 --- a/src/ContentGrabber/grabberUtils.vala +++ b/src/ContentGrabber/grabberUtils.vala @@ -630,7 +630,7 @@ public class FeedReader.grabberUtils : GLib.Object { message_dlImg.request_headers.append("DNT", "1"); } - session.send_and_read(message_dlImg); + var response_body = session.send_and_read(message_dlImg); var status = message_dlImg.status_code; if(status == 200) @@ -648,8 +648,8 @@ public class FeedReader.grabberUtils : GLib.Object { try{ FileUtils.set_contents( localFilename, - (string)message_dlImg.response_body.flatten().data, - (long)message_dlImg.response_body.length); + (string)response_body.get_data(), + (long)response_body.length); } catch(GLib.FileError e) { From acfdd06d5345b32e694e72bf73f307ce94fc0b27 Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sun, 29 Sep 2024 15:28:23 +0530 Subject: [PATCH 06/14] Replace ssl_strict with equivalent libsoup3 logic --- plugins/backend/owncloud/OwncloudNewsAPI.vala | 3 ++- plugins/backend/ttrss/ttrssAPI.vala | 3 ++- src/Backend/FeedServer.vala | 9 ++++++--- src/Utils.vala | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/backend/owncloud/OwncloudNewsAPI.vala b/plugins/backend/owncloud/OwncloudNewsAPI.vala index 221fbfc0..b55cd70c 100644 --- a/plugins/backend/owncloud/OwncloudNewsAPI.vala +++ b/plugins/backend/owncloud/OwncloudNewsAPI.vala @@ -36,7 +36,8 @@ public class FeedReader.OwncloudNewsAPI : GLib.Object { m_utils = utils; m_session = new Soup.Session(); m_session.user_agent = Constants.USER_AGENT; - m_session.ssl_strict = false; + m_session.tls_database = null; + m_session.tls_interaction = null; m_session.authenticate.connect((msg, auth, retrying) => { if(m_utils.getHtaccessUser() == "") { diff --git a/plugins/backend/ttrss/ttrssAPI.vala b/plugins/backend/ttrss/ttrssAPI.vala index 50bf4c6f..b97bf32c 100644 --- a/plugins/backend/ttrss/ttrssAPI.vala +++ b/plugins/backend/ttrss/ttrssAPI.vala @@ -26,7 +26,8 @@ public class FeedReader.ttrssAPI : GLib.Object { m_utils = utils; m_session = new Soup.Session(); m_session.user_agent = Constants.USER_AGENT; - m_session.ssl_strict = false; + m_session.tls_database = null; + m_session.tls_interaction = null; m_session.authenticate.connect((msg, auth, retrying) => { if(m_utils.getHtaccessUser() == "") { diff --git a/src/Backend/FeedServer.vala b/src/Backend/FeedServer.vala index f61f2845..eca9447f 100644 --- a/src/Backend/FeedServer.vala +++ b/src/Backend/FeedServer.vala @@ -438,7 +438,8 @@ public class FeedReader.FeedServer : GLib.Object { var session = new Soup.Session(); session.user_agent = Constants.USER_AGENT; session.timeout = 5; - session.ssl_strict = false; + session.tls_database = null; + session.tls_interaction = null; try { @@ -583,7 +584,8 @@ public class FeedReader.FeedServer : GLib.Object { var session = new Soup.Session(); session.user_agent = Constants.USER_AGENT; session.timeout = 5; - session.ssl_strict = false; + session.tls_database = null; + session.tls_interaction = null; var a = new Article ("", "", @@ -673,7 +675,8 @@ public class FeedReader.FeedServer : GLib.Object { var session = new Soup.Session(); session.user_agent = Constants.USER_AGENT; session.timeout = 5; - session.ssl_strict = false; + session.tls_database = null; + session.tls_interaction = null; var html_cntx = new Html.ParserCtxt(); html_cntx.use_options(Html.ParserOption.NOERROR + Html.ParserOption.NOWARNING); diff --git a/src/Utils.vala b/src/Utils.vala index 271e2e08..c821c2e1 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -23,7 +23,8 @@ public class FeedReader.Utils : GLib.Object { { m_session = new Soup.Session(); m_session.user_agent = Constants.USER_AGENT; - m_session.ssl_strict = false; + m_session.tls_database = null; + m_session.tls_interaction = null; m_session.timeout = 5; } From 4c8ad94aece026e3be6662532b268361c26fe4b3 Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sun, 29 Sep 2024 16:01:58 +0530 Subject: [PATCH 07/14] Fix URI errors --- src/ContentGrabber/grabber.vala | 8 ++++---- src/FavIcon.vala | 8 +++++++- src/Utils.vala | 8 ++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/ContentGrabber/grabber.vala b/src/ContentGrabber/grabber.vala index 594dd147..76af4c35 100644 --- a/src/ContentGrabber/grabber.vala +++ b/src/ContentGrabber/grabber.vala @@ -105,9 +105,9 @@ public class FeedReader.Grabber : GLib.Object { { Logger.debug("Grabber: process article: " + m_articleURL); - var uri = new Soup.URI(m_articleURL); - if(uri == null) - { + try { + var uri = GLib.Uri.parse(m_articleURL, GLib.UriFlags.NONE); + } catch (GLib.UriError e) { Logger.error("No valid article-url?!?"); return false; } @@ -229,7 +229,7 @@ public class FeedReader.Grabber : GLib.Object { if(msg.status_code == Soup.Status.MOVED_TEMPORARILY || msg.status_code == Soup.Status.MOVED_PERMANENTLY) { - m_articleURL = msg.uri.to_string(false); + m_articleURL = msg.uri.to_string(); m_article.setURL(m_articleURL); Logger.debug("Grabber: new url is: " + m_articleURL); } diff --git a/src/FavIcon.vala b/src/FavIcon.vala index fcf730c9..25d29ace 100644 --- a/src/FavIcon.vala +++ b/src/FavIcon.vala @@ -288,7 +288,13 @@ public class FeedReader.FavIcon : GLib.Object } // try domainname/favicon.ico - var uri = new Soup.URI(m_feed.getURL()); + GLib.Uri uri; + try { + uri = GLib.Uri.parse(m_feed.getURL(), GLib.UriFlags.NONE); + } catch (GLib.UriError e) { + Logger.error(@"Fetching favicon failed: can't parse url $(m_feed.getURL())! Seems to be not valid."); + } + string? siteURL = null; if(uri != null) { diff --git a/src/Utils.vala b/src/Utils.vala index c821c2e1..c4870575 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -263,10 +263,10 @@ public class FeedReader.Utils : GLib.Object { public static bool ping(string link) { Logger.debug("Ping: " + link); - var uri = new Soup.URI(link); - - if(uri == null) - { + GLib.Uri uri; + try { + uri = GLib.Uri.parse(link, GLib.UriFlags.NONE); + } catch (GLib.UriError e) { Logger.error(@"Ping failed: can't parse url $link! Seems to be not valid."); return false; } From 246b53f481dc26b37c095770ada75648a58a5684 Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sun, 29 Sep 2024 16:15:58 +0530 Subject: [PATCH 08/14] Fix send_async errors --- src/FavIcon.vala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/FavIcon.vala b/src/FavIcon.vala index 25d29ace..ced252cd 100644 --- a/src/FavIcon.vala +++ b/src/FavIcon.vala @@ -288,7 +288,7 @@ public class FeedReader.FavIcon : GLib.Object } // try domainname/favicon.ico - GLib.Uri uri; + GLib.Uri uri = null; try { uri = GLib.Uri.parse(m_feed.getURL(), GLib.UriFlags.NONE); } catch (GLib.UriError e) { @@ -340,7 +340,7 @@ public class FeedReader.FavIcon : GLib.Object string html; try { - var bodyStream = yield Utils.getSession().send_async(message_html); + var bodyStream = yield Utils.getSession().send_async(message_html, 2, cancellable); html = (string)yield Utils.inputStreamToArray(bodyStream, cancellable); } catch (Error e) @@ -438,7 +438,7 @@ public class FeedReader.FavIcon : GLib.Object uint8[]? data; try { - var bodyStream = yield Utils.getSession().send_async(message, cancellable); + var bodyStream = yield Utils.getSession().send_async(message, 1, cancellable); data = yield Utils.inputStreamToArray(bodyStream, cancellable); } catch (Error e) From 958ea907911afe421b48bf0da4800507a43c8341 Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sun, 6 Oct 2024 15:45:33 +0530 Subject: [PATCH 09/14] Platform 8 update: Port FreshRSS plugin to Soup 3 (#32) * Fix some errors for FreshRSS * Add return type to auth signal handler --- plugins/backend/fresh/freshConnection.vala | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/backend/fresh/freshConnection.vala b/plugins/backend/fresh/freshConnection.vala index 2c4a60f0..afdc1188 100644 --- a/plugins/backend/fresh/freshConnection.vala +++ b/plugins/backend/fresh/freshConnection.vala @@ -25,27 +25,27 @@ public class FeedReader.freshConnection { m_settingsTweaks = new GLib.Settings("com.github.suzie97.communique.tweaks"); m_session = new Soup.Session(); m_session.user_agent = Constants.USER_AGENT; - m_session.authenticate.connect((msg, auth, retrying) => { - if(m_utils.getHtaccessUser() == "") - { - Logger.error("fresh Session: need Authentication"); - } - else if(!retrying) - { - auth.authenticate(m_utils.getHtaccessUser(), m_utils.getHtaccessPasswd()); - } - }); } public LoginResponse getSID() { var message = new Soup.Message("POST", m_utils.getURL()+"accounts/ClientLogin"); + message.authenticate.connect((auth, retrying) => { + if(m_utils.getHtaccessUser() == "") { + Logger.error("fresh Session: need Authentication"); + } else if(!retrying) { + auth.authenticate(m_utils.getHtaccessUser(), m_utils.getHtaccessPasswd()); + return true; + } + return false; + }); + var msg = new freshMessage(); msg.add("Email", m_utils.getUser()); msg.add("Passwd", m_utils.getPasswd()); - message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, msg.get().data); + message.set_request_body_from_bytes("application/x-www-form-urlencoded", new Bytes(msg.get().data)); var response_body = m_session.send_and_read(message); if(message.status_code != 200) @@ -91,7 +91,7 @@ public class FeedReader.freshConnection { message.request_headers.append("Authorization","GoogleLogin auth=%s".printf(m_utils.getToken())); message.request_headers.append("Content-Type", type); - message.request_body.append_take(input.data); + message.set_request_body_from_bytes(type, new Bytes(input.data)); var response_body = m_session.send_and_read(message); if(message.status_code != 200) From b17262ca6ef69378c026c1e11ffefe8fab338b92 Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sun, 6 Oct 2024 15:48:51 +0530 Subject: [PATCH 10/14] Ignore temp files created by elementary Code --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 22483d62..93562e64 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ builddir/ _build/ .mypy_cache .vscode/ -*.~ +*~ .DS_Store build-aux/flatpak/build build-aux/flatpak/.flatpak-builder From 6471bff2ec23d75c59b20c11db4211d65f54e7d4 Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sun, 6 Oct 2024 16:02:42 +0530 Subject: [PATCH 11/14] Platform 8 upgrade: Port local plugin to Soup 3 (#33) --- plugins/backend/local/SuggestedFeedRow.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/backend/local/SuggestedFeedRow.vala b/plugins/backend/local/SuggestedFeedRow.vala index 995696d9..2d9bbe75 100644 --- a/plugins/backend/local/SuggestedFeedRow.vala +++ b/plugins/backend/local/SuggestedFeedRow.vala @@ -61,7 +61,7 @@ public class FeedReader.SuggestedFeedRow : Gtk.ListBoxRow { this.set_tooltip_text(m_desc); show_all(); - var uri = new Soup.URI(url); + var uri = GLib.Uri.parse(url, GLib.UriFlags.NONE); var fakeFeed = new Feed(uri.get_host(), null, null, 0); load_favicon.begin(iconStack, fakeFeed, iconURL, (obj, res) => { load_favicon.end(res); From 026a3176d1b1ac7dcdf2e6bde7dccb4307acc22d Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sun, 6 Oct 2024 16:19:51 +0530 Subject: [PATCH 12/14] Platform 8 upgrade: Port Inoreader plugin to Soup 3 --- plugins/backend/inoreader/InoReaderConnection.vala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/backend/inoreader/InoReaderConnection.vala b/plugins/backend/inoreader/InoReaderConnection.vala index 54a15b9d..2fcd50d7 100644 --- a/plugins/backend/inoreader/InoReaderConnection.vala +++ b/plugins/backend/inoreader/InoReaderConnection.vala @@ -39,7 +39,7 @@ public class FeedReader.InoReaderConnection { + "&client_secret=" + InoReaderSecret.apiClientSecret + "&scope=" + "&grant_type=authorization_code"; - message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); + message.set_request_body_from_bytes("application/x-www-form-urlencoded", new Bytes(message_string.data)); var response_body = m_session.send_and_read(message); if(message.status_code != 200) @@ -89,7 +89,7 @@ public class FeedReader.InoReaderConnection { + "&grant_type=refresh_token" + "&refresh_token=" + m_utils.getRefreshToken(); - message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); + message.set_request_body_from_bytes("application/x-www-form-urlencoded", new Bytes(message_string.data)); var response_body = m_session.send_and_read(message); if(message.status_code != 200) @@ -153,7 +153,7 @@ public class FeedReader.InoReaderConnection { if(message_string != null) { - message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); + message.set_request_body_from_bytes("application/x-www-form-urlencoded", new Bytes(message_string.data)); } var response_body = m_session.send_and_read(message); @@ -166,7 +166,7 @@ public class FeedReader.InoReaderConnection { return Response() { status = message.status_code, - data = (string)response_body.get_data().data + data = (string)response_body.get_data() }; } From 3833e04d55496d9552b5ebc52b5d9aaef2b5581b Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sun, 6 Oct 2024 16:30:28 +0530 Subject: [PATCH 13/14] Platform 8 upgrade: Port FeedHQ plugin to Soup 3 --- plugins/backend/feedhq/feedhqConnection.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/backend/feedhq/feedhqConnection.vala b/plugins/backend/feedhq/feedhqConnection.vala index cf2e3c48..52220308 100644 --- a/plugins/backend/feedhq/feedhqConnection.vala +++ b/plugins/backend/feedhq/feedhqConnection.vala @@ -49,7 +49,7 @@ public class FeedReader.FeedHQConnection { var message = new Soup.Message("POST", "https://feedhq.org/accounts/ClientLogin"); string message_string = "Email=" + m_username + "&Passwd=" + m_passwd; - message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); + message.set_request_body_from_bytes("application/x-www-form-urlencoded", new Bytes(message_string.data)); var response_body = m_session.send_and_read(message); string response = (string)response_body.get_data(); try{ @@ -121,7 +121,7 @@ public class FeedReader.FeedHQConnection { var message_string_post = message_string + "&T=" + m_utils.getPostToken(); if(message_string != null) { - message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string_post.data); + message.set_request_body_from_bytes("application/x-www-form-urlencoded", new Bytes(message_string_post.data)); } var response_body = m_session.send_and_read(message); From 18117d3d187fa479409472106c6e35a8d015f107 Mon Sep 17 00:00:00 2001 From: Darshak Parikh Date: Sun, 8 Dec 2024 20:01:07 +0530 Subject: [PATCH 14/14] Platform 8 upgrade: Port Bazqux plugin to Soup 3 --- plugins/backend/bazqux/bazquxConnection.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/backend/bazqux/bazquxConnection.vala b/plugins/backend/bazqux/bazquxConnection.vala index a40bd6ff..0f8cd8a5 100644 --- a/plugins/backend/bazqux/bazquxConnection.vala +++ b/plugins/backend/bazqux/bazquxConnection.vala @@ -49,7 +49,7 @@ public class FeedReader.bazquxConnection { var message = new Soup.Message("POST", "https://bazqux.com/accounts/ClientLogin/"); string message_string = "Email=" + m_username + "&Passwd=" + m_passwd; - message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); + message.set_request_body_from_bytes("application/x-www-form-urlencoded", new Bytes(message_string.data)); var response_body = m_session.send_and_read(message); string response = (string)response_body.get_data(); try{ @@ -97,7 +97,7 @@ public class FeedReader.bazquxConnection { if(message_string != null) { - message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, message_string.data); + message.set_request_body_from_bytes("application/x-www-form-urlencoded", new Bytes(message_string.data)); } var response_body = m_session.send_and_read(message);