mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00:00 
			
		
		
		
	add: Bot Trending Toggle, Hide Bot in Timeline client option
This commit is contained in:
		
							parent
							
								
									fa5cf36602
								
							
						
					
					
						commit
						c21d255604
					
				
					 19 changed files with 90 additions and 1 deletions
				
			
		
							
								
								
									
										16
									
								
								packages/backend/migration/1697603945000-BotTrending.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								packages/backend/migration/1697603945000-BotTrending.js
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,16 @@
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * SPDX-FileCopyrightText: syuilo and other misskey contributors
 | 
				
			||||||
 | 
					 * SPDX-License-Identifier: AGPL-3.0-only
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export class BotTrending1697603945000 {
 | 
				
			||||||
 | 
					    name = 'BotTrending1697603945000'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    async up(queryRunner) {
 | 
				
			||||||
 | 
					        await queryRunner.query(`ALTER TABLE "meta" ADD "enableBotTrending" boolean NOT NULL DEFAULT true`);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    async down(queryRunner) {
 | 
				
			||||||
 | 
					        await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "enableBotTrending"`);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -511,7 +511,11 @@ export class NoteCreateService implements OnApplicationShutdown {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// ハッシュタグ更新
 | 
							// ハッシュタグ更新
 | 
				
			||||||
		if (data.visibility === 'public' || data.visibility === 'home') {
 | 
							if (data.visibility === 'public' || data.visibility === 'home') {
 | 
				
			||||||
			this.hashtagService.updateHashtags(user, tags);
 | 
								if (user.isBot && meta.enableBotTrending) {
 | 
				
			||||||
 | 
									this.hashtagService.updateHashtags(user, tags);
 | 
				
			||||||
 | 
								} else if (!user.isBot) {
 | 
				
			||||||
 | 
									this.hashtagService.updateHashtags(user, tags);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Increment notes count (user)
 | 
							// Increment notes count (user)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -247,6 +247,11 @@ export class MiMeta {
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
	public enableSensitiveMediaDetectionForVideos: boolean;
 | 
						public enableSensitiveMediaDetectionForVideos: boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Column('boolean', {
 | 
				
			||||||
 | 
							default: false,
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
						public enableBotTrending: boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Column('varchar', {
 | 
						@Column('varchar', {
 | 
				
			||||||
		length: 1024,
 | 
							length: 1024,
 | 
				
			||||||
		nullable: true,
 | 
							nullable: true,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -178,6 +178,10 @@ export const meta = {
 | 
				
			||||||
				type: 'boolean',
 | 
									type: 'boolean',
 | 
				
			||||||
				optional: false, nullable: false,
 | 
									optional: false, nullable: false,
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
 | 
								enableBotTrending: {
 | 
				
			||||||
 | 
									type: 'boolean',
 | 
				
			||||||
 | 
									optional: false, nullable: false,
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
			proxyAccountId: {
 | 
								proxyAccountId: {
 | 
				
			||||||
				type: 'string',
 | 
									type: 'string',
 | 
				
			||||||
				optional: false, nullable: true,
 | 
									optional: false, nullable: true,
 | 
				
			||||||
| 
						 | 
					@ -391,6 +395,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
				sensitiveMediaDetectionSensitivity: instance.sensitiveMediaDetectionSensitivity,
 | 
									sensitiveMediaDetectionSensitivity: instance.sensitiveMediaDetectionSensitivity,
 | 
				
			||||||
				setSensitiveFlagAutomatically: instance.setSensitiveFlagAutomatically,
 | 
									setSensitiveFlagAutomatically: instance.setSensitiveFlagAutomatically,
 | 
				
			||||||
				enableSensitiveMediaDetectionForVideos: instance.enableSensitiveMediaDetectionForVideos,
 | 
									enableSensitiveMediaDetectionForVideos: instance.enableSensitiveMediaDetectionForVideos,
 | 
				
			||||||
 | 
									enableBotTrending: instance.enableBotTrending,
 | 
				
			||||||
				proxyAccountId: instance.proxyAccountId,
 | 
									proxyAccountId: instance.proxyAccountId,
 | 
				
			||||||
				summalyProxy: instance.summalyProxy,
 | 
									summalyProxy: instance.summalyProxy,
 | 
				
			||||||
				email: instance.email,
 | 
									email: instance.email,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,6 +72,7 @@ export const paramDef = {
 | 
				
			||||||
		sensitiveMediaDetectionSensitivity: { type: 'string', enum: ['medium', 'low', 'high', 'veryLow', 'veryHigh'] },
 | 
							sensitiveMediaDetectionSensitivity: { type: 'string', enum: ['medium', 'low', 'high', 'veryLow', 'veryHigh'] },
 | 
				
			||||||
		setSensitiveFlagAutomatically: { type: 'boolean' },
 | 
							setSensitiveFlagAutomatically: { type: 'boolean' },
 | 
				
			||||||
		enableSensitiveMediaDetectionForVideos: { type: 'boolean' },
 | 
							enableSensitiveMediaDetectionForVideos: { type: 'boolean' },
 | 
				
			||||||
 | 
							enableBotTrending: { type: 'boolean' },
 | 
				
			||||||
		proxyAccountId: { type: 'string', format: 'misskey:id', nullable: true },
 | 
							proxyAccountId: { type: 'string', format: 'misskey:id', nullable: true },
 | 
				
			||||||
		maintainerName: { type: 'string', nullable: true },
 | 
							maintainerName: { type: 'string', nullable: true },
 | 
				
			||||||
		maintainerEmail: { type: 'string', nullable: true },
 | 
							maintainerEmail: { type: 'string', nullable: true },
 | 
				
			||||||
| 
						 | 
					@ -301,6 +302,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
				set.enableSensitiveMediaDetectionForVideos = ps.enableSensitiveMediaDetectionForVideos;
 | 
									set.enableSensitiveMediaDetectionForVideos = ps.enableSensitiveMediaDetectionForVideos;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (ps.enableBotTrending !== undefined) {
 | 
				
			||||||
 | 
									set.enableBotTrending = ps.enableBotTrending;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (ps.proxyAccountId !== undefined) {
 | 
								if (ps.proxyAccountId !== undefined) {
 | 
				
			||||||
				set.proxyAccountId = ps.proxyAccountId;
 | 
									set.proxyAccountId = ps.proxyAccountId;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,6 +40,7 @@ export const paramDef = {
 | 
				
			||||||
	type: 'object',
 | 
						type: 'object',
 | 
				
			||||||
	properties: {
 | 
						properties: {
 | 
				
			||||||
		withFiles: { type: 'boolean', default: false },
 | 
							withFiles: { type: 'boolean', default: false },
 | 
				
			||||||
 | 
							withBots: { type: 'boolean', default: true },
 | 
				
			||||||
		withRenotes: { type: 'boolean', default: true },
 | 
							withRenotes: { type: 'boolean', default: true },
 | 
				
			||||||
		limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
 | 
							limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
 | 
				
			||||||
		sinceId: { type: 'string', format: 'misskey:id' },
 | 
							sinceId: { type: 'string', format: 'misskey:id' },
 | 
				
			||||||
| 
						 | 
					@ -87,6 +88,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
			if (ps.withFiles) {
 | 
								if (ps.withFiles) {
 | 
				
			||||||
				query.andWhere('note.fileIds != \'{}\'');
 | 
									query.andWhere('note.fileIds != \'{}\'');
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (!ps.withBots) query.andWhere('user.isBot = FALSE');
 | 
				
			||||||
			//#endregion
 | 
								//#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			const timeline = await query.limit(ps.limit).getMany();
 | 
								const timeline = await query.limit(ps.limit).getMany();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,6 +56,7 @@ export const paramDef = {
 | 
				
			||||||
		withFiles: { type: 'boolean', default: false },
 | 
							withFiles: { type: 'boolean', default: false },
 | 
				
			||||||
		withRenotes: { type: 'boolean', default: true },
 | 
							withRenotes: { type: 'boolean', default: true },
 | 
				
			||||||
		withReplies: { type: 'boolean', default: false },
 | 
							withReplies: { type: 'boolean', default: false },
 | 
				
			||||||
 | 
							withBots: { type: 'boolean', default: true },
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	required: [],
 | 
						required: [],
 | 
				
			||||||
} as const;
 | 
					} as const;
 | 
				
			||||||
| 
						 | 
					@ -134,6 +135,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
				.leftJoinAndSelect('renote.user', 'renoteUser')
 | 
									.leftJoinAndSelect('renote.user', 'renoteUser')
 | 
				
			||||||
				.leftJoinAndSelect('note.channel', 'channel');
 | 
									.leftJoinAndSelect('note.channel', 'channel');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (!ps.withBots) query.andWhere('user.isBot = FALSE');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			let timeline = await query.getMany();
 | 
								let timeline = await query.getMany();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			timeline = timeline.filter(note => {
 | 
								timeline = timeline.filter(note => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,6 +46,7 @@ export const paramDef = {
 | 
				
			||||||
		withFiles: { type: 'boolean', default: false },
 | 
							withFiles: { type: 'boolean', default: false },
 | 
				
			||||||
		withRenotes: { type: 'boolean', default: true },
 | 
							withRenotes: { type: 'boolean', default: true },
 | 
				
			||||||
		withReplies: { type: 'boolean', default: false },
 | 
							withReplies: { type: 'boolean', default: false },
 | 
				
			||||||
 | 
							withBots: { type: 'boolean', default: true },
 | 
				
			||||||
		excludeNsfw: { type: 'boolean', default: false },
 | 
							excludeNsfw: { type: 'boolean', default: false },
 | 
				
			||||||
		limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
 | 
							limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
 | 
				
			||||||
		sinceId: { type: 'string', format: 'misskey:id' },
 | 
							sinceId: { type: 'string', format: 'misskey:id' },
 | 
				
			||||||
| 
						 | 
					@ -119,6 +120,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
				.leftJoinAndSelect('renote.user', 'renoteUser')
 | 
									.leftJoinAndSelect('renote.user', 'renoteUser')
 | 
				
			||||||
				.leftJoinAndSelect('note.channel', 'channel');
 | 
									.leftJoinAndSelect('note.channel', 'channel');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (!ps.withBots) query.andWhere('user.isBot = FALSE');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			let timeline = await query.getMany();
 | 
								let timeline = await query.getMany();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			timeline = timeline.filter(note => {
 | 
								timeline = timeline.filter(note => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
 | 
				
			||||||
import { QueryService } from '@/core/QueryService.js';
 | 
					import { QueryService } from '@/core/QueryService.js';
 | 
				
			||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
 | 
					import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
 | 
				
			||||||
import { DI } from '@/di-symbols.js';
 | 
					import { DI } from '@/di-symbols.js';
 | 
				
			||||||
 | 
					import { MetaService } from '@/core/MetaService.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const meta = {
 | 
					export const meta = {
 | 
				
			||||||
	tags: ['notes', 'hashtags'],
 | 
						tags: ['notes', 'hashtags'],
 | 
				
			||||||
| 
						 | 
					@ -71,6 +72,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		private noteEntityService: NoteEntityService,
 | 
							private noteEntityService: NoteEntityService,
 | 
				
			||||||
		private queryService: QueryService,
 | 
							private queryService: QueryService,
 | 
				
			||||||
 | 
							private metaService: MetaService,
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(meta, paramDef, async (ps, me) => {
 | 
							super(meta, paramDef, async (ps, me) => {
 | 
				
			||||||
			const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId)
 | 
								const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId)
 | 
				
			||||||
| 
						 | 
					@ -80,6 +82,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
				.leftJoinAndSelect('reply.user', 'replyUser')
 | 
									.leftJoinAndSelect('reply.user', 'replyUser')
 | 
				
			||||||
				.leftJoinAndSelect('renote.user', 'renoteUser');
 | 
									.leftJoinAndSelect('renote.user', 'renoteUser');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								const meta = await this.metaService.fetch(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (!meta.enableBotTrending) query.andWhere('user.isBot = FALSE');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			this.queryService.generateVisibilityQuery(query, me);
 | 
								this.queryService.generateVisibilityQuery(query, me);
 | 
				
			||||||
			if (me) this.queryService.generateMutedUserQuery(query, me);
 | 
								if (me) this.queryService.generateMutedUserQuery(query, me);
 | 
				
			||||||
			if (me) this.queryService.generateBlockedUserQuery(query, me);
 | 
								if (me) this.queryService.generateBlockedUserQuery(query, me);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,6 +46,7 @@ export const paramDef = {
 | 
				
			||||||
		includeLocalRenotes: { type: 'boolean', default: true },
 | 
							includeLocalRenotes: { type: 'boolean', default: true },
 | 
				
			||||||
		withFiles: { type: 'boolean', default: false },
 | 
							withFiles: { type: 'boolean', default: false },
 | 
				
			||||||
		withRenotes: { type: 'boolean', default: true },
 | 
							withRenotes: { type: 'boolean', default: true },
 | 
				
			||||||
 | 
							withBots: { type: 'boolean', default: true },
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	required: [],
 | 
						required: [],
 | 
				
			||||||
} as const;
 | 
					} as const;
 | 
				
			||||||
| 
						 | 
					@ -97,6 +98,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
				.leftJoinAndSelect('renote.user', 'renoteUser')
 | 
									.leftJoinAndSelect('renote.user', 'renoteUser')
 | 
				
			||||||
				.leftJoinAndSelect('note.channel', 'channel');
 | 
									.leftJoinAndSelect('note.channel', 'channel');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (!ps.withBots) query.andWhere('user.isBot = FALSE');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			let timeline = await query.getMany();
 | 
								let timeline = await query.getMany();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			timeline = timeline.filter(note => {
 | 
								timeline = timeline.filter(note => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,7 @@ class GlobalTimelineChannel extends Channel {
 | 
				
			||||||
	public static requireCredential = false;
 | 
						public static requireCredential = false;
 | 
				
			||||||
	private withRenotes: boolean;
 | 
						private withRenotes: boolean;
 | 
				
			||||||
	private withFiles: boolean;
 | 
						private withFiles: boolean;
 | 
				
			||||||
 | 
						private withBots: boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private metaService: MetaService,
 | 
							private metaService: MetaService,
 | 
				
			||||||
| 
						 | 
					@ -40,6 +41,7 @@ class GlobalTimelineChannel extends Channel {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.withRenotes = params.withRenotes ?? true;
 | 
							this.withRenotes = params.withRenotes ?? true;
 | 
				
			||||||
		this.withFiles = params.withFiles ?? false;
 | 
							this.withFiles = params.withFiles ?? false;
 | 
				
			||||||
 | 
							this.withBots = params.withBots ?? true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Subscribe events
 | 
							// Subscribe events
 | 
				
			||||||
		this.subscriber.on('notesStream', this.onNote);
 | 
							this.subscriber.on('notesStream', this.onNote);
 | 
				
			||||||
| 
						 | 
					@ -48,6 +50,7 @@ class GlobalTimelineChannel extends Channel {
 | 
				
			||||||
	@bindThis
 | 
						@bindThis
 | 
				
			||||||
	private async onNote(note: Packed<'Note'>) {
 | 
						private async onNote(note: Packed<'Note'>) {
 | 
				
			||||||
		if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
 | 
							if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
 | 
				
			||||||
 | 
							if (!this.withBots && note.user.isBot) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (note.visibility !== 'public') return;
 | 
							if (note.visibility !== 'public') return;
 | 
				
			||||||
		if (note.channelId != null) return;
 | 
							if (note.channelId != null) return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,7 @@ class HybridTimelineChannel extends Channel {
 | 
				
			||||||
	public static requireCredential = true;
 | 
						public static requireCredential = true;
 | 
				
			||||||
	private withRenotes: boolean;
 | 
						private withRenotes: boolean;
 | 
				
			||||||
	private withReplies: boolean;
 | 
						private withReplies: boolean;
 | 
				
			||||||
 | 
						private withBots: boolean;
 | 
				
			||||||
	private withFiles: boolean;
 | 
						private withFiles: boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
| 
						 | 
					@ -41,6 +42,7 @@ class HybridTimelineChannel extends Channel {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.withRenotes = params.withRenotes ?? true;
 | 
							this.withRenotes = params.withRenotes ?? true;
 | 
				
			||||||
		this.withReplies = params.withReplies ?? false;
 | 
							this.withReplies = params.withReplies ?? false;
 | 
				
			||||||
 | 
							this.withBots = params.withBots ?? true;
 | 
				
			||||||
		this.withFiles = params.withFiles ?? false;
 | 
							this.withFiles = params.withFiles ?? false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Subscribe events
 | 
							// Subscribe events
 | 
				
			||||||
| 
						 | 
					@ -50,6 +52,7 @@ class HybridTimelineChannel extends Channel {
 | 
				
			||||||
	@bindThis
 | 
						@bindThis
 | 
				
			||||||
	private async onNote(note: Packed<'Note'>) {
 | 
						private async onNote(note: Packed<'Note'>) {
 | 
				
			||||||
		if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
 | 
							if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
 | 
				
			||||||
 | 
							if (!this.withBots && note.user.isBot) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// チャンネルの投稿ではなく、自分自身の投稿 または
 | 
							// チャンネルの投稿ではなく、自分自身の投稿 または
 | 
				
			||||||
		// チャンネルの投稿ではなく、その投稿のユーザーをフォローしている または
 | 
							// チャンネルの投稿ではなく、その投稿のユーザーをフォローしている または
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,7 @@ class LocalTimelineChannel extends Channel {
 | 
				
			||||||
	public static requireCredential = false;
 | 
						public static requireCredential = false;
 | 
				
			||||||
	private withRenotes: boolean;
 | 
						private withRenotes: boolean;
 | 
				
			||||||
	private withReplies: boolean;
 | 
						private withReplies: boolean;
 | 
				
			||||||
 | 
						private withBots: boolean;
 | 
				
			||||||
	private withFiles: boolean;
 | 
						private withFiles: boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
| 
						 | 
					@ -40,6 +41,7 @@ class LocalTimelineChannel extends Channel {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.withRenotes = params.withRenotes ?? true;
 | 
							this.withRenotes = params.withRenotes ?? true;
 | 
				
			||||||
		this.withReplies = params.withReplies ?? false;
 | 
							this.withReplies = params.withReplies ?? false;
 | 
				
			||||||
 | 
							this.withBots = params.withBots ?? true;
 | 
				
			||||||
		this.withFiles = params.withFiles ?? false;
 | 
							this.withFiles = params.withFiles ?? false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Subscribe events
 | 
							// Subscribe events
 | 
				
			||||||
| 
						 | 
					@ -49,6 +51,7 @@ class LocalTimelineChannel extends Channel {
 | 
				
			||||||
	@bindThis
 | 
						@bindThis
 | 
				
			||||||
	private async onNote(note: Packed<'Note'>) {
 | 
						private async onNote(note: Packed<'Note'>) {
 | 
				
			||||||
		if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
 | 
							if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
 | 
				
			||||||
 | 
							if (!this.withBots && note.user.isBot) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (note.user.host !== null) return;
 | 
							if (note.user.host !== null) return;
 | 
				
			||||||
		if (note.visibility !== 'public') return;
 | 
							if (note.visibility !== 'public') return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,11 +25,13 @@ const props = withDefaults(defineProps<{
 | 
				
			||||||
	sound?: boolean;
 | 
						sound?: boolean;
 | 
				
			||||||
	withRenotes?: boolean;
 | 
						withRenotes?: boolean;
 | 
				
			||||||
	withReplies?: boolean;
 | 
						withReplies?: boolean;
 | 
				
			||||||
 | 
						withBots?: boolean;
 | 
				
			||||||
	onlyFiles?: boolean;
 | 
						onlyFiles?: boolean;
 | 
				
			||||||
}>(), {
 | 
					}>(), {
 | 
				
			||||||
	withRenotes: true,
 | 
						withRenotes: true,
 | 
				
			||||||
	withReplies: false,
 | 
						withReplies: false,
 | 
				
			||||||
	onlyFiles: false,
 | 
						onlyFiles: false,
 | 
				
			||||||
 | 
						withBots: true,
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const emit = defineEmits<{
 | 
					const emit = defineEmits<{
 | 
				
			||||||
| 
						 | 
					@ -93,11 +95,13 @@ if (props.src === 'antenna') {
 | 
				
			||||||
	query = {
 | 
						query = {
 | 
				
			||||||
		withRenotes: props.withRenotes,
 | 
							withRenotes: props.withRenotes,
 | 
				
			||||||
		withReplies: props.withReplies,
 | 
							withReplies: props.withReplies,
 | 
				
			||||||
 | 
							withBots: props.withBots,
 | 
				
			||||||
		withFiles: props.onlyFiles ? true : undefined,
 | 
							withFiles: props.onlyFiles ? true : undefined,
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	connection = stream.useChannel('localTimeline', {
 | 
						connection = stream.useChannel('localTimeline', {
 | 
				
			||||||
		withRenotes: props.withRenotes,
 | 
							withRenotes: props.withRenotes,
 | 
				
			||||||
		withReplies: props.withReplies,
 | 
							withReplies: props.withReplies,
 | 
				
			||||||
 | 
							withBots: props.withBots,
 | 
				
			||||||
		withFiles: props.onlyFiles ? true : undefined,
 | 
							withFiles: props.onlyFiles ? true : undefined,
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
	connection.on('note', prepend);
 | 
						connection.on('note', prepend);
 | 
				
			||||||
| 
						 | 
					@ -106,11 +110,13 @@ if (props.src === 'antenna') {
 | 
				
			||||||
	query = {
 | 
						query = {
 | 
				
			||||||
		withRenotes: props.withRenotes,
 | 
							withRenotes: props.withRenotes,
 | 
				
			||||||
		withReplies: props.withReplies,
 | 
							withReplies: props.withReplies,
 | 
				
			||||||
 | 
							withBots: props.withBots,
 | 
				
			||||||
		withFiles: props.onlyFiles ? true : undefined,
 | 
							withFiles: props.onlyFiles ? true : undefined,
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	connection = stream.useChannel('hybridTimeline', {
 | 
						connection = stream.useChannel('hybridTimeline', {
 | 
				
			||||||
		withRenotes: props.withRenotes,
 | 
							withRenotes: props.withRenotes,
 | 
				
			||||||
		withReplies: props.withReplies,
 | 
							withReplies: props.withReplies,
 | 
				
			||||||
 | 
							withBots: props.withBots,
 | 
				
			||||||
		withFiles: props.onlyFiles ? true : undefined,
 | 
							withFiles: props.onlyFiles ? true : undefined,
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
	connection.on('note', prepend);
 | 
						connection.on('note', prepend);
 | 
				
			||||||
| 
						 | 
					@ -118,10 +124,12 @@ if (props.src === 'antenna') {
 | 
				
			||||||
	endpoint = 'notes/global-timeline';
 | 
						endpoint = 'notes/global-timeline';
 | 
				
			||||||
	query = {
 | 
						query = {
 | 
				
			||||||
		withRenotes: props.withRenotes,
 | 
							withRenotes: props.withRenotes,
 | 
				
			||||||
 | 
							withBots: props.withBots,
 | 
				
			||||||
		withFiles: props.onlyFiles ? true : undefined,
 | 
							withFiles: props.onlyFiles ? true : undefined,
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	connection = stream.useChannel('globalTimeline', {
 | 
						connection = stream.useChannel('globalTimeline', {
 | 
				
			||||||
		withRenotes: props.withRenotes,
 | 
							withRenotes: props.withRenotes,
 | 
				
			||||||
 | 
							withBots: props.withBots,
 | 
				
			||||||
		withFiles: props.onlyFiles ? true : undefined,
 | 
							withFiles: props.onlyFiles ? true : undefined,
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
	connection.on('note', prepend);
 | 
						connection.on('note', prepend);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,6 +23,13 @@ SPDX-License-Identifier: AGPL-3.0-only
 | 
				
			||||||
					</MkSwitch>
 | 
										</MkSwitch>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									<div class="_panel" style="padding: 16px;">
 | 
				
			||||||
 | 
										<MkSwitch v-model="enableBotTrending">
 | 
				
			||||||
 | 
											<template #label>Populate Hashtags with Bots</template>
 | 
				
			||||||
 | 
											<template #caption>Turning this off will stop Bots from populating Hashtags</template>
 | 
				
			||||||
 | 
										</MkSwitch>
 | 
				
			||||||
 | 
									</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				<div class="_panel" style="padding: 16px;">
 | 
									<div class="_panel" style="padding: 16px;">
 | 
				
			||||||
					<MkSwitch v-model="enableIdenticonGeneration">
 | 
										<MkSwitch v-model="enableIdenticonGeneration">
 | 
				
			||||||
						<template #label>{{ i18n.ts.enableIdenticonGeneration }}</template>
 | 
											<template #label>{{ i18n.ts.enableIdenticonGeneration }}</template>
 | 
				
			||||||
| 
						 | 
					@ -61,6 +68,7 @@ import MkSwitch from '@/components/MkSwitch.vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let enableServerMachineStats: boolean = $ref(false);
 | 
					let enableServerMachineStats: boolean = $ref(false);
 | 
				
			||||||
let enableAchievements: boolean = $ref(false);
 | 
					let enableAchievements: boolean = $ref(false);
 | 
				
			||||||
 | 
					let enableBotTrending: boolean = $ref(false);
 | 
				
			||||||
let enableIdenticonGeneration: boolean = $ref(false);
 | 
					let enableIdenticonGeneration: boolean = $ref(false);
 | 
				
			||||||
let enableChartsForRemoteUser: boolean = $ref(false);
 | 
					let enableChartsForRemoteUser: boolean = $ref(false);
 | 
				
			||||||
let enableChartsForFederatedInstances: boolean = $ref(false);
 | 
					let enableChartsForFederatedInstances: boolean = $ref(false);
 | 
				
			||||||
| 
						 | 
					@ -69,6 +77,7 @@ async function init() {
 | 
				
			||||||
	const meta = await os.api('admin/meta');
 | 
						const meta = await os.api('admin/meta');
 | 
				
			||||||
	enableServerMachineStats = meta.enableServerMachineStats;
 | 
						enableServerMachineStats = meta.enableServerMachineStats;
 | 
				
			||||||
	enableAchievements = meta.enableAchievements;
 | 
						enableAchievements = meta.enableAchievements;
 | 
				
			||||||
 | 
						enableBotTrending = meta.enableBotTrending;
 | 
				
			||||||
	enableIdenticonGeneration = meta.enableIdenticonGeneration;
 | 
						enableIdenticonGeneration = meta.enableIdenticonGeneration;
 | 
				
			||||||
	enableChartsForRemoteUser = meta.enableChartsForRemoteUser;
 | 
						enableChartsForRemoteUser = meta.enableChartsForRemoteUser;
 | 
				
			||||||
	enableChartsForFederatedInstances = meta.enableChartsForFederatedInstances;
 | 
						enableChartsForFederatedInstances = meta.enableChartsForFederatedInstances;
 | 
				
			||||||
| 
						 | 
					@ -78,6 +87,7 @@ function save() {
 | 
				
			||||||
	os.apiWithDialog('admin/update-meta', {
 | 
						os.apiWithDialog('admin/update-meta', {
 | 
				
			||||||
		enableServerMachineStats,
 | 
							enableServerMachineStats,
 | 
				
			||||||
		enableAchievements,
 | 
							enableAchievements,
 | 
				
			||||||
 | 
							enableBotTrending,
 | 
				
			||||||
		enableIdenticonGeneration,
 | 
							enableIdenticonGeneration,
 | 
				
			||||||
		enableChartsForRemoteUser,
 | 
							enableChartsForRemoteUser,
 | 
				
			||||||
		enableChartsForFederatedInstances,
 | 
							enableChartsForFederatedInstances,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -152,6 +152,7 @@ SPDX-License-Identifier: AGPL-3.0-only
 | 
				
			||||||
				<MkSwitch v-model="enableInfiniteScroll">{{ i18n.ts.enableInfiniteScroll }}</MkSwitch>
 | 
									<MkSwitch v-model="enableInfiniteScroll">{{ i18n.ts.enableInfiniteScroll }}</MkSwitch>
 | 
				
			||||||
				<MkSwitch v-model="keepScreenOn">{{ i18n.ts.keepScreenOn }}</MkSwitch>
 | 
									<MkSwitch v-model="keepScreenOn">{{ i18n.ts.keepScreenOn }}</MkSwitch>
 | 
				
			||||||
				<MkSwitch v-model="clickToOpen">{{ i18n.ts.clickToOpen }}</MkSwitch>
 | 
									<MkSwitch v-model="clickToOpen">{{ i18n.ts.clickToOpen }}</MkSwitch>
 | 
				
			||||||
 | 
									<MkSwitch v-model="showBots">Show bots in timeline</MkSwitch>
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
			<MkSelect v-model="serverDisconnectedBehavior">
 | 
								<MkSelect v-model="serverDisconnectedBehavior">
 | 
				
			||||||
				<template #label>{{ i18n.ts.whenServerDisconnected }}</template>
 | 
									<template #label>{{ i18n.ts.whenServerDisconnected }}</template>
 | 
				
			||||||
| 
						 | 
					@ -227,6 +228,7 @@ const showClipButtonInNoteFooter = computed(defaultStore.makeGetterSetter('showC
 | 
				
			||||||
const reactionsDisplaySize = computed(defaultStore.makeGetterSetter('reactionsDisplaySize'));
 | 
					const reactionsDisplaySize = computed(defaultStore.makeGetterSetter('reactionsDisplaySize'));
 | 
				
			||||||
const collapseRenotes = computed(defaultStore.makeGetterSetter('collapseRenotes'));
 | 
					const collapseRenotes = computed(defaultStore.makeGetterSetter('collapseRenotes'));
 | 
				
			||||||
const clickToOpen = computed(defaultStore.makeGetterSetter('clickToOpen'));
 | 
					const clickToOpen = computed(defaultStore.makeGetterSetter('clickToOpen'));
 | 
				
			||||||
 | 
					const showBots = computed(defaultStore.makeGetterSetter('tlWithBots'));
 | 
				
			||||||
const collapseFiles = computed(defaultStore.makeGetterSetter('collapseFiles'));
 | 
					const collapseFiles = computed(defaultStore.makeGetterSetter('collapseFiles'));
 | 
				
			||||||
const autoloadConversation = computed(defaultStore.makeGetterSetter('autoloadConversation'));
 | 
					const autoloadConversation = computed(defaultStore.makeGetterSetter('autoloadConversation'));
 | 
				
			||||||
const reduceAnimation = computed(defaultStore.makeGetterSetter('animation', v => !v, v => !v));
 | 
					const reduceAnimation = computed(defaultStore.makeGetterSetter('animation', v => !v, v => !v));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only
 | 
				
			||||||
					:withRenotes="withRenotes"
 | 
										:withRenotes="withRenotes"
 | 
				
			||||||
					:withReplies="withReplies"
 | 
										:withReplies="withReplies"
 | 
				
			||||||
					:onlyFiles="onlyFiles"
 | 
										:onlyFiles="onlyFiles"
 | 
				
			||||||
 | 
										:withBots="withBots"
 | 
				
			||||||
					:sound="true"
 | 
										:sound="true"
 | 
				
			||||||
					@queue="queueUpdated"
 | 
										@queue="queueUpdated"
 | 
				
			||||||
				/>
 | 
									/>
 | 
				
			||||||
| 
						 | 
					@ -63,6 +64,7 @@ let srcWhenNotSignin = $ref(isLocalTimelineAvailable ? 'local' : 'global');
 | 
				
			||||||
const src = $computed({ get: () => ($i ? defaultStore.reactiveState.tl.value.src : srcWhenNotSignin), set: (x) => saveSrc(x) });
 | 
					const src = $computed({ get: () => ($i ? defaultStore.reactiveState.tl.value.src : srcWhenNotSignin), set: (x) => saveSrc(x) });
 | 
				
			||||||
const withRenotes = $ref(true);
 | 
					const withRenotes = $ref(true);
 | 
				
			||||||
const withReplies = $ref($i ? defaultStore.state.tlWithReplies : false);
 | 
					const withReplies = $ref($i ? defaultStore.state.tlWithReplies : false);
 | 
				
			||||||
 | 
					const withBots = $ref($i ? defaultStore.state.tlWithBots : true);
 | 
				
			||||||
const onlyFiles = $ref(false);
 | 
					const onlyFiles = $ref(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
watch($$(src), () => queue = 0);
 | 
					watch($$(src), () => queue = 0);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -373,6 +373,10 @@ export const defaultStore = markRaw(new Storage('base', {
 | 
				
			||||||
		where: 'device',
 | 
							where: 'device',
 | 
				
			||||||
		default: false,
 | 
							default: false,
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
						tlWithBots: {
 | 
				
			||||||
 | 
							where: 'device',
 | 
				
			||||||
 | 
							default: true,
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
}));
 | 
					}));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO: 他のタブと永続化されたstateを同期
 | 
					// TODO: 他のタブと永続化されたstateを同期
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -405,6 +405,7 @@ export type AdminInstanceMetadata = DetailedInstanceMetadata & {
 | 
				
			||||||
	app192IconUrl: string | null;
 | 
						app192IconUrl: string | null;
 | 
				
			||||||
	app512IconUrl: string | null;
 | 
						app512IconUrl: string | null;
 | 
				
			||||||
	manifestJsonOverride: string;
 | 
						manifestJsonOverride: string;
 | 
				
			||||||
 | 
						enableBotTrending: boolean;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type ServerInfo = {
 | 
					export type ServerInfo = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue