Fix fetch from auto mute plugin
This commit is contained in:
parent
dbc6fc0d5f
commit
0c32675427
@ -25,7 +25,7 @@ async function register ({
|
||||
registerSetting({
|
||||
name: 'check-seconds-interval',
|
||||
label: 'Blocklist check frequency (seconds)',
|
||||
type: 'input-textarea',
|
||||
type: 'input',
|
||||
private: true,
|
||||
default: 3600 // 1 Hour
|
||||
})
|
||||
@ -105,7 +105,7 @@ function runLater () {
|
||||
|
||||
function get (url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
simpleGet({ url, json: true }, function (err, res, data) {
|
||||
simpleGet.concat({ url, method: 'GET', json: true }, function (err, res, data) {
|
||||
if (err) return reject(err)
|
||||
|
||||
return resolve({ res, data })
|
||||
@ -114,13 +114,15 @@ function get (url) {
|
||||
}
|
||||
|
||||
function addEntity (peertubeHelpers, value) {
|
||||
const moderation = { peertubeHelpers }
|
||||
const { moderation, logger } = peertubeHelpers
|
||||
|
||||
if (store.alreadyAdded.has(value)) return
|
||||
|
||||
store.alreadyRemoved.delete(value)
|
||||
store.alreadyAdded.add(value)
|
||||
|
||||
logger.info('Auto mute %s from blocklist.', value)
|
||||
|
||||
// Account
|
||||
if (value.includes('@')) {
|
||||
return moderation.blockAccount({ byAccountId: store.serverAccountId, handleToBlock: value })
|
||||
@ -131,13 +133,15 @@ function addEntity (peertubeHelpers, value) {
|
||||
}
|
||||
|
||||
function removeEntity (peertubeHelpers, value) {
|
||||
const moderation = { peertubeHelpers }
|
||||
const { moderation, logger } = peertubeHelpers
|
||||
|
||||
if (store.alreadyRemoved.has(value)) return
|
||||
|
||||
store.alreadyAdded.delete(value)
|
||||
store.alreadyRemoved.add(value)
|
||||
|
||||
logger.info('Auto removing mute %s from blocklist.', value)
|
||||
|
||||
// Account
|
||||
if (value.includes('@')) {
|
||||
return moderation.blockAccount({ byAccountId: store.serverAccountId, handleToUnblock: value })
|
||||
|
Loading…
x
Reference in New Issue
Block a user