This commit is contained in:
syuilo 2025-04-30 07:40:53 +09:00
parent 7246f6529f
commit d309ca1244
2 changed files with 13 additions and 4 deletions

View File

@ -106,7 +106,7 @@ type TimelineQueryType = {
roleId?: string
};
let noteCounterForAd = 0;
let adInsertionCounter = 0;
const POLLING_INTERVAL = 1000 * 15;
@ -128,9 +128,9 @@ function releaseQueue() {
}
function prepend(note: Misskey.entities.Note) {
noteCounterForAd++;
adInsertionCounter++;
if (instance.notesPerOneAd > 0 && noteCounterForAd % instance.notesPerOneAd === 0) {
if (instance.notesPerOneAd > 0 && adInsertionCounter % instance.notesPerOneAd === 0) {
note._shouldInsertAd_ = true;
}
@ -319,7 +319,7 @@ onUnmounted(() => {
function reloadTimeline() {
return new Promise<void>((res) => {
noteCounterForAd = 0;
adInsertionCounter = 0;
paginator.reload().then(() => {
res();

View File

@ -73,6 +73,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import { url } from '@@/js/config.js';
import { useInterval } from '@@/js/use-interval.js';
import type { PageHeaderItem } from '@/types/page-header.js';
import MkPostForm from '@/components/MkPostForm.vue';
import MkTimeline from '@/components/MkTimeline.vue';
@ -118,6 +119,14 @@ const featuredPagination = computed(() => ({
},
}));
useInterval(() => {
if (channel.value == null) return;
miLocalStorage.setItemAsJson(`channelLastReadedAt:${channel.value.id}`, Date.now());
}, 3000, {
immediate: true,
afterMounted: true,
});
watch(() => props.channelId, async () => {
channel.value = await misskeyApi('channels/show', {
channelId: props.channelId,