Skip to content

Commit

Permalink
Fix some errors for FreshRSS
Browse files Browse the repository at this point in the history
  • Loading branch information
dar5hak committed Oct 5, 2024
1 parent 246b53f commit e83ff20
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions plugins/backend/fresh/freshConnection.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,25 @@ 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());
}
});

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 +89,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

0 comments on commit e83ff20

Please sign in to comment.