mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Add deprecation messages to plugins (#7101)
And deprecate Goodreads plugin.
This commit is contained in:
@@ -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.",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user