Patching KOReader Wallabag Plugin to add star support
Now you can star Wallabag entries from the comfort of your Kobo e-reader
I have been gradually, painfully migrating away from the defunct Pocket, to Wallabag.
When I started using the KOReader Wallabag plugin, I discovered that there was no way to star articles from my e-reader. Ugh!
I Googled, and searched through the code base, and found no reference to starring articles from KOreader.
But KOReader is open source.
I squinted at the KOReader Wallabag plugin’s main.lua. Hmm, it looked pretty simple. And there’s already the star icons in the book details view… And it’s already set-up to send Wallabag PATCH entry API requests. And I remember from my star_article_in_wallabag_by_url.py script what payload to use to star an article.
I started a discussion about the idea: @Frenzie seemed a bit unimpressed by the primitive approach I had in mind, but supportive in principle.
I’ve never written Lua before, but it looked nice. I installed a Lua LSP for Helix editor (simple as brew install lua-language-server, no config needed). Since I was mostly adapting syntax from surrounding code, I didn’t even need to Google or use AI.
I added ~6 simple lines to archiveArticle() in main.lua:
-- if rated 5 stars, star article in Wallabag
local doc_settings = DocSettings:open(path)
local summary = doc_settings:readSetting("summary")
local rating = summary.rating
if rating and rating == 5 then
body = { archive = 1, starred = 1 }
end
Then, I updated .adds/koreader/plugins/wallabag.koplugin/main.lua on my e-reader with the new version.
The feature worked perfectly, first try.
I have opened a draft pull request (#14793), so there’s a chance this feature might be available in the default KOReader install at some point in the future.