Merge pull request #879 from jgmdev/plugins-skip-version

config: added skip_plugins_version
This commit is contained in:
Jefferson González 2022-03-11 17:30:36 -04:00 committed by GitHub
commit 1725a48ce2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -29,6 +29,9 @@ config.borderless = false
config.tab_close_button = true config.tab_close_button = true
config.max_clicks = 3 config.max_clicks = 3
-- set as true to be able to test non supported plugins
config.skip_plugins_version = false
config.plugins = {} config.plugins = {}
-- Allow you to set plugin configs even if we haven't seen the plugin before. -- Allow you to set plugin configs even if we haven't seen the plugin before.
setmetatable(config.plugins, { setmetatable(config.plugins, {

View File

@ -891,12 +891,11 @@ function core.load_plugins()
local plugin_dir, basename = files[filename], filename:match("(.-)%.lua$") or filename local plugin_dir, basename = files[filename], filename:match("(.-)%.lua$") or filename
local is_lua_file, version_match = check_plugin_version(plugin_dir .. '/' .. filename) local is_lua_file, version_match = check_plugin_version(plugin_dir .. '/' .. filename)
if is_lua_file then if is_lua_file then
if not version_match then if not config.skip_plugins_version and not version_match then
core.log_quiet("Version mismatch for plugin %q from %s", basename, plugin_dir) core.log_quiet("Version mismatch for plugin %q from %s", basename, plugin_dir)
local list = refused_list[plugin_dir:find(USERDIR, 1, true) == 1 and 'userdir' or 'datadir'].plugins local list = refused_list[plugin_dir:find(USERDIR, 1, true) == 1 and 'userdir' or 'datadir'].plugins
table.insert(list, filename) table.insert(list, filename)
end elseif config.plugins[basename] ~= false then
if version_match and config.plugins[basename] ~= false then
local ok = core.try(require, "plugins." .. basename) local ok = core.try(require, "plugins." .. basename)
if ok then core.log_quiet("Loaded plugin %q from %s", basename, plugin_dir) end if ok then core.log_quiet("Loaded plugin %q from %s", basename, plugin_dir) end
if not ok then if not ok then