Add deprecation messages to plugins (#7101)

And deprecate Goodreads plugin.
pull/7119/head
Martín Fernández 3 years ago committed by GitHub
parent 6c23d29a8a
commit 5ec0b049d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,11 +1,24 @@
local lfs = require("libs/libkoreader-lfs")
local logger = require("logger")
local _ = require("gettext")
local DEFAULT_PLUGIN_PATH = "plugins"
-- plugin names that were removed and are no longer available.
local OBSOLETE_PLUGINS = {
storagestat = true,
kobolight = true,
}
-- Deprecated plugins are still available, but show a hint about deprecation.
local function getMenuTable(plugin)
local t = {}
t.name = plugin.name
t.fullname = string.format("%s%s", plugin.fullname or plugin.name,
plugin.deprecated and " (" .. _("outdated") .. ")" or "")
t.description = string.format("%s%s", plugin.description,
type(plugin.deprecated) == "string" and "\n\n" .. plugin.deprecated or "")
return t
end
local function sandboxPluginEventHandlers(plugin)
for key, value in pairs(plugin) do
@ -126,19 +139,13 @@ function PluginLoader:genPluginManagerSubItem()
end
for _, plugin in ipairs(enabled_plugins) do
local element = {}
element.fullname = plugin.fullname or plugin.name
element.name = plugin.name
element.description = plugin.description
local element = getMenuTable(plugin)
element.enable = true
table.insert(self.all_plugins, element)
end
for _, plugin in ipairs(disabled_plugins) do
local element = {}
element.fullname = plugin.fullname or plugin.name
element.name = plugin.name
element.description = plugin.description
local element = getMenuTable(plugin)
element.enable = false
if not OBSOLETE_PLUGINS[element.name] then
table.insert(self.all_plugins, element)

@ -3,4 +3,5 @@ return {
name = "goodreads",
fullname = _("Goodreads"),
description = _([[Allows browsing and searching the Goodreads database of books.]]),
deprecated = "The Goodreads API has been discontinued. Some keys might still work, but this plugin will be removed soon.",
}

Loading…
Cancel
Save