Merge branch 'timeline-upgrade' into develop

This commit is contained in:
mattyatea 2024-01-17 20:21:17 +09:00
commit 4d4c711f0e
7 changed files with 652 additions and 151 deletions

View file

@ -283,6 +283,7 @@ import * as ep___notes_featured from './endpoints/notes/featured.js';
import * as ep___notes_globalTimeline from './endpoints/notes/global-timeline.js';
import * as ep___notes_hybridTimeline from './endpoints/notes/hybrid-timeline.js';
import * as ep___notes_localTimeline from './endpoints/notes/local-timeline.js';
import * as ep___notes_anyLocalTimeline from './endpoints/notes/any-local-timeline.js';
import * as ep___notes_mentions from './endpoints/notes/mentions.js';
import * as ep___notes_polls_recommendation from './endpoints/notes/polls/recommendation.js';
import * as ep___notes_polls_vote from './endpoints/notes/polls/vote.js';
@ -600,7 +601,7 @@ const $i_importMuting: Provider = { provide: 'ep:i/import-muting', useClass: ep_
const $i_importUserLists: Provider = { provide: 'ep:i/import-user-lists', useClass: ep___i_importUserLists.default };
const $i_importAntennas: Provider = { provide: 'ep:i/import-antennas', useClass: ep___i_importAntennas.default };
const $i_notifications: Provider = { provide: 'ep:i/notifications', useClass: ep___i_notifications.default };
const $i_userstats: Provider = { provide: 'ep:i/stats', useClass: ep___users_user_stats.default }
const $i_userstats: Provider = { provide: 'ep:i/stats', useClass: ep___users_user_stats.default };
const $i_notificationsGrouped: Provider = { provide: 'ep:i/notifications-grouped', useClass: ep___i_notificationsGrouped.default };
const $i_pageLikes: Provider = { provide: 'ep:i/page-likes', useClass: ep___i_pageLikes.default };
const $i_pages: Provider = { provide: 'ep:i/pages', useClass: ep___i_pages.default };
@ -658,6 +659,7 @@ const $notes_featured: Provider = { provide: 'ep:notes/featured', useClass: ep__
const $notes_globalTimeline: Provider = { provide: 'ep:notes/global-timeline', useClass: ep___notes_globalTimeline.default };
const $notes_hybridTimeline: Provider = { provide: 'ep:notes/hybrid-timeline', useClass: ep___notes_hybridTimeline.default };
const $notes_localTimeline: Provider = { provide: 'ep:notes/local-timeline', useClass: ep___notes_localTimeline.default };
const $notes_anyLocalTimeline: Provider = { provide: 'ep:notes/any-local-timeline', useClass: ep___notes_anyLocalTimeline.default };
const $notes_mentions: Provider = { provide: 'ep:notes/mentions', useClass: ep___notes_mentions.default };
const $notes_polls_recommendation: Provider = { provide: 'ep:notes/polls/recommendation', useClass: ep___notes_polls_recommendation.default };
const $notes_polls_vote: Provider = { provide: 'ep:notes/polls/vote', useClass: ep___notes_polls_vote.default };
@ -1036,6 +1038,7 @@ const $bubbleGame_ranking: Provider = { provide: 'ep:bubble-game/ranking', useCl
$notes_globalTimeline,
$notes_hybridTimeline,
$notes_localTimeline,
$notes_anyLocalTimeline,
$notes_mentions,
$notes_polls_recommendation,
$notes_polls_vote,
@ -1408,6 +1411,7 @@ const $bubbleGame_ranking: Provider = { provide: 'ep:bubble-game/ranking', useCl
$notes_globalTimeline,
$notes_hybridTimeline,
$notes_localTimeline,
$notes_anyLocalTimeline,
$notes_mentions,
$notes_polls_recommendation,
$notes_polls_vote,

View file

@ -284,6 +284,7 @@ import * as ep___notes_featured from './endpoints/notes/featured.js';
import * as ep___notes_globalTimeline from './endpoints/notes/global-timeline.js';
import * as ep___notes_hybridTimeline from './endpoints/notes/hybrid-timeline.js';
import * as ep___notes_localTimeline from './endpoints/notes/local-timeline.js';
import * as ep___notes_anyLocalTimeline from './endpoints/notes/any-local-timeline.js';
import * as ep___notes_mentions from './endpoints/notes/mentions.js';
import * as ep___notes_polls_recommendation from './endpoints/notes/polls/recommendation.js';
import * as ep___notes_polls_vote from './endpoints/notes/polls/vote.js';
@ -656,6 +657,7 @@ const eps = [
['notes/global-timeline', ep___notes_globalTimeline],
['notes/hybrid-timeline', ep___notes_hybridTimeline],
['notes/local-timeline', ep___notes_localTimeline],
['notes/any-local-timeline', ep___notes_anyLocalTimeline],
['notes/mentions', ep___notes_mentions],
['notes/polls/recommendation', ep___notes_polls_recommendation],
['notes/polls/vote', ep___notes_polls_vote],

View file

@ -0,0 +1,247 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Inject, Injectable } from '@nestjs/common';
import { In } from 'typeorm';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { IdService } from '@/core/IdService.js';
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
import { HttpRequestService } from '@/core/HttpRequestService.js';
import { ApDbResolverService } from '@/core/activitypub/ApDbResolverService.js';
import { ApResolverService } from '@/core/activitypub/ApResolverService.js';
import { getApId, isActor, isPost } from '@/core/activitypub/type.js';
import { ApNoteService } from '@/core/activitypub/models/ApNoteService.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { DI } from '@/di-symbols.js';
import type { NotesRepository } from '@/models/_.js';
import { MiNote, MiUser } from '@/models/_.js';
import { bindThis } from '@/decorators.js';
import { MiLocalUser } from '@/models/User.js';
import { SchemaType } from '@/misc/json-schema.js';
import { UtilityService } from '@/core/UtilityService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { MetaService } from '@/core/MetaService.js';
import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
import { ApiError } from '../../error.js';
export const meta = {
tags: ['notes'],
res: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
optional: false, nullable: false,
ref: 'Note',
},
},
errors: {
hostIsNull: {
message: 'Host is null',
code: 'HOST_NULL',
id: 'PRSMSK-ANY-LTL-0001',
},
bothWithRepliesAndWithFiles: {
message: 'Specifying both withReplies and withFiles is not supported',
code: 'BOTH_WITH_REPLIES_AND_WITH_FILES',
id: 'dd9c8400-1cb5-4eef-8a31-200c5f933793',
},
remoteTokenIsNull: {
message: 'remoteToken is null',
code: 'REMOTE_TOKEN_NULL',
id: 'PRSMSK-ANY-LTL-0002',
},
},
} as const;
export const paramDef = {
type: 'object',
properties: {
withFiles: { type: 'boolean', default: false },
withRenotes: { type: 'boolean', default: true },
withReplies: { type: 'boolean', default: false },
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
sinceId: { type: 'string', format: 'misskey:id' },
untilId: { type: 'string', format: 'misskey:id' },
allowPartial: { type: 'boolean', default: false }, // true is recommended but for compatibility false by default
sinceDate: { type: 'integer' },
untilDate: { type: 'integer' },
host: { type: 'string' },
remoteToken: { type: 'string' },
},
required: [],
} as const;
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
constructor(
@Inject(DI.notesRepository)
private notesRepository: NotesRepository,
private idService: IdService,
private federatedInstanceService: FederatedInstanceService,
private httpRequestService: HttpRequestService,
private utilityService: UtilityService,
private userEntityService: UserEntityService,
private noteEntityService: NoteEntityService,
private metaService: MetaService,
private apResolverService: ApResolverService,
private apDbResolverService: ApDbResolverService,
private apPersonService: ApPersonService,
private apNoteService: ApNoteService,
) {
super(meta, paramDef, async (ps, me) => {
const untilId = ps.untilId ?? (ps.untilDate ? this.idService.gen(ps.untilDate!) : null);
const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.gen(ps.sinceDate!) : null);
if (ps.host === undefined) throw new ApiError(meta.errors.hostIsNull);
if (ps.remoteToken === undefined) throw new ApiError(meta.errors.remoteTokenIsNull);
const i = await this.federatedInstanceService.fetch(ps.host);
const noteIds = [];
if (i.softwareName === 'misskey') {
const remoteTimeline: string[] = await (await this.httpRequestService.send('https://' + ps.host + '/api/notes/local-timeline', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
i: ps.remoteToken,
withFiles: ps.withFiles,
withRenotes: ps.withRenotes,
withReplies: ps.withReplies,
limit: 30,
}),
})).json() as string[];
if (remoteTimeline.length > 0) {
for (const note of remoteTimeline) {
const uri = `https://${ps.host}/notes/${note.id}`;
const note_ = await this.fetchAny(uri, me);
if (note_ == null) continue;
noteIds.push(note_.id);
}
}
let notes = await this.notesRepository.findBy({ id: In(noteIds) });
let packedNote: any[] = await this.noteEntityService.packMany(notes, me, { detail: true });
if (untilId) {
let lastRemoteId;
const lastUri = packedNote[packedNote.length - 1].uri;
lastRemoteId = lastUri.split('/')[lastUri.split('/').length - 1];
do {
const remoteTimeline: string[] = await (await this.httpRequestService.send('https://' + ps.host + '/api/notes/local-timeline', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
i: ps.remoteToken,
withFiles: ps.withFiles,
withRenotes: ps.withRenotes,
withReplies: ps.withReplies,
untilId: lastRemoteId,
limit: 30,
}),
})).json() as string[];
if (remoteTimeline.length > 0) {
for (const note of remoteTimeline) {
const uri = `https://${ps.host}/notes/${note.id}`;
const note_ = await this.fetchAny(uri, me);
if (note_ == null) continue;
//noteIds.push(note_.id);
lastRemoteId = note_.id;
if (lastRemoteId === ps.untilId) {
break;
}
}
}
} while (lastRemoteId !== ps.untilId);
const remoteTimeline: string[] = await (await this.httpRequestService.send('https://' + ps.host + '/api/notes/local-timeline', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
i: ps.remoteToken,
withFiles: ps.withFiles,
withRenotes: ps.withRenotes,
withReplies: ps.withReplies,
untilId: lastRemoteId,
limit: 30,
}),
})).json() as string[];
if (remoteTimeline.length > 0) {
for (const note of remoteTimeline) {
const uri = `https://${ps.host}/notes/${note.id}`;
const note_ = await this.fetchAny(uri, me);
if (note_ == null) continue;
noteIds.push(note_.id);
}
}
}
notes = await this.notesRepository.findBy({ id: In(noteIds) });
packedNote = await this.noteEntityService.packMany(notes, me, { detail: true });
return packedNote.reverse();
}
});
}
@bindThis
private async fetchAny(uri: string, me: MiLocalUser | null | undefined) {
// ブロックしてたら中断
const fetchedMeta = await this.metaService.fetch();
if (this.utilityService.isBlockedHost(fetchedMeta.blockedHosts, this.utilityService.extractDbHost(uri))) return null;
let local = await this.mergePack(me, ...await Promise.all([
this.apDbResolverService.getUserFromApId(uri),
this.apDbResolverService.getNoteFromApId(uri),
]));
if (local != null) return local;
// リモートから一旦オブジェクトフェッチ
let object;
try {
const resolver = this.apResolverService.createResolver();
object = await resolver.resolve(uri) as any;
} catch (e) {
return null;
}
if (!object) return null;
// /@user のような正規id以外で取得できるURIが指定されていた場合、ここで初めて正規URIが確定する
// これはDBに存在する可能性があるため再度DB検索
if (uri !== object.id) {
local = await this.mergePack(me, ...await Promise.all([
this.apDbResolverService.getUserFromApId(object.id),
this.apDbResolverService.getNoteFromApId(object.id),
]));
if (local != null) return local;
}
return await this.mergePack(
me,
isActor(object) ? await this.apPersonService.createPerson(getApId(object)) : null,
isPost(object) ? await this.apNoteService.createNote(getApId(object), undefined, true) : null,
);
}
@bindThis
private async mergePack(me: MiLocalUser | null | undefined, user: MiUser | null | undefined, note: MiNote | null | undefined) {
if (note != null) {
try {
const object = await this.noteEntityService.pack(note, me, { detail: true });
return object;
} catch (e) {
return null;
}
}
return null;
}
}

View file

@ -152,6 +152,9 @@ function connectChannel() {
roleId: props.role,
});
}
if (props.src.startsWith('custom-timeline')) {
return;
}
if (props.src !== 'directs' || props.src !== 'mentions') connection.on('note', prepend);
}
@ -227,6 +230,12 @@ function updatePaginationQuery() {
query = {
roleId: props.role,
};
} else if (props.src.startsWith('custom-timeline')) {
endpoint = "notes/any-local-timeline";
query = {
host: defaultStore.state[`remoteLocalTimelineDomain${props.src.split("-")[2]}`],
remoteToken:defaultStore.state[`remoteLocalTimelineToken${props.src.split("-")[2]}`]
};
}else {
endpoint = null;
query = null;

View file

@ -220,6 +220,88 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>{{ i18n.ts.other }}</template>
<div class="_gaps">
<MkFolder>
<template #label>リモートのローカルタイムラインをTLの上のバーのやつに表示する</template>
<div style="padding: 0 16px;">
<div v-if="maxLocalTimeline >= 1" style="padding: 16px 0 ;" >
<MkInput v-model="remoteLocalTimelineName1" placeholder="prismisskey">
<template #label>{{i18n.ts.name}}</template>
</MkInput>
<MkInput v-model="remoteLocalTimelineDomain1" placeholder="prismisskey.space">
<template #label>instance Url</template>
</MkInput>
<MkInput v-model="remoteLocalTimelineToken1" placeholder="">
<template #prefix><i class="ti ti-key"></i></template>
<template #label>Token</template>
</MkInput>
<MkSwitch v-model="remoteLocalTimelineEnable1">
{{ i18n.ts.enable }}
</MkSwitch>
</div>
<div v-if="maxLocalTimeline >= 2" style="padding: 16px 0 ;" >
<MkInput v-model="remoteLocalTimelineName2" placeholder="prismisskey">
<template #label>{{i18n.ts.name}}</template>
</MkInput>
<MkInput v-model="remoteLocalTimelineDomain2" placeholder="prismisskey.space">
<template #label>instance Url</template>
</MkInput>
<MkInput v-model="remoteLocalTimelineToken2" placeholder="">
<template #prefix><i class="ti ti-key"></i></template>
<template #label>Token</template>
</MkInput>
<MkSwitch v-model="remoteLocalTimelineEnable2">
{{ i18n.ts.enable }}
</MkSwitch>
</div>
<div v-if="maxLocalTimeline >= 3" style="padding: 16px 0 ;" >
<MkInput v-model="remoteLocalTimelineName3" placeholder="prismisskey">
<template #label>{{i18n.ts.name}}</template>
</MkInput>
<MkInput v-model="remoteLocalTimelineDomain3" placeholder="prismisskey.space">
<template #label>instance Url</template>
</MkInput>
<MkInput v-model="remoteLocalTimelineToken3" placeholder="">
<template #prefix><i class="ti ti-key"></i></template>
<template #label>Token</template>
</MkInput>
<MkSwitch v-model="remoteLocalTimelineEnable3">
{{ i18n.ts.enable }}
</MkSwitch>
</div>
<div v-if="maxLocalTimeline >= 4" style="padding: 16px 0 ;" >
<MkInput v-model="remoteLocalTimelineName4" placeholder="prismisskey">
<template #label>{{i18n.ts.name}}</template>
</MkInput>
<MkInput v-model="remoteLocalTimelineDomain4" placeholder="prismisskey.space"/>
<MkInput v-model="remoteLocalTimelineToken4" placeholder="">
<template #prefix><i class="ti ti-key"></i></template>
<template #label>Token</template>
</MkInput>
<MkSwitch v-model="remoteLocalTimelineEnable4">
{{ i18n.ts.enable }}
</MkSwitch>
</div>
<div v-if="maxLocalTimeline >= 5" style="padding: 16px 0 ;" >
<MkInput v-model="remoteLocalTimelineName5" placeholder="prismisskey">
<template #label>{{i18n.ts.name}}</template>
</MkInput>
<MkInput v-model="remoteLocalTimelineDomain5" placeholder="prismisskey.space">
<template #label>instance Url</template>
</MkInput>
<MkInput v-model="remoteLocalTimelineToken5" placeholder="">
<template #prefix><i class="ti ti-key"></i></template>
<template #label>Token</template>
</MkInput>
<MkSwitch v-model="remoteLocalTimelineEnable5">
{{ i18n.ts.enable }}
</MkSwitch>
</div>
<MkButton @click="remoteLocaltimelineSave">
{{ i18n.ts.save}}
</MkButton>
</div>
</MkFolder>
<MkFolder>
<template #label>{{ i18n.ts.additionalEmojiDictionary }}</template>
<div class="_buttons">
@ -261,6 +343,7 @@ import { globalEvents } from '@/events.js';
import { claimAchievement } from '@/scripts/achievements.js';
import MkColorInput from '@/components/MkColorInput.vue';
import MkFoldableSection from '@/components/MkFoldableSection.vue';
import MkInput from '@/components/MkInput.vue';
const lang = ref(miLocalStorage.getItem('lang'));
const fontSize = ref(miLocalStorage.getItem('fontSize'));
@ -326,6 +409,29 @@ const showVisibilityColor = computed(defaultStore.makeGetterSetter('showVisibili
const disableStreamingTimeline = computed(defaultStore.makeGetterSetter('disableStreamingTimeline'));
const useGroupedNotifications = computed(defaultStore.makeGetterSetter('useGroupedNotifications'));
const enableSeasonalScreenEffect = computed(defaultStore.makeGetterSetter('enableSeasonalScreenEffect'));
const maxLocalTimeline = 3;
const remoteLocalTimelineDomain1 = ref(defaultStore.state['remoteLocalTimelineDomain1']);
const remoteLocalTimelineToken1 = ref(defaultStore.state['remoteLocalTimelineToken1']);
const remoteLocalTimelineDomain2 = ref(defaultStore.state['remoteLocalTimelineDomain2']);
const remoteLocalTimelineToken2 = ref(defaultStore.state['remoteLocalTimelineToken2']);
const remoteLocalTimelineDomain3 = ref(defaultStore.state['remoteLocalTimelineDomain3']);
const remoteLocalTimelineToken3 = ref(defaultStore.state['remoteLocalTimelineToken3']);
const remoteLocalTimelineDomain4 = ref(defaultStore.state['remoteLocalTimelineDomain4']);
const remoteLocalTimelineToken4 = ref(defaultStore.state['remoteLocalTimelineToken4']);
const remoteLocalTimelineDomain5 = ref(defaultStore.state['remoteLocalTimelineDomain5']);
const remoteLocalTimelineToken5 = ref(defaultStore.state['remoteLocalTimelineToken5']);
const remoteLocalTimelineName1 = ref(defaultStore.state['remoteLocalTimelineName1']);
const remoteLocalTimelineName2 = ref(defaultStore.state['remoteLocalTimelineName2']);
const remoteLocalTimelineName3 = ref(defaultStore.state['remoteLocalTimelineName3']);
const remoteLocalTimelineName4 = ref(defaultStore.state['remoteLocalTimelineName4']);
const remoteLocalTimelineName5 = ref(defaultStore.state['remoteLocalTimelineName5']);
const remoteLocalTimelineEnable1 = computed(defaultStore.makeGetterSetter('remoteLocalTimelineEnable1'));
const remoteLocalTimelineEnable2 = computed(defaultStore.makeGetterSetter('remoteLocalTimelineEnable2'));
const remoteLocalTimelineEnable3 = computed(defaultStore.makeGetterSetter('remoteLocalTimelineEnable3'));
const remoteLocalTimelineEnable4 = computed(defaultStore.makeGetterSetter('remoteLocalTimelineEnable4'));
const remoteLocalTimelineEnable5 = computed(defaultStore.makeGetterSetter('remoteLocalTimelineEnable5'));
watch(lang, () => {
miLocalStorage.setItem('lang', lang.value as string);
miLocalStorage.removeItem('locale');
@ -398,6 +504,30 @@ watch([
await reloadAsk();
});
async function remoteLocaltimelineSave() {
os.alert({
type: 'success',
text: i18n.ts.saved,
});
await reloadAsk();
defaultStore.set('remoteLocalTimelineDomain1', remoteLocalTimelineDomain1.value);
defaultStore.set('remoteLocalTimelineToken1', remoteLocalTimelineToken1.value);
defaultStore.set('remoteLocalTimelineDomain2', remoteLocalTimelineDomain2.value);
defaultStore.set('remoteLocalTimelineToken2', remoteLocalTimelineToken2.value);
defaultStore.set('remoteLocalTimelineDomain3', remoteLocalTimelineDomain3.value);
defaultStore.set('remoteLocalTimelineToken3', remoteLocalTimelineToken3.value);
defaultStore.set('remoteLocalTimelineDomain4', remoteLocalTimelineDomain4.value);
defaultStore.set('remoteLocalTimelineToken4', remoteLocalTimelineToken4.value);
defaultStore.set('remoteLocalTimelineDomain5', remoteLocalTimelineDomain5.value);
defaultStore.set('remoteLocalTimelineToken5', remoteLocalTimelineToken5.value);
defaultStore.set('remoteLocalTimelineName1', remoteLocalTimelineName1.value);
defaultStore.set('remoteLocalTimelineName2', remoteLocalTimelineName2.value);
defaultStore.set('remoteLocalTimelineName3', remoteLocalTimelineName3.value);
defaultStore.set('remoteLocalTimelineName4', remoteLocalTimelineName4.value);
defaultStore.set('remoteLocalTimelineName5', remoteLocalTimelineName5.value);
}
const emojiIndexLangs = ['en-US', 'ja-JP', 'ja-JP_hira'] as const;
function getEmojiIndexLangName(targetLang: typeof emojiIndexLangs[number]) {

View file

@ -68,8 +68,12 @@ const src = computed({ get: () => ($i ? defaultStore.reactiveState.tl.value.src
const withRenotes = ref(true);
const withReplies = ref($i ? defaultStore.state.tlWithReplies : false);
const onlyFiles = ref(false);
const isShowMediaTimeline = ref(defaultStore.state.showMediaTimeline)
const isShowMediaTimeline = ref(defaultStore.state.showMediaTimeline);
const remoteLocalTimelineEnable1 = ref(defaultStore.state.remoteLocalTimelineEnable1);
const remoteLocalTimelineEnable2 = ref(defaultStore.state.remoteLocalTimelineEnable2);
const remoteLocalTimelineEnable3 = ref(defaultStore.state.remoteLocalTimelineEnable3);
const remoteLocalTimelineEnable4 = ref(defaultStore.state.remoteLocalTimelineEnable4);
const remoteLocalTimelineEnable5 = ref(defaultStore.state.remoteLocalTimelineEnable5);
watch(src, () => queue.value = 0);
watch(withReplies, (x) => {
@ -90,7 +94,7 @@ async function chooseList(ev: MouseEvent): Promise<void> {
... lists.map(list => ({
type: 'link' as const,
text: list.name,
to: `/timeline/list/${list.id}`,})),
to: `/timeline/list/${list.id}` })),
(lists.length === 0 ? undefined : { type: 'divider' }),
{
type: 'link' as const,
@ -109,7 +113,7 @@ async function chooseAntenna(ev: MouseEvent): Promise<void> {
type: 'link' as const,
text: antenna.name,
indicate: antenna.hasUnreadNote,
to: `/timeline/antenna/${antenna.id}`,})),
to: `/timeline/antenna/${antenna.id}` })),
(antennas.length === 0 ? undefined : { type: 'divider' }),
{
type: 'link' as const,
@ -133,7 +137,7 @@ async function chooseChannel(ev: MouseEvent): Promise<void> {
return { type: 'link' as const,
text: channel.name,
indicate: hasUnreadNote,
to: `/channels/${channel.id}`,};
to: `/channels/${channel.id}` };
}),
(channels.length === 0 ? undefined : { type: 'divider' }),
{
@ -193,7 +197,7 @@ const headerActions = computed(() => {
type: 'switch',
text: i18n.ts.showRepliesToOthersInTimeline,
ref: withReplies,
disabled: onlyFiles,} : undefined, {
disabled: onlyFiles } : undefined, {
type: 'switch',
text: i18n.ts.fileAttachedOnly,
@ -241,6 +245,31 @@ const headerTabs = computed(() => [...(defaultStore.reactiveState.pinnedUserList
title: i18n.ts._timelines.social,
icon: 'ti ti-universe',
iconOnly: true,
}] : []), ...(remoteLocalTimelineEnable1.value ? [{
key: 'custom-timeline-1',
title: defaultStore.state.remoteLocalTimelineName1,
icon: 'ti ti-plus',
iconOnly: false,
}] : []), ...(remoteLocalTimelineEnable2.value ? [{
key: 'custom-timeline-2',
title: defaultStore.state.remoteLocalTimelineName2,
icon: 'ti ti-plus',
iconOnly: false,
}] : []), ...(remoteLocalTimelineEnable3.value ? [{
key: 'custom-timeline-3',
title: defaultStore.state.remoteLocalTimelineName3,
icon: 'ti ti-plus',
iconOnly: false,
}] : []), ...(remoteLocalTimelineEnable4.value ? [{
key: 'custom-timeline-4',
title: defaultStore.state.remoteLocalTimelineName4,
icon: 'ti ti-plus',
iconOnly: false,
}] : []), ...(remoteLocalTimelineEnable5.value ? [{
key: 'custom-timeline-5',
title: defaultStore.state.remoteLocalTimelineName5,
icon: 'ti ti-plus',
iconOnly: false,
}] : []), ...(isGlobalTimelineAvailable ? [{
key: 'global',
title: i18n.ts._timelines.global,

View file

@ -465,6 +465,86 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: 44,
},
remoteLocalTimelineDomain1: {
where: 'account',
default: '',
},
remoteLocalTimelineDomain2: {
where: 'account',
default: '',
},
remoteLocalTimelineDomain3: {
where: 'account',
default: '',
},
remoteLocalTimelineDomain4: {
where: 'account',
default: '',
},
remoteLocalTimelineDomain5: {
where: 'account',
default: '',
},
remoteLocalTimelineToken1: {
where: 'account',
default: '',
},
remoteLocalTimelineToken2: {
where: 'account',
default: '',
},
remoteLocalTimelineToken3: {
where: 'account',
default: '',
},
remoteLocalTimelineToken4: {
where: 'account',
default: '',
},
remoteLocalTimelineToken5: {
where: 'account',
default: '',
},
remoteLocalTimelineEnable1: {
where: 'account',
default: false,
},
remoteLocalTimelineEnable2: {
where: 'account',
default: false,
},
remoteLocalTimelineEnable3: {
where: 'account',
default: false,
},
remoteLocalTimelineEnable4: {
where: 'account',
default: false,
},
remoteLocalTimelineEnable5: {
where: 'account',
default: false,
},
remoteLocalTimelineName1: {
where: 'account',
default: 'custom timeline 1',
},
remoteLocalTimelineName2: {
where: 'account',
default: 'custom timeline 2 ',
},
remoteLocalTimelineName3: {
where: 'account',
default: 'custom timeline 3',
},
remoteLocalTimelineName4: {
where: 'account',
default: 'custom timeline 4',
},
remoteLocalTimelineName5: {
where: 'account',
default: 'custom timeline 5',
},
onlyAndWithSave: {
where: 'device',
default: false,