Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Platform 8 #31

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ builddir/
_build/
.mypy_cache
.vscode/
*.~
*~
.DS_Store
build-aux/flatpak/build
build-aux/flatpak/.flatpak-builder
.flatpak-builder
20 changes: 12 additions & 8 deletions com.github.suzie97.communique.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -41,26 +41,30 @@ 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:
- '/include'
- '*.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:
Expand Down
8 changes: 4 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
16 changes: 8 additions & 8 deletions plugins/backend/bazqux/bazquxConnection.vala
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ 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);
string response = (string)message.response_body.flatten().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{

var regex = new Regex(".*\\w\\s.*\\w\\sAuth=");
Expand Down Expand Up @@ -97,14 +97,14 @@ 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));
}

m_session.send_message(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()
};
}

Expand All @@ -114,9 +114,9 @@ public class FeedReader.bazquxConnection {

string oldauth = "GoogleLogin auth=" + m_utils.getAccessToken();
message.request_headers.append("Authorization", oldauth);
m_session.send_message(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;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/backend/feedbin/feedbinAPI.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
16 changes: 8 additions & 8 deletions plugins/backend/feedhq/feedhqConnection.vala
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ 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);
string response = (string)message.response_body.flatten().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{

var regex = new Regex(".*\\w\\s.*\\w\\sAuth=");
Expand Down Expand Up @@ -85,15 +85,15 @@ public class FeedReader.FeedHQConnection {

string oldauth = "GoogleLogin auth=" + m_utils.getAccessToken();
message.request_headers.append("Authorization", oldauth);
m_session.send_message(message);
var response_body = m_session.send_and_read(message);

if(message.status_code != 200)
{
Logger.debug("FeedHQ post token failed");
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);

Expand Down Expand Up @@ -121,10 +121,10 @@ 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));
}

m_session.send_message(message);
var response_body = m_session.send_and_read(message);

if(message.status_code != 200)
{
Expand All @@ -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()
};
}

Expand Down
36 changes: 18 additions & 18 deletions plugins/backend/fresh/freshConnection.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,36 @@ 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);
m_session.send_message(message);
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)
{
Logger.error("No response from freshRSS to message getSID()");
return LoginResponse.NO_CONNECTION;
}

string response = (string)message.response_body.flatten().data;
string response = (string)response_body.get_data();

if(!response.has_prefix("SID="))
{
Expand Down Expand Up @@ -91,8 +91,8 @@ 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);
m_session.send_message(message);
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)
{
Expand All @@ -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()
};
}

Expand All @@ -115,7 +115,7 @@ public class FeedReader.freshConnection {
message.request_headers.append("DNT", "1");
}

m_session.send_message(message);
var response_body = m_session.send_and_read(message);

if(message.status_code != 200)
{
Expand All @@ -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()
};
}
}
Expand Down
18 changes: 9 additions & 9 deletions plugins/backend/inoreader/InoReaderConnection.vala
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ 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);
m_session.send_message(message);
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)
{
return LoginResponse.NO_CONNECTION;
}

string response = (string)message.response_body.flatten().data;
string response = (string)response_body.get_data();

try
{
Expand Down Expand Up @@ -89,15 +89,15 @@ 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);
m_session.send_message(message);
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)
{
return LoginResponse.NO_CONNECTION;
}

string response = (string)message.response_body.flatten().data;
string response = (string)response_body.get_data();

try
{
Expand Down Expand Up @@ -153,10 +153,10 @@ 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));
}

m_session.send_message(message);
var response_body = m_session.send_and_read(message);

if(message.status_code != 200)
{
Expand All @@ -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()
};
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/backend/local/SuggestedFeedRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions plugins/backend/local/localInterface.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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_message(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();
Expand Down
6 changes: 4 additions & 2 deletions plugins/backend/local/localUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public class FeedReader.localUtils : GLib.Object {
return null;
}

uint status = session.send_message(msg);
var response_body = session.send_and_read(msg);
uint status = msg.status_code;

if(status < 100 || status >= 400)
{
if(status < 100)
Expand All @@ -51,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
Expand Down
3 changes: 2 additions & 1 deletion plugins/backend/owncloud/OwncloudNewsAPI.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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() == "")
{
Expand Down
Loading
Loading