Skip to content
This repository has been archived by the owner on Oct 10, 2019. It is now read-only.

Commit

Permalink
TTRSS-API: only set auth_info for "Single" ttrss-mode
Browse files Browse the repository at this point in the history
Currently, newsbeuter sets the HTTP-Auth parameter for all requests that
target the TTRSS-api from the "ttrss-login" and "ttrss-password" config
file options. This explicitly provided auth_info takes precedence over
optionally provided user-information in libcurl.

Therefore the following config settings
    urls-source    "ttrss"
    ttrss-url      "https://htuser:[email protected]"

    ttrss-login    "ttrssuser"
    ttrss-password "ttrsspasswd"

will try to query "trssinstance.example.org" with auth_info
"ttrssuser:ttrsspasswd" and consequently fail, while libcurl as such
would happily accept the auth info from "ttrss-url" when no explicit
auth-info was provided.

This commit rectifies this and consequently allows newsbeuter to use
multiuser-TTRSS instances which are hosted behind http-basic auth.
  • Loading branch information
noctux committed Jul 26, 2017
1 parent d20cf49 commit 678a9db
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions doc/newsbeuter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,14 @@ authentication is done against Tiny Tiny RSS itself.

ttrss-mode "single" # "multi" is default

If Tiny Tiny RSS is configured in multi-user mode and still deployed behind
an additional HTTP-BasicAuth, the required username and password (which may
deviate from ttrss-login and ttrss-password) can be specified in the user-part
of the url like this:

ttrss-url "http://htuser:[email protected]/ttrss/"


With these settings, newsbeuter should be able to connect to Tiny Tiny RSS and
download your subscribed feeds. Articles or even complete feeds that you marked
as read are synchronized directly to Tiny Tiny RSS.
Expand Down
12 changes: 10 additions & 2 deletions src/ttrss_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ namespace newsbeuter {

ttrss_api::ttrss_api(configcontainer * c) : remote_api(c) {
single = (cfg->get_configvalue("ttrss-mode") == "single");
auth_info = strprintf::fmt("%s:%s", cfg->get_configvalue("ttrss-login"), cfg->get_configvalue("ttrss-password"));
if (single) {
auth_info = strprintf::fmt("%s:%s", cfg->get_configvalue("ttrss-login"), cfg->get_configvalue("ttrss-password"));
} else {
auth_info = "";
}
sid = "";
}

Expand Down Expand Up @@ -42,7 +46,11 @@ std::string ttrss_api::retrieve_sid() {

args["user"] = single ? "admin" : cred.user.c_str();
args["password"] = cred.pass.c_str();
auth_info = strprintf::fmt("%s:%s", cred.user, cred.pass);
if (single) {
auth_info = strprintf::fmt("%s:%s", cred.user, cred.pass);
} else {
auth_info = "";
}
json_object * content = run_op("login", args);

if (content == nullptr)
Expand Down

0 comments on commit 678a9db

Please sign in to comment.