Fix sitemap URL for accounts and channels

pull/6026/head
Chocobozzz 2023-10-19 16:13:22 +02:00
parent 58daa2d97b
commit e731f4b724
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 5 additions and 12 deletions

View File

@ -61,17 +61,13 @@ async function getSitemap (req: express.Request, res: express.Response) {
async function getSitemapVideoChannelUrls () { async function getSitemapVideoChannelUrls () {
const rows = await VideoChannelModel.listLocalsForSitemap('createdAt') const rows = await VideoChannelModel.listLocalsForSitemap('createdAt')
return rows.map(channel => ({ return rows.map(channel => ({ url: channel.getClientUrl() }))
url: WEBSERVER.URL + '/video-channels/' + channel.Actor.preferredUsername
}))
} }
async function getSitemapAccountUrls () { async function getSitemapAccountUrls () {
const rows = await AccountModel.listLocalsForSitemap('createdAt') const rows = await AccountModel.listLocalsForSitemap('createdAt')
return rows.map(channel => ({ return rows.map(account => ({ url: account.getClientUrl() }))
url: WEBSERVER.URL + '/accounts/' + channel.Actor.preferredUsername
}))
} }
async function getSitemapLocalVideoUrls () { async function getSitemapLocalVideoUrls () {

View File

@ -23,9 +23,7 @@ import { isAccountDescriptionValid } from '../../helpers/custom-validators/accou
import { CONSTRAINTS_FIELDS, SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants.js' import { CONSTRAINTS_FIELDS, SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants.js'
import { sendDeleteActor } from '../../lib/activitypub/send/send-delete.js' import { sendDeleteActor } from '../../lib/activitypub/send/send-delete.js'
import { import {
MAccount, MAccount, MAccountAP,
MAccountActor,
MAccountAP,
MAccountDefault, MAccountDefault,
MAccountFormattable, MAccountFormattable,
MAccountHost, MAccountHost,
@ -390,7 +388,7 @@ export class AccountModel extends Model<Partial<AttributesOnly<AccountModel>>> {
return AccountModel.findOne(query) return AccountModel.findOne(query)
} }
static listLocalsForSitemap (sort: string): Promise<MAccountActor[]> { static listLocalsForSitemap (sort: string): Promise<MAccountHost[]> {
const query = { const query = {
attributes: [ ], attributes: [ ],
offset: 0, offset: 0,

View File

@ -34,7 +34,6 @@ import {
import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants.js' import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants.js'
import { sendDeleteActor } from '../../lib/activitypub/send/index.js' import { sendDeleteActor } from '../../lib/activitypub/send/index.js'
import { import {
MChannelActor,
MChannelAP, MChannelAP,
MChannelBannerAccountDefault, MChannelBannerAccountDefault,
MChannelFormattable, MChannelFormattable,
@ -500,7 +499,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel
} }
} }
static listLocalsForSitemap (sort: string): Promise<MChannelActor[]> { static listLocalsForSitemap (sort: string): Promise<MChannelHost[]> {
const query = { const query = {
attributes: [ ], attributes: [ ],
offset: 0, offset: 0,