rss json atomを隠した

This commit is contained in:
hijiki 2024-11-01 18:07:22 +09:00
parent b3fc2b484a
commit 1bfcdc45e8
3 changed files with 72 additions and 71 deletions

View File

@ -485,7 +485,7 @@ export class ClientServerService {
// URL preview endpoint
fastify.get<{ Querystring: { url: string; lang: string; } }>('/url', (request, reply) => this.urlPreviewService.handle(request, reply));
const getFeed = async (acct: string) => {
/* const getFeed = async (acct: string) => {
const { username, host } = Acct.parse(acct);
const user = await this.usersRepository.findOneBy({
usernameLower: username.toLowerCase(),
@ -496,7 +496,7 @@ export class ClientServerService {
return user && await this.feedService.packFeed(user);
};
// Atom
/* // Atom
fastify.get<{ Params: { user?: string; } }>('/@:user.atom', async (request, reply) => {
if (request.params.user == null) return await renderBase(reply);
@ -540,7 +540,7 @@ export class ClientServerService {
return;
}
});
*/
//#region SSR (for crawlers)
// User
fastify.get<{ Params: { user: string; sub?: string; } }>('/@:user/:sub?', async (request, reply) => {

View File

@ -41,11 +41,11 @@ export class FeedService {
@bindThis
public async packFeed(user: MiUser) {
const author = {
link: `${this.config.url}/@${user.username}`,
name: user.name ?? user.username,
};
// フィード生成を無効化
throw new Error("フィード生成は無効化されています");
// フィード生成のロジックはここでコメントアウトまたは削除します
/*
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
const notes = await this.notesRepository.find({
@ -92,5 +92,6 @@ export class FeedService {
}
return feed;
*/
}
}

View File

@ -133,13 +133,13 @@ describe('Webリソース', () => {
});
describe.each([
{ ext: 'rss', type: 'application/rss+xml; charset=utf-8' },
/* { ext: 'rss', type: 'application/rss+xml; charset=utf-8' },
{ ext: 'atom', type: 'application/atom+xml; charset=utf-8' },
{ ext: 'json', type: 'application/json; charset=utf-8' },
{ ext: 'json', type: 'application/json; charset=utf-8' },*/
])('/@:username.$ext', ({ ext, type }) => {
const path = (username: string): string => `/@${username}.${ext}`;
test('がGETできる。', async () => await ok({
/* test('GET', async () => await ok({
path: path(alice.username),
type,
}));
@ -161,7 +161,7 @@ describe('Webリソース', () => {
test('MFMを含まない。', async () => {
const content = await simpleGet(path(alice.username), "*/*", undefined, res => res.text());
const _body: unknown = content.body;
/* const _body: unknown = content.body;
// JSONフィードのときは改めて文字列化する
const body: string = typeof (_body) === "object" ? JSON.stringify(_body) : _body as string;
@ -169,7 +169,7 @@ describe('Webリソース', () => {
throw new Error("MFM shouldn't be included");
}
});
})
})*/
});
describe.each([{ path: '/api/foo' }])('$path', ({ path }) => {