Lock off public HTML
This commit is contained in:
parent
acec9de658
commit
83880096b2
1 changed files with 22 additions and 0 deletions
|
@ -432,6 +432,8 @@ export class ClientServerService {
|
||||||
|
|
||||||
// Atom
|
// Atom
|
||||||
fastify.get<{ Params: { user: string; } }>('/@:user.atom', async (request, reply) => {
|
fastify.get<{ Params: { user: string; } }>('/@:user.atom', async (request, reply) => {
|
||||||
|
if (this.config.secureApiMode) return await renderBase(reply);
|
||||||
|
|
||||||
const feed = await getFeed(request.params.user);
|
const feed = await getFeed(request.params.user);
|
||||||
|
|
||||||
if (feed) {
|
if (feed) {
|
||||||
|
@ -445,6 +447,8 @@ export class ClientServerService {
|
||||||
|
|
||||||
// RSS
|
// RSS
|
||||||
fastify.get<{ Params: { user: string; } }>('/@:user.rss', async (request, reply) => {
|
fastify.get<{ Params: { user: string; } }>('/@:user.rss', async (request, reply) => {
|
||||||
|
if (this.config.secureApiMode) return await renderBase(reply);
|
||||||
|
|
||||||
const feed = await getFeed(request.params.user);
|
const feed = await getFeed(request.params.user);
|
||||||
|
|
||||||
if (feed) {
|
if (feed) {
|
||||||
|
@ -458,6 +462,8 @@ export class ClientServerService {
|
||||||
|
|
||||||
// JSON
|
// JSON
|
||||||
fastify.get<{ Params: { user: string; } }>('/@:user.json', async (request, reply) => {
|
fastify.get<{ Params: { user: string; } }>('/@:user.json', async (request, reply) => {
|
||||||
|
if (this.config.secureApiMode) return await renderBase(reply);
|
||||||
|
|
||||||
const feed = await getFeed(request.params.user);
|
const feed = await getFeed(request.params.user);
|
||||||
|
|
||||||
if (feed) {
|
if (feed) {
|
||||||
|
@ -472,6 +478,8 @@ export class ClientServerService {
|
||||||
//#region SSR (for crawlers)
|
//#region SSR (for crawlers)
|
||||||
// User
|
// User
|
||||||
fastify.get<{ Params: { user: string; sub?: string; } }>('/@:user/:sub?', async (request, reply) => {
|
fastify.get<{ Params: { user: string; sub?: string; } }>('/@:user/:sub?', async (request, reply) => {
|
||||||
|
if (this.config.secureApiMode) return await renderBase(reply);
|
||||||
|
|
||||||
const { username, host } = Acct.parse(request.params.user);
|
const { username, host } = Acct.parse(request.params.user);
|
||||||
const user = await this.usersRepository.findOneBy({
|
const user = await this.usersRepository.findOneBy({
|
||||||
usernameLower: username.toLowerCase(),
|
usernameLower: username.toLowerCase(),
|
||||||
|
@ -507,6 +515,8 @@ export class ClientServerService {
|
||||||
});
|
});
|
||||||
|
|
||||||
fastify.get<{ Params: { user: string; } }>('/users/:user', async (request, reply) => {
|
fastify.get<{ Params: { user: string; } }>('/users/:user', async (request, reply) => {
|
||||||
|
if (this.config.secureApiMode) return await renderBase(reply);
|
||||||
|
|
||||||
const user = await this.usersRepository.findOneBy({
|
const user = await this.usersRepository.findOneBy({
|
||||||
id: request.params.user,
|
id: request.params.user,
|
||||||
host: IsNull(),
|
host: IsNull(),
|
||||||
|
@ -523,6 +533,8 @@ export class ClientServerService {
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
fastify.get<{ Params: { note: string; } }>('/notes/:note', async (request, reply) => {
|
fastify.get<{ Params: { note: string; } }>('/notes/:note', async (request, reply) => {
|
||||||
|
if (this.config.secureApiMode) return await renderBase(reply);
|
||||||
|
|
||||||
vary(reply.raw, 'Accept');
|
vary(reply.raw, 'Accept');
|
||||||
|
|
||||||
const note = await this.notesRepository.findOneBy({
|
const note = await this.notesRepository.findOneBy({
|
||||||
|
@ -554,6 +566,8 @@ export class ClientServerService {
|
||||||
|
|
||||||
// Page
|
// Page
|
||||||
fastify.get<{ Params: { user: string; page: string; } }>('/@:user/pages/:page', async (request, reply) => {
|
fastify.get<{ Params: { user: string; page: string; } }>('/@:user/pages/:page', async (request, reply) => {
|
||||||
|
if (this.config.secureApiMode) return await renderBase(reply);
|
||||||
|
|
||||||
const { username, host } = Acct.parse(request.params.user);
|
const { username, host } = Acct.parse(request.params.user);
|
||||||
const user = await this.usersRepository.findOneBy({
|
const user = await this.usersRepository.findOneBy({
|
||||||
usernameLower: username.toLowerCase(),
|
usernameLower: username.toLowerCase(),
|
||||||
|
@ -593,6 +607,8 @@ export class ClientServerService {
|
||||||
|
|
||||||
// Flash
|
// Flash
|
||||||
fastify.get<{ Params: { id: string; } }>('/play/:id', async (request, reply) => {
|
fastify.get<{ Params: { id: string; } }>('/play/:id', async (request, reply) => {
|
||||||
|
if (this.config.secureApiMode) return await renderBase(reply);
|
||||||
|
|
||||||
const flash = await this.flashsRepository.findOneBy({
|
const flash = await this.flashsRepository.findOneBy({
|
||||||
id: request.params.id,
|
id: request.params.id,
|
||||||
});
|
});
|
||||||
|
@ -619,6 +635,8 @@ export class ClientServerService {
|
||||||
|
|
||||||
// Clip
|
// Clip
|
||||||
fastify.get<{ Params: { clip: string; } }>('/clips/:clip', async (request, reply) => {
|
fastify.get<{ Params: { clip: string; } }>('/clips/:clip', async (request, reply) => {
|
||||||
|
if (this.config.secureApiMode) return await renderBase(reply);
|
||||||
|
|
||||||
const clip = await this.clipsRepository.findOneBy({
|
const clip = await this.clipsRepository.findOneBy({
|
||||||
id: request.params.clip,
|
id: request.params.clip,
|
||||||
});
|
});
|
||||||
|
@ -645,6 +663,8 @@ export class ClientServerService {
|
||||||
|
|
||||||
// Gallery post
|
// Gallery post
|
||||||
fastify.get<{ Params: { post: string; } }>('/gallery/:post', async (request, reply) => {
|
fastify.get<{ Params: { post: string; } }>('/gallery/:post', async (request, reply) => {
|
||||||
|
if (this.config.secureApiMode) return await renderBase(reply);
|
||||||
|
|
||||||
const post = await this.galleryPostsRepository.findOneBy({ id: request.params.post });
|
const post = await this.galleryPostsRepository.findOneBy({ id: request.params.post });
|
||||||
|
|
||||||
if (post) {
|
if (post) {
|
||||||
|
@ -669,6 +689,8 @@ export class ClientServerService {
|
||||||
|
|
||||||
// Channel
|
// Channel
|
||||||
fastify.get<{ Params: { channel: string; } }>('/channels/:channel', async (request, reply) => {
|
fastify.get<{ Params: { channel: string; } }>('/channels/:channel', async (request, reply) => {
|
||||||
|
if (this.config.secureApiMode) return await renderBase(reply);
|
||||||
|
|
||||||
const channel = await this.channelsRepository.findOneBy({
|
const channel = await this.channelsRepository.findOneBy({
|
||||||
id: request.params.channel,
|
id: request.params.channel,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue