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
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
19 changed files with 90 additions and 1 deletions

View file

@ -25,11 +25,13 @@ const props = withDefaults(defineProps<{
sound?: boolean;
withRenotes?: boolean;
withReplies?: boolean;
withBots?: boolean;
onlyFiles?: boolean;
}>(), {
withRenotes: true,
withReplies: false,
onlyFiles: false,
withBots: true,
});
const emit = defineEmits<{
@ -93,11 +95,13 @@ if (props.src === 'antenna') {
query = {
withRenotes: props.withRenotes,
withReplies: props.withReplies,
withBots: props.withBots,
withFiles: props.onlyFiles ? true : undefined,
};
connection = stream.useChannel('localTimeline', {
withRenotes: props.withRenotes,
withReplies: props.withReplies,
withBots: props.withBots,
withFiles: props.onlyFiles ? true : undefined,
});
connection.on('note', prepend);
@ -106,11 +110,13 @@ if (props.src === 'antenna') {
query = {
withRenotes: props.withRenotes,
withReplies: props.withReplies,
withBots: props.withBots,
withFiles: props.onlyFiles ? true : undefined,
};
connection = stream.useChannel('hybridTimeline', {
withRenotes: props.withRenotes,
withReplies: props.withReplies,
withBots: props.withBots,
withFiles: props.onlyFiles ? true : undefined,
});
connection.on('note', prepend);
@ -118,10 +124,12 @@ if (props.src === 'antenna') {
endpoint = 'notes/global-timeline';
query = {
withRenotes: props.withRenotes,
withBots: props.withBots,
withFiles: props.onlyFiles ? true : undefined,
};
connection = stream.useChannel('globalTimeline', {
withRenotes: props.withRenotes,
withBots: props.withBots,
withFiles: props.onlyFiles ? true : undefined,
});
connection.on('note', prepend);

View file

@ -23,6 +23,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkSwitch>
</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;">
<MkSwitch v-model="enableIdenticonGeneration">
<template #label>{{ i18n.ts.enableIdenticonGeneration }}</template>
@ -61,6 +68,7 @@ import MkSwitch from '@/components/MkSwitch.vue';
let enableServerMachineStats: boolean = $ref(false);
let enableAchievements: boolean = $ref(false);
let enableBotTrending: boolean = $ref(false);
let enableIdenticonGeneration: boolean = $ref(false);
let enableChartsForRemoteUser: boolean = $ref(false);
let enableChartsForFederatedInstances: boolean = $ref(false);
@ -69,6 +77,7 @@ async function init() {
const meta = await os.api('admin/meta');
enableServerMachineStats = meta.enableServerMachineStats;
enableAchievements = meta.enableAchievements;
enableBotTrending = meta.enableBotTrending;
enableIdenticonGeneration = meta.enableIdenticonGeneration;
enableChartsForRemoteUser = meta.enableChartsForRemoteUser;
enableChartsForFederatedInstances = meta.enableChartsForFederatedInstances;
@ -78,6 +87,7 @@ function save() {
os.apiWithDialog('admin/update-meta', {
enableServerMachineStats,
enableAchievements,
enableBotTrending,
enableIdenticonGeneration,
enableChartsForRemoteUser,
enableChartsForFederatedInstances,

View file

@ -152,6 +152,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-model="enableInfiniteScroll">{{ i18n.ts.enableInfiniteScroll }}</MkSwitch>
<MkSwitch v-model="keepScreenOn">{{ i18n.ts.keepScreenOn }}</MkSwitch>
<MkSwitch v-model="clickToOpen">{{ i18n.ts.clickToOpen }}</MkSwitch>
<MkSwitch v-model="showBots">Show bots in timeline</MkSwitch>
</div>
<MkSelect v-model="serverDisconnectedBehavior">
<template #label>{{ i18n.ts.whenServerDisconnected }}</template>
@ -227,6 +228,7 @@ const showClipButtonInNoteFooter = computed(defaultStore.makeGetterSetter('showC
const reactionsDisplaySize = computed(defaultStore.makeGetterSetter('reactionsDisplaySize'));
const collapseRenotes = computed(defaultStore.makeGetterSetter('collapseRenotes'));
const clickToOpen = computed(defaultStore.makeGetterSetter('clickToOpen'));
const showBots = computed(defaultStore.makeGetterSetter('tlWithBots'));
const collapseFiles = computed(defaultStore.makeGetterSetter('collapseFiles'));
const autoloadConversation = computed(defaultStore.makeGetterSetter('autoloadConversation'));
const reduceAnimation = computed(defaultStore.makeGetterSetter('animation', v => !v, v => !v));

View file

@ -21,6 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:withRenotes="withRenotes"
:withReplies="withReplies"
:onlyFiles="onlyFiles"
:withBots="withBots"
:sound="true"
@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 withRenotes = $ref(true);
const withReplies = $ref($i ? defaultStore.state.tlWithReplies : false);
const withBots = $ref($i ? defaultStore.state.tlWithBots : true);
const onlyFiles = $ref(false);
watch($$(src), () => queue = 0);

View file

@ -373,6 +373,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: false,
},
tlWithBots: {
where: 'device',
default: true,
},
}));
// TODO: 他のタブと永続化されたstateを同期