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

Platform 8 update: Port FreshRSS plugin to Soup 3 #32

Merged
merged 2 commits into from
Oct 6, 2024
Merged
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
24 changes: 12 additions & 12 deletions plugins/backend/fresh/freshConnection.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Loading