follow up of 6c8f21b608
				
					
				
			This commit is contained in:
		@@ -8,7 +8,7 @@ import { IsNull } from 'typeorm';
 | 
			
		||||
import vary from 'vary';
 | 
			
		||||
import fastifyAccepts from '@fastify/accepts';
 | 
			
		||||
import { DI } from '@/di-symbols.js';
 | 
			
		||||
import type { UsersRepository } from '@/models/_.js';
 | 
			
		||||
import type { MiMeta, UsersRepository } from '@/models/_.js';
 | 
			
		||||
import type { Config } from '@/config.js';
 | 
			
		||||
import { escapeAttribute, escapeValue } from '@/misc/prelude/xml.js';
 | 
			
		||||
import type { MiUser } from '@/models/User.js';
 | 
			
		||||
@@ -26,6 +26,9 @@ export class WellKnownServerService {
 | 
			
		||||
		@Inject(DI.config)
 | 
			
		||||
		private config: Config,
 | 
			
		||||
 | 
			
		||||
		@Inject(DI.meta)
 | 
			
		||||
		private meta: MiMeta,
 | 
			
		||||
 | 
			
		||||
		@Inject(DI.usersRepository)
 | 
			
		||||
		private usersRepository: UsersRepository,
 | 
			
		||||
 | 
			
		||||
@@ -66,6 +69,11 @@ export class WellKnownServerService {
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		fastify.get('/.well-known/host-meta', async (request, reply) => {
 | 
			
		||||
			if (this.meta.federation === 'none') {
 | 
			
		||||
				reply.code(403);
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			reply.header('Content-Type', xrd);
 | 
			
		||||
			return XRD({ element: 'Link', attributes: {
 | 
			
		||||
				rel: 'lrdd',
 | 
			
		||||
@@ -75,6 +83,11 @@ export class WellKnownServerService {
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		fastify.get('/.well-known/host-meta.json', async (request, reply) => {
 | 
			
		||||
			if (this.meta.federation === 'none') {
 | 
			
		||||
				reply.code(403);
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			reply.header('Content-Type', 'application/json');
 | 
			
		||||
			return {
 | 
			
		||||
				links: [{
 | 
			
		||||
@@ -86,6 +99,11 @@ export class WellKnownServerService {
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		fastify.get('/.well-known/nodeinfo', async (request, reply) => {
 | 
			
		||||
			if (this.meta.federation === 'none') {
 | 
			
		||||
				reply.code(403);
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			return { links: this.nodeinfoServerService.getLinks() };
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
@@ -99,6 +117,11 @@ fastify.get('/.well-known/change-password', async (request, reply) => {
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
		fastify.get<{ Querystring: { resource: string } }>(webFingerPath, async (request, reply) => {
 | 
			
		||||
			if (this.meta.federation === 'none') {
 | 
			
		||||
				reply.code(403);
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			const fromId = (id: MiUser['id']): FindOptionsWhere<MiUser> => ({
 | 
			
		||||
				id,
 | 
			
		||||
				host: IsNull(),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user