From e94550a26165dd94875ae31a62bddea0125caa71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Janou=C5=A1ek?= Date: Sat, 18 May 2024 15:57:03 +0100 Subject: [PATCH] PocketBook: Open links in the on-device web browser (#11787) Many PocketBook devices include a web browser, but when clicking a link in KOReader, there was no option to open the link in the browser, there was only an option to show a QR code (which can then be scanned by a smartphone). This commit implements `canOpenLink`/`openLink` on PocketBook using the "browser.app", if available. Tested on PB740 (InkPad 3). Fixes: https://github.com/koreader/koreader/issues/11782 Related: https://github.com/koreader/koreader/issues/6597 --- frontend/device/pocketbook/device.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frontend/device/pocketbook/device.lua b/frontend/device/pocketbook/device.lua index e49aee33e..df9856d12 100644 --- a/frontend/device/pocketbook/device.lua +++ b/frontend/device/pocketbook/device.lua @@ -428,6 +428,25 @@ function PocketBook:setEventHandlers(uimgr) end end +local function getBrowser() + if util.pathExists("/usr/bin/browser.app") then + return true, "/usr/bin/browser.app" + elseif util.pathExists("/ebrmain/bin/browser.app") then + return true, "/ebrmain/bin/browser.app" + end + return false +end + +function PocketBook:canOpenLink() + return inkview.MultitaskingSupported() and getBrowser() +end + +function PocketBook:openLink(link) + local found, bin = getBrowser() + if not found or not link or type(link) ~= "string" then return end + inkview.OpenBook(bin, link, 0) +end + -- Pocketbook HW rotation modes start from landsape, CCW local function landscape_ccw() return { 1, 0, 3, 2, -- PORTRAIT, LANDSCAPE, PORTRAIT_180, LANDSCAPE_180