Skip to content

Commit

Permalink
PocketBook: Open links in the on-device web browser
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: koreader#11782
Related: koreader#6597
  • Loading branch information
liskin committed May 15, 2024
1 parent 8530282 commit 62d3310
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions frontend/device/pocketbook/device.lua
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,27 @@ 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

local argv = ffi.new("const char *[1]", {link})
inkview.OpenBook2(bin, 1, argv, 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 62d3310

Please sign in to comment.