Add ability to disable federation
This commit is contained in:
parent
7d52f17a35
commit
e6de476ae8
|
@ -433,6 +433,9 @@ plugins:
|
|||
url: 'https://packages.joinpeertube.org'
|
||||
|
||||
federation:
|
||||
# Enable ActivityPub endpoints (inbox/outbox)
|
||||
enabled: true
|
||||
|
||||
# Some federated software such as Mastodon may require an HTTP signature to access content
|
||||
sign_federated_fetches: true
|
||||
|
||||
|
|
|
@ -431,6 +431,9 @@ plugins:
|
|||
url: 'https://packages.joinpeertube.org'
|
||||
|
||||
federation:
|
||||
# Enable ActivityPub endpoints (inbox/outbox)
|
||||
enabled: true
|
||||
|
||||
# Some federated software such as Mastodon may require an HTTP signature to access content
|
||||
sign_federated_fetches: true
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ import {
|
|||
cleanupTests,
|
||||
createMultipleServers,
|
||||
doubleFollow,
|
||||
makeActivityPubGetRequest,
|
||||
makeGetRequest,
|
||||
PeerTubeServer,
|
||||
setAccessTokensToServers,
|
||||
waitJobs
|
||||
|
@ -315,6 +317,26 @@ describe('Test follow constraints', function () {
|
|||
})
|
||||
})
|
||||
|
||||
describe('When disabling federation', function () {
|
||||
|
||||
before(async function () {
|
||||
this.timeout(60_000)
|
||||
|
||||
await servers[0].kill()
|
||||
await servers[0].run({ federation: { enabled: false } })
|
||||
})
|
||||
|
||||
it('Should not federate anymore', async function () {
|
||||
const { uuid } = await servers[0].videos.quickUpload({ name: 'non federated video' })
|
||||
await waitJobs(servers)
|
||||
|
||||
await servers[1].videos.get({ id: uuid, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
|
||||
|
||||
await makeActivityPubGetRequest(servers[0].url, '/inbox', HttpStatusCode.NOT_ACCEPTABLE_406)
|
||||
await makeActivityPubGetRequest(servers[0].url, '/outbox', HttpStatusCode.NOT_ACCEPTABLE_406)
|
||||
})
|
||||
})
|
||||
|
||||
after(async function () {
|
||||
await cleanupTests(servers)
|
||||
})
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import express from 'express'
|
||||
|
||||
import { activityPubClientRouter } from './client.js'
|
||||
import { inboxRouter } from './inbox.js'
|
||||
import { outboxRouter } from './outbox.js'
|
||||
|
|
|
@ -74,7 +74,7 @@ function checkMissedConfig () {
|
|||
'feeds.videos.count', 'feeds.comments.count',
|
||||
'geo_ip.enabled', 'geo_ip.country.database_url', 'geo_ip.city.database_url',
|
||||
'remote_redundancy.videos.accept_from',
|
||||
'federation.videos.federate_unlisted', 'federation.videos.cleanup_remote_interactions',
|
||||
'federation.enabled', 'federation.videos.federate_unlisted', 'federation.videos.cleanup_remote_interactions',
|
||||
'peertube.check_latest_version.enabled', 'peertube.check_latest_version.url',
|
||||
'search.remote_uri.users', 'search.remote_uri.anonymous', 'search.search_index.enabled', 'search.search_index.url',
|
||||
'search.search_index.disable_local_search', 'search.search_index.is_default_search',
|
||||
|
|
|
@ -341,6 +341,7 @@ const CONFIG = {
|
|||
}
|
||||
},
|
||||
FEDERATION: {
|
||||
ENABLED: config.get<boolean>('federation.enabled'),
|
||||
VIDEOS: {
|
||||
FEDERATE_UNLISTED: config.get<boolean>('federation.videos.federate_unlisted'),
|
||||
CLEANUP_REMOTE_INTERACTIONS: config.get<boolean>('federation.videos.cleanup_remote_interactions')
|
||||
|
|
|
@ -232,7 +232,10 @@ app.use('/api/' + API_VERSION, apiRouter)
|
|||
// Services (oembed...)
|
||||
app.use('/services', servicesRouter)
|
||||
|
||||
app.use('/', activityPubRouter)
|
||||
if (CONFIG.FEDERATION.ENABLED) {
|
||||
app.use('/', activityPubRouter)
|
||||
}
|
||||
|
||||
app.use('/', feedsRouter)
|
||||
app.use('/', trackerRouter)
|
||||
app.use('/', sitemapRouter)
|
||||
|
|
Loading…
Reference in New Issue