ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix CI using 127.0.0.1 for tests
Chocobozzz2732eeff9e69
diff --git a/config/test-1.yaml b/config/test-1.yamlindex 1402f30484..1d1020214e 100644--- a/config/test-1.yaml+++ b/config/test-1.yaml@@ -2,7 +2,6 @@ listen:port: 9001webserver:- hostname: 'localhost'port: 9001database:diff --git a/config/test-2.yaml b/config/test-2.yamlindex 5d9db762fb..d155b017df 100644--- a/config/test-2.yaml+++ b/config/test-2.yaml@@ -2,7 +2,6 @@ listen:port: 9002webserver:- hostname: 'localhost'port: 9002database:diff --git a/config/test-3.yaml b/config/test-3.yamlindex 97fe9cd44e..50acf613ae 100644--- a/config/test-3.yaml+++ b/config/test-3.yaml@@ -2,7 +2,6 @@ listen:port: 9003webserver:- hostname: 'localhost'port: 9003database:diff --git a/config/test-4.yaml b/config/test-4.yamlindex 328e70fa6e..615e288b35 100644--- a/config/test-4.yaml+++ b/config/test-4.yaml@@ -2,7 +2,6 @@ listen:port: 9004webserver:- hostname: 'localhost'port: 9004database:diff --git a/config/test-5.yaml b/config/test-5.yamlindex 3e6ca9c12f..447e3862a3 100644--- a/config/test-5.yaml+++ b/config/test-5.yaml@@ -2,7 +2,6 @@ listen:port: 9005webserver:- hostname: 'localhost'port: 9005database:diff --git a/config/test-6.yaml b/config/test-6.yamlindex 89a71593fe..c077d7e380 100644--- a/config/test-6.yaml+++ b/config/test-6.yaml@@ -2,7 +2,6 @@ listen:port: 9006webserver:- hostname: 'localhost'port: 9006database:diff --git a/config/test.yaml b/config/test.yamlindex 48cf0c0f67..878d68cb98 100644--- a/config/test.yaml+++ b/config/test.yaml@@ -3,6 +3,7 @@ listen:port: 9000webserver:+ hostname: '127.0.0.1'https: falsesecrets:@@ -20,18 +21,18 @@ rates_limit:max: 500database:- hostname: 'localhost'+ hostname: '127.0.0.1'port: 5432redis:- hostname: 'localhost'+ hostname: '127.0.0.1'smtp:hostname: nullport: 1025tls: falsedisable_starttls: true- from_address: 'test-admin@localhost'+ from_address: '[email protected]'username: nullpassword: nulldiff --git a/scripts/clean/server/test.sh b/scripts/clean/server/test.shindex 5c30c7639b..1f1c9cec0b 100755--- a/scripts/clean/server/test.sh+++ b/scripts/clean/server/test.sh@@ -18,11 +18,11 @@ removeFiles () {dropRedis () {port=$((9000+$1))- host="localhost"+ host="127.0.0.1"- redis-cli -h "$host" KEYS "bull-localhost:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL- redis-cli -h "$host" KEYS "redis-localhost:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL- redis-cli -h "$host" KEYS "*redis-localhost:$port-" | grep -v empty | xargs -r redis-cli -h "$host" DEL+ redis-cli -h "$host" KEYS "bull-127.0.0.1:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL+ redis-cli -h "$host" KEYS "redis-127.0.0.1:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL+ redis-cli -h "$host" KEYS "*redis-127.0.0.1:$port-" | grep -v empty | xargs -r redis-cli -h "$host" DEL}seq=$(seq 1 6)diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.tsindex 90c89138c1..572a358a04 100644--- a/server/tests/api/activitypub/client.ts+++ b/server/tests/api/activitypub/client.ts@@ -23,7 +23,7 @@ describe('Test activitypub', function () {const object = res.bodyexpect(object.type).to.equal('Person')- expect(object.id).to.equal('http://localhost:' + servers[0].port + '/accounts/root')+ expect(object.id).to.equal(servers[0].url + '/accounts/root')expect(object.name).to.equal('root')expect(object.preferredUsername).to.equal('root')}@@ -33,7 +33,7 @@ describe('Test activitypub', function () {const object = res.bodyexpect(object.type).to.equal('Group')- expect(object.id).to.equal('http://localhost:' + servers[0].port + '/video-channels/root_channel')+ expect(object.id).to.equal(servers[0].url + '/video-channels/root_channel')expect(object.name).to.equal('Main root channel')expect(object.preferredUsername).to.equal('root_channel')}@@ -43,7 +43,7 @@ describe('Test activitypub', function () {const object = res.bodyexpect(object.type).to.equal('Video')- expect(object.id).to.equal('http://localhost:' + servers[0].port + '/videos/watch/' + video.uuid)+ expect(object.id).to.equal(servers[0].url + '/videos/watch/' + video.uuid)expect(object.name).to.equal('video')}@@ -52,7 +52,7 @@ describe('Test activitypub', function () {const object = res.bodyexpect(object.type).to.equal('Playlist')- expect(object.id).to.equal('http://localhost:' + servers[0].port + '/video-playlists/' + playlist.uuid)+ expect(object.id).to.equal(servers[0].url + '/video-playlists/' + playlist.uuid)expect(object.name).to.equal('playlist')}@@ -110,7 +110,7 @@ describe('Test activitypub', function () {it('Should redirect to the origin video object', async function () {const res = await makeActivityPubGetRequest(servers[1].url, '/videos/watch/' + video.uuid, HttpStatusCode.FOUND_302)- expect(res.header.location).to.equal('http://localhost:' + servers[0].port + '/videos/watch/' + video.uuid)+ expect(res.header.location).to.equal(servers[0].url + '/videos/watch/' + video.uuid)})it('Should return the watch action', async function () {diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.tsindex 4edabd1d97..f0caea507d 100644--- a/server/tests/api/activitypub/fetch.ts+++ b/server/tests/api/activitypub/fetch.ts@@ -35,13 +35,13 @@ describe('Test ActivityPub fetcher', function () {await servers[0].videos.upload({ token: userAccessToken, attributes: { name: 'video user' } }){- const to = 'http://localhost:' + servers[0].port + '/accounts/user1'- const value = 'http://localhost:' + servers[1].port + '/accounts/user1'+ const to = servers[0].url + '/accounts/user1'+ const value = servers[1].url + '/accounts/user1'await servers[0].sql.setActorField(to, 'url', value)}{- const value = 'http://localhost:' + servers[2].port + '/videos/watch/' + uuid+ const value = servers[2].url + '/videos/watch/' + uuidawait servers[0].sql.setVideoField(uuid, 'url', value)}})diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.tsindex 401a090902..4fb22f512a 100644--- a/server/tests/api/activitypub/refresher.ts+++ b/server/tests/api/activitypub/refresher.ts@@ -112,16 +112,16 @@ describe('Test AP refresher', function () {await wait(10000)// Change actor name so the remote server returns a 404- const to = 'http://localhost:' + servers[1].port + '/accounts/user2'+ const to = servers[1].url + '/accounts/user2'await servers[1].sql.setActorField(to, 'preferredUsername', 'toto')- await command.get({ accountName: 'user1@localhost:' + servers[1].port })- await command.get({ accountName: 'user2@localhost:' + servers[1].port })+ await command.get({ accountName: 'user1@' + servers[1].host })+ await command.get({ accountName: 'user2@' + servers[1].host })await waitJobs(servers)- await command.get({ accountName: 'user1@localhost:' + servers[1].port, expectedStatus: HttpStatusCode.OK_200 })- await command.get({ accountName: 'user2@localhost:' + servers[1].port, expectedStatus: HttpStatusCode.NOT_FOUND_404 })+ await command.get({ accountName: 'user1@' + servers[1].host, expectedStatus: HttpStatusCode.OK_200 })+ await command.get({ accountName: 'user2@' + servers[1].host, expectedStatus: HttpStatusCode.NOT_FOUND_404 })})})diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.tsindex 423fefb106..22fae83316 100644--- a/server/tests/api/activitypub/security.ts+++ b/server/tests/api/activitypub/security.ts@@ -11,7 +11,7 @@ import { HttpStatusCode } from '@shared/models'import { cleanupTests, createMultipleServers, killallServers, PeerTubeServer } from '@shared/server-commands'function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, publicKey: string, privateKey: string) {- const url = 'http://localhost:' + ofServer.port + '/accounts/peertube'+ const url = ofServer.url + '/accounts/peertube'return Promise.all([onServer.sql.setActorField(url, 'publicKey', publicKey),@@ -20,7 +20,7 @@ function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, pu}function setUpdatedAtOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, updatedAt: string) {- const url = 'http://localhost:' + ofServer.port + '/accounts/peertube'+ const url = ofServer.url + '/accounts/peertube'return Promise.all([onServer.sql.setActorField(url, 'createdAt', updatedAt),@@ -52,7 +52,7 @@ describe('Test ActivityPub security', function () {const baseHttpSignature = () => ({algorithm: HTTP_SIGNATURE.ALGORITHM,authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME,- keyId: 'acct:peertube@localhost:' + servers[1].port,+ keyId: 'acct:peertube@' + servers[1].host,key: keys.privateKey,headers: HTTP_SIGNATURE.HEADERS_TO_SIGN})@@ -69,8 +69,8 @@ describe('Test ActivityPub security', function () {await setKeysOfServer(servers[0], servers[1], keys.publicKey, null)await setKeysOfServer(servers[1], servers[1], keys.publicKey, keys.privateKey)- const to = { url: 'http://localhost:' + servers[0].port + '/accounts/peertube' }- const by = { url: 'http://localhost:' + servers[1].port + '/accounts/peertube', privateKey: keys.privateKey }+ const to = { url: servers[0].url + '/accounts/peertube' }+ const by = { url: servers[1].url + '/accounts/peertube', privateKey: keys.privateKey }await makeFollowRequest(to, by)})@@ -196,8 +196,8 @@ describe('Test ActivityPub security', function () {await setKeysOfServer(servers[1], servers[1], keys.publicKey, keys.privateKey)await setKeysOfServer(servers[2], servers[2], keys.publicKey, keys.privateKey)- const to = { url: 'http://localhost:' + servers[0].port + '/accounts/peertube' }- const by = { url: 'http://localhost:' + servers[2].port + '/accounts/peertube', privateKey: keys.privateKey }+ const to = { url: servers[0].url + '/accounts/peertube' }+ const by = { url: servers[2].url + '/accounts/peertube', privateKey: keys.privateKey }await makeFollowRequest(to, by)})@@ -208,9 +208,9 @@ describe('Test ActivityPub security', function () {await setKeysOfServer(servers[2], servers[2], invalidKeys.publicKey, invalidKeys.privateKey)const body = getAnnounceWithoutContext(servers[1])- body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube'+ body.actor = servers[2].url + '/accounts/peertube'- const signer: any = { privateKey: invalidKeys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' }+ const signer: any = { privateKey: invalidKeys.privateKey, url: servers[2].url + '/accounts/peertube' }const signedBody = await signAndContextify(signer, body, 'Announce')const headers = buildGlobalHeaders(signedBody)@@ -230,12 +230,12 @@ describe('Test ActivityPub security', function () {await setKeysOfServer(servers[0], servers[2], keys.publicKey, keys.privateKey)const body = getAnnounceWithoutContext(servers[1])- body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube'+ body.actor = servers[2].url + '/accounts/peertube'- const signer: any = { privateKey: keys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' }+ const signer: any = { privateKey: keys.privateKey, url: servers[2].url + '/accounts/peertube' }const signedBody = await signAndContextify(signer, body, 'Announce')- signedBody.actor = 'http://localhost:' + servers[2].port + '/account/peertube'+ signedBody.actor = servers[2].url + '/account/peertube'const headers = buildGlobalHeaders(signedBody)@@ -251,9 +251,9 @@ describe('Test ActivityPub security', function () {this.timeout(10000)const body = getAnnounceWithoutContext(servers[1])- body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube'+ body.actor = servers[2].url + '/accounts/peertube'- const signer: any = { privateKey: keys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' }+ const signer: any = { privateKey: keys.privateKey, url: servers[2].url + '/accounts/peertube' }const signedBody = await signAndContextify(signer, body, 'Announce')const headers = buildGlobalHeaders(signedBody)@@ -273,9 +273,9 @@ describe('Test ActivityPub security', function () {await setKeysOfServer(servers[2], servers[2], invalidKeys.publicKey, invalidKeys.privateKey)const body = getAnnounceWithoutContext(servers[1])- body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube'+ body.actor = servers[2].url + '/accounts/peertube'- const signer: any = { privateKey: keys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' }+ const signer: any = { privateKey: keys.privateKey, url: servers[2].url + '/accounts/peertube' }const signedBody = await signAndContextify(signer, body, 'Announce')const headers = buildGlobalHeaders(signedBody)diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.tsindex f745b90881..169b591a35 100644--- a/server/tests/api/check-params/blocklist.ts+++ b/server/tests/api/check-params/blocklist.ts@@ -163,7 +163,7 @@ describe('Test blocklist API validators', function () {await makePostBodyRequest({url: server.url,path,- fields: { host: 'localhost:9002' },+ fields: { host: '127.0.0.1:9002' },expectedStatus: HttpStatusCode.UNAUTHORIZED_401})})@@ -173,7 +173,7 @@ describe('Test blocklist API validators', function () {url: server.url,token: server.accessToken,path,- fields: { host: 'localhost:9003' },+ fields: { host: '127.0.0.1:9003' },expectedStatus: HttpStatusCode.NO_CONTENT_204})})@@ -183,7 +183,7 @@ describe('Test blocklist API validators', function () {url: server.url,token: server.accessToken,path,- fields: { host: 'localhost:' + server.port },+ fields: { host: server.host },expectedStatus: HttpStatusCode.CONFLICT_409})})@@ -193,7 +193,7 @@ describe('Test blocklist API validators', function () {url: server.url,token: server.accessToken,path,- fields: { host: 'localhost:' + servers[1].port },+ fields: { host: servers[1].host },expectedStatus: HttpStatusCode.NO_CONTENT_204})})@@ -203,7 +203,7 @@ describe('Test blocklist API validators', function () {it('Should fail with an unauthenticated user', async function () {await makeDeleteRequest({url: server.url,- path: path + '/localhost:' + servers[1].port,+ path: path + '/' + servers[1].host,expectedStatus: HttpStatusCode.UNAUTHORIZED_401})})@@ -211,7 +211,7 @@ describe('Test blocklist API validators', function () {it('Should fail with an unknown server block', async function () {await makeDeleteRequest({url: server.url,- path: path + '/localhost:9004',+ path: path + '/127.0.0.1:9004',token: server.accessToken,expectedStatus: HttpStatusCode.NOT_FOUND_404})@@ -220,7 +220,7 @@ describe('Test blocklist API validators', function () {it('Should succeed with the correct params', async function () {await makeDeleteRequest({url: server.url,- path: path + '/localhost:' + servers[1].port,+ path: path + '/' + servers[1].host,token: server.accessToken,expectedStatus: HttpStatusCode.NO_CONTENT_204})@@ -393,7 +393,7 @@ describe('Test blocklist API validators', function () {await makePostBodyRequest({url: server.url,path,- fields: { host: 'localhost:' + servers[1].port },+ fields: { host: servers[1].host },expectedStatus: HttpStatusCode.UNAUTHORIZED_401})})@@ -403,7 +403,7 @@ describe('Test blocklist API validators', function () {url: server.url,token: userAccessToken,path,- fields: { host: 'localhost:' + servers[1].port },+ fields: { host: servers[1].host },expectedStatus: HttpStatusCode.FORBIDDEN_403})})@@ -413,7 +413,7 @@ describe('Test blocklist API validators', function () {url: server.url,token: server.accessToken,path,- fields: { host: 'localhost:9003' },+ fields: { host: '127.0.0.1:9003' },expectedStatus: HttpStatusCode.NO_CONTENT_204})})@@ -423,7 +423,7 @@ describe('Test blocklist API validators', function () {url: server.url,token: server.accessToken,path,- fields: { host: 'localhost:' + server.port },+ fields: { host: server.host },expectedStatus: HttpStatusCode.CONFLICT_409})})@@ -433,7 +433,7 @@ describe('Test blocklist API validators', function () {url: server.url,token: server.accessToken,path,- fields: { host: 'localhost:' + servers[1].port },+ fields: { host: servers[1].host },expectedStatus: HttpStatusCode.NO_CONTENT_204})})@@ -443,7 +443,7 @@ describe('Test blocklist API validators', function () {it('Should fail with an unauthenticated user', async function () {await makeDeleteRequest({url: server.url,- path: path + '/localhost:' + servers[1].port,+ path: path + '/' + servers[1].host,expectedStatus: HttpStatusCode.UNAUTHORIZED_401})})@@ -451,7 +451,7 @@ describe('Test blocklist API validators', function () {it('Should fail with a user without the appropriate rights', async function () {await makeDeleteRequest({url: server.url,- path: path + '/localhost:' + servers[1].port,+ path: path + '/' + servers[1].host,token: userAccessToken,expectedStatus: HttpStatusCode.FORBIDDEN_403})@@ -460,7 +460,7 @@ describe('Test blocklist API validators', function () {it('Should fail with an unknown server block', async function () {await makeDeleteRequest({url: server.url,- path: path + '/localhost:9004',+ path: path + '/127.0.0.1:9004',token: server.accessToken,expectedStatus: HttpStatusCode.NOT_FOUND_404})@@ -469,7 +469,7 @@ describe('Test blocklist API validators', function () {it('Should succeed with the correct params', async function () {await makeDeleteRequest({url: server.url,- path: path + '/localhost:' + servers[1].port,+ path: path + '/' + servers[1].host,token: server.accessToken,expectedStatus: HttpStatusCode.NO_CONTENT_204})diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.tsindex e82688356a..7968ef8023 100644--- a/server/tests/api/check-params/contact-form.ts+++ b/server/tests/api/check-params/contact-form.ts@@ -38,7 +38,7 @@ describe('Test contact form API validators', function () {await killallServers([ server ])// Contact form is disabled- await server.run({ smtp: { hostname: 'localhost', port: emailPort }, contact_form: { enabled: false } })+ await server.run({ smtp: { hostname: '127.0.0.1', port: emailPort }, contact_form: { enabled: false } })await command.send({ ...defaultBody, expectedStatus: HttpStatusCode.CONFLICT_409 })})@@ -48,7 +48,7 @@ describe('Test contact form API validators', function () {await killallServers([ server ])// Email & contact form enabled- await server.run({ smtp: { hostname: 'localhost', port: emailPort } })+ await server.run({ smtp: { hostname: '127.0.0.1', port: emailPort } })await command.send({ ...defaultBody, fromEmail: 'badEmail', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })await command.send({ ...defaultBody, fromEmail: 'badEmail@', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.tsindex 56e9f8d962..3c911dcee8 100644--- a/server/tests/api/check-params/follows.ts+++ b/server/tests/api/check-params/follows.ts@@ -48,7 +48,7 @@ describe('Test server follows API validators', function () {await makePostBodyRequest({url: server.url,path,- fields: { hosts: [ 'localhost:9002', 'localhost:coucou' ] },+ fields: { hosts: [ '127.0.0.1:9002', '127.0.0.1:coucou' ] },token: server.accessToken,expectedStatus: HttpStatusCode.BAD_REQUEST_400})@@ -58,7 +58,7 @@ describe('Test server follows API validators', function () {await makePostBodyRequest({url: server.url,path,- fields: { hosts: [ 'localhost:9002', 'http://localhost:9003' ] },+ fields: { hosts: [ '127.0.0.1:9002', 'http://127.0.0.1:9003' ] },token: server.accessToken,expectedStatus: HttpStatusCode.BAD_REQUEST_400})@@ -68,7 +68,7 @@ describe('Test server follows API validators', function () {await makePostBodyRequest({url: server.url,path,- fields: { urls: [ 'localhost:9002', 'localhost:9002' ] },+ fields: { urls: [ '127.0.0.1:9002', '127.0.0.1:9002' ] },token: server.accessToken,expectedStatus: HttpStatusCode.BAD_REQUEST_400})@@ -78,7 +78,7 @@ describe('Test server follows API validators', function () {await makePostBodyRequest({url: server.url,path,- fields: { handles: [ '[email protected]', 'localhost:9001' ] },+ fields: { handles: [ '[email protected]', '127.0.0.1:9001' ] },token: server.accessToken,expectedStatus: HttpStatusCode.BAD_REQUEST_400})@@ -98,7 +98,7 @@ describe('Test server follows API validators', function () {await makePostBodyRequest({url: server.url,path,- fields: { hosts: [ 'localhost:9002' ] },+ fields: { hosts: [ '127.0.0.1:9002' ] },token: 'fake_token',expectedStatus: HttpStatusCode.UNAUTHORIZED_401})@@ -108,7 +108,7 @@ describe('Test server follows API validators', function () {await makePostBodyRequest({url: server.url,path,- fields: { hosts: [ 'localhost:9002' ] },+ fields: { hosts: [ '127.0.0.1:9002' ] },token: userAccessToken,expectedStatus: HttpStatusCode.FORBIDDEN_403})@@ -217,7 +217,7 @@ describe('Test server follows API validators', function () {it('Should fail with an invalid token', async function () {await makeDeleteRequest({url: server.url,- path: path + '/toto@localhost:9002',+ path: path + '/[email protected]:9002',token: 'fake_token',expectedStatus: HttpStatusCode.UNAUTHORIZED_401})@@ -226,7 +226,7 @@ describe('Test server follows API validators', function () {it('Should fail if the user is not an administrator', async function () {await makeDeleteRequest({url: server.url,- path: path + '/toto@localhost:9002',+ path: path + '/[email protected]:9002',token: userAccessToken,expectedStatus: HttpStatusCode.FORBIDDEN_403})@@ -244,7 +244,7 @@ describe('Test server follows API validators', function () {it('Should fail with an unknown follower', async function () {await makeDeleteRequest({url: server.url,- path: path + '/toto@localhost:9003',+ path: path + '/[email protected]:9003',token: server.accessToken,expectedStatus: HttpStatusCode.NOT_FOUND_404})@@ -257,7 +257,7 @@ describe('Test server follows API validators', function () {it('Should fail with an invalid token', async function () {await makePostBodyRequest({url: server.url,- path: path + '/toto@localhost:9002/accept',+ path: path + '/[email protected]:9002/accept',token: 'fake_token',expectedStatus: HttpStatusCode.UNAUTHORIZED_401})@@ -266,7 +266,7 @@ describe('Test server follows API validators', function () {it('Should fail if the user is not an administrator', async function () {await makePostBodyRequest({url: server.url,- path: path + '/toto@localhost:9002/accept',+ path: path + '/[email protected]:9002/accept',token: userAccessToken,expectedStatus: HttpStatusCode.FORBIDDEN_403})@@ -284,7 +284,7 @@ describe('Test server follows API validators', function () {it('Should fail with an unknown follower', async function () {await makePostBodyRequest({url: server.url,- path: path + '/toto@localhost:9003/accept',+ path: path + '/[email protected]:9003/accept',token: server.accessToken,expectedStatus: HttpStatusCode.NOT_FOUND_404})@@ -297,7 +297,7 @@ describe('Test server follows API validators', function () {it('Should fail with an invalid token', async function () {await makePostBodyRequest({url: server.url,- path: path + '/toto@localhost:9002/reject',+ path: path + '/[email protected]:9002/reject',token: 'fake_token',expectedStatus: HttpStatusCode.UNAUTHORIZED_401})@@ -306,7 +306,7 @@ describe('Test server follows API validators', function () {it('Should fail if the user is not an administrator', async function () {await makePostBodyRequest({url: server.url,- path: path + '/toto@localhost:9002/reject',+ path: path + '/[email protected]:9002/reject',token: userAccessToken,expectedStatus: HttpStatusCode.FORBIDDEN_403})@@ -324,7 +324,7 @@ describe('Test server follows API validators', function () {it('Should fail with an unknown follower', async function () {await makePostBodyRequest({url: server.url,- path: path + '/toto@localhost:9003/reject',+ path: path + '/[email protected]:9003/reject',token: server.accessToken,expectedStatus: HttpStatusCode.NOT_FOUND_404})@@ -337,7 +337,7 @@ describe('Test server follows API validators', function () {it('Should fail with an invalid token', async function () {await makeDeleteRequest({url: server.url,- path: path + '/localhost:9002',+ path: path + '/127.0.0.1:9002',token: 'fake_token',expectedStatus: HttpStatusCode.UNAUTHORIZED_401})@@ -346,7 +346,7 @@ describe('Test server follows API validators', function () {it('Should fail if the user is not an administrator', async function () {await makeDeleteRequest({url: server.url,- path: path + '/localhost:9002',+ path: path + '/127.0.0.1:9002',token: userAccessToken,expectedStatus: HttpStatusCode.FORBIDDEN_403})diff --git a/server/tests/api/check-params/redundancy.ts b/server/tests/api/check-params/redundancy.tsindex f45860e029..908407b9a5 100644--- a/server/tests/api/check-params/redundancy.ts+++ b/server/tests/api/check-params/redundancy.ts@@ -186,7 +186,7 @@ describe('Test server redundancy API validators', function () {it('Should fail with an invalid token', async function () {await makePutBodyRequest({url: servers[0].url,- path: path + '/localhost:' + servers[1].port,+ path: path + '/' + servers[1].host,fields: { redundancyAllowed: true },token: 'fake_token',expectedStatus: HttpStatusCode.UNAUTHORIZED_401@@ -196,7 +196,7 @@ describe('Test server redundancy API validators', function () {it('Should fail if the user is not an administrator', async function () {await makePutBodyRequest({url: servers[0].url,- path: path + '/localhost:' + servers[1].port,+ path: path + '/' + servers[1].host,fields: { redundancyAllowed: true },token: userAccessToken,expectedStatus: HttpStatusCode.FORBIDDEN_403@@ -216,7 +216,7 @@ describe('Test server redundancy API validators', function () {it('Should fail without de redundancyAllowed param', async function () {await makePutBodyRequest({url: servers[0].url,- path: path + '/localhost:' + servers[1].port,+ path: path + '/' + servers[1].host,fields: { blabla: true },token: servers[0].accessToken,expectedStatus: HttpStatusCode.BAD_REQUEST_400@@ -226,7 +226,7 @@ describe('Test server redundancy API validators', function () {it('Should succeed with the correct parameters', async function () {await makePutBodyRequest({url: servers[0].url,- path: path + '/localhost:' + servers[1].port,+ path: path + '/' + servers[1].host,fields: { redundancyAllowed: true },token: servers[0].accessToken,expectedStatus: HttpStatusCode.NO_CONTENT_204diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.tsindex 0da6759022..d45868f36f 100644--- a/server/tests/api/check-params/services.ts+++ b/server/tests/api/check-params/services.ts@@ -76,87 +76,87 @@ describe('Test services API validators', function () {})it('Should fail with an invalid element id', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watch/blabla`+ const embedUrl = `${server.url}/videos/watch/blabla`await checkParamEmbed(server, embedUrl)})it('Should fail with an unknown element', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watch/88fc0165-d1f0-4a35-a51a-3b47f668689c`+ const embedUrl = `${server.url}/videos/watch/88fc0165-d1f0-4a35-a51a-3b47f668689c`await checkParamEmbed(server, embedUrl, HttpStatusCode.NOT_FOUND_404)})it('Should fail with an invalid path', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watchs/${server.store.videoCreated.uuid}`+ const embedUrl = `${server.url}/videos/watchs/${server.store.videoCreated.uuid}`await checkParamEmbed(server, embedUrl)})it('Should fail with an invalid max height', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}`+ const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}`await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxheight: 'hello' })})it('Should fail with an invalid max width', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}`+ const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}`await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxwidth: 'hello' })})it('Should fail with an invalid format', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}`+ const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}`await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { format: 'blabla' })})it('Should fail with a non supported format', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}`+ const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}`await checkParamEmbed(server, embedUrl, HttpStatusCode.NOT_IMPLEMENTED_501, { format: 'xml' })})it('Should fail with a private video', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watch/${privateVideo.uuid}`+ const embedUrl = `${server.url}/videos/watch/${privateVideo.uuid}`await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403)})it('Should fail with an unlisted video with the int id', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watch/${unlistedVideo.id}`+ const embedUrl = `${server.url}/videos/watch/${unlistedVideo.id}`await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403)})it('Should succeed with an unlisted video using the uuid id', async function () {for (const uuid of [ unlistedVideo.uuid, unlistedVideo.shortUUID ]) {- const embedUrl = `http://localhost:${server.port}/videos/watch/${uuid}`+ const embedUrl = `${server.url}/videos/watch/${uuid}`await checkParamEmbed(server, embedUrl, HttpStatusCode.OK_200)}})it('Should fail with a private playlist', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watch/playlist/${privatePlaylist.uuid}`+ const embedUrl = `${server.url}/videos/watch/playlist/${privatePlaylist.uuid}`await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403)})it('Should fail with an unlisted playlist using the int id', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watch/playlist/${unlistedPlaylist.id}`+ const embedUrl = `${server.url}/videos/watch/playlist/${unlistedPlaylist.id}`await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403)})it('Should succeed with an unlisted playlist using the uuid id', async function () {for (const uuid of [ unlistedPlaylist.uuid, unlistedPlaylist.shortUUID ]) {- const embedUrl = `http://localhost:${server.port}/videos/watch/playlist/${uuid}`+ const embedUrl = `${server.url}/videos/watch/playlist/${uuid}`await checkParamEmbed(server, embedUrl, HttpStatusCode.OK_200)}})it('Should succeed with the correct params with a video', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}`+ const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}`const query = {format: 'json',maxheight: 400,@@ -167,7 +167,7 @@ describe('Test services API validators', function () {})it('Should succeed with the correct params with a playlist', async function () {- const embedUrl = `http://localhost:${server.port}/videos/watch/playlist/${playlistUUID}`+ const embedUrl = `${server.url}/videos/watch/playlist/${playlistUUID}`const query = {format: 'json',maxheight: 400,diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.tsindex 7de2fda79c..6a588e4460 100644--- a/server/tests/api/check-params/user-notifications.ts+++ b/server/tests/api/check-params/user-notifications.ts@@ -233,7 +233,7 @@ describe('Test user notifications API validators', function () {describe('When connecting to my notification socket', function () {it('Should fail with no token', function (next) {- const socket = io(`http://localhost:${server.port}/user-notifications`, { reconnection: false })+ const socket = io(`${server.url}/user-notifications`, { reconnection: false })socket.once('connect_error', function () {socket.disconnect()@@ -247,7 +247,7 @@ describe('Test user notifications API validators', function () {})it('Should fail with an invalid token', function (next) {- const socket = io(`http://localhost:${server.port}/user-notifications`, {+ const socket = io(`${server.url}/user-notifications`, {query: { accessToken: 'bad_access_token' },reconnection: false})@@ -264,7 +264,7 @@ describe('Test user notifications API validators', function () {})it('Should success with the correct token', function (next) {- const socket = io(`http://localhost:${server.port}/user-notifications`, {+ const socket = io(`${server.url}/user-notifications`, {query: { accessToken: server.accessToken },reconnection: false})diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.tsindex a0e663e253..c4922c7a2d 100644--- a/server/tests/api/check-params/user-subscriptions.ts+++ b/server/tests/api/check-params/user-subscriptions.ts@@ -104,7 +104,7 @@ describe('Test user subscriptions API validators', function () {await makePostBodyRequest({url: server.url,path,- fields: { uri: 'user1_channel@localhost:' + server.port },+ fields: { uri: 'user1_channel@' + server.host },expectedStatus: HttpStatusCode.UNAUTHORIZED_401})})@@ -142,7 +142,7 @@ describe('Test user subscriptions API validators', function () {url: server.url,path,token: server.accessToken,- fields: { uri: 'user1_channel@localhost:' + server.port },+ fields: { uri: 'user1_channel@' + server.host },expectedStatus: HttpStatusCode.NO_CONTENT_204})@@ -154,7 +154,7 @@ describe('Test user subscriptions API validators', function () {it('Should fail with a non authenticated user', async function () {await makeGetRequest({url: server.url,- path: path + '/user1_channel@localhost:' + server.port,+ path: path + '/user1_channel@' + server.host,expectedStatus: HttpStatusCode.UNAUTHORIZED_401})})@@ -185,7 +185,7 @@ describe('Test user subscriptions API validators', function () {it('Should fail with an unknown subscription', async function () {await makeGetRequest({url: server.url,- path: path + '/root1@localhost:' + server.port,+ path: path + '/root1@' + server.host,token: server.accessToken,expectedStatus: HttpStatusCode.NOT_FOUND_404})@@ -194,7 +194,7 @@ describe('Test user subscriptions API validators', function () {it('Should succeed with the correct parameters', async function () {await makeGetRequest({url: server.url,- path: path + '/user1_channel@localhost:' + server.port,+ path: path + '/user1_channel@' + server.host,token: server.accessToken,expectedStatus: HttpStatusCode.OK_200})@@ -234,7 +234,7 @@ describe('Test user subscriptions API validators', function () {await makeGetRequest({url: server.url,path: existPath,- query: { 'uris[]': 'coucou@localhost:' + server.port },+ query: { 'uris[]': 'coucou@' + server.host },token: server.accessToken,expectedStatus: HttpStatusCode.OK_200})@@ -245,7 +245,7 @@ describe('Test user subscriptions API validators', function () {it('Should fail with a non authenticated user', async function () {await makeDeleteRequest({url: server.url,- path: path + '/user1_channel@localhost:' + server.port,+ path: path + '/user1_channel@' + server.host,expectedStatus: HttpStatusCode.UNAUTHORIZED_401})})@@ -276,7 +276,7 @@ describe('Test user subscriptions API validators', function () {it('Should fail with an unknown subscription', async function () {await makeDeleteRequest({url: server.url,- path: path + '/root1@localhost:' + server.port,+ path: path + '/root1@' + server.host,token: server.accessToken,expectedStatus: HttpStatusCode.NOT_FOUND_404})@@ -285,7 +285,7 @@ describe('Test user subscriptions API validators', function () {it('Should succeed with the correct parameters', async function () {await makeDeleteRequest({url: server.url,- path: path + '/user1_channel@localhost:' + server.port,+ path: path + '/user1_channel@' + server.host,token: server.accessToken,expectedStatus: HttpStatusCode.NO_CONTENT_204})diff --git a/server/tests/api/check-params/users-admin.ts b/server/tests/api/check-params/users-admin.tsindex d941ca0246..7ba709c4a5 100644--- a/server/tests/api/check-params/users-admin.ts+++ b/server/tests/api/check-params/users-admin.ts@@ -158,7 +158,7 @@ describe('Test users admin API validators', function () {const config = {smtp: {- hostname: 'localhost',+ hostname: '127.0.0.1',port: emailPort}}diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.tsindex 27592e8c57..47d29e7f83 100644--- a/server/tests/api/moderation/blocklist.ts+++ b/server/tests/api/moderation/blocklist.ts@@ -154,7 +154,7 @@ describe('Test blocklist', function () {})it('Should block a remote account', async function () {- await command.addToMyBlocklist({ account: 'user2@localhost:' + servers[1].port })+ await command.addToMyBlocklist({ account: 'user2@' + servers[1].host })})it('Should hide its videos', async function () {@@ -217,7 +217,7 @@ describe('Test blocklist', function () {server: servers[0],token: userToken1,videoUUID: videoUUID2,- text: 'hello @root@localhost:' + servers[0].port+ text: 'hello @root@' + servers[0].host}await checkCommentNotification(servers[0], comment, 'absence')}@@ -237,7 +237,7 @@ describe('Test blocklist', function () {expect(block.byAccount.name).to.equal('root')expect(block.blockedAccount.displayName).to.equal('user2')expect(block.blockedAccount.name).to.equal('user2')- expect(block.blockedAccount.host).to.equal('localhost:' + servers[1].port)+ expect(block.blockedAccount.host).to.equal('' + servers[1].host)}{@@ -249,7 +249,7 @@ describe('Test blocklist', function () {expect(block.byAccount.name).to.equal('root')expect(block.blockedAccount.displayName).to.equal('user1')expect(block.blockedAccount.name).to.equal('user1')- expect(block.blockedAccount.host).to.equal('localhost:' + servers[0].port)+ expect(block.blockedAccount.host).to.equal('' + servers[0].host)}})@@ -347,7 +347,7 @@ describe('Test blocklist', function () {})it('Should unblock the remote account', async function () {- await command.removeFromMyBlocklist({ account: 'user2@localhost:' + servers[1].port })+ await command.removeFromMyBlocklist({ account: 'user2@' + servers[1].host })})it('Should display its videos', async function () {@@ -401,7 +401,7 @@ describe('Test blocklist', function () {server: servers[0],token: userToken1,videoUUID: videoUUID2,- text: 'hello @root@localhost:' + servers[0].port+ text: 'hello @root@' + servers[0].host}await checkCommentNotification(servers[0], comment, 'presence')}@@ -419,7 +419,7 @@ describe('Test blocklist', function () {})it('Should block a remote server', async function () {- await command.addToMyBlocklist({ server: 'localhost:' + servers[1].port })+ await command.addToMyBlocklist({ server: '' + servers[1].host })})it('Should hide its videos', async function () {@@ -463,7 +463,7 @@ describe('Test blocklist', function () {server: servers[1],token: userToken2,videoUUID: videoUUID1,- text: 'hello @root@localhost:' + servers[0].port+ text: 'hello @root@' + servers[0].host}await checkCommentNotification(servers[0], comment, 'absence')}@@ -476,7 +476,7 @@ describe('Test blocklist', function () {const block = body.data[0]expect(block.byAccount.displayName).to.equal('root')expect(block.byAccount.name).to.equal('root')- expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port)+ expect(block.blockedServer.host).to.equal('' + servers[1].host)})it('Should search blocked servers', async function () {@@ -516,7 +516,7 @@ describe('Test blocklist', function () {})it('Should unblock the remote server', async function () {- await command.removeFromMyBlocklist({ server: 'localhost:' + servers[1].port })+ await command.removeFromMyBlocklist({ server: '' + servers[1].host })})it('Should display its videos', function () {@@ -540,7 +540,7 @@ describe('Test blocklist', function () {server: servers[1],token: userToken2,videoUUID: videoUUID1,- text: 'hello @root@localhost:' + servers[0].port+ text: 'hello @root@' + servers[0].host}await checkCommentNotification(servers[0], comment, 'presence')}@@ -564,7 +564,7 @@ describe('Test blocklist', function () {})it('Should block a remote account', async function () {- await command.addToServerBlocklist({ account: 'user2@localhost:' + servers[1].port })+ await command.addToServerBlocklist({ account: 'user2@' + servers[1].host })})it('Should hide its videos', async function () {@@ -624,7 +624,7 @@ describe('Test blocklist', function () {server: servers[1],token: userToken2,videoUUID: videoUUID1,- text: 'hello @root@localhost:' + servers[0].port+ text: 'hello @root@' + servers[0].host}await checkCommentNotification(servers[0], comment, 'absence')}@@ -640,7 +640,7 @@ describe('Test blocklist', function () {expect(block.byAccount.name).to.equal('peertube')expect(block.blockedAccount.displayName).to.equal('user2')expect(block.blockedAccount.name).to.equal('user2')- expect(block.blockedAccount.host).to.equal('localhost:' + servers[1].port)+ expect(block.blockedAccount.host).to.equal('' + servers[1].host)}{@@ -652,7 +652,7 @@ describe('Test blocklist', function () {expect(block.byAccount.name).to.equal('peertube')expect(block.blockedAccount.displayName).to.equal('user1')expect(block.blockedAccount.name).to.equal('user1')- expect(block.blockedAccount.host).to.equal('localhost:' + servers[0].port)+ expect(block.blockedAccount.host).to.equal('' + servers[0].host)}})@@ -685,7 +685,7 @@ describe('Test blocklist', function () {})it('Should unblock the remote account', async function () {- await command.removeFromServerBlocklist({ account: 'user2@localhost:' + servers[1].port })+ await command.removeFromServerBlocklist({ account: 'user2@' + servers[1].host })})it('Should display its videos', async function () {@@ -721,7 +721,7 @@ describe('Test blocklist', function () {server: servers[1],token: userToken2,videoUUID: videoUUID1,- text: 'hello @root@localhost:' + servers[0].port+ text: 'hello @root@' + servers[0].host}await checkCommentNotification(servers[0], comment, 'presence')}@@ -743,7 +743,7 @@ describe('Test blocklist', function () {})it('Should block a remote server', async function () {- await command.addToServerBlocklist({ server: 'localhost:' + servers[1].port })+ await command.addToServerBlocklist({ server: '' + servers[1].host })})it('Should hide its videos', async function () {@@ -791,7 +791,7 @@ describe('Test blocklist', function () {server: servers[1],token: userToken2,videoUUID: videoUUID1,- text: 'hello @root@localhost:' + servers[0].port+ text: 'hello @root@' + servers[0].host}await checkCommentNotification(servers[0], comment, 'absence')}@@ -820,7 +820,7 @@ describe('Test blocklist', function () {const block = body.data[0]expect(block.byAccount.displayName).to.equal('peertube')expect(block.byAccount.name).to.equal('peertube')- expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port)+ expect(block.blockedServer.host).to.equal('' + servers[1].host)})it('Should search blocked servers', async function () {@@ -848,7 +848,7 @@ describe('Test blocklist', function () {})it('Should unblock the remote server', async function () {- await command.removeFromServerBlocklist({ server: 'localhost:' + servers[1].port })+ await command.removeFromServerBlocklist({ server: '' + servers[1].host })})it('Should list all videos', async function () {@@ -876,7 +876,7 @@ describe('Test blocklist', function () {server: servers[1],token: userToken2,videoUUID: videoUUID1,- text: 'hello @root@localhost:' + servers[0].port+ text: 'hello @root@' + servers[0].host}await checkCommentNotification(servers[0], comment, 'presence')}diff --git a/server/tests/api/notifications/admin-notifications.ts b/server/tests/api/notifications/admin-notifications.tsindex 07c981a372..6f059f6220 100644--- a/server/tests/api/notifications/admin-notifications.ts+++ b/server/tests/api/notifications/admin-notifications.ts@@ -31,7 +31,7 @@ describe('Test admin notifications', function () {peertube: {check_latest_version: {enabled: true,- url: `http://localhost:${port}/versions.json`+ url: `http://127.0.0.1:${port}/versions.json`}},plugins: {diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.tsindex 8b8c5712ae..5a50af0402 100644--- a/server/tests/api/notifications/comments-notifications.ts+++ b/server/tests/api/notifications/comments-notifications.ts@@ -257,7 +257,7 @@ describe('Test comments notifications', function () {await waitJobs(servers)- const text1 = `hello @user_1@localhost:${servers[0].port} 1`+ const text1 = `hello @user_1@${servers[0].host} 1`const { id: server2ThreadId } = await servers[1].comments.createThread({ videoId: uuid, text: text1 })await waitJobs(servers)@@ -269,7 +269,7 @@ describe('Test comments notifications', function () {const threadId = data[0].idawait checkCommentMention({ ...baseParams, shortUUID, commentId: threadId, threadId, byAccountDisplayName, checkType: 'presence' })- const text2 = `@user_1@localhost:${servers[0].port} hello 2 @root@localhost:${servers[0].port}`+ const text2 = `@user_1@${servers[0].host} hello 2 @root@${servers[0].host}`await servers[1].comments.addReply({ videoId: uuid, toCommentId: server2ThreadId, text: text2 })await waitJobs(servers)diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.tsindex 5a632fb226..b127a7a31e 100644--- a/server/tests/api/notifications/moderation-notifications.ts+++ b/server/tests/api/notifications/moderation-notifications.ts@@ -373,7 +373,7 @@ describe('Test moderation notifications', function () {followings: {instance: {autoFollowIndex: {- indexUrl: `http://localhost:${port}/api/v1/instances/hosts`,+ indexUrl: `http://127.0.0.1:${port}/api/v1/instances/hosts`,enabled: true}}@@ -388,10 +388,10 @@ describe('Test moderation notifications', function () {await waitJobs(servers)- await checkNewInstanceFollower({ ...baseParams, followerHost: 'localhost:' + servers[2].port, checkType: 'presence' })+ await checkNewInstanceFollower({ ...baseParams, followerHost: servers[2].host, checkType: 'presence' })const userOverride = { socketNotifications: userNotifications, token: userToken1, check: { web: true, mail: false } }- await checkNewInstanceFollower({ ...baseParams, ...userOverride, followerHost: 'localhost:' + servers[2].port, checkType: 'absence' })+ await checkNewInstanceFollower({ ...baseParams, ...userOverride, followerHost: servers[2].host, checkType: 'absence' })})it('Should send a notification on auto follow back', async function () {@@ -495,8 +495,8 @@ describe('Test moderation notifications', function () {autoBlacklistTestsCustomConfig.transcoding.enabled = trueawait servers[0].config.updateCustomConfig({ newCustomConfig: autoBlacklistTestsCustomConfig })- await servers[0].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })- await servers[1].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })+ await servers[0].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host })+ await servers[1].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host })})it('Should send notification to moderators on new video with auto-blacklist', async function () {@@ -615,8 +615,8 @@ describe('Test moderation notifications', function () {after(async () => {await servers[0].config.updateCustomConfig({ newCustomConfig: currentCustomConfig })- await servers[0].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })- await servers[1].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })+ await servers[0].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host })+ await servers[1].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host })})})diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.tsindex f194656c9f..1fc8611604 100644--- a/server/tests/api/notifications/notifications-api.ts+++ b/server/tests/api/notifications/notifications-api.ts@@ -26,7 +26,7 @@ describe('Test notifications API', function () {userNotifications = res.userNotificationsserver = res.servers[0]- await server.subscriptions.add({ token: userToken, targetUri: 'root_channel@localhost:' + server.port })+ await server.subscriptions.add({ token: userToken, targetUri: 'root_channel@' + server.host })for (let i = 0; i < 10; i++) {await server.videos.randomUpload({ wait: false })diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.tsindex ceadc21ffc..c6087b1eb7 100644--- a/server/tests/api/notifications/user-notifications.ts+++ b/server/tests/api/notifications/user-notifications.ts@@ -69,7 +69,7 @@ describe('Test user notifications', function () {it('Should send a new video notification if the user follows the local video publisher', async function () {this.timeout(15000)- await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[0].port })+ await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@' + servers[0].host })await waitJobs(servers)const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1)@@ -79,7 +79,7 @@ describe('Test user notifications', function () {it('Should send a new video notification from a remote account', async function () {this.timeout(150000) // Server 2 has transcoding enabled- await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[1].port })+ await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@' + servers[1].host })await waitJobs(servers)const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2)@@ -509,7 +509,7 @@ describe('Test user notifications', function () {it('Should notify when a local channel is following one of our channel', async function () {this.timeout(50000)- await servers[0].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })+ await servers[0].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host })await waitJobs(servers)await checkNewActorFollow({@@ -521,13 +521,13 @@ describe('Test user notifications', function () {checkType: 'presence'})- await servers[0].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })+ await servers[0].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host })})it('Should notify when a remote channel is following one of our channel', async function () {this.timeout(50000)- await servers[1].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })+ await servers[1].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host })await waitJobs(servers)await checkNewActorFollow({@@ -539,14 +539,14 @@ describe('Test user notifications', function () {checkType: 'presence'})- await servers[1].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })+ await servers[1].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host })})// PeerTube does not support account -> account follows// it('Should notify when a local account is following one of our channel', async function () {// this.timeout(50000)//- // await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@localhost:' + servers[0].port)+ // await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@' + servers[0].host)//// await waitJobs(servers)//@@ -556,7 +556,7 @@ describe('Test user notifications', function () {// it('Should notify when a remote account is following one of our channel', async function () {// this.timeout(50000)//- // await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@localhost:' + servers[0].port)+ // await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@' + servers[0].host)//// await waitJobs(servers)//diff --git a/server/tests/api/object-storage/videos.ts b/server/tests/api/object-storage/videos.tsindex d1875febb9..1b3c389d71 100644--- a/server/tests/api/object-storage/videos.ts+++ b/server/tests/api/object-storage/videos.ts@@ -139,7 +139,7 @@ function runTestSuite (options: {this.timeout(120000)const port = await mockObjectStorage.initialize()- baseMockUrl = options.useMockBaseUrl ? `http://localhost:${port}` : undefined+ baseMockUrl = options.useMockBaseUrl ? `http://127.0.0.1:${port}` : undefinedawait ObjectStorageCommand.createMockBucket(options.playlistBucket)await ObjectStorageCommand.createMockBucket(options.webtorrentBucket)diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.tsindex fb2e6e91c6..57939775e3 100644--- a/server/tests/api/redundancy/redundancy.ts+++ b/server/tests/api/redundancy/redundancy.ts@@ -265,8 +265,8 @@ async function checkStatsWithoutRedundancy (strategy: VideoRedundancyStrategyWitasync function findServerFollows () {const body = await servers[0].follows.getFollowings({ start: 0, count: 5, sort: '-createdAt' })const follows = body.data- const server2 = follows.find(f => f.following.host === `localhost:${servers[1].port}`)- const server3 = follows.find(f => f.following.host === `localhost:${servers[2].port}`)+ const server2 = follows.find(f => f.following.host === `${servers[1].host}`)+ const server3 = follows.find(f => f.following.host === `${servers[2].host}`)return { server2, server3 }}@@ -639,12 +639,12 @@ describe('Test videos redundancy', function () {await wait(10000)try {- await checkContains(servers, 'http%3A%2F%2Flocalhost%3A' + servers[0].port)+ await checkContains(servers, 'http%3A%2F%2F' + servers[0].hostname + '%3A' + servers[0].port)} catch {// Maybe a server deleted a redundancy in the schedulerawait wait(2000)- await checkContains(servers, 'http%3A%2F%2Flocalhost%3A' + servers[0].port)+ await checkContains(servers, 'http%3A%2F%2F' + servers[0].hostname + '%3A' + servers[0].port)}})@@ -655,7 +655,7 @@ describe('Test videos redundancy', function () {await wait(15000)- await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2Flocalhost%3A' + servers[0].port)+ await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2F' + servers[0].port + '%3A' + servers[0].port)})after(async function () {diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.tsindex 8173c8b608..003bd34d03 100644--- a/server/tests/api/search/search-activitypub-video-channels.ts+++ b/server/tests/api/search/search-activitypub-video-channels.ts@@ -87,7 +87,7 @@ describe('Test ActivityPub video channels search', function () {it('Should search a local video channel', async function () {const searches = [servers[0].url + '/video-channels/channel1_server1',- 'channel1_server1@localhost:' + servers[0].port+ 'channel1_server1@' + servers[0].host]for (const search of searches) {@@ -139,7 +139,7 @@ describe('Test ActivityPub video channels search', function () {servers[1].url + '/video-channels/channel1_server2',servers[1].url + '/c/channel1_server2',servers[1].url + '/c/channel1_server2/videos',- 'channel1_server2@localhost:' + servers[1].port+ 'channel1_server2@' + servers[1].host]for (const search of searches) {@@ -169,7 +169,7 @@ describe('Test ActivityPub video channels search', function () {const { total, data } = await servers[0].videos.listByChannel({token: null,- handle: 'channel1_server2@localhost:' + servers[1].port+ handle: 'channel1_server2@' + servers[1].host})expect(total).to.equal(0)expect(data).to.have.lengthOf(0)@@ -177,7 +177,7 @@ describe('Test ActivityPub video channels search', function () {it('Should list video channel videos of server 2 with token', async function () {const { total, data } = await servers[0].videos.listByChannel({- handle: 'channel1_server2@localhost:' + servers[1].port+ handle: 'channel1_server2@' + servers[1].host})expect(total).to.equal(1)@@ -226,7 +226,7 @@ describe('Test ActivityPub video channels search', function () {await waitJobs(servers)- const handle = 'channel1_server2@localhost:' + servers[1].port+ const handle = 'channel1_server2@' + servers[1].hostconst { total, data } = await servers[0].videos.listByChannel({ handle, sort: '-createdAt' })expect(total).to.equal(2)diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.tsindex eae4391ec9..c8be762d2b 100644--- a/server/tests/api/search/search-index.ts+++ b/server/tests/api/search/search-index.ts@@ -57,7 +57,7 @@ describe('Test index search', function () {expect(body.total).to.equal(1)expect(body.data[0].name).to.equal('root_channel')- expect(body.data[0].host).to.equal('localhost:' + server.port)+ expect(body.data[0].host).to.equal(server.host)})it('Should make an index videos search by default', async function () {diff --git a/server/tests/api/server/auto-follows.ts b/server/tests/api/server/auto-follows.tsindex cdaadb3ad7..99d5c3142b 100644--- a/server/tests/api/server/auto-follows.ts+++ b/server/tests/api/server/auto-follows.ts@@ -150,7 +150,7 @@ describe('Test auto follows', function () {followings: {instance: {autoFollowIndex: {- indexUrl: `http://localhost:${port}/api/v1/instances/hosts`,+ indexUrl: `http://127.0.0.1:${port}/api/v1/instances/hosts`,enabled: true}}diff --git a/server/tests/api/server/bulk.ts b/server/tests/api/server/bulk.tsindex 7c8b40cbe0..1fe26bb267 100644--- a/server/tests/api/server/bulk.ts+++ b/server/tests/api/server/bulk.ts@@ -77,7 +77,7 @@ describe('Test bulk actions', function () {const { data } = await servers[1].comments.listThreads({ videoId: video.id })const comment = data.find(c => c.text === 'comment by user 3')- if (video.account.host === 'localhost:' + servers[0].port) {+ if (video.account.host === servers[0].host) {expect(comment).to.not.exist} else {expect(comment).to.exist@@ -151,7 +151,7 @@ describe('Test bulk actions', function () {await bulkCommand.removeCommentsOf({attributes: {- accountName: 'user3@localhost:' + servers[1].port,+ accountName: 'user3@' + servers[1].host,scope: 'instance'}})diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.tsindex fcd7f3c4c0..3252180085 100644--- a/server/tests/api/server/contact-form.ts+++ b/server/tests/api/server/contact-form.ts@@ -25,7 +25,7 @@ describe('Test contact form', function () {const overrideConfig = {smtp: {- hostname: 'localhost',+ hostname: '127.0.0.1',port}}@@ -51,7 +51,7 @@ describe('Test contact form', function () {const email = emails[0]- expect(email['from'][0]['address']).equal('test-admin@localhost')+ expect(email['from'][0]['address']).equal('[email protected]')expect(email['replyTo'][0]['address']).equal('[email protected]')expect(email['to'][0]['address']).equal('admin' + server.internalServerNumber + '@example.com')expect(email['subject']).contains('my subject')diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.tsindex 1826c268ad..4ab5463fe2 100644--- a/server/tests/api/server/email.ts+++ b/server/tests/api/server/email.ts@@ -33,7 +33,7 @@ describe('Test emails', function () {const overrideConfig = {smtp: {- hostname: 'localhost',+ hostname: '127.0.0.1',port: emailPort}}@@ -66,8 +66,6 @@ describe('Test emails', function () {describe('When resetting user password', function () {it('Should ask to reset the password', async function () {- this.timeout(10000)-await server.users.askResetPassword({ email: '[email protected]' })await waitJobs(server)@@ -76,7 +74,7 @@ describe('Test emails', function () {const email = emails[0]expect(email['from'][0]['name']).equal('PeerTube')- expect(email['from'][0]['address']).equal('test-admin@localhost')+ expect(email['from'][0]['address']).equal('[email protected]')expect(email['to'][0]['address']).equal('[email protected]')expect(email['subject']).contains('password')@@ -135,7 +133,7 @@ describe('Test emails', function () {const email = emails[1]expect(email['from'][0]['name']).equal('PeerTube')- expect(email['from'][0]['address']).equal('test-admin@localhost')+ expect(email['from'][0]['address']).equal('[email protected]')expect(email['to'][0]['address']).equal('[email protected]')expect(email['subject']).contains('account')expect(email['subject']).contains('password')@@ -191,7 +189,7 @@ describe('Test emails', function () {const email = emails[2]expect(email['from'][0]['name']).equal('PeerTube')- expect(email['from'][0]['address']).equal('test-admin@localhost')+ expect(email['from'][0]['address']).equal('[email protected]')expect(email['to'][0]['address']).equal('admin' + server.internalServerNumber + '@example.com')expect(email['subject']).contains('abuse')expect(email['text']).contains(videoShortUUID)@@ -212,7 +210,7 @@ describe('Test emails', function () {const email = emails[3]expect(email['from'][0]['name']).equal('PeerTube')- expect(email['from'][0]['address']).equal('test-admin@localhost')+ expect(email['from'][0]['address']).equal('[email protected]')expect(email['to'][0]['address']).equal('[email protected]')expect(email['subject']).contains(' blocked')expect(email['text']).contains(' blocked')@@ -230,7 +228,7 @@ describe('Test emails', function () {const email = emails[4]expect(email['from'][0]['name']).equal('PeerTube')- expect(email['from'][0]['address']).equal('test-admin@localhost')+ expect(email['from'][0]['address']).equal('[email protected]')expect(email['to'][0]['address']).equal('[email protected]')expect(email['subject']).contains(' unblocked')expect(email['text']).contains(' unblocked')@@ -250,7 +248,7 @@ describe('Test emails', function () {const email = emails[5]expect(email['from'][0]['name']).equal('PeerTube')- expect(email['from'][0]['address']).equal('test-admin@localhost')+ expect(email['from'][0]['address']).equal('[email protected]')expect(email['to'][0]['address']).equal('[email protected]')expect(email['subject']).contains(' blacklisted')expect(email['text']).contains('my super user video')@@ -268,7 +266,7 @@ describe('Test emails', function () {const email = emails[6]expect(email['from'][0]['name']).equal('PeerTube')- expect(email['from'][0]['address']).equal('test-admin@localhost')+ expect(email['from'][0]['address']).equal('[email protected]')expect(email['to'][0]['address']).equal('[email protected]')expect(email['subject']).contains(' unblacklisted')expect(email['text']).contains('my super user video')@@ -293,7 +291,7 @@ describe('Test emails', function () {const email = emails[7]expect(email['from'][0]['name']).equal('PeerTube')- expect(email['from'][0]['address']).equal('test-admin@localhost')+ expect(email['from'][0]['address']).equal('[email protected]')expect(email['to'][0]['address']).equal('[email protected]')expect(email['subject']).contains('Verify')diff --git a/server/tests/api/server/follow-constraints.ts b/server/tests/api/server/follow-constraints.tsindex e1ec2b069b..ff53328584 100644--- a/server/tests/api/server/follow-constraints.ts+++ b/server/tests/api/server/follow-constraints.ts@@ -57,21 +57,21 @@ describe('Test follow constraints', function () {})it('Should list local account videos', async function () {- const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@localhost:' + servers[0].port })+ const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@' + servers[0].host })expect(total).to.equal(1)expect(data).to.have.lengthOf(1)})it('Should list remote account videos', async function () {- const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@localhost:' + servers[1].port })+ const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@' + servers[1].host })expect(total).to.equal(1)expect(data).to.have.lengthOf(1)})it('Should list local channel videos', async function () {- const handle = 'root_channel@localhost:' + servers[0].port+ const handle = 'root_channel@' + servers[0].hostconst { total, data } = await servers[0].videos.listByChannel({ handle })expect(total).to.equal(1)@@ -79,7 +79,7 @@ describe('Test follow constraints', function () {})it('Should list remote channel videos', async function () {- const handle = 'root_channel@localhost:' + servers[1].port+ const handle = 'root_channel@' + servers[1].hostconst { total, data } = await servers[0].videos.listByChannel({ handle })expect(total).to.equal(1)@@ -97,21 +97,21 @@ describe('Test follow constraints', function () {})it('Should list local account videos', async function () {- const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[0].port })+ const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@' + servers[0].host })expect(total).to.equal(1)expect(data).to.have.lengthOf(1)})it('Should list remote account videos', async function () {- const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[1].port })+ const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@' + servers[1].host })expect(total).to.equal(1)expect(data).to.have.lengthOf(1)})it('Should list local channel videos', async function () {- const handle = 'root_channel@localhost:' + servers[0].port+ const handle = 'root_channel@' + servers[0].hostconst { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle })expect(total).to.equal(1)@@ -119,7 +119,7 @@ describe('Test follow constraints', function () {})it('Should list remote channel videos', async function () {- const handle = 'root_channel@localhost:' + servers[1].port+ const handle = 'root_channel@' + servers[1].hostconst { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle })expect(total).to.equal(1)@@ -161,7 +161,7 @@ describe('Test follow constraints', function () {it('Should list local account videos', async function () {const { total, data } = await servers[0].videos.listByAccount({token: null,- handle: 'root@localhost:' + servers[0].port+ handle: 'root@' + servers[0].host})expect(total).to.equal(1)@@ -171,7 +171,7 @@ describe('Test follow constraints', function () {it('Should not list remote account videos', async function () {const { total, data } = await servers[0].videos.listByAccount({token: null,- handle: 'root@localhost:' + servers[1].port+ handle: 'root@' + servers[1].host})expect(total).to.equal(0)@@ -179,7 +179,7 @@ describe('Test follow constraints', function () {})it('Should list local channel videos', async function () {- const handle = 'root_channel@localhost:' + servers[0].port+ const handle = 'root_channel@' + servers[0].hostconst { total, data } = await servers[0].videos.listByChannel({ token: null, handle })expect(total).to.equal(1)@@ -187,7 +187,7 @@ describe('Test follow constraints', function () {})it('Should not list remote channel videos', async function () {- const handle = 'root_channel@localhost:' + servers[1].port+ const handle = 'root_channel@' + servers[1].hostconst { total, data } = await servers[0].videos.listByChannel({ token: null, handle })expect(total).to.equal(0)@@ -206,21 +206,21 @@ describe('Test follow constraints', function () {})it('Should list local account videos', async function () {- const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[0].port })+ const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@' + servers[0].host })expect(total).to.equal(1)expect(data).to.have.lengthOf(1)})it('Should list remote account videos', async function () {- const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[1].port })+ const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@' + servers[1].host })expect(total).to.equal(1)expect(data).to.have.lengthOf(1)})it('Should list local channel videos', async function () {- const handle = 'root_channel@localhost:' + servers[0].port+ const handle = 'root_channel@' + servers[0].hostconst { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle })expect(total).to.equal(1)@@ -228,7 +228,7 @@ describe('Test follow constraints', function () {})it('Should list remote channel videos', async function () {- const handle = 'root_channel@localhost:' + servers[1].port+ const handle = 'root_channel@' + servers[1].hostconst { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle })expect(total).to.equal(1)diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.tsindex 96d39352b9..6a2cc2c434 100644--- a/server/tests/api/server/follows.ts+++ b/server/tests/api/server/follows.ts@@ -88,7 +88,7 @@ describe('Test follows', function () {const follows = body.dataexpect(follows).to.be.an('array')expect(follows).to.have.lengthOf(1)- expect(follows[0].follower.host).to.equal('localhost:' + servers[0].port)+ expect(follows[0].follower.host).to.equal(servers[0].host)})it('Should have 0 followers on server 1 and 2', async function () {diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.tsindex 9ace65ddf3..1fb4d18f9d 100644--- a/server/tests/api/server/handle-down.ts+++ b/server/tests/api/server/handle-down.ts@@ -62,7 +62,7 @@ describe('Test handle downs', function () {support: 'my super support text for server 1',account: {name: 'root',- host: 'localhost:' + servers[0].port+ host: servers[0].host},isLocal: false,duration: 10,@@ -151,7 +151,7 @@ describe('Test handle downs', function () {const body = await servers[0].follows.getFollowers({ start: 0, count: 2, sort: 'createdAt' })expect(body.data).to.be.an('array')expect(body.data).to.have.lengthOf(1)- expect(body.data[0].follower.host).to.equal('localhost:' + servers[2].port)+ expect(body.data[0].follower.host).to.equal(servers[2].host)})it('Should not have pending/processing jobs anymore', async function () {diff --git a/server/tests/api/server/open-telemetry.ts b/server/tests/api/server/open-telemetry.tsindex 7a294be829..db76a3d7f1 100644--- a/server/tests/api/server/open-telemetry.ts+++ b/server/tests/api/server/open-telemetry.ts@@ -9,7 +9,7 @@ describe('Open Telemetry', function () {let server: PeerTubeServerdescribe('Metrics', function () {- const metricsUrl = 'http://localhost:9092/metrics'+ const metricsUrl = 'http://127.0.0.1:9092/metrics'it('Should not enable open telemetry metrics', async function () {this.timeout(60000)@@ -92,7 +92,7 @@ describe('Open Telemetry', function () {tracing: {enabled: true,jaeger_exporter: {- endpoint: 'http://localhost:' + mockPort+ endpoint: 'http://127.0.0.1:' + mockPort}}}diff --git a/server/tests/api/server/proxy.ts b/server/tests/api/server/proxy.tsindex 71c444efd6..de8872d742 100644--- a/server/tests/api/server/proxy.ts+++ b/server/tests/api/server/proxy.ts@@ -20,7 +20,7 @@ describe('Test proxy', function () {let proxy: MockProxyconst goodEnv = { HTTP_PROXY: '' }- const badEnv = { HTTP_PROXY: 'http://localhost:9000' }+ const badEnv = { HTTP_PROXY: 'http://127.0.0.1:9000' }before(async function () {this.timeout(120000)@@ -30,7 +30,7 @@ describe('Test proxy', function () {const proxyPort = await proxy.initialize()servers = await createMultipleServers(2)- goodEnv.HTTP_PROXY = 'http://localhost:' + proxyPort+ goodEnv.HTTP_PROXY = 'http://127.0.0.1:' + proxyPortawait setAccessTokensToServers(servers)await setDefaultVideoChannel(servers)diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.tsindex fbeca7d67c..b45cfe67ed 100644--- a/server/tests/api/users/user-subscriptions.ts+++ b/server/tests/api/users/user-subscriptions.ts@@ -63,8 +63,8 @@ describe('Test users subscriptions', function () {it('User of server 1 should follow user of server 3 and root of server 1', async function () {this.timeout(60000)- await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@localhost:' + servers[2].port })- await command.add({ token: users[0].accessToken, targetUri: 'root_channel@localhost:' + servers[0].port })+ await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@' + servers[2].host })+ await command.add({ token: users[0].accessToken, targetUri: 'root_channel@' + servers[0].host })await waitJobs(servers)@@ -112,20 +112,20 @@ describe('Test users subscriptions', function () {it('Should get subscription', async function () {{- const videoChannel = await command.get({ token: users[0].accessToken, uri: 'user3_channel@localhost:' + servers[2].port })+ const videoChannel = await command.get({ token: users[0].accessToken, uri: 'user3_channel@' + servers[2].host })expect(videoChannel.name).to.equal('user3_channel')- expect(videoChannel.host).to.equal('localhost:' + servers[2].port)+ expect(videoChannel.host).to.equal(servers[2].host)expect(videoChannel.displayName).to.equal('Main user3 channel')expect(videoChannel.followingCount).to.equal(0)expect(videoChannel.followersCount).to.equal(1)}{- const videoChannel = await command.get({ token: users[0].accessToken, uri: 'root_channel@localhost:' + servers[0].port })+ const videoChannel = await command.get({ token: users[0].accessToken, uri: 'root_channel@' + servers[0].host })expect(videoChannel.name).to.equal('root_channel')- expect(videoChannel.host).to.equal('localhost:' + servers[0].port)+ expect(videoChannel.host).to.equal(servers[0].host)expect(videoChannel.displayName).to.equal('Main root channel')expect(videoChannel.followingCount).to.equal(0)expect(videoChannel.followersCount).to.equal(1)@@ -134,18 +134,18 @@ describe('Test users subscriptions', function () {it('Should return the existing subscriptions', async function () {const uris = [- 'user3_channel@localhost:' + servers[2].port,- 'root2_channel@localhost:' + servers[0].port,- 'root_channel@localhost:' + servers[0].port,- 'user3_channel@localhost:' + servers[0].port+ 'user3_channel@' + servers[2].host,+ 'root2_channel@' + servers[0].host,+ 'root_channel@' + servers[0].host,+ 'user3_channel@' + servers[0].host]const body = await command.exist({ token: users[0].accessToken, uris })- expect(body['user3_channel@localhost:' + servers[2].port]).to.be.true- expect(body['root2_channel@localhost:' + servers[0].port]).to.be.false- expect(body['root_channel@localhost:' + servers[0].port]).to.be.true- expect(body['user3_channel@localhost:' + servers[0].port]).to.be.false+ expect(body['user3_channel@' + servers[2].host]).to.be.true+ expect(body['root2_channel@' + servers[0].host]).to.be.false+ expect(body['root_channel@' + servers[0].host]).to.be.true+ expect(body['user3_channel@' + servers[0].host]).to.be.false})it('Should search among subscriptions', async function () {@@ -305,7 +305,7 @@ describe('Test users subscriptions', function () {it('Should remove user of server 3 subscription', async function () {this.timeout(30000)- await command.remove({ token: users[0].accessToken, uri: 'user3_channel@localhost:' + servers[2].port })+ await command.remove({ token: users[0].accessToken, uri: 'user3_channel@' + servers[2].host })await waitJobs(servers)})@@ -324,7 +324,7 @@ describe('Test users subscriptions', function () {it('Should remove the root subscription and not display the videos anymore', async function () {this.timeout(30000)- await command.remove({ token: users[0].accessToken, uri: 'root_channel@localhost:' + servers[0].port })+ await command.remove({ token: users[0].accessToken, uri: 'root_channel@' + servers[0].host })await waitJobs(servers)@@ -355,7 +355,7 @@ describe('Test users subscriptions', function () {it('Should follow user of server 3 again', async function () {this.timeout(60000)- await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@localhost:' + servers[2].port })+ await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@' + servers[2].host })await waitJobs(servers)@@ -389,8 +389,8 @@ describe('Test users subscriptions', function () {await servers[2].channels.create({ token: users[2].accessToken, attributes: { name: 'user3_channel2' } })- await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel@localhost:' + servers[2].port })- await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel2@localhost:' + servers[2].port })+ await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel@' + servers[2].host })+ await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel2@' + servers[2].host })await waitJobs(servers)})diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.tsindex 188e6f1377..f94191b043 100644--- a/server/tests/api/users/users-multiple-servers.ts+++ b/server/tests/api/users/users-multiple-servers.ts@@ -111,7 +111,7 @@ describe('Test users with multiple servers', function () {for (const server of servers) {const body = await server.accounts.list({ sort: '-createdAt' })- const resList = body.data.find(a => a.name === 'root' && a.host === 'localhost:' + servers[0].port)+ const resList = body.data.find(a => a.name === 'root' && a.host === servers[0].host)expect(resList).not.to.be.undefinedconst account = await server.accounts.get({ accountName: resList.name + '@' + resList.host })@@ -119,7 +119,7 @@ describe('Test users with multiple servers', function () {if (!createdAt) createdAt = account.createdAtexpect(account.name).to.equal('root')- expect(account.host).to.equal('localhost:' + servers[0].port)+ expect(account.host).to.equal(servers[0].host)expect(account.displayName).to.equal('my super display name')expect(account.description).to.equal('my super description updated')expect(createdAt).to.equal(account.createdAt)@@ -138,7 +138,7 @@ describe('Test users with multiple servers', function () {it('Should list account videos', async function () {for (const server of servers) {- const { total, data } = await server.videos.listByAccount({ handle: 'user1@localhost:' + servers[0].port })+ const { total, data } = await server.videos.listByAccount({ handle: 'user1@' + servers[0].host })expect(total).to.equal(1)expect(data).to.be.an('array')@@ -155,7 +155,7 @@ describe('Test users with multiple servers', function () {await waitJobs(servers)for (const server of servers) {- const { total, data } = await server.videos.listByAccount({ handle: 'user1@localhost:' + servers[0].port, search: 'Kami' })+ const { total, data } = await server.videos.listByAccount({ handle: 'user1@' + servers[0].host, search: 'Kami' })expect(total).to.equal(1)expect(data).to.be.an('array')@@ -170,11 +170,11 @@ describe('Test users with multiple servers', function () {for (const server of servers) {const body = await server.accounts.list({ sort: '-createdAt' })- const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port)+ const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === servers[0].host)expect(accountDeleted).not.to.be.undefinedconst { data } = await server.channels.list()- const videoChannelDeleted = data.find(a => a.displayName === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port)+ const videoChannelDeleted = data.find(a => a.displayName === 'Main user1 channel' && a.host === servers[0].host)expect(videoChannelDeleted).not.to.be.undefined}@@ -185,11 +185,11 @@ describe('Test users with multiple servers', function () {for (const server of servers) {const body = await server.accounts.list({ sort: '-createdAt' })- const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port)+ const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === servers[0].host)expect(accountDeleted).to.be.undefinedconst { data } = await server.channels.list()- const videoChannelDeleted = data.find(a => a.name === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port)+ const videoChannelDeleted = data.find(a => a.name === 'Main user1 channel' && a.host === servers[0].host)expect(videoChannelDeleted).to.be.undefined}})diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.tsindex fc082383a7..19a8df9e10 100644--- a/server/tests/api/users/users-verification.ts+++ b/server/tests/api/users/users-verification.ts@@ -28,7 +28,7 @@ describe('Test users account verification', function () {const overrideConfig = {smtp: {- hostname: 'localhost',+ hostname: '127.0.0.1',port}}diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.tsindex 2ad749fd4d..ff730287a2 100644--- a/server/tests/api/videos/multiple-servers.ts+++ b/server/tests/api/videos/multiple-servers.ts@@ -105,7 +105,7 @@ describe('Test multiple servers', function () {originallyPublishedAt: '2019-02-10T13:38:14.449Z',account: {name: 'root',- host: 'localhost:' + servers[0].port+ host: servers[0].host},isLocal,publishedAt,@@ -185,7 +185,7 @@ describe('Test multiple servers', function () {// All servers should have this videofor (const server of servers) {- const isLocal = server.url === 'http://localhost:' + servers[1].port+ const isLocal = server.url === servers[1].urlconst checkAttributes = {name: 'my super name for server 2',category: 4,@@ -196,7 +196,7 @@ describe('Test multiple servers', function () {support: 'my super support text for server 2',account: {name: 'user1',- host: 'localhost:' + servers[1].port+ host: servers[1].host},isLocal,commentsEnabled: true,@@ -279,7 +279,7 @@ describe('Test multiple servers', function () {// All servers should have this videofor (const server of servers) {- const isLocal = server.url === 'http://localhost:' + servers[2].port+ const isLocal = server.url === servers[2].urlconst { data } = await server.videos.list()expect(data).to.be.an('array')@@ -306,7 +306,7 @@ describe('Test multiple servers', function () {support: 'my super support text for server 3',account: {name: 'root',- host: 'localhost:' + servers[2].port+ host: servers[2].host},isLocal,duration: 5,@@ -340,7 +340,7 @@ describe('Test multiple servers', function () {support: 'my super support text for server 3-2',account: {name: 'root',- host: 'localhost:' + servers[2].port+ host: servers[2].host},commentsEnabled: true,downloadEnabled: true,@@ -649,7 +649,7 @@ describe('Test multiple servers', function () {expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin)- const isLocal = server.url === 'http://localhost:' + servers[2].port+ const isLocal = server.url === servers[2].urlconst checkAttributes = {name: 'my super video updated',category: 10,@@ -661,7 +661,7 @@ describe('Test multiple servers', function () {originallyPublishedAt: '2019-02-11T13:38:14.449Z',account: {name: 'root',- host: 'localhost:' + servers[2].port+ host: servers[2].host},isLocal,duration: 5,@@ -830,7 +830,7 @@ describe('Test multiple servers', function () {expect(comment).to.not.be.undefinedexpect(comment.inReplyToCommentId).to.be.nullexpect(comment.account.name).to.equal('root')- expect(comment.account.host).to.equal('localhost:' + servers[0].port)+ expect(comment.account.host).to.equal(servers[0].host)expect(comment.totalReplies).to.equal(3)expect(dateIsValid(comment.createdAt as string)).to.be.trueexpect(dateIsValid(comment.updatedAt as string)).to.be.true@@ -841,7 +841,7 @@ describe('Test multiple servers', function () {expect(comment).to.not.be.undefinedexpect(comment.inReplyToCommentId).to.be.nullexpect(comment.account.name).to.equal('root')- expect(comment.account.host).to.equal('localhost:' + servers[2].port)+ expect(comment.account.host).to.equal(servers[2].host)expect(comment.totalReplies).to.equal(0)expect(dateIsValid(comment.createdAt as string)).to.be.trueexpect(dateIsValid(comment.updatedAt as string)).to.be.true@@ -858,25 +858,25 @@ describe('Test multiple servers', function () {expect(tree.comment.text).equal('my super first comment')expect(tree.comment.account.name).equal('root')- expect(tree.comment.account.host).equal('localhost:' + servers[0].port)+ expect(tree.comment.account.host).equal(servers[0].host)expect(tree.children).to.have.lengthOf(2)const firstChild = tree.children[0]expect(firstChild.comment.text).to.equal('my super answer to thread 1')expect(firstChild.comment.account.name).equal('root')- expect(firstChild.comment.account.host).equal('localhost:' + servers[1].port)+ expect(firstChild.comment.account.host).equal(servers[1].host)expect(firstChild.children).to.have.lengthOf(1)childOfFirstChild = firstChild.children[0]expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1')expect(childOfFirstChild.comment.account.name).equal('root')- expect(childOfFirstChild.comment.account.host).equal('localhost:' + servers[2].port)+ expect(childOfFirstChild.comment.account.host).equal(servers[2].host)expect(childOfFirstChild.children).to.have.lengthOf(0)const secondChild = tree.children[1]expect(secondChild.comment.text).to.equal('my second answer to thread 1')expect(secondChild.comment.account.name).equal('root')- expect(secondChild.comment.account.host).equal('localhost:' + servers[2].port)+ expect(secondChild.comment.account.host).equal(servers[2].host)expect(secondChild.children).to.have.lengthOf(0)}})@@ -935,7 +935,7 @@ describe('Test multiple servers', function () {expect(comment).to.not.be.undefinedexpect(comment.inReplyToCommentId).to.be.nullexpect(comment.account.name).to.equal('root')- expect(comment.account.host).to.equal('localhost:' + servers[2].port)+ expect(comment.account.host).to.equal(servers[2].host)expect(comment.totalReplies).to.equal(0)expect(dateIsValid(comment.createdAt as string)).to.be.trueexpect(dateIsValid(comment.updatedAt as string)).to.be.true@@ -1042,7 +1042,7 @@ describe('Test multiple servers', function () {const { data } = await server.videos.list()const video = data.find(v => v.name === 'minimum parameters')- const isLocal = server.url === 'http://localhost:' + servers[1].port+ const isLocal = server.url === servers[1].urlconst checkAttributes = {name: 'minimum parameters',category: null,@@ -1053,7 +1053,7 @@ describe('Test multiple servers', function () {support: null,account: {name: 'root',- host: 'localhost:' + servers[1].port+ host: servers[1].host},isLocal,duration: 5,diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.tsindex da8bde07b6..e8e981e556 100644--- a/server/tests/api/videos/single-server.ts+++ b/server/tests/api/videos/single-server.ts@@ -33,7 +33,7 @@ describe('Test a single server', function () {support: 'my super support text',account: {name: 'root',- host: 'localhost:' + server.port+ host: server.host},isLocal: true,duration: 5,@@ -66,7 +66,7 @@ describe('Test a single server', function () {support: 'my super support text updated',account: {name: 'root',- host: 'localhost:' + server.port+ host: server.host},isLocal: true,tags: [ 'tagup1', 'tagup2' ],diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.tsindex 86a8a038cf..64bd4d9ae4 100644--- a/server/tests/api/videos/video-channels.ts+++ b/server/tests/api/videos/video-channels.ts@@ -373,7 +373,7 @@ describe('Test video channels', function () {this.timeout(10000)for (const server of servers) {- const channelURI = 'second_video_channel@localhost:' + servers[0].port+ const channelURI = 'second_video_channel@' + servers[0].hostconst { total, data } = await server.videos.listByChannel({ handle: channelURI })expect(total).to.equal(1)@@ -396,13 +396,13 @@ describe('Test video channels', function () {for (const server of servers) {{- const secondChannelURI = 'second_video_channel@localhost:' + servers[0].port+ const secondChannelURI = 'second_video_channel@' + servers[0].hostconst { total } = await server.videos.listByChannel({ handle: secondChannelURI })expect(total).to.equal(0)}{- const channelURI = 'root_channel@localhost:' + servers[0].port+ const channelURI = 'root_channel@' + servers[0].hostconst { total, data } = await server.videos.listByChannel({ handle: channelURI })expect(total).to.equal(1)diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.tsindex 348b408e85..dc47f8a4a4 100644--- a/server/tests/api/videos/video-comments.ts+++ b/server/tests/api/videos/video-comments.ts@@ -63,8 +63,8 @@ describe('Test video comments', function () {expect(comment.videoId).to.equal(videoId)expect(comment.id).to.equal(comment.threadId)expect(comment.account.name).to.equal('root')- expect(comment.account.host).to.equal('localhost:' + server.port)- expect(comment.account.url).to.equal('http://localhost:' + server.port + '/accounts/root')+ expect(comment.account.host).to.equal(server.host)+ expect(comment.account.url).to.equal(server.url + '/accounts/root')expect(comment.totalReplies).to.equal(0)expect(comment.totalRepliesFromVideoAuthor).to.equal(0)expect(dateIsValid(comment.createdAt as string)).to.be.true@@ -85,7 +85,7 @@ describe('Test video comments', function () {expect(comment.videoId).to.equal(videoId)expect(comment.id).to.equal(comment.threadId)expect(comment.account.name).to.equal('root')- expect(comment.account.host).to.equal('localhost:' + server.port)+ expect(comment.account.host).to.equal(server.host)for (const avatar of comment.account.avatars) {await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png')diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.tsindex a3de73ba52..6a18cf26a1 100644--- a/server/tests/api/videos/video-playlists.ts+++ b/server/tests/api/videos/video-playlists.ts@@ -404,7 +404,7 @@ describe('Test video playlists', function () {it('Should not list unlisted or private playlists', async function () {for (const server of servers) {const results = [- await server.playlists.listByAccount({ handle: 'root@localhost:' + servers[1].port, sort: '-createdAt' }),+ await server.playlists.listByAccount({ handle: 'root@' + servers[1].host, sort: '-createdAt' }),await server.playlists.list({ start: 0, count: 2, sort: '-createdAt' })]@@ -701,52 +701,52 @@ describe('Test video playlists', function () {const position = 2{- await command.addToMyBlocklist({ token: userTokenServer1, account: 'root@localhost:' + servers[1].port })+ await command.addToMyBlocklist({ token: userTokenServer1, account: 'root@' + servers[1].host })await waitJobs(servers)await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)- await command.removeFromMyBlocklist({ token: userTokenServer1, account: 'root@localhost:' + servers[1].port })+ await command.removeFromMyBlocklist({ token: userTokenServer1, account: 'root@' + servers[1].host })await waitJobs(servers)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)}{- await command.addToMyBlocklist({ token: userTokenServer1, server: 'localhost:' + servers[1].port })+ await command.addToMyBlocklist({ token: userTokenServer1, server: servers[1].host })await waitJobs(servers)await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)- await command.removeFromMyBlocklist({ token: userTokenServer1, server: 'localhost:' + servers[1].port })+ await command.removeFromMyBlocklist({ token: userTokenServer1, server: servers[1].host })await waitJobs(servers)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)}{- await command.addToServerBlocklist({ account: 'root@localhost:' + servers[1].port })+ await command.addToServerBlocklist({ account: 'root@' + servers[1].host })await waitJobs(servers)await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)- await command.removeFromServerBlocklist({ account: 'root@localhost:' + servers[1].port })+ await command.removeFromServerBlocklist({ account: 'root@' + servers[1].host })await waitJobs(servers)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)}{- await command.addToServerBlocklist({ server: 'localhost:' + servers[1].port })+ await command.addToServerBlocklist({ server: servers[1].host })await waitJobs(servers)await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)- await command.removeFromServerBlocklist({ server: 'localhost:' + servers[1].port })+ await command.removeFromServerBlocklist({ server: servers[1].host })await waitJobs(servers)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.tsindex a39bcfebe8..400d5867c0 100644--- a/server/tests/cli/peertube.ts+++ b/server/tests/cli/peertube.ts@@ -300,7 +300,7 @@ describe('Test CLI wrapper', function () {const stdout = await cliCommand.execWithEnv(`${cmd} redundancy ${params}`)expect(stdout).to.contain('super video')- expect(stdout).to.contain(`localhost:${server.port}`)+ expect(stdout).to.contain(server.host)}})diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.tsindex ba0fa1f868..8bdf2136dd 100644--- a/server/tests/cli/prune-storage.ts+++ b/server/tests/cli/prune-storage.ts@@ -94,7 +94,7 @@ describe('Test prune storage scripts', function () {// Lazy load the remote avatars{- const account = await servers[0].accounts.get({ accountName: 'root@localhost:' + servers[1].port })+ const account = await servers[0].accounts.get({ accountName: 'root@' + servers[1].host })for (const avatar of account.avatars) {await makeGetRequest({@@ -106,7 +106,7 @@ describe('Test prune storage scripts', function () {}{- const account = await servers[1].accounts.get({ accountName: 'root@localhost:' + servers[0].port })+ const account = await servers[1].accounts.get({ accountName: 'root@' + servers[0].host })for (const avatar of account.avatars) {await makeGetRequest({url: servers[1].url,diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.tsindex 97632450a2..51257d3d35 100644--- a/server/tests/cli/update-host.ts+++ b/server/tests/cli/update-host.ts@@ -67,7 +67,7 @@ describe('Test update host scripts', function () {for (const video of data) {const { body } = await makeActivityPubGetRequest(server.url, '/videos/watch/' + video.uuid)- expect(body.id).to.equal('http://localhost:9002/videos/watch/' + video.uuid)+ expect(body.id).to.equal('http://127.0.0.1:9002/videos/watch/' + video.uuid)const videoDetails = await server.videos.get({ id: video.uuid })@@ -84,7 +84,7 @@ describe('Test update host scripts', function () {for (const channel of data) {const { body } = await makeActivityPubGetRequest(server.url, '/video-channels/' + channel.name)- expect(body.id).to.equal('http://localhost:9002/video-channels/' + channel.name)+ expect(body.id).to.equal('http://127.0.0.1:9002/video-channels/' + channel.name)}})@@ -96,7 +96,7 @@ describe('Test update host scripts', function () {const usernameWithDomain = account.nameconst { body } = await makeActivityPubGetRequest(server.url, '/accounts/' + usernameWithDomain)- expect(body.id).to.equal('http://localhost:9002/accounts/' + usernameWithDomain)+ expect(body.id).to.equal('http://127.0.0.1:9002/accounts/' + usernameWithDomain)}})@@ -113,17 +113,17 @@ describe('Test update host scripts', function () {expect(files).to.have.lengthOf(8)for (const file of files) {- expect(file.magnetUri).to.contain('localhost%3A9002%2Ftracker%2Fsocket')- expect(file.magnetUri).to.contain('localhost%3A9002%2Fstatic%2F')+ expect(file.magnetUri).to.contain('127.0.0.1%3A9002%2Ftracker%2Fsocket')+ expect(file.magnetUri).to.contain('127.0.0.1%3A9002%2Fstatic%2F')const torrent = await parseTorrentVideo(server, file)- const announceWS = torrent.announce.find(a => a === 'ws://localhost:9002/tracker/socket')+ const announceWS = torrent.announce.find(a => a === 'ws://127.0.0.1:9002/tracker/socket')expect(announceWS).to.not.be.undefined- const announceHttp = torrent.announce.find(a => a === 'http://localhost:9002/tracker/announce')+ const announceHttp = torrent.announce.find(a => a === 'http://127.0.0.1:9002/tracker/announce')expect(announceHttp).to.not.be.undefined- expect(torrent.urlList[0]).to.contain('http://localhost:9002/static/')+ expect(torrent.urlList[0]).to.contain('http://127.0.0.1:9002/static/')}}})diff --git a/server/tests/client.ts b/server/tests/client.tsindex 39ba5fdf69..e0dae2b5e3 100644--- a/server/tests/client.ts+++ b/server/tests/client.ts@@ -134,11 +134,9 @@ describe('Test a client controllers', function () {expectedStatus: HttpStatusCode.OK_200})- const port = servers[0].port-- const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:' + port + '/services/oembed?' +- `url=http%3A%2F%2Flocalhost%3A${port}%2Fw%2F${servers[0].store.video.shortUUID}" ` +- `title="${servers[0].store.video.name}" />`+ const expectedLink = `<link rel="alternate" type="application/json+oembed" href="${servers[0].url}/services/oembed?` ++ `url=http%3A%2F%2F${servers[0].hostname}%3A${servers[0].port}%2Fw%2F${servers[0].store.video.shortUUID}" ` ++ `title="${servers[0].store.video.name}" />`expect(res.text).to.contain(expectedLink)}@@ -155,10 +153,8 @@ describe('Test a client controllers', function () {expectedStatus: HttpStatusCode.OK_200})- const port = servers[0].port-- const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:' + port + '/services/oembed?' +- `url=http%3A%2F%2Flocalhost%3A${port}%2Fw%2Fp%2F${playlist.shortUUID}" ` ++ const expectedLink = `<link rel="alternate" type="application/json+oembed" href="${servers[0].url}/services/oembed?` ++ `url=http%3A%2F%2F${servers[0].hostname}%3A${servers[0].port}%2Fw%2Fp%2F${playlist.shortUUID}" ` +`title="${playlistName}" />`expect(res.text).to.contain(expectedLink)diff --git a/server/tests/external-plugins/auth-ldap.ts b/server/tests/external-plugins/auth-ldap.tsindex 6f6a574a07..d51d337be7 100644--- a/server/tests/external-plugins/auth-ldap.ts+++ b/server/tests/external-plugins/auth-ldap.ts@@ -32,7 +32,7 @@ describe('Official plugin auth-ldap', function () {'mail-property': 'mail','search-base': 'ou=people,dc=planetexpress,dc=com','search-filter': '(|(mail={{username}})(uid={{username}}))',- 'url': 'ldap://localhost:390',+ 'url': 'ldap://127.0.0.1:390','username-property': 'uid'}})@@ -50,7 +50,7 @@ describe('Official plugin auth-ldap', function () {'mail-property': 'mail','search-base': 'ou=people,dc=planetexpress,dc=com','search-filter': '(|(mail={{username}})(uid={{username}}))',- 'url': 'ldap://localhost:10389',+ 'url': 'ldap://127.0.0.1:10389','username-property': 'uid'}})diff --git a/server/tests/external-plugins/auto-block-videos.ts b/server/tests/external-plugins/auto-block-videos.tsindex 7df0b3390e..d14587c386 100644--- a/server/tests/external-plugins/auto-block-videos.ts+++ b/server/tests/external-plugins/auto-block-videos.ts@@ -64,7 +64,7 @@ describe('Official plugin auto-block videos', function () {await servers[0].plugins.updateSettings({npmName: 'peertube-plugin-auto-block-videos',settings: {- 'blocklist-urls': `http://localhost:${port}/blocklist`,+ 'blocklist-urls': `http://127.0.0.1:${port}/blocklist`,'check-seconds-interval': 1}})diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.tsindex b4578cd90f..440b58bfd4 100644--- a/server/tests/external-plugins/auto-mute.ts+++ b/server/tests/external-plugins/auto-mute.ts@@ -43,7 +43,7 @@ describe('Official plugin auto-mute', function () {await servers[0].plugins.updateSettings({npmName: 'peertube-plugin-auto-mute',settings: {- 'blocklist-urls': `http://localhost:${port}/blocklist`,+ 'blocklist-urls': `http://127.0.0.1:${port}/blocklist`,'check-seconds-interval': 1}})@@ -55,7 +55,7 @@ describe('Official plugin auto-mute', function () {blocklistServer.replace({data: [{- value: 'localhost:' + servers[1].port+ value: servers[1].host}]})@@ -72,7 +72,7 @@ describe('Official plugin auto-mute', function () {blocklistServer.replace({data: [{- value: 'localhost:' + servers[1].port,+ value: servers[1].host,action: 'remove'}]@@ -90,7 +90,7 @@ describe('Official plugin auto-mute', function () {blocklistServer.replace({data: [{- value: 'root@localhost:' + servers[1].port+ value: 'root@' + servers[1].host}]})@@ -107,7 +107,7 @@ describe('Official plugin auto-mute', function () {blocklistServer.replace({data: [{- value: 'root@localhost:' + servers[1].port,+ value: 'root@' + servers[1].host,action: 'remove'}]@@ -122,7 +122,7 @@ describe('Official plugin auto-mute', function () {it('Should auto mute an account, manually unmute it and do not remute it automatically', async function () {this.timeout(20000)- const account = 'root@localhost:' + servers[1].port+ const account = 'root@' + servers[1].hostblocklistServer.replace({data: [@@ -188,14 +188,14 @@ describe('Official plugin auto-mute', function () {await servers[1].plugins.updateSettings({npmName: 'peertube-plugin-auto-mute',settings: {- 'blocklist-urls': 'http://localhost:' + servers[0].port + autoMuteListPath,+ 'blocklist-urls': 'http://' + servers[0].host + autoMuteListPath,'check-seconds-interval': 1,'expose-mute-list': false}})- await servers[0].blocklist.addToServerBlocklist({ account: 'root@localhost:' + servers[1].port })- await servers[0].blocklist.addToMyBlocklist({ server: 'localhost:' + servers[1].port })+ await servers[0].blocklist.addToServerBlocklist({ account: 'root@' + servers[1].host })+ await servers[0].blocklist.addToMyBlocklist({ server: servers[1].host })const res = await makeGetRequest({url: servers[0].url,@@ -206,7 +206,7 @@ describe('Official plugin auto-mute', function () {const data = res.body.dataexpect(data).to.have.lengthOf(1)expect(data[0].updatedAt).to.exist- expect(data[0].value).to.equal('root@localhost:' + servers[1].port)+ expect(data[0].value).to.equal('root@' + servers[1].host)await wait(2000)diff --git a/server/tests/fixtures/ap-json/peertube/announce-without-context.json b/server/tests/fixtures/ap-json/peertube/announce-without-context.jsonindex 5f2af0cdef..cda1c514c2 100644--- a/server/tests/fixtures/ap-json/peertube/announce-without-context.json+++ b/server/tests/fixtures/ap-json/peertube/announce-without-context.json@@ -1,13 +1,13 @@{"type": "Announce",- "id": "http://localhost:9002/videos/watch/997111d4-e8d8-4f45-99d3-857905785d05/announces/1",- "actor": "http://localhost:9002/accounts/peertube",- "object": "http://localhost:9002/videos/watch/997111d4-e8d8-4f45-99d3-857905785d05",+ "id": "http://127.0.0.1:9002/videos/watch/997111d4-e8d8-4f45-99d3-857905785d05/announces/1",+ "actor": "http://127.0.0.1:9002/accounts/peertube",+ "object": "http://127.0.0.1:9002/videos/watch/997111d4-e8d8-4f45-99d3-857905785d05","to": ["https://www.w3.org/ns/activitystreams#Public",- "http://localhost:9002/accounts/peertube/followers",- "http://localhost:9002/video-channels/root_channel/followers",- "http://localhost:9002/accounts/root/followers"+ "http://127.0.0.1:9002/accounts/peertube/followers",+ "http://127.0.0.1:9002/video-channels/root_channel/followers",+ "http://127.0.0.1:9002/accounts/root/followers"],"cc": []}diff --git a/server/tests/helpers/request.ts b/server/tests/helpers/request.tsindex a85d80b88c..363237df52 100644--- a/server/tests/helpers/request.ts+++ b/server/tests/helpers/request.ts@@ -41,7 +41,7 @@ describe('Request helpers', function () {const port = await mock.initialize()const before = new Date().getTime()- await doRequest('http://localhost:' + port)+ await doRequest('http://127.0.0.1:' + port)expect(new Date().getTime() - before).to.be.greaterThan(2000)diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.tsindex d2072342ef..f9cf2b717c 100644--- a/server/tests/misc-endpoints.ts+++ b/server/tests/misc-endpoints.ts@@ -166,7 +166,7 @@ describe('Test misc endpoints', function () {})expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')- expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>')+ expect(res.text).to.contain('<url><loc>' + server.url + '/about/instance</loc></url>')})it('Should get the empty cached sitemap', async function () {@@ -177,7 +177,7 @@ describe('Test misc endpoints', function () {})expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')- expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>')+ expect(res.text).to.contain('<url><loc>' + server.url + '/about/instance</loc></url>')})it('Should add videos, channel and accounts and get sitemap', async function () {@@ -200,17 +200,17 @@ describe('Test misc endpoints', function () {})expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')- expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>')+ expect(res.text).to.contain('<url><loc>' + server.url + '/about/instance</loc></url>')expect(res.text).to.contain('<video:title>video 1</video:title>')expect(res.text).to.contain('<video:title>video 2</video:title>')expect(res.text).to.not.contain('<video:title>video 3</video:title>')- expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/video-channels/channel1</loc></url>')- expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/video-channels/channel2</loc></url>')+ expect(res.text).to.contain('<url><loc>' + server.url + '/video-channels/channel1</loc></url>')+ expect(res.text).to.contain('<url><loc>' + server.url + '/video-channels/channel2</loc></url>')- expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/accounts/user1</loc></url>')- expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/accounts/user2</loc></url>')+ expect(res.text).to.contain('<url><loc>' + server.url + '/accounts/user1</loc></url>')+ expect(res.text).to.contain('<url><loc>' + server.url + '/accounts/user2</loc></url>')})it('Should not fail with big title/description videos', async function () {diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.tsindex f2bada4eea..038e3f0d6c 100644--- a/server/tests/plugins/plugin-helpers.ts+++ b/server/tests/plugins/plugin-helpers.ts@@ -46,7 +46,7 @@ describe('Test plugin helpers', function () {describe('Logger', function () {it('Should have logged things', async function () {- await servers[0].servers.waitUntilLog('localhost:' + servers[0].port + ' peertube-plugin-test-four', 1, false)+ await servers[0].servers.waitUntilLog(servers[0].host + ' peertube-plugin-test-four', 1, false)await servers[0].servers.waitUntilLog('Hello world from plugin four', 1)})})@@ -61,7 +61,7 @@ describe('Test plugin helpers', function () {describe('Config', function () {it('Should have the correct webserver url', async function () {- await servers[0].servers.waitUntilLog(`server url is http://localhost:${servers[0].port}`)+ await servers[0].servers.waitUntilLog(`server url is ${servers[0].url}`)})it('Should have the correct config', async function () {@@ -208,7 +208,7 @@ describe('Test plugin helpers', function () {it('Should mute server 2', async function () {this.timeout(10000)- await postCommand(servers[0], 'blockServer', { hostToBlock: `localhost:${servers[1].port}` })+ await postCommand(servers[0], 'blockServer', { hostToBlock: servers[1].host })const { data } = await servers[0].videos.list()@@ -217,7 +217,7 @@ describe('Test plugin helpers', function () {})it('Should unmute server 2', async function () {- await postCommand(servers[0], 'unblockServer', { hostToUnblock: `localhost:${servers[1].port}` })+ await postCommand(servers[0], 'unblockServer', { hostToUnblock: servers[1].host })const { data } = await servers[0].videos.list()@@ -225,7 +225,7 @@ describe('Test plugin helpers', function () {})it('Should mute account of server 2', async function () {- await postCommand(servers[0], 'blockAccount', { handleToBlock: `root@localhost:${servers[1].port}` })+ await postCommand(servers[0], 'blockAccount', { handleToBlock: `root@${servers[1].host}` })const { data } = await servers[0].videos.list()@@ -234,7 +234,7 @@ describe('Test plugin helpers', function () {})it('Should unmute account of server 2', async function () {- await postCommand(servers[0], 'unblockAccount', { handleToUnblock: `root@localhost:${servers[1].port}` })+ await postCommand(servers[0], 'unblockAccount', { handleToUnblock: `root@${servers[1].host}` })const { data } = await servers[0].videos.list()diff --git a/server/tests/shared/notifications.ts b/server/tests/shared/notifications.tsindex ee15e2b098..e600bd6b2b 100644--- a/server/tests/shared/notifications.ts+++ b/server/tests/shared/notifications.ts@@ -371,7 +371,7 @@ async function checkNewCommentOnMyVideo (options: CheckerBaseParams & {}}- const commentUrl = `http://localhost:${server.port}/w/${shortUUID};threadId=${threadId}`+ const commentUrl = `${server.url}/w/${shortUUID};threadId=${threadId}`function emailNotificationFinder (email: object) {return email['text'].indexOf(commentUrl) !== -1@@ -674,7 +674,7 @@ async function prepareNotificationsTest (serversCount = 3, overrideConfigArg: anconst overrideConfig = {smtp: {- hostname: 'localhost',+ hostname: '127.0.0.1',port},signup: {diff --git a/shared/server-commands/miscs/sql-command.ts b/shared/server-commands/miscs/sql-command.tsindex f163cc8c99..dbc441abab 100644--- a/shared/server-commands/miscs/sql-command.ts+++ b/shared/server-commands/miscs/sql-command.ts@@ -131,7 +131,7 @@ export class SQLCommand extends AbstractCommand {const dbname = 'peertube_test' + this.server.internalServerNumberconst username = 'peertube'const password = 'peertube'- const host = 'localhost'+ const host = '127.0.0.1'const port = 5432this.sequelize = new Sequelize(dbname, username, password, {diff --git a/shared/server-commands/server/server.ts b/shared/server-commands/server/server.tsindex f2ca51431c..ae1395a742 100644--- a/shared/server-commands/server/server.ts+++ b/shared/server-commands/server/server.ts@@ -179,9 +179,9 @@ export class PeerTubeServer {this.rtmpsPort = this.parallel ? this.randomRTMP() : 1937this.port = 9000 + this.internalServerNumber- this.url = `http://localhost:${this.port}`- this.host = `localhost:${this.port}`- this.hostname = 'localhost'+ this.url = `http://127.0.0.1:${this.port}`+ this.host = `127.0.0.1:${this.port}`+ this.hostname = '127.0.0.1'}setUrl (url: string) {diff --git a/shared/server-commands/videos/live.ts b/shared/server-commands/videos/live.tsindex ee7444b64a..578e6ede78 100644--- a/shared/server-commands/videos/live.ts+++ b/shared/server-commands/videos/live.ts@@ -39,6 +39,7 @@ function sendRTMPStream (options: {if (process.env.DEBUG) {command.on('stderr', data => console.log(data))+ command.on('stdout', data => console.log(data))}command.run()