Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Framasoft
PeerTube
official-plugins
Commits
0c326754
Verified
Commit
0c326754
authored
May 07, 2020
by
Chocobozzz
Browse files
Fix fetch from auto mute plugin
parent
dbc6fc0d
Changes
1
Show whitespace changes
Inline
Side-by-side
peertube-plugin-auto-mute/main.js
View file @
0c326754
...
@@ -25,7 +25,7 @@ async function register ({
...
@@ -25,7 +25,7 @@ async function register ({
registerSetting
({
registerSetting
({
name
:
'
check-seconds-interval
'
,
name
:
'
check-seconds-interval
'
,
label
:
'
Blocklist check frequency (seconds)
'
,
label
:
'
Blocklist check frequency (seconds)
'
,
type
:
'
input
-textarea
'
,
type
:
'
input
'
,
private
:
true
,
private
:
true
,
default
:
3600
// 1 Hour
default
:
3600
// 1 Hour
})
})
...
@@ -105,7 +105,7 @@ function runLater () {
...
@@ -105,7 +105,7 @@ function runLater () {
function
get
(
url
)
{
function
get
(
url
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
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
)
if
(
err
)
return
reject
(
err
)
return
resolve
({
res
,
data
})
return
resolve
({
res
,
data
})
...
@@ -114,13 +114,15 @@ function get (url) {
...
@@ -114,13 +114,15 @@ function get (url) {
}
}
function
addEntity
(
peertubeHelpers
,
value
)
{
function
addEntity
(
peertubeHelpers
,
value
)
{
const
moderation
=
{
peertubeHelpers
}
const
{
moderation
,
logger
}
=
peertubeHelpers
if
(
store
.
alreadyAdded
.
has
(
value
))
return
if
(
store
.
alreadyAdded
.
has
(
value
))
return
store
.
alreadyRemoved
.
delete
(
value
)
store
.
alreadyRemoved
.
delete
(
value
)
store
.
alreadyAdded
.
add
(
value
)
store
.
alreadyAdded
.
add
(
value
)
logger
.
info
(
'
Auto mute %s from blocklist.
'
,
value
)
// Account
// Account
if
(
value
.
includes
(
'
@
'
))
{
if
(
value
.
includes
(
'
@
'
))
{
return
moderation
.
blockAccount
({
byAccountId
:
store
.
serverAccountId
,
handleToBlock
:
value
})
return
moderation
.
blockAccount
({
byAccountId
:
store
.
serverAccountId
,
handleToBlock
:
value
})
...
@@ -131,13 +133,15 @@ function addEntity (peertubeHelpers, value) {
...
@@ -131,13 +133,15 @@ function addEntity (peertubeHelpers, value) {
}
}
function
removeEntity
(
peertubeHelpers
,
value
)
{
function
removeEntity
(
peertubeHelpers
,
value
)
{
const
moderation
=
{
peertubeHelpers
}
const
{
moderation
,
logger
}
=
peertubeHelpers
if
(
store
.
alreadyRemoved
.
has
(
value
))
return
if
(
store
.
alreadyRemoved
.
has
(
value
))
return
store
.
alreadyAdded
.
delete
(
value
)
store
.
alreadyAdded
.
delete
(
value
)
store
.
alreadyRemoved
.
add
(
value
)
store
.
alreadyRemoved
.
add
(
value
)
logger
.
info
(
'
Auto removing mute %s from blocklist.
'
,
value
)
// Account
// Account
if
(
value
.
includes
(
'
@
'
))
{
if
(
value
.
includes
(
'
@
'
))
{
return
moderation
.
blockAccount
({
byAccountId
:
store
.
serverAccountId
,
handleToUnblock
:
value
})
return
moderation
.
blockAccount
({
byAccountId
:
store
.
serverAccountId
,
handleToUnblock
:
value
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment