Skip to content

Instantly share code, notes, and snippets.

@scateu
Last active May 18, 2020 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scateu/cc109fa180af87615bb91a927be25857 to your computer and use it in GitHub Desktop.
Save scateu/cc109fa180af87615bb91a927be25857 to your computer and use it in GitHub Desktop.
newsboat - inoreader thread patch - for homebrew
[source.crates-io]
replace-with = 'tuna'
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
class Newsboat < Formula
desc "RSS/Atom feed reader for text terminals"
homepage "https://newsboat.org/"
url "https://newsboat.org/releases/2.19/newsboat-2.19.tar.xz"
sha256 "ba484c825bb903daf6d33d55126107b59e41111b455d368362208f1825403d1b"
head "https://github.com/newsboat/newsboat.git"
bottle do
sha256 "9b650d0f032cd046cc75de2870186977666892ddef0c120e9481d452aed64679" => :catalina
sha256 "59c06c5a6b1e7c360f9c31c93e7d2f25296ce8a0048b47ad365cb642c2365d19" => :mojave
sha256 "023a4bcb967d4bd7bd052a59167b1581d16e261c1dbe2a0fdac11d8b38ee816d" => :high_sierra
end
depends_on "asciidoctor" => :build
depends_on "pkg-config" => :build
depends_on "rust" => :build
depends_on "gettext"
depends_on "json-c"
depends_on "libstfl"
uses_from_macos "curl"
uses_from_macos "libxml2"
uses_from_macos "libxslt"
patch :DATA
def install
gettext = Formula["gettext"]
ENV["GETTEXT_BIN_DIR"] = gettext.opt_bin.to_s
ENV["GETTEXT_LIB_DIR"] = gettext.lib.to_s
ENV["GETTEXT_INCLUDE_DIR"] = gettext.include.to_s
ENV["XML_CATALOG_FILES"] = etc/"xml/catalog"
system "make", "-j8", "install", "prefix=#{prefix}"
end
test do
(testpath/"urls.txt").write "https://github.com/blog/subscribe"
assert_match /newsboat - Exported Feeds/m, shell_output("LC_ALL=C #{bin}/newsboat -e -u urls.txt")
end
end
__END__
diff --git a/src/inoreaderapi.cpp b/src/inoreaderapi.cpp
index a27f66a3..0bdd69d4 100644
--- a/src/inoreaderapi.cpp
+++ b/src/inoreaderapi.cpp
@@ -4,6 +4,7 @@
#include <curl/curl.h>
#include <json.h>
#include <vector>
+#include <thread>
#include "config.h"
#include "strprintf.h"
@@ -214,8 +215,18 @@ bool InoreaderApi::mark_all_read(const std::string& feedurl)
bool InoreaderApi::mark_article_read(const std::string& guid, bool read)
{
- std::string token = get_new_token();
- return mark_article_read_with_token(guid, read, token);
+ // Do this in a thread, as we don't care about the result enough to wait
+ // for it. // borrowed from ttrssapi.cpp
+ std::thread t{[=]()
+ {
+ LOG(Level::DEBUG,
+ "InoreaderApi::mark_article_read: inside thread, marking "
+ "thread as read...");
+ std::string token = get_new_token();
+ mark_article_read_with_token(guid, read, token);
+ }};
+ t.detach();
+ return true;
}
bool InoreaderApi::mark_article_read_with_token(const std::string& guid,
USAGE:
```bash
ALL_PROXY=socks5://localhost:<PORT> brew install -s ./newsboat.rb
proxychains4 newsboat
```
EXAMPLE CONF FOR NEWSBOAT:
```
bind-key k up
bind-key j down
bind-key L toggle-show-read-feeds
bind-key - pageup
unbind-key SPACE
bind-key SPACE pagedown
unbind-key l
bind-key l open
bind-key RIGHT open
bind-key , quit
bind-key h quit
bind-key LEFT quit
bind-key J next-feed
bind-key K prev-feed
download-retries 5
download-timeout 90
auto-reload yes
reload-time 90
reload-threads 15
always-display-description yes
keep-articles-days 500
refresh-on-startup yes
confirm-exit yes
show-read-feeds no
show-read-articles yes
highlight article "^Feed: .*$" color3 default
highlight article "^Title: .*$" color13 default bold
highlight article "^Author: .*$" color5 default
highlight article "^Link: .*$" color6 default
highlight article "^Date: .*$" color4 default
urls-source "inoreader"
inoreader-login "EMAIL_ADDRESS"
inoreader-passwordeval "gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.inoreader-pass.gpg"
inoreader-min-items 200
# echo -e "password\n" | gpg --encrypt -o .inoreader-pass.gpg
# echo -e "password\n" | gpg --symmetric -o .inoreader-pass.gpg
#browser w3m %u
browser open %u
download-full-page yes
html-renderer "w3m -dump -T text/html"
#proxy-type socks5
#proxy localhost:1080
#use-proxy yes
```
@scateu
Copy link
Author

scateu commented May 17, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment