add X-Robots-Tag: noai
This commit is contained in:
parent
0c4c4e7202
commit
7ae1d6511a
|
@ -35,8 +35,8 @@ import { RoleService } from '@/core/RoleService.js';
|
||||||
import manifest from './manifest.json' assert { type: 'json' };
|
import manifest from './manifest.json' assert { type: 'json' };
|
||||||
import { FeedService } from './FeedService.js';
|
import { FeedService } from './FeedService.js';
|
||||||
import { UrlPreviewService } from './UrlPreviewService.js';
|
import { UrlPreviewService } from './UrlPreviewService.js';
|
||||||
import type { FastifyInstance, FastifyPluginOptions, FastifyReply } from 'fastify';
|
|
||||||
import { ClientLoggerService } from './ClientLoggerService.js';
|
import { ClientLoggerService } from './ClientLoggerService.js';
|
||||||
|
import type { FastifyInstance, FastifyPluginOptions, FastifyReply } from 'fastify';
|
||||||
|
|
||||||
const _filename = fileURLToPath(import.meta.url);
|
const _filename = fileURLToPath(import.meta.url);
|
||||||
const _dirname = dirname(_filename);
|
const _dirname = dirname(_filename);
|
||||||
|
@ -423,6 +423,10 @@ export class ClientServerService {
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
reply.header('Cache-Control', 'public, max-age=15');
|
reply.header('Cache-Control', 'public, max-age=15');
|
||||||
|
if (profile.preventAiLarning) {
|
||||||
|
reply.header('X-Robots-Tag', 'noimageai');
|
||||||
|
reply.header('X-Robots-Tag', 'noai');
|
||||||
|
}
|
||||||
return await reply.view('user', {
|
return await reply.view('user', {
|
||||||
user, profile, me,
|
user, profile, me,
|
||||||
avatarUrl: user.avatarUrl ?? this.userEntityService.getIdenticonUrl(user),
|
avatarUrl: user.avatarUrl ?? this.userEntityService.getIdenticonUrl(user),
|
||||||
|
@ -467,6 +471,10 @@ export class ClientServerService {
|
||||||
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: note.userId });
|
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: note.userId });
|
||||||
const meta = await this.metaService.fetch();
|
const meta = await this.metaService.fetch();
|
||||||
reply.header('Cache-Control', 'public, max-age=15');
|
reply.header('Cache-Control', 'public, max-age=15');
|
||||||
|
if (profile.preventAiLarning) {
|
||||||
|
reply.header('X-Robots-Tag', 'noimageai');
|
||||||
|
reply.header('X-Robots-Tag', 'noai');
|
||||||
|
}
|
||||||
return await reply.view('note', {
|
return await reply.view('note', {
|
||||||
note: _note,
|
note: _note,
|
||||||
profile,
|
profile,
|
||||||
|
@ -506,6 +514,10 @@ export class ClientServerService {
|
||||||
} else {
|
} else {
|
||||||
reply.header('Cache-Control', 'private, max-age=0, must-revalidate');
|
reply.header('Cache-Control', 'private, max-age=0, must-revalidate');
|
||||||
}
|
}
|
||||||
|
if (profile.preventAiLarning) {
|
||||||
|
reply.header('X-Robots-Tag', 'noimageai');
|
||||||
|
reply.header('X-Robots-Tag', 'noai');
|
||||||
|
}
|
||||||
return await reply.view('page', {
|
return await reply.view('page', {
|
||||||
page: _page,
|
page: _page,
|
||||||
profile,
|
profile,
|
||||||
|
@ -530,6 +542,10 @@ export class ClientServerService {
|
||||||
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: flash.userId });
|
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: flash.userId });
|
||||||
const meta = await this.metaService.fetch();
|
const meta = await this.metaService.fetch();
|
||||||
reply.header('Cache-Control', 'public, max-age=15');
|
reply.header('Cache-Control', 'public, max-age=15');
|
||||||
|
if (profile.preventAiLarning) {
|
||||||
|
reply.header('X-Robots-Tag', 'noimageai');
|
||||||
|
reply.header('X-Robots-Tag', 'noai');
|
||||||
|
}
|
||||||
return await reply.view('flash', {
|
return await reply.view('flash', {
|
||||||
flash: _flash,
|
flash: _flash,
|
||||||
profile,
|
profile,
|
||||||
|
@ -554,6 +570,10 @@ export class ClientServerService {
|
||||||
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: clip.userId });
|
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: clip.userId });
|
||||||
const meta = await this.metaService.fetch();
|
const meta = await this.metaService.fetch();
|
||||||
reply.header('Cache-Control', 'public, max-age=15');
|
reply.header('Cache-Control', 'public, max-age=15');
|
||||||
|
if (profile.preventAiLarning) {
|
||||||
|
reply.header('X-Robots-Tag', 'noimageai');
|
||||||
|
reply.header('X-Robots-Tag', 'noai');
|
||||||
|
}
|
||||||
return await reply.view('clip', {
|
return await reply.view('clip', {
|
||||||
clip: _clip,
|
clip: _clip,
|
||||||
profile,
|
profile,
|
||||||
|
@ -576,6 +596,10 @@ export class ClientServerService {
|
||||||
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: post.userId });
|
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: post.userId });
|
||||||
const meta = await this.metaService.fetch();
|
const meta = await this.metaService.fetch();
|
||||||
reply.header('Cache-Control', 'public, max-age=15');
|
reply.header('Cache-Control', 'public, max-age=15');
|
||||||
|
if (profile.preventAiLarning) {
|
||||||
|
reply.header('X-Robots-Tag', 'noimageai');
|
||||||
|
reply.header('X-Robots-Tag', 'noai');
|
||||||
|
}
|
||||||
return await reply.view('gallery-post', {
|
return await reply.view('gallery-post', {
|
||||||
post: _post,
|
post: _post,
|
||||||
profile,
|
profile,
|
||||||
|
|
Loading…
Reference in New Issue