Skip to content

Commit

Permalink
PocketBook: Open links in the on-device web browser (#11787)
Browse files Browse the repository at this point in the history
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: #11782
Related: #6597
  • Loading branch information
liskin committed May 18, 2024
1 parent 7bded46 commit e94550a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions frontend/device/pocketbook/device.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e94550a

Please sign in to comment.