Initial WIP commit to add <podcast:chat> tag to Podcast RSS feeds
This commit is contained in:
parent
81110da5e1
commit
97a5d4b408
55
package-lock.json
generated
55
package-lock.json
generated
@ -17,6 +17,7 @@
|
||||
"validate-color": "^2.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@peertube/feed": "^5.1.0",
|
||||
"@peertube/peertube-types": "^5.1.0",
|
||||
"@tsconfig/node12": "^1.0.9",
|
||||
"@types/async": "^3.2.9",
|
||||
@ -2557,6 +2558,18 @@
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/@peertube/feed": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@peertube/feed/-/feed-5.1.0.tgz",
|
||||
"integrity": "sha512-ggwIbjxh4oc1aAGYV7ZxtIpiEIGq3Rkg6FxvOSrk/EPZ76rExoIJCjKeSyd4zb/sGkyKldy+bGs1OUUVidWWTQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"xml-js": "^1.6.11"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@peertube/peertube-types": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@peertube/peertube-types/-/peertube-types-5.1.0.tgz",
|
||||
@ -8804,6 +8817,12 @@
|
||||
"node": ">=8.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
@ -10441,6 +10460,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/xml-js": {
|
||||
"version": "1.6.11",
|
||||
"resolved": "https://registry.npmjs.org/xml-js/-/xml-js-1.6.11.tgz",
|
||||
"integrity": "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"sax": "^1.2.4"
|
||||
},
|
||||
"bin": {
|
||||
"xml-js": "bin/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/xtend": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||
@ -12611,6 +12642,15 @@
|
||||
"integrity": "sha512-hO+bdeGOlJwqowUBoZF5LyP3ORUFOP1G0GRv8N45W/cztXbT2ZEXaAzfokRS9Xc9FWmYrDj32mF6SzH6wuoIyA==",
|
||||
"dev": true
|
||||
},
|
||||
"@peertube/feed": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@peertube/feed/-/feed-5.1.0.tgz",
|
||||
"integrity": "sha512-ggwIbjxh4oc1aAGYV7ZxtIpiEIGq3Rkg6FxvOSrk/EPZ76rExoIJCjKeSyd4zb/sGkyKldy+bGs1OUUVidWWTQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"xml-js": "^1.6.11"
|
||||
}
|
||||
},
|
||||
"@peertube/peertube-types": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@peertube/peertube-types/-/peertube-types-5.1.0.tgz",
|
||||
@ -17285,6 +17325,12 @@
|
||||
"chokidar": ">=3.0.0 <4.0.0"
|
||||
}
|
||||
},
|
||||
"sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
|
||||
"dev": true
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
@ -18531,6 +18577,15 @@
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"xml-js": {
|
||||
"version": "1.6.11",
|
||||
"resolved": "https://registry.npmjs.org/xml-js/-/xml-js-1.6.11.tgz",
|
||||
"integrity": "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"sax": "^1.2.4"
|
||||
}
|
||||
},
|
||||
"xtend": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||
|
@ -40,6 +40,7 @@
|
||||
"validate-color": "^2.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@peertube/feed": "^5.1.0",
|
||||
"@peertube/peertube-types": "^5.1.0",
|
||||
"@tsconfig/node12": "^1.0.9",
|
||||
"@types/async": "^3.2.9",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { RegisterServerOptions } from '@peertube/peertube-types'
|
||||
import type { RegisterServerOptions, Video } from '@peertube/peertube-types'
|
||||
import { migrateSettings } from './lib/migration/settings'
|
||||
import { initSettings } from './lib/settings'
|
||||
import { initCustomFields } from './lib/custom-fields'
|
||||
@ -8,6 +8,8 @@ import { prepareProsody, ensureProsodyRunning, ensureProsodyNotRunning } from '.
|
||||
import { unloadDebugMode } from './lib/debug'
|
||||
import { loadLoc } from './lib/loc'
|
||||
import decache from 'decache'
|
||||
import { CustomTag } from '@peertube/feed/lib/typings'
|
||||
import { URL } from 'url'
|
||||
|
||||
// FIXME: Peertube unregister don't have any parameter.
|
||||
// Using this global variable to fix this, so we can use helpers to unregister.
|
||||
@ -31,6 +33,33 @@ async function register (options: RegisterServerOptions): Promise<any> {
|
||||
await initRouters(options)
|
||||
await initFederation(options)
|
||||
|
||||
options.registerHook({
|
||||
// @ts-expect-error Type doesn't exist for peertube 5.1 yet
|
||||
target: 'filter:feed.podcast.video.create-custom-tags.result',
|
||||
handler: (result: CustomTag[], { video, liveItem }: { video: Video, liveItem: boolean }) => {
|
||||
if (!liveItem) {
|
||||
return result
|
||||
}
|
||||
|
||||
const webserverUrl = options.peertubeHelpers.config.getWebserverUrl()
|
||||
const hostname = (new URL(webserverUrl)).hostname
|
||||
const embedUrl = `${webserverUrl}/plugins/livechat/router/webchat/room/${encodeURIComponent(video.uuid)}`
|
||||
const xmppHostname = `room.${hostname}`
|
||||
|
||||
return result.concat([
|
||||
{
|
||||
name: 'podcast:chat',
|
||||
attributes: {
|
||||
server: xmppHostname,
|
||||
protocol: 'xmpp',
|
||||
space: `${video.uuid}@${xmppHostname}`,
|
||||
embedUrl: embedUrl
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
})
|
||||
|
||||
try {
|
||||
await prepareProsody(options)
|
||||
await ensureProsodyRunning(options)
|
||||
|
Loading…
x
Reference in New Issue
Block a user