mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 06:03:34 +01:00
Added plugin live view.
This commit is contained in:
parent
b44af95cb8
commit
cf32d45f66
4 changed files with 20 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -21,3 +21,4 @@ out/
|
|||
/src/bin/convertSettings.json
|
||||
/src/bin/etherpad-1.deb
|
||||
/src/bin/node.exe
|
||||
plugin_packages
|
|
@ -56,6 +56,7 @@
|
|||
"npm": "^6.14.18",
|
||||
"openapi-backend": "^5.10.5",
|
||||
"proxy-addr": "^2.0.7",
|
||||
"live-plugin-manager": "^0.18.1",
|
||||
"rate-limiter-flexible": "^3.0.0",
|
||||
"rehype": "^13.0.1",
|
||||
"rehype-minify-whitespace": "^6.0.0",
|
||||
|
|
|
@ -6,9 +6,12 @@ const hooks = require('./hooks');
|
|||
const runCmd = require('../../../node/utils/run_cmd');
|
||||
const settings = require('../../../node/utils/Settings');
|
||||
const axios = require('axios');
|
||||
|
||||
const {PluginManager} = require('live-plugin-manager');
|
||||
const logger = log4js.getLogger('plugins');
|
||||
|
||||
exports.manager = new PluginManager();
|
||||
|
||||
|
||||
const onAllTasksFinished = async () => {
|
||||
settings.reloadSettings();
|
||||
await hooks.aCallAll('loadSettings', {settings});
|
||||
|
@ -72,19 +75,19 @@ exports.getAvailablePlugins = (maxCacheAge) => {
|
|||
const nowTimestamp = Math.round(Date.now() / 1000);
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
// check cache age before making any request
|
||||
if (exports.availablePlugins && maxCacheAge && (nowTimestamp - cacheTimestamp) <= maxCacheAge) {
|
||||
return resolve(exports.availablePlugins);
|
||||
}
|
||||
// check cache age before making any request
|
||||
if (exports.availablePlugins && maxCacheAge && (nowTimestamp - cacheTimestamp) <= maxCacheAge) {
|
||||
return resolve(exports.availablePlugins);
|
||||
}
|
||||
|
||||
await axios.get('https://static.etherpad.org/plugins.json')
|
||||
.then(pluginsLoaded => {
|
||||
exports.availablePlugins = pluginsLoaded.data;
|
||||
cacheTimestamp = nowTimestamp;
|
||||
resolve(exports.availablePlugins);
|
||||
})
|
||||
})
|
||||
}
|
||||
await axios.get('https://static.etherpad.org/plugins.json')
|
||||
.then((pluginsLoaded) => {
|
||||
exports.availablePlugins = pluginsLoaded.data;
|
||||
cacheTimestamp = nowTimestamp;
|
||||
resolve(exports.availablePlugins);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
exports.search = (searchTerm, maxCacheAge) => exports.getAvailablePlugins(maxCacheAge).then(
|
||||
|
|
|
@ -8,6 +8,7 @@ const runCmd = require('../../../node/utils/run_cmd');
|
|||
const tsort = require('./tsort');
|
||||
const pluginUtils = require('./shared');
|
||||
const defs = require('./plugin_defs');
|
||||
const {manager} = require('./installer');
|
||||
|
||||
const logger = log4js.getLogger('plugins');
|
||||
|
||||
|
@ -124,6 +125,7 @@ exports.getPackages = async () => {
|
|||
};
|
||||
|
||||
const loadPlugin = async (packages, pluginName, plugins, parts) => {
|
||||
console.log('Plugins', manager.list());
|
||||
const pluginPath = path.resolve(packages[pluginName].path, 'ep.json');
|
||||
try {
|
||||
const data = await fs.readFile(pluginPath);
|
||||
|
|
Loading…
Reference in a new issue