+ it('Should not expose the auto mute list', async function () {
+ await makeGetRequest({
+ url: servers[0].url,
+ path: '/plugins/auto-mute/router/api/v1/mute-list',
+ statusCodeExpected: HttpStatusCode.FORBIDDEN_403
+ })
+ })
+
+ it('Should enable auto mute list', async function () {
+ await servers[0].pluginsCommand.updateSettings({
+ npmName: 'peertube-plugin-auto-mute',
+ settings: {
+ 'blocklist-urls': '',
+ 'check-seconds-interval': 1,
+ 'expose-mute-list': true
+ }
+ })
+
+ await makeGetRequest({
+ url: servers[0].url,
+ path: '/plugins/auto-mute/router/api/v1/mute-list',
+ statusCodeExpected: HttpStatusCode.OK_200
+ })
+ })
+
+ it('Should mute an account on server 1, and server 2 auto mutes it', async function () {
+ this.timeout(20000)
+
+ await servers[1].pluginsCommand.updateSettings({
+ npmName: 'peertube-plugin-auto-mute',
+ settings: {
+ 'blocklist-urls': 'http://localhost:' + servers[0].port + autoMuteListPath,
+ 'check-seconds-interval': 1,
+ 'expose-mute-list': false
+ }
+ })
+
+ await servers[0].blocklistCommand.addToServerBlocklist({ account: 'root@localhost:' + servers[1].port })
+ await servers[0].blocklistCommand.addToMyBlocklist({ server: 'localhost:' + servers[1].port })
+
+ const res = await makeGetRequest({
+ url: servers[0].url,
+ path: '/plugins/auto-mute/router/api/v1/mute-list',
+ statusCodeExpected: HttpStatusCode.OK_200
+ })
+
+ const data = res.body.data
+ expect(data).to.have.lengthOf(1)
+ expect(data[0].updatedAt).to.exist
+ expect(data[0].value).to.equal('root@localhost:' + servers[1].port)
+
+ await wait(2000)
+
+ for (const server of servers) {
+ const res = await getVideosList(server.url)
+ expect(res.body.total).to.equal(1)
+ }
+ })
+