[Fix] Don't load disabled plugins (#4169)

pull/4172/head
Robert 6 years ago committed by poire-z
parent d865bf84f4
commit 5344e0b672

@ -70,6 +70,10 @@ function PluginLoader:loadPlugins()
-- valid koreader plugin directory -- valid koreader plugin directory
if mode == "directory" and entry:find(".+%.koplugin$") then if mode == "directory" and entry:find(".+%.koplugin$") then
local mainfile = plugin_root.."/main.lua" local mainfile = plugin_root.."/main.lua"
local metafile = plugin_root.."/_meta.lua"
if plugins_disabled and plugins_disabled[entry:sub(1, -10)] then
mainfile = metafile
end
package.path = string.format("%s/?.lua;%s", plugin_root, package_path) package.path = string.format("%s/?.lua;%s", plugin_root, package_path)
package.cpath = string.format("%s/lib/?.so;%s", plugin_root, package_cpath) package.cpath = string.format("%s/lib/?.so;%s", plugin_root, package_cpath)
local ok, plugin_module = pcall(dofile, mainfile) local ok, plugin_module = pcall(dofile, mainfile)
@ -81,6 +85,10 @@ function PluginLoader:loadPlugins()
if (plugins_disabled and plugins_disabled[entry:sub(1, -10)]) then if (plugins_disabled and plugins_disabled[entry:sub(1, -10)]) then
table.insert(self.disabled_plugins, plugin_module) table.insert(self.disabled_plugins, plugin_module)
else else
local ok_meta, plugin_metamodule = pcall(dofile, metafile)
if ok_meta and plugin_metamodule then
for k,v in pairs(plugin_metamodule) do plugin_module[k] = v end
end
sandboxPluginEventHandlers(plugin_module) sandboxPluginEventHandlers(plugin_module)
table.insert(self.enabled_plugins, plugin_module) table.insert(self.enabled_plugins, plugin_module)
end end

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = 'SSH',
fullname = _("SSH"),
description = _([[Connect and transfer files to the device using SSH.]]),
}

@ -20,8 +20,6 @@ end
local SSH = WidgetContainer:new{ local SSH = WidgetContainer:new{
name = 'SSH', name = 'SSH',
fullname = _("SSH"),
description = _([[Connect and transfer files to the device using SSH.]]),
is_doc_only = false, is_doc_only = false,
} }

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "autofrontlight",
fullname = _("Auto frontlight"),
description = _([[Automatically turns the frontlight on and off once brightness in the environment reaches a certain level.]]),
}

@ -89,8 +89,6 @@ AutoFrontlight:init()
local AutoFrontlightWidget = WidgetContainer:new{ local AutoFrontlightWidget = WidgetContainer:new{
name = "autofrontlight", name = "autofrontlight",
fullname = _("Auto frontlight"),
description = _([[Automatically turns the frontlight on and off once brightness in the environment reaches a certain level.]]),
} }
function AutoFrontlightWidget:init() function AutoFrontlightWidget:init()

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "autosuspend",
fullname = _("Auto suspend"),
description = _([[Suspends the device after a period of inactivity.]]),
}

@ -112,8 +112,6 @@ AutoSuspend:init()
local AutoSuspendWidget = WidgetContainer:new{ local AutoSuspendWidget = WidgetContainer:new{
name = "autosuspend", name = "autosuspend",
fullname = _("Auto suspend"),
description = _([[Suspends the device after a period of inactivity.]]),
} }
function AutoSuspendWidget:onInputEvent() function AutoSuspendWidget:onInputEvent()

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "backgroundrunner",
fullname = _("Background runner"),
description = _([[Service to other plugins: allows tasks to run regularly in the background.]]),
}

@ -239,8 +239,6 @@ BackgroundRunner:_schedule()
local BackgroundRunnerWidget = WidgetContainer:new{ local BackgroundRunnerWidget = WidgetContainer:new{
name = "backgroundrunner", name = "backgroundrunner",
fullname = _("Background runner"),
description = _([[Service to other plugins: allows tasks to run regularly in the background.]]),
runner = BackgroundRunner, runner = BackgroundRunner,
} }

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "batterystat",
fullname = _("Battery statistics"),
description = _([[Collects and displays battery statistics.]]),
}

@ -282,8 +282,6 @@ BatteryStat:init()
local BatteryStatWidget = WidgetContainer:new{ local BatteryStatWidget = WidgetContainer:new{
name = "batterystat", name = "batterystat",
fullname = _("Battery statistics"),
description = _([[Collects and displays battery statistics.]]),
} }
function BatteryStatWidget:init() function BatteryStatWidget:init()

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "calibrecompanion",
fullname = _("Calibre companion"),
description = _([[Send documents from calibre library directly to device via Wi-Fi connection]]),
}

@ -23,8 +23,6 @@ require("ffi/zeromq_h")
--]] --]]
local CalibreCompanion = InputContainer:new{ local CalibreCompanion = InputContainer:new{
name = "calibrecompanion", name = "calibrecompanion",
fullname = _("Calibre companion"),
description = _([[Send documents from calibre library directly to device via Wi-Fi connection]]),
-- calibre companion local port -- calibre companion local port
port = 8134, port = 8134,
-- calibre broadcast ports used to find calibre server -- calibre broadcast ports used to find calibre server

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "coverbrowser",
fullname = _("Cover browser"),
description = _([[Alternative display modes for file browser and history.]]),
}

@ -43,8 +43,6 @@ local history_display_mode = false -- not initialized yet
local CoverBrowser = InputContainer:new{ local CoverBrowser = InputContainer:new{
name = "coverbrowser", name = "coverbrowser",
fullname = _("Cover browser"),
description = _([[Alternative display modes for file browser and history.]]),
} }
function CoverBrowser:init() function CoverBrowser:init()

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "evernote",
fullname = _("Evernote"),
description = _([[Exports hightlights and notes to the Evernote cloud.]]),
}

@ -18,8 +18,6 @@ local realpath = require("ffi/util").realpath
local EvernoteExporter = InputContainer:new{ local EvernoteExporter = InputContainer:new{
name = "evernote", name = "evernote",
fullname = _("Evernote"),
description = _([[Exports hightlights and notes to the Evernote cloud.]]),
login_title = _("Login to Evernote"), login_title = _("Login to Evernote"),
notebook_name = _("KOReader Notes"), notebook_name = _("KOReader Notes"),
evernote_domain = nil, evernote_domain = nil,

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "goodreads",
fullname = _("Goodreads"),
description = _([[Allows browsing and searching the Goodreads database of books.]]),
}

@ -10,8 +10,6 @@ local NetworkMgr = require("ui/network/manager")
local Goodreads = InputContainer:new { local Goodreads = InputContainer:new {
name = "goodreads", name = "goodreads",
fullname = _("Goodreads"),
description = _([[Allows browsing and searching the Goodreads database of books.]]),
goodreads_key = "", goodreads_key = "",
goodreads_secret = "", goodreads_secret = "",
} }

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = 'hello',
fullname = _("Hello"),
description = _([[This is a debugging plugin.]]),
}

@ -10,8 +10,6 @@ local _ = require("gettext")
local Hello = WidgetContainer:new{ local Hello = WidgetContainer:new{
name = 'hello', name = 'hello',
fullname = _("Hello"),
description = _([[This is a debugging plugin.]]),
is_doc_only = false, is_doc_only = false,
} }

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "keepalive",
fullname = _("Keep alive"),
description = _([[Keeps the device awake to prevent automatic Wi-Fi disconnects.]]),
}

@ -61,8 +61,6 @@ end
local KeepAlive = WidgetContainer:new{ local KeepAlive = WidgetContainer:new{
name = "keepalive", name = "keepalive",
fullname = _("Keep alive"),
description = _([[Keeps the device awake to prevent automatic Wi-Fi disconnects.]]),
} }
function KeepAlive:init() function KeepAlive:init()

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = 'kobolight',
fullname = _("Frontlight gesture controller"),
description = _([[Controls the frontlight with gestures on the left border of screen.]]),
}

@ -22,8 +22,6 @@ local swipe_touch_zone_ratio_warmth = { x = 7/8, y = 1/8, w = 1/8, h = 7/8, }
local KoboLight = WidgetContainer:new{ local KoboLight = WidgetContainer:new{
name = 'kobolight', name = 'kobolight',
fullname = _("Frontlight gesture controller"),
description = _([[Controls the frontlight with gestures on the left border of screen.]]),
gestureScale = nil, -- initialized in self:resetLayout() gestureScale = nil, -- initialized in self:resetLayout()
} }

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "kosync",
fullname = _("Progress sync"),
description = _([[Synchronizes your reading progess to a server across your KOReader devices.]]),
}

@ -20,8 +20,6 @@ end
local KOSync = InputContainer:new{ local KOSync = InputContainer:new{
name = "kosync", name = "kosync",
fullname = _("Progress sync"),
description = _([[Synchronizes your reading progess to a server across your KOReader devices.]]),
is_doc_only = true, is_doc_only = true,
title = _("Register/login to KOReader server"), title = _("Register/login to KOReader server"),

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "newsdownloader",
fullname = _("News downloader"),
description = _([[Retrieves RSS and Atom news entries and saves them as HTML files.]]),
}

@ -17,8 +17,6 @@ local T = FFIUtil.template
local NewsDownloader = WidgetContainer:new{ local NewsDownloader = WidgetContainer:new{
name = "newsdownloader", name = "newsdownloader",
fullname = _("News downloader"),
description = _([[Retrieves RSS and Atom news entries and saves them as HTML files.]]),
} }
local initialized = false local initialized = false

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "perceptionexpander",
fullname = _("Perception expander"),
description = _([[Improves your reading speed with the help of two vertical lines over the text.]]),
}

@ -16,8 +16,6 @@ local Blitbuffer = require("ffi/blitbuffer")
local PerceptionExpander = Widget:extend{ local PerceptionExpander = Widget:extend{
is_enabled = nil, is_enabled = nil,
name = "perceptionexpander", name = "perceptionexpander",
fullname = _("Perception expander"),
description = _([[Improves your reading speed with the help of two vertical lines over the text.]]),
page_counter = 0, page_counter = 0,
shift_each_pages = 100, shift_each_pages = 100,
margin = 0.1, margin = 0.1,

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "readtimer",
fullname = _("Read timer"),
description = _([[Shows an alarm after a specified amount of time.]]),
}

@ -7,8 +7,6 @@ local _ = require("gettext")
local ReadTimer = WidgetContainer:new{ local ReadTimer = WidgetContainer:new{
name = "readtimer", name = "readtimer",
fullname = _("Read timer"),
description = _([[Shows an alarm after a specified amount of time.]]),
time = 0, -- The expected time of alarm if enabled, or 0. time = 0, -- The expected time of alarm if enabled, or 0.
} }

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "send2ebook",
fullname = _("Send to eBook"),
description = _([[Receives articles sent with the Send2Ebook PC/Android application.]]),
}

@ -17,8 +17,6 @@ local T = FFIUtil.template
local Send2Ebook = WidgetContainer:new{ local Send2Ebook = WidgetContainer:new{
name = "send2ebook", name = "send2ebook",
fullname = _("Send to eBook"),
description = _([[Receives articles sent with the Send2Ebook PC/Android application.]]),
} }
local initialized = false local initialized = false

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "statistics",
fullname = _("Reader statistics"),
description = _([[Keeps and displays your reading statistics.]]),
}

@ -29,8 +29,6 @@ local DEFAULT_MAX_READ_SEC = 120
local ReaderStatistics = Widget:extend{ local ReaderStatistics = Widget:extend{
name = "statistics", name = "statistics",
fullname = _("Reader statistics"),
description = _([[Keeps and displays your reading statistics.]]),
page_min_read_sec = DEFAULT_MIN_READ_SEC, page_min_read_sec = DEFAULT_MIN_READ_SEC,
page_max_read_sec = DEFAULT_MAX_READ_SEC, page_max_read_sec = DEFAULT_MAX_READ_SEC,
start_current_period = 0, start_current_period = 0,

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "systemstat",
fullname = _("System statistics"),
description = _([[Shows system statistics.]]),
}

@ -240,8 +240,6 @@ SystemStat:init()
local SystemStatWidget = WidgetContainer:new{ local SystemStatWidget = WidgetContainer:new{
name = "systemstat", name = "systemstat",
fullname = _("System statistics"),
description = _([[Shows system statistics.]]),
} }
function SystemStatWidget:init() function SystemStatWidget:init()

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "terminal",
fullname = _("Terminal"),
description = _([[Executes simple commands and shows their output.]]),
}

@ -11,8 +11,6 @@ local Screen = require("device").screen
local Terminal = WidgetContainer:new{ local Terminal = WidgetContainer:new{
name = "terminal", name = "terminal",
fullname = _("Terminal"),
description = _([[Executes simple commands and shows their output.]]),
dump_file = util.realpath(DataStorage:getDataDir()) .. "/terminal_output.txt", dump_file = util.realpath(DataStorage:getDataDir()) .. "/terminal_output.txt",
command = "", command = "",
} }

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "texteditor",
fullname = _("Text editor"),
description = _([[A basic text editor for making small changes to plain text files.]]),
}

@ -18,8 +18,6 @@ local T = ffiutil.template
local TextEditor = WidgetContainer:new{ local TextEditor = WidgetContainer:new{
name = "texteditor", name = "texteditor",
fullname = _("Text editor"),
description = _([[A basic text editor for making small changes to plain text files.]]),
settings_file = DataStorage:getSettingsDir() .. "/text_editor.lua", settings_file = DataStorage:getSettingsDir() .. "/text_editor.lua",
settings = nil, -- loaded only when needed settings = nil, -- loaded only when needed
-- how many to display in menu (10x3 pages minus our 3 default menu items): -- how many to display in menu (10x3 pages minus our 3 default menu items):

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "timesync",
fullname = _("Time sync"),
description = _([[Synchronizes the device time with NTP servers.]]),
}

@ -19,8 +19,6 @@ local NetworkMgr = require("ui/network/manager")
local TimeSync = WidgetContainer:new{ local TimeSync = WidgetContainer:new{
name = "timesync", name = "timesync",
fullname = _("Time sync"),
description = _([[Synchronizes the device time with NTP servers.]]),
} }
local function currentTime() local function currentTime()

@ -0,0 +1,6 @@
local _ = require("gettext")
return {
name = "zsync",
fullname = _("Zsync"),
description = _([[Devices in the same Wi-Fi network can transfer documents between each other directly.]]),
}

@ -15,8 +15,6 @@ int rmdir(const char *);
require("ffi/zeromq_h") require("ffi/zeromq_h")
local ZSync = InputContainer:new{ local ZSync = InputContainer:new{
name = "zsync", name = "zsync",
fullname = _("Zsync"),
description = _([[Devices in the same Wi-Fi network can transfer documents between each other directly.]]),
is_doc_only = true, is_doc_only = true,
} }

Loading…
Cancel
Save