summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-05-10 10:57:27 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-05-10 10:57:27 +0900
commit7ae1d6511a68ee8e11f17351a559f7dc1f651938 (patch)
treecd8e84cc29aa8ccb98846997ab7e501bf59eb1af
parent念のためnoimageaiもつける (diff)
downloadsharkey-7ae1d6511a68ee8e11f17351a559f7dc1f651938.tar.gz
sharkey-7ae1d6511a68ee8e11f17351a559f7dc1f651938.tar.bz2
sharkey-7ae1d6511a68ee8e11f17351a559f7dc1f651938.zip
add X-Robots-Tag: noai
-rw-r--r--packages/backend/src/server/web/ClientServerService.ts26
1 files changed, 25 insertions, 1 deletions
diff --git a/packages/backend/src/server/web/ClientServerService.ts b/packages/backend/src/server/web/ClientServerService.ts
index 50b23a0682..12369c927c 100644
--- a/packages/backend/src/server/web/ClientServerService.ts
+++ b/packages/backend/src/server/web/ClientServerService.ts
@@ -35,8 +35,8 @@ import { RoleService } from '@/core/RoleService.js';
import manifest from './manifest.json' assert { type: 'json' };
import { FeedService } from './FeedService.js';
import { UrlPreviewService } from './UrlPreviewService.js';
-import type { FastifyInstance, FastifyPluginOptions, FastifyReply } from 'fastify';
import { ClientLoggerService } from './ClientLoggerService.js';
+import type { FastifyInstance, FastifyPluginOptions, FastifyReply } from 'fastify';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
@@ -423,6 +423,10 @@ export class ClientServerService {
: [];
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', {
user, profile, me,
avatarUrl: user.avatarUrl ?? this.userEntityService.getIdenticonUrl(user),
@@ -467,6 +471,10 @@ export class ClientServerService {
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: note.userId });
const meta = await this.metaService.fetch();
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', {
note: _note,
profile,
@@ -506,6 +514,10 @@ export class ClientServerService {
} else {
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', {
page: _page,
profile,
@@ -530,6 +542,10 @@ export class ClientServerService {
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: flash.userId });
const meta = await this.metaService.fetch();
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', {
flash: _flash,
profile,
@@ -554,6 +570,10 @@ export class ClientServerService {
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: clip.userId });
const meta = await this.metaService.fetch();
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', {
clip: _clip,
profile,
@@ -576,6 +596,10 @@ export class ClientServerService {
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: post.userId });
const meta = await this.metaService.fetch();
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', {
post: _post,
profile,