1
0

add: Bot Trending Toggle, Hide Bot in Timeline client option

This commit is contained in:
Mar0xy
2023-10-18 07:29:16 +02:00
parent fa5cf36602
commit c21d255604
19 changed files with 90 additions and 1 deletions
@@ -20,6 +20,7 @@ class GlobalTimelineChannel extends Channel {
public static requireCredential = false;
private withRenotes: boolean;
private withFiles: boolean;
private withBots: boolean;
constructor(
private metaService: MetaService,
@@ -40,6 +41,7 @@ class GlobalTimelineChannel extends Channel {
this.withRenotes = params.withRenotes ?? true;
this.withFiles = params.withFiles ?? false;
this.withBots = params.withBots ?? true;
// Subscribe events
this.subscriber.on('notesStream', this.onNote);
@@ -48,6 +50,7 @@ class GlobalTimelineChannel extends Channel {
@bindThis
private async onNote(note: Packed<'Note'>) {
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.channelId != null) return;
@@ -20,6 +20,7 @@ class HybridTimelineChannel extends Channel {
public static requireCredential = true;
private withRenotes: boolean;
private withReplies: boolean;
private withBots: boolean;
private withFiles: boolean;
constructor(
@@ -41,6 +42,7 @@ class HybridTimelineChannel extends Channel {
this.withRenotes = params.withRenotes ?? true;
this.withReplies = params.withReplies ?? false;
this.withBots = params.withBots ?? true;
this.withFiles = params.withFiles ?? false;
// Subscribe events
@@ -50,6 +52,7 @@ class HybridTimelineChannel extends Channel {
@bindThis
private async onNote(note: Packed<'Note'>) {
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;
private withRenotes: boolean;
private withReplies: boolean;
private withBots: boolean;
private withFiles: boolean;
constructor(
@@ -40,6 +41,7 @@ class LocalTimelineChannel extends Channel {
this.withRenotes = params.withRenotes ?? true;
this.withReplies = params.withReplies ?? false;
this.withBots = params.withBots ?? true;
this.withFiles = params.withFiles ?? false;
// Subscribe events
@@ -49,6 +51,7 @@ class LocalTimelineChannel extends Channel {
@bindThis
private async onNote(note: Packed<'Note'>) {
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.visibility !== 'public') return;