mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 15:55:57 +02:00
Remove sounds (#8617)
* feat: remove sounds * feat: remove more sounds * feat: disable sounds plugin * fix: openapi
This commit is contained in:
committed by
GitHub
parent
251ea79bd2
commit
5f10d67db5
@@ -216,35 +216,6 @@ Data.getModules = async function getModules(pluginData) {
|
||||
return modules;
|
||||
};
|
||||
|
||||
Data.getSoundpack = async function getSoundpack(pluginData) {
|
||||
var spack = pluginData.soundpack;
|
||||
if (!spack || !spack.dir || !spack.sounds) {
|
||||
return;
|
||||
}
|
||||
|
||||
var soundpack = {};
|
||||
soundpack.name = spack.name || pluginData.name;
|
||||
soundpack.id = pluginData.id;
|
||||
soundpack.dir = path.join(pluginData.path, spack.dir);
|
||||
soundpack.sounds = {};
|
||||
|
||||
async function processSoundPack(name) {
|
||||
const soundFile = spack.sounds[name];
|
||||
const exists = await file.exists(path.join(soundpack.dir, soundFile));
|
||||
if (!exists) {
|
||||
winston.warn('[plugins] Sound file not found: ' + soundFile);
|
||||
return;
|
||||
}
|
||||
soundpack.sounds[name] = soundFile;
|
||||
}
|
||||
|
||||
await Promise.all(Object.keys(spack.sounds).map(key => processSoundPack(key)));
|
||||
|
||||
const len = Object.keys(soundpack.sounds).length;
|
||||
winston.verbose('[plugins] Found ' + len + ' sound file(s) for plugin ' + pluginData.id);
|
||||
return soundpack;
|
||||
};
|
||||
|
||||
Data.getLanguageData = async function getLanguageData(pluginData) {
|
||||
if (typeof pluginData.languages !== 'string') {
|
||||
return;
|
||||
|
||||
@@ -36,7 +36,6 @@ Plugins.clientScripts = [];
|
||||
Plugins.acpScripts = [];
|
||||
Plugins.libraryPaths = [];
|
||||
Plugins.versionWarning = [];
|
||||
Plugins.soundpacks = [];
|
||||
Plugins.languageData = {};
|
||||
Plugins.loadedPlugins = [];
|
||||
|
||||
|
||||
@@ -37,9 +37,6 @@ module.exports = function (Plugins) {
|
||||
modules: function (next) {
|
||||
Plugins.data.getModules(pluginData, next);
|
||||
},
|
||||
soundpack: function (next) {
|
||||
Plugins.data.getSoundpack(pluginData, next);
|
||||
},
|
||||
languageData: function (next) {
|
||||
Plugins.data.getLanguageData(pluginData, next);
|
||||
},
|
||||
@@ -63,9 +60,6 @@ module.exports = function (Plugins) {
|
||||
add(Plugins.clientScripts, results.clientScripts);
|
||||
add(Plugins.acpScripts, results.acpScripts);
|
||||
Object.assign(meta.js.scripts.modules, results.modules || {});
|
||||
if (results.soundpack) {
|
||||
Plugins.soundpacks.push(results.soundpack);
|
||||
}
|
||||
if (results.languageData) {
|
||||
Plugins.languageData.languages = _.union(Plugins.languageData.languages, results.languageData.languages);
|
||||
Plugins.languageData.namespaces = _.union(Plugins.languageData.namespaces, results.languageData.namespaces);
|
||||
@@ -81,7 +75,6 @@ module.exports = function (Plugins) {
|
||||
'admin js bundle': ['acpScripts'],
|
||||
'client side styles': ['cssFiles', 'lessFiles'],
|
||||
'admin control panel styles': ['cssFiles', 'lessFiles', 'acpLessFiles'],
|
||||
sounds: ['soundpack'],
|
||||
languages: ['languageData'],
|
||||
};
|
||||
|
||||
@@ -97,9 +90,6 @@ module.exports = function (Plugins) {
|
||||
case 'acpLessFiles':
|
||||
Plugins[field].length = 0;
|
||||
break;
|
||||
case 'soundpack':
|
||||
Plugins.soundpacks.length = 0;
|
||||
break;
|
||||
case 'languageData':
|
||||
Plugins.languageData.languages = [];
|
||||
Plugins.languageData.namespaces = [];
|
||||
@@ -132,7 +122,7 @@ module.exports = function (Plugins) {
|
||||
|
||||
try {
|
||||
registerHooks(pluginData);
|
||||
await registerPluginAssets(pluginData, ['soundpack']);
|
||||
await registerPluginAssets(pluginData);
|
||||
} catch (err) {
|
||||
winston.error(err.stack);
|
||||
winston.verbose('[plugins] Could not load plugin : ' + pluginData.id);
|
||||
|
||||
Reference in New Issue
Block a user