mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 07:25:46 +01:00
* axios migration * controller tests * add missing deps * feeds * remove unused async * flags * locale-detect * messaging/middleware * remove log * meta * plugins * posts * search * topics/thumbs * user/emails * uploads.js * socket.io * cleaunup * test native fetch * cleanup * increase engine to 18 fix remaining tests * remove testing file * fix comments,typo * revert debug
This commit is contained in:
committed by
GitHub
parent
451430006e
commit
c15bdd4cf0
@@ -7,8 +7,8 @@ const nconf = require('nconf');
|
||||
const os = require('os');
|
||||
const cproc = require('child_process');
|
||||
const util = require('util');
|
||||
const request = require('request-promise-native');
|
||||
|
||||
const request = require('../request');
|
||||
const db = require('../database');
|
||||
const meta = require('../meta');
|
||||
const pubsub = require('../pubsub');
|
||||
@@ -74,12 +74,10 @@ module.exports = function (Plugins) {
|
||||
};
|
||||
|
||||
Plugins.checkWhitelist = async function (id, version) {
|
||||
const body = await request({
|
||||
method: 'GET',
|
||||
url: `https://packages.nodebb.org/api/v1/plugins/${encodeURIComponent(id)}`,
|
||||
json: true,
|
||||
});
|
||||
|
||||
const { response, body } = await request.get(`https://packages.nodebb.org/api/v1/plugins/${encodeURIComponent(id)}`);
|
||||
if (!response.ok) {
|
||||
throw new Error(`[[error:cant-connect-to-nbbpm]]`);
|
||||
}
|
||||
if (body && body.code === 'ok' && (version === 'latest' || body.payload.valid.includes(version))) {
|
||||
return;
|
||||
}
|
||||
@@ -88,11 +86,10 @@ module.exports = function (Plugins) {
|
||||
};
|
||||
|
||||
Plugins.suggest = async function (pluginId, nbbVersion) {
|
||||
const body = await request({
|
||||
method: 'GET',
|
||||
url: `https://packages.nodebb.org/api/v1/suggest?package=${encodeURIComponent(pluginId)}&version=${encodeURIComponent(nbbVersion)}`,
|
||||
json: true,
|
||||
});
|
||||
const { response, body } = await request.get(`https://packages.nodebb.org/api/v1/suggest?package=${encodeURIComponent(pluginId)}&version=${encodeURIComponent(nbbVersion)}`);
|
||||
if (!response.ok) {
|
||||
throw new Error(`[[error:cant-connect-to-nbbpm]]`);
|
||||
}
|
||||
return body;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user