mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Add option to start SSH server with KOReader (#13772)
This commit is contained in:
@@ -29,11 +29,22 @@ local SSH = WidgetContainer:extend{
|
||||
function SSH:init()
|
||||
self.SSH_port = G_reader_settings:readSetting("SSH_port") or "2222"
|
||||
self.allow_no_password = G_reader_settings:isTrue("SSH_allow_no_password")
|
||||
self.autostart = G_reader_settings:isTrue("SSH_autostart")
|
||||
|
||||
if self.autostart then
|
||||
self:start()
|
||||
end
|
||||
|
||||
self.ui.menu:registerToMainMenu(self)
|
||||
self:onDispatcherRegisterActions()
|
||||
end
|
||||
|
||||
function SSH:start()
|
||||
if self:isRunning() then
|
||||
logger.dbg("[Network] Not starting SSH server, already running.")
|
||||
return
|
||||
end
|
||||
|
||||
local cmd = string.format("%s %s %s %s%s %s",
|
||||
"./dropbear",
|
||||
"-E",
|
||||
@@ -200,6 +211,15 @@ function SSH:addToMainMenu(menu_items)
|
||||
G_reader_settings:flipNilOrFalse("SSH_allow_no_password")
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Start SSH server with KOReader"),
|
||||
checked_func = function() return self.autostart end,
|
||||
enabled_func = function() return not self:isRunning() end,
|
||||
callback = function()
|
||||
self.autostart = not self.autostart
|
||||
G_reader_settings:flipNilOrFalse("SSH_autostart")
|
||||
end,
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user