PeerTube/server/core/models/account/account.ts

464 lines
11 KiB
TypeScript
Raw Normal View History

2020-12-08 14:30:29 +01:00
import { FindOptions, Includeable, IncludeOptions, Op, Transaction, WhereOptions } from 'sequelize'
2017-12-12 17:53:50 +01:00
import {
AllowNull,
BeforeDestroy,
BelongsTo,
Column,
2019-08-15 11:53:26 +02:00
CreatedAt,
DataType,
Default,
DefaultScope,
ForeignKey,
HasMany,
2024-02-22 10:12:04 +01:00
Is, Scopes,
Table,
2017-12-12 17:53:50 +01:00
UpdatedAt
} from 'sequelize-typescript'
import { Account, AccountSummary } from '@peertube/peertube-models'
import { ModelCache } from '@server/models/shared/model-cache.js'
import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts.js'
import { CONSTRAINTS_FIELDS, SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants.js'
import { sendDeleteActor } from '../../lib/activitypub/send/send-delete.js'
import {
MAccount, MAccountAP,
MAccountDefault,
MAccountFormattable,
Add Podcast RSS feeds (#5487) * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Add correct feed image to RSS channel * Prefer HLS videos for podcast RSS Remove video/stream titles, add optional height attribute to podcast RSS * Prefix podcast RSS images with root server URL * Add optional video query support to include captions * Add transcripts & person images to podcast RSS feed * Prefer webseed/webtorrent files over HLS fragmented mp4s * Experimentally adding podcast fields to basic config page * Add validation for new basic config fields * Don't include "content" in podcast feed, use full description for "description" * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Add correct feed image to RSS channel * Prefer HLS videos for podcast RSS Remove video/stream titles, add optional height attribute to podcast RSS * Prefix podcast RSS images with root server URL * Add optional video query support to include captions * Add transcripts & person images to podcast RSS feed * Prefer webseed/webtorrent files over HLS fragmented mp4s * Experimentally adding podcast fields to basic config page * Add validation for new basic config fields * Don't include "content" in podcast feed, use full description for "description" * Add medium/socialInteract to podcast RSS feeds. Use HTML for description * Change base production image to bullseye, install prosody in image * Add liveItem and trackers to Podcast RSS feeds Remove height from alternateEnclosure, replaced with title. * Clear Podcast RSS feed cache when live streams start/end * Upgrade to Node 16 * Refactor clearCacheRoute to use ApiCache * Remove unnecessary type hint * Update dockerfile to node 16, install python-is-python2 * Use new file paths for captions/playlists * Fix legacy videos in RSS after migration to object storage * Improve method of identifying non-fragmented mp4s in podcast RSS feeds * Don't include fragmented MP4s in podcast RSS feeds * Add experimental support for podcast:categories on the podcast RSS item * Fix undefined category when no videos exist Allows for empty feeds to exist (important for feeds that might only go live) * Add support for podcast:locked -- user has to opt in to show their email * Use comma for podcast:categories delimiter * Make cache clearing async * Fix merge, temporarily test with pfeed-podcast * Syntax changes * Add EXT_MIMETYPE constants for captions * Update & fix tests, fix enclosure mimetypes, remove admin email * Add test for podacst:socialInteract * Add filters hooks for podcast customTags * Remove showdown, updated to pfeed-podcast 6.1.2 * Add 'action:api.live-video.state.updated' hook * Avoid assigning undefined category to podcast feeds * Remove nvmrc * Remove comment * Remove unused podcast config * Remove more unused podcast config * Fix MChannelAccountDefault type hint missed in merge * Remove extra line * Re-add newline in config * Fix lint errors for isEmailPublic * Fix thumbnails in podcast feeds * Requested changes based on review * Provide podcast rss 2.0 only on video channels * Misc cleanup for a less messy PR * Lint fixes * Remove pfeed-podcast * Add peertube version to new hooks * Don't use query include, remove TODO * Remove film medium hack * Clear podcast rss cache before video/channel update hooks * Clear podcast rss cache before video uploaded/deleted hooks * Refactor podcast feed cache clearing * Set correct person name from video channel * Styling * Fix tests --------- Co-authored-by: Chocobozzz <me@florianbigard.com>
2023-05-22 16:00:05 +02:00
MAccountHost,
MAccountSummaryFormattable,
Add Podcast RSS feeds (#5487) * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Add correct feed image to RSS channel * Prefer HLS videos for podcast RSS Remove video/stream titles, add optional height attribute to podcast RSS * Prefix podcast RSS images with root server URL * Add optional video query support to include captions * Add transcripts & person images to podcast RSS feed * Prefer webseed/webtorrent files over HLS fragmented mp4s * Experimentally adding podcast fields to basic config page * Add validation for new basic config fields * Don't include "content" in podcast feed, use full description for "description" * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Add correct feed image to RSS channel * Prefer HLS videos for podcast RSS Remove video/stream titles, add optional height attribute to podcast RSS * Prefix podcast RSS images with root server URL * Add optional video query support to include captions * Add transcripts & person images to podcast RSS feed * Prefer webseed/webtorrent files over HLS fragmented mp4s * Experimentally adding podcast fields to basic config page * Add validation for new basic config fields * Don't include "content" in podcast feed, use full description for "description" * Add medium/socialInteract to podcast RSS feeds. Use HTML for description * Change base production image to bullseye, install prosody in image * Add liveItem and trackers to Podcast RSS feeds Remove height from alternateEnclosure, replaced with title. * Clear Podcast RSS feed cache when live streams start/end * Upgrade to Node 16 * Refactor clearCacheRoute to use ApiCache * Remove unnecessary type hint * Update dockerfile to node 16, install python-is-python2 * Use new file paths for captions/playlists * Fix legacy videos in RSS after migration to object storage * Improve method of identifying non-fragmented mp4s in podcast RSS feeds * Don't include fragmented MP4s in podcast RSS feeds * Add experimental support for podcast:categories on the podcast RSS item * Fix undefined category when no videos exist Allows for empty feeds to exist (important for feeds that might only go live) * Add support for podcast:locked -- user has to opt in to show their email * Use comma for podcast:categories delimiter * Make cache clearing async * Fix merge, temporarily test with pfeed-podcast * Syntax changes * Add EXT_MIMETYPE constants for captions * Update & fix tests, fix enclosure mimetypes, remove admin email * Add test for podacst:socialInteract * Add filters hooks for podcast customTags * Remove showdown, updated to pfeed-podcast 6.1.2 * Add 'action:api.live-video.state.updated' hook * Avoid assigning undefined category to podcast feeds * Remove nvmrc * Remove comment * Remove unused podcast config * Remove more unused podcast config * Fix MChannelAccountDefault type hint missed in merge * Remove extra line * Re-add newline in config * Fix lint errors for isEmailPublic * Fix thumbnails in podcast feeds * Requested changes based on review * Provide podcast rss 2.0 only on video channels * Misc cleanup for a less messy PR * Lint fixes * Remove pfeed-podcast * Add peertube version to new hooks * Don't use query include, remove TODO * Remove film medium hack * Clear podcast rss cache before video/channel update hooks * Clear podcast rss cache before video uploaded/deleted hooks * Refactor podcast feed cache clearing * Set correct person name from video channel * Styling * Fix tests --------- Co-authored-by: Chocobozzz <me@florianbigard.com>
2023-05-22 16:00:05 +02:00
MChannelHost
} from '../../types/models/index.js'
import { ActorFollowModel } from '../actor/actor-follow.js'
import { ActorImageModel } from '../actor/actor-image.js'
import { ActorModel } from '../actor/actor.js'
import { ApplicationModel } from '../application/application.js'
import { ServerBlocklistModel } from '../server/server-blocklist.js'
import { ServerModel } from '../server/server.js'
2024-02-22 10:12:04 +01:00
import { buildSQLAttributes, getSort, SequelizeModel, throwIfNotValid } from '../shared/index.js'
import { UserModel } from '../user/user.js'
import { VideoChannelModel } from '../video/video-channel.js'
import { VideoCommentModel } from '../video/video-comment.js'
import { VideoPlaylistModel } from '../video/video-playlist.js'
import { VideoModel } from '../video/video.js'
import { AccountBlocklistModel } from './account-blocklist.js'
2019-02-26 10:55:40 +01:00
export enum ScopeNames {
SUMMARY = 'SUMMARY'
}
2017-12-12 17:53:50 +01:00
2019-07-31 15:57:32 +02:00
export type SummaryOptions = {
2020-07-07 14:34:16 +02:00
actorRequired?: boolean // Default: true
2019-07-31 15:57:32 +02:00
whereActor?: WhereOptions
whereServer?: WhereOptions
2019-07-31 15:57:32 +02:00
withAccountBlockerIds?: number[]
forCount?: boolean
2019-07-31 15:57:32 +02:00
}
2019-04-23 09:50:57 +02:00
@DefaultScope(() => ({
2017-12-14 17:38:41 +01:00
include: [
2017-12-12 17:53:50 +01:00
{
2019-04-23 09:50:57 +02:00
model: ActorModel, // Default scope includes avatar and server
2018-08-23 17:58:39 +02:00
required: true
2017-11-09 17:51:58 +01:00
}
]
2019-04-23 09:50:57 +02:00
}))
@Scopes(() => ({
2020-01-31 16:56:52 +01:00
[ScopeNames.SUMMARY]: (options: SummaryOptions = {}) => {
2019-07-31 15:57:32 +02:00
const serverInclude: IncludeOptions = {
attributes: [ 'host' ],
model: ServerModel.unscoped(),
required: !!options.whereServer,
where: options.whereServer
2019-07-31 15:57:32 +02:00
}
const actorInclude: Includeable = {
attributes: [ 'id', 'preferredUsername', 'url', 'serverId' ],
model: ActorModel.unscoped(),
required: options.actorRequired ?? true,
where: options.whereActor,
include: [ serverInclude ]
}
2019-07-31 15:57:32 +02:00
if (options.forCount !== true) {
actorInclude.include.push({
model: ActorImageModel,
as: 'Avatars',
required: false
})
}
const queryInclude: Includeable[] = [
actorInclude
2020-12-08 14:30:29 +01:00
]
const query: FindOptions = {
attributes: [ 'id', 'name', 'actorId' ]
2019-02-26 10:55:40 +01:00
}
2019-07-31 15:57:32 +02:00
if (options.withAccountBlockerIds) {
2020-12-08 14:30:29 +01:00
queryInclude.push({
2019-07-31 15:57:32 +02:00
attributes: [ 'id' ],
model: AccountBlocklistModel.unscoped(),
as: 'BlockedBy',
2019-07-31 15:57:32 +02:00
required: false,
where: {
accountId: {
[Op.in]: options.withAccountBlockerIds
}
}
})
serverInclude.include = [
{
attributes: [ 'id' ],
model: ServerBlocklistModel.unscoped(),
required: false,
where: {
accountId: {
[Op.in]: options.withAccountBlockerIds
}
}
}
]
}
2020-12-08 14:30:29 +01:00
query.include = queryInclude
2019-07-31 15:57:32 +02:00
return query
2019-02-26 10:55:40 +01:00
}
2019-04-23 09:50:57 +02:00
}))
2017-12-14 17:38:41 +01:00
@Table({
2018-07-23 20:13:30 +02:00
tableName: 'account',
indexes: [
{
fields: [ 'actorId' ],
unique: true
},
{
fields: [ 'applicationId' ]
},
{
fields: [ 'userId' ]
}
]
2017-12-14 17:38:41 +01:00
})
2024-02-22 10:12:04 +01:00
export class AccountModel extends SequelizeModel<AccountModel> {
2017-12-12 17:53:50 +01:00
2017-12-14 17:38:41 +01:00
@AllowNull(false)
@Column
name: string
@AllowNull(true)
@Default(null)
2019-04-18 11:28:17 +02:00
@Is('AccountDescription', value => throwIfNotValid(value, isAccountDescriptionValid, 'description', true))
2019-05-13 14:37:30 +02:00
@Column(DataType.STRING(CONSTRAINTS_FIELDS.USERS.DESCRIPTION.max))
description: string
2017-12-12 17:53:50 +01:00
@CreatedAt
createdAt: Date
@UpdatedAt
updatedAt: Date
2017-12-14 11:18:49 +01:00
@ForeignKey(() => ActorModel)
2017-12-12 17:53:50 +01:00
@Column
2017-12-14 11:18:49 +01:00
actorId: number
2017-11-09 17:51:58 +01:00
2017-12-14 11:18:49 +01:00
@BelongsTo(() => ActorModel, {
2017-11-09 17:51:58 +01:00
foreignKey: {
2017-12-14 11:18:49 +01:00
allowNull: false
2017-11-09 17:51:58 +01:00
},
onDelete: 'cascade'
})
Actor: Awaited<ActorModel>
2017-11-09 17:51:58 +01:00
2017-12-12 17:53:50 +01:00
@ForeignKey(() => UserModel)
@Column
userId: number
@BelongsTo(() => UserModel, {
2017-11-09 17:51:58 +01:00
foreignKey: {
allowNull: true
},
onDelete: 'cascade'
})
User: Awaited<UserModel>
2017-12-12 17:53:50 +01:00
@ForeignKey(() => ApplicationModel)
@Column
applicationId: number
2017-11-09 17:51:58 +01:00
2017-12-12 17:53:50 +01:00
@BelongsTo(() => ApplicationModel, {
2017-11-09 17:51:58 +01:00
foreignKey: {
allowNull: true
},
onDelete: 'cascade'
})
Application: Awaited<ApplicationModel>
2017-11-09 17:51:58 +01:00
2017-12-12 17:53:50 +01:00
@HasMany(() => VideoChannelModel, {
2017-11-09 17:51:58 +01:00
foreignKey: {
allowNull: false
},
onDelete: 'cascade',
hooks: true
})
VideoChannels: Awaited<VideoChannelModel>[]
2017-11-09 17:51:58 +01:00
2019-02-26 10:55:40 +01:00
@HasMany(() => VideoPlaylistModel, {
foreignKey: {
allowNull: false
},
onDelete: 'cascade',
hooks: true
})
VideoPlaylists: Awaited<VideoPlaylistModel>[]
2019-02-26 10:55:40 +01:00
@HasMany(() => VideoCommentModel, {
foreignKey: {
allowNull: true
},
onDelete: 'cascade',
hooks: true
})
VideoComments: Awaited<VideoCommentModel>[]
2019-07-31 15:57:32 +02:00
@HasMany(() => AccountBlocklistModel, {
foreignKey: {
name: 'targetAccountId',
allowNull: false
},
as: 'BlockedBy',
2019-07-31 15:57:32 +02:00
onDelete: 'CASCADE'
})
BlockedBy: Awaited<AccountBlocklistModel>[]
2019-07-31 15:57:32 +02:00
@BeforeDestroy
static async sendDeleteIfOwned (instance: AccountModel, options) {
if (!instance.Actor) {
instance.Actor = await instance.$get('Actor', { transaction: options.transaction })
}
2019-08-02 09:46:48 +02:00
await ActorFollowModel.removeFollowsOf(instance.Actor.id, options.transaction)
2020-11-10 16:29:35 +01:00
if (instance.isOwned()) {
return sendDeleteActor(instance.Actor, options.transaction)
}
return undefined
2017-11-09 17:51:58 +01:00
}
2023-01-09 10:29:23 +01:00
// ---------------------------------------------------------------------------
static getSQLAttributes (tableName: string, aliasPrefix = '') {
return buildSQLAttributes({
model: this,
tableName,
aliasPrefix
})
}
// ---------------------------------------------------------------------------
2020-12-08 14:30:29 +01:00
static load (id: number, transaction?: Transaction): Promise<MAccountDefault> {
2019-02-21 14:28:06 +01:00
return AccountModel.findByPk(id, { transaction })
2017-12-12 17:53:50 +01:00
}
2017-12-04 10:34:40 +01:00
2020-12-08 14:30:29 +01:00
static loadByNameWithHost (nameWithHost: string): Promise<MAccountDefault> {
2019-02-21 14:06:10 +01:00
const [ accountName, host ] = nameWithHost.split('@')
2019-04-11 11:33:44 +02:00
if (!host || host === WEBSERVER.HOST) return AccountModel.loadLocalByName(accountName)
2019-02-21 14:06:10 +01:00
return AccountModel.loadByNameAndHost(accountName, host)
}
2020-12-08 14:30:29 +01:00
static loadLocalByName (name: string): Promise<MAccountDefault> {
2020-02-04 11:26:51 +01:00
const fun = () => {
const query = {
where: {
[Op.or]: [
{
userId: {
[Op.ne]: null
}
},
{
applicationId: {
[Op.ne]: null
}
2017-12-12 17:53:50 +01:00
}
2020-02-04 11:26:51 +01:00
]
},
include: [
2017-12-12 17:53:50 +01:00
{
2020-02-04 11:26:51 +01:00
model: ActorModel,
required: true,
where: ActorModel.wherePreferredUsername(name)
2017-12-12 17:53:50 +01:00
}
]
2020-02-04 11:26:51 +01:00
}
2018-02-21 16:44:18 +01:00
2020-02-04 11:26:51 +01:00
return AccountModel.findOne(query)
}
2019-12-27 13:33:16 +01:00
2020-02-04 11:26:51 +01:00
return ModelCache.Instance.doCache({
cacheType: 'server-account',
2020-02-04 11:26:51 +01:00
key: name,
fun,
// The server actor never change, so we can easily cache it
whitelist: () => name === SERVER_ACTOR_NAME
})
2018-02-21 16:44:18 +01:00
}
2020-12-08 14:30:29 +01:00
static loadByNameAndHost (name: string, host: string): Promise<MAccountDefault> {
2018-02-21 16:44:18 +01:00
const query = {
include: [
{
model: ActorModel,
required: true,
where: ActorModel.wherePreferredUsername(name),
2018-02-21 16:44:18 +01:00
include: [
{
model: ServerModel,
required: true,
where: {
host
}
}
]
}
]
2017-12-12 17:53:50 +01:00
}
2017-11-13 17:39:41 +01:00
2017-12-12 17:53:50 +01:00
return AccountModel.findOne(query)
}
2017-11-13 17:39:41 +01:00
2020-12-08 14:30:29 +01:00
static loadByUrl (url: string, transaction?: Transaction): Promise<MAccountDefault> {
2017-12-12 17:53:50 +01:00
const query = {
2017-12-14 11:18:49 +01:00
include: [
{
model: ActorModel,
required: true,
where: {
url
}
}
],
2017-12-12 17:53:50 +01:00
transaction
}
2017-11-09 17:51:58 +01:00
2017-12-12 17:53:50 +01:00
return AccountModel.findOne(query)
}
2017-11-09 17:51:58 +01:00
2018-01-03 16:38:50 +01:00
static listForApi (start: number, count: number, sort: string) {
const query = {
offset: start,
limit: count,
2018-02-19 11:31:50 +01:00
order: getSort(sort)
2018-01-03 16:38:50 +01:00
}
return Promise.all([
AccountModel.count(),
AccountModel.findAll(query)
]).then(([ total, data ]) => ({ total, data }))
2018-01-03 16:38:50 +01:00
}
2020-12-08 14:30:29 +01:00
static loadAccountIdFromVideo (videoId: number): Promise<MAccount> {
const query = {
include: [
{
attributes: [ 'id', 'accountId' ],
model: VideoChannelModel.unscoped(),
required: true,
include: [
{
attributes: [ 'id', 'channelId' ],
model: VideoModel.unscoped(),
where: {
id: videoId
}
}
]
}
]
}
return AccountModel.findOne(query)
}
static listLocalsForSitemap (sort: string): Promise<MAccountHost[]> {
2018-12-05 17:27:24 +01:00
const query = {
attributes: [ ],
offset: 0,
order: getSort(sort),
include: [
{
attributes: [ 'preferredUsername', 'serverId' ],
model: ActorModel.unscoped(),
where: {
serverId: null
}
}
]
}
return AccountModel
.unscoped()
.findAll(query)
}
2019-08-20 19:05:31 +02:00
toFormattedJSON (this: MAccountFormattable): Account {
return {
...this.Actor.toFormattedJSON(),
2017-12-12 17:53:50 +01:00
id: this.id,
displayName: this.getDisplayName(),
description: this.description,
updatedAt: this.updatedAt,
userId: this.userId ?? undefined
2017-12-12 17:53:50 +01:00
}
}
2017-11-09 17:51:58 +01:00
2019-08-20 19:05:31 +02:00
toFormattedSummaryJSON (this: MAccountSummaryFormattable): AccountSummary {
const actor = this.Actor.toFormattedSummaryJSON()
2019-02-26 10:55:40 +01:00
return {
id: this.id,
displayName: this.getDisplayName(),
name: actor.name,
2019-02-26 10:55:40 +01:00
url: actor.url,
host: actor.host,
avatars: actor.avatars
2019-02-26 10:55:40 +01:00
}
}
async toActivityPubObject (this: MAccountAP) {
const obj = await this.Actor.toActivityPubObject(this.name)
return Object.assign(obj, {
summary: this.description
})
2017-11-09 17:51:58 +01:00
}
2017-12-12 17:53:50 +01:00
isOwned () {
2017-12-14 11:18:49 +01:00
return this.Actor.isOwned()
2017-12-12 17:53:50 +01:00
}
2019-01-14 11:30:15 +01:00
isOutdated () {
return this.Actor.isOutdated()
}
getDisplayName () {
return this.name
}
2019-07-31 15:57:32 +02:00
Add Podcast RSS feeds (#5487) * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Add correct feed image to RSS channel * Prefer HLS videos for podcast RSS Remove video/stream titles, add optional height attribute to podcast RSS * Prefix podcast RSS images with root server URL * Add optional video query support to include captions * Add transcripts & person images to podcast RSS feed * Prefer webseed/webtorrent files over HLS fragmented mp4s * Experimentally adding podcast fields to basic config page * Add validation for new basic config fields * Don't include "content" in podcast feed, use full description for "description" * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Add correct feed image to RSS channel * Prefer HLS videos for podcast RSS Remove video/stream titles, add optional height attribute to podcast RSS * Prefix podcast RSS images with root server URL * Add optional video query support to include captions * Add transcripts & person images to podcast RSS feed * Prefer webseed/webtorrent files over HLS fragmented mp4s * Experimentally adding podcast fields to basic config page * Add validation for new basic config fields * Don't include "content" in podcast feed, use full description for "description" * Add medium/socialInteract to podcast RSS feeds. Use HTML for description * Change base production image to bullseye, install prosody in image * Add liveItem and trackers to Podcast RSS feeds Remove height from alternateEnclosure, replaced with title. * Clear Podcast RSS feed cache when live streams start/end * Upgrade to Node 16 * Refactor clearCacheRoute to use ApiCache * Remove unnecessary type hint * Update dockerfile to node 16, install python-is-python2 * Use new file paths for captions/playlists * Fix legacy videos in RSS after migration to object storage * Improve method of identifying non-fragmented mp4s in podcast RSS feeds * Don't include fragmented MP4s in podcast RSS feeds * Add experimental support for podcast:categories on the podcast RSS item * Fix undefined category when no videos exist Allows for empty feeds to exist (important for feeds that might only go live) * Add support for podcast:locked -- user has to opt in to show their email * Use comma for podcast:categories delimiter * Make cache clearing async * Fix merge, temporarily test with pfeed-podcast * Syntax changes * Add EXT_MIMETYPE constants for captions * Update & fix tests, fix enclosure mimetypes, remove admin email * Add test for podacst:socialInteract * Add filters hooks for podcast customTags * Remove showdown, updated to pfeed-podcast 6.1.2 * Add 'action:api.live-video.state.updated' hook * Avoid assigning undefined category to podcast feeds * Remove nvmrc * Remove comment * Remove unused podcast config * Remove more unused podcast config * Fix MChannelAccountDefault type hint missed in merge * Remove extra line * Re-add newline in config * Fix lint errors for isEmailPublic * Fix thumbnails in podcast feeds * Requested changes based on review * Provide podcast rss 2.0 only on video channels * Misc cleanup for a less messy PR * Lint fixes * Remove pfeed-podcast * Add peertube version to new hooks * Don't use query include, remove TODO * Remove film medium hack * Clear podcast rss cache before video/channel update hooks * Clear podcast rss cache before video uploaded/deleted hooks * Refactor podcast feed cache clearing * Set correct person name from video channel * Styling * Fix tests --------- Co-authored-by: Chocobozzz <me@florianbigard.com>
2023-05-22 16:00:05 +02:00
// Avoid error when running this method on MAccount... | MChannel...
getClientUrl (this: MAccountHost | MChannelHost) {
return WEBSERVER.URL + '/a/' + this.Actor.getIdentifier() + '/video-channels'
}
2019-07-31 15:57:32 +02:00
isBlocked () {
return this.BlockedBy && this.BlockedBy.length !== 0
2019-07-31 15:57:32 +02:00
}
}