Merge branch 'timeline-upgrade' into develop
This commit is contained in:
commit
4d4c711f0e
|
@ -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_globalTimeline from './endpoints/notes/global-timeline.js';
|
||||||
import * as ep___notes_hybridTimeline from './endpoints/notes/hybrid-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_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_mentions from './endpoints/notes/mentions.js';
|
||||||
import * as ep___notes_polls_recommendation from './endpoints/notes/polls/recommendation.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';
|
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_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_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_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_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_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 };
|
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_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_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_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_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_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 };
|
const $notes_polls_vote: Provider = { provide: 'ep:notes/polls/vote', useClass: ep___notes_polls_vote.default };
|
||||||
|
@ -783,8 +785,8 @@ const $bubbleGame_ranking: Provider = { provide: 'ep:bubble-game/ranking', useCl
|
||||||
$admin_drive_files,
|
$admin_drive_files,
|
||||||
$admin_drive_showFile,
|
$admin_drive_showFile,
|
||||||
$admin_emoji_addAliasesBulk,
|
$admin_emoji_addAliasesBulk,
|
||||||
$admin_emoji_setlocalOnlyBulk,
|
$admin_emoji_setlocalOnlyBulk,
|
||||||
$admin_emoji_setisSensitiveBulk,
|
$admin_emoji_setisSensitiveBulk,
|
||||||
$admin_emoji_add,
|
$admin_emoji_add,
|
||||||
$admin_emoji_addRequest,
|
$admin_emoji_addRequest,
|
||||||
$admin_emoji_copy,
|
$admin_emoji_copy,
|
||||||
|
@ -866,7 +868,7 @@ const $bubbleGame_ranking: Provider = { provide: 'ep:bubble-game/ranking', useCl
|
||||||
$channels_timeline,
|
$channels_timeline,
|
||||||
$channels_unfollow,
|
$channels_unfollow,
|
||||||
$channels_update,
|
$channels_update,
|
||||||
$i_userstats,
|
$i_userstats,
|
||||||
$channels_favorite,
|
$channels_favorite,
|
||||||
$channels_unfavorite,
|
$channels_unfavorite,
|
||||||
$channels_myFavorites,
|
$channels_myFavorites,
|
||||||
|
@ -1036,6 +1038,7 @@ const $bubbleGame_ranking: Provider = { provide: 'ep:bubble-game/ranking', useCl
|
||||||
$notes_globalTimeline,
|
$notes_globalTimeline,
|
||||||
$notes_hybridTimeline,
|
$notes_hybridTimeline,
|
||||||
$notes_localTimeline,
|
$notes_localTimeline,
|
||||||
|
$notes_anyLocalTimeline,
|
||||||
$notes_mentions,
|
$notes_mentions,
|
||||||
$notes_polls_recommendation,
|
$notes_polls_recommendation,
|
||||||
$notes_polls_vote,
|
$notes_polls_vote,
|
||||||
|
@ -1168,12 +1171,12 @@ const $bubbleGame_ranking: Provider = { provide: 'ep:bubble-game/ranking', useCl
|
||||||
$admin_emoji_setAliasesBulk,
|
$admin_emoji_setAliasesBulk,
|
||||||
$admin_emoji_setCategoryBulk,
|
$admin_emoji_setCategoryBulk,
|
||||||
$admin_emoji_setLicenseBulk,
|
$admin_emoji_setLicenseBulk,
|
||||||
$admin_emoji_setlocalOnlyBulk,
|
$admin_emoji_setlocalOnlyBulk,
|
||||||
$admin_emoji_setisSensitiveBulk,
|
$admin_emoji_setisSensitiveBulk,
|
||||||
$admin_emoji_update,
|
$admin_emoji_update,
|
||||||
$admin_emoji_updateRequest,
|
$admin_emoji_updateRequest,
|
||||||
$admin_federation_deleteAllFiles,
|
$admin_federation_deleteAllFiles,
|
||||||
$i_userstats,
|
$i_userstats,
|
||||||
$admin_federation_refreshRemoteInstanceMetadata,
|
$admin_federation_refreshRemoteInstanceMetadata,
|
||||||
$admin_federation_removeAllFollowing,
|
$admin_federation_removeAllFollowing,
|
||||||
$admin_federation_updateInstance,
|
$admin_federation_updateInstance,
|
||||||
|
@ -1408,6 +1411,7 @@ const $bubbleGame_ranking: Provider = { provide: 'ep:bubble-game/ranking', useCl
|
||||||
$notes_globalTimeline,
|
$notes_globalTimeline,
|
||||||
$notes_hybridTimeline,
|
$notes_hybridTimeline,
|
||||||
$notes_localTimeline,
|
$notes_localTimeline,
|
||||||
|
$notes_anyLocalTimeline,
|
||||||
$notes_mentions,
|
$notes_mentions,
|
||||||
$notes_polls_recommendation,
|
$notes_polls_recommendation,
|
||||||
$notes_polls_vote,
|
$notes_polls_vote,
|
||||||
|
|
|
@ -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_globalTimeline from './endpoints/notes/global-timeline.js';
|
||||||
import * as ep___notes_hybridTimeline from './endpoints/notes/hybrid-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_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_mentions from './endpoints/notes/mentions.js';
|
||||||
import * as ep___notes_polls_recommendation from './endpoints/notes/polls/recommendation.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';
|
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/global-timeline', ep___notes_globalTimeline],
|
||||||
['notes/hybrid-timeline', ep___notes_hybridTimeline],
|
['notes/hybrid-timeline', ep___notes_hybridTimeline],
|
||||||
['notes/local-timeline', ep___notes_localTimeline],
|
['notes/local-timeline', ep___notes_localTimeline],
|
||||||
|
['notes/any-local-timeline', ep___notes_anyLocalTimeline],
|
||||||
['notes/mentions', ep___notes_mentions],
|
['notes/mentions', ep___notes_mentions],
|
||||||
['notes/polls/recommendation', ep___notes_polls_recommendation],
|
['notes/polls/recommendation', ep___notes_polls_recommendation],
|
||||||
['notes/polls/vote', ep___notes_polls_vote],
|
['notes/polls/vote', ep___notes_polls_vote],
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -152,6 +152,9 @@ function connectChannel() {
|
||||||
roleId: props.role,
|
roleId: props.role,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (props.src.startsWith('custom-timeline')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (props.src !== 'directs' || props.src !== 'mentions') connection.on('note', prepend);
|
if (props.src !== 'directs' || props.src !== 'mentions') connection.on('note', prepend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,13 +192,13 @@ function updatePaginationQuery() {
|
||||||
withReplies: props.withReplies,
|
withReplies: props.withReplies,
|
||||||
withFiles: props.onlyFiles ? true : undefined,
|
withFiles: props.onlyFiles ? true : undefined,
|
||||||
};
|
};
|
||||||
}else if (props.src === 'global') {
|
} else if (props.src === 'global') {
|
||||||
endpoint = 'notes/global-timeline';
|
endpoint = 'notes/global-timeline';
|
||||||
query = {
|
query = {
|
||||||
withRenotes: props.withRenotes,
|
withRenotes: props.withRenotes,
|
||||||
withFiles: props.onlyFiles ? true : undefined,
|
withFiles: props.onlyFiles ? true : undefined,
|
||||||
};
|
};
|
||||||
}else if(props.src === 'media'){
|
} else if (props.src === 'media') {
|
||||||
endpoint = 'notes/hybrid-timeline';
|
endpoint = 'notes/hybrid-timeline';
|
||||||
query = {
|
query = {
|
||||||
withFiles: true,
|
withFiles: true,
|
||||||
|
@ -227,7 +230,13 @@ function updatePaginationQuery() {
|
||||||
query = {
|
query = {
|
||||||
roleId: props.role,
|
roleId: props.role,
|
||||||
};
|
};
|
||||||
} else {
|
} 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;
|
endpoint = null;
|
||||||
query = null;
|
query = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,6 +220,88 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template #label>{{ i18n.ts.other }}</template>
|
<template #label>{{ i18n.ts.other }}</template>
|
||||||
|
|
||||||
<div class="_gaps">
|
<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>
|
<MkFolder>
|
||||||
<template #label>{{ i18n.ts.additionalEmojiDictionary }}</template>
|
<template #label>{{ i18n.ts.additionalEmojiDictionary }}</template>
|
||||||
<div class="_buttons">
|
<div class="_buttons">
|
||||||
|
@ -261,6 +343,7 @@ import { globalEvents } from '@/events.js';
|
||||||
import { claimAchievement } from '@/scripts/achievements.js';
|
import { claimAchievement } from '@/scripts/achievements.js';
|
||||||
import MkColorInput from '@/components/MkColorInput.vue';
|
import MkColorInput from '@/components/MkColorInput.vue';
|
||||||
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
||||||
|
import MkInput from '@/components/MkInput.vue';
|
||||||
|
|
||||||
const lang = ref(miLocalStorage.getItem('lang'));
|
const lang = ref(miLocalStorage.getItem('lang'));
|
||||||
const fontSize = ref(miLocalStorage.getItem('fontSize'));
|
const fontSize = ref(miLocalStorage.getItem('fontSize'));
|
||||||
|
@ -326,6 +409,29 @@ const showVisibilityColor = computed(defaultStore.makeGetterSetter('showVisibili
|
||||||
const disableStreamingTimeline = computed(defaultStore.makeGetterSetter('disableStreamingTimeline'));
|
const disableStreamingTimeline = computed(defaultStore.makeGetterSetter('disableStreamingTimeline'));
|
||||||
const useGroupedNotifications = computed(defaultStore.makeGetterSetter('useGroupedNotifications'));
|
const useGroupedNotifications = computed(defaultStore.makeGetterSetter('useGroupedNotifications'));
|
||||||
const enableSeasonalScreenEffect = computed(defaultStore.makeGetterSetter('enableSeasonalScreenEffect'));
|
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, () => {
|
watch(lang, () => {
|
||||||
miLocalStorage.setItem('lang', lang.value as string);
|
miLocalStorage.setItem('lang', lang.value as string);
|
||||||
miLocalStorage.removeItem('locale');
|
miLocalStorage.removeItem('locale');
|
||||||
|
@ -398,6 +504,30 @@ watch([
|
||||||
await reloadAsk();
|
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;
|
const emojiIndexLangs = ['en-US', 'ja-JP', 'ja-JP_hira'] as const;
|
||||||
|
|
||||||
function getEmojiIndexLangName(targetLang: typeof emojiIndexLangs[number]) {
|
function getEmojiIndexLangName(targetLang: typeof emojiIndexLangs[number]) {
|
||||||
|
|
|
@ -4,32 +4,32 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<MkStickyContainer>
|
<MkStickyContainer>
|
||||||
<template #header><MkPageHeader v-model:tab="src" :actions="headerActions" :tabs="$i ? headerTabs : headerTabsWhenNotLogin" :displayMyAvatar="true"/></template>
|
<template #header><MkPageHeader v-model:tab="src" :actions="headerActions" :tabs="$i ? headerTabs : headerTabsWhenNotLogin" :displayMyAvatar="true"/></template>
|
||||||
<MkSpacer :contentMax="800">
|
<MkSpacer :contentMax="800">
|
||||||
<div ref="rootEl" v-hotkey.global="keymap">
|
<div ref="rootEl" v-hotkey.global="keymap">
|
||||||
<MkInfo v-if="['home', 'local', 'social', 'global'].includes(src) && !defaultStore.reactiveState.timelineTutorials.value[src]" style="margin-bottom: var(--margin);" closable @close="closeTutorial()">
|
<MkInfo v-if="['home', 'local', 'social', 'global'].includes(src) && !defaultStore.reactiveState.timelineTutorials.value[src]" style="margin-bottom: var(--margin);" closable @close="closeTutorial()">
|
||||||
{{ i18n.ts._timelineDescription[src] }}
|
{{ i18n.ts._timelineDescription[src] }}
|
||||||
</MkInfo>
|
</MkInfo>
|
||||||
<MkPostForm v-if="defaultStore.reactiveState.showFixedPostForm.value" :class="$style.postForm" class="post-form _panel" fixed style="margin-bottom: var(--margin);"/>
|
<MkPostForm v-if="defaultStore.reactiveState.showFixedPostForm.value" :class="$style.postForm" class="post-form _panel" fixed style="margin-bottom: var(--margin);"/>
|
||||||
|
|
||||||
<div v-if="queue > 0" :class="$style.new"><button class="_buttonPrimary" :class="$style.newButton" @click="top()">{{ i18n.ts.newNoteRecived }}</button></div>
|
<div v-if="queue > 0" :class="$style.new"><button class="_buttonPrimary" :class="$style.newButton" @click="top()">{{ i18n.ts.newNoteRecived }}</button></div>
|
||||||
<div :class="$style.tl">
|
<div :class="$style.tl">
|
||||||
<MkTimeline
|
<MkTimeline
|
||||||
ref="tlComponent"
|
ref="tlComponent"
|
||||||
:key="src + withRenotes + withReplies + onlyFiles"
|
:key="src + withRenotes + withReplies + onlyFiles"
|
||||||
:src="src.split(':')[0]"
|
:src="src.split(':')[0]"
|
||||||
:list="src.split(':')[1]"
|
:list="src.split(':')[1]"
|
||||||
:withRenotes="withRenotes"
|
:withRenotes="withRenotes"
|
||||||
:withReplies="withReplies"
|
:withReplies="withReplies"
|
||||||
:onlyFiles="onlyFiles"
|
:onlyFiles="onlyFiles"
|
||||||
:sound="true"
|
:sound="true"
|
||||||
@queue="queueUpdated"
|
@queue="queueUpdated"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
</MkStickyContainer>
|
</MkStickyContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
@ -56,7 +56,7 @@ provide('shouldOmitHeaderTitle', true);
|
||||||
const isLocalTimelineAvailable = ($i == null && instance.policies.ltlAvailable) || ($i != null && $i.policies.ltlAvailable);
|
const isLocalTimelineAvailable = ($i == null && instance.policies.ltlAvailable) || ($i != null && $i.policies.ltlAvailable);
|
||||||
const isGlobalTimelineAvailable = ($i == null && instance.policies.gtlAvailable && defaultStore.state.showGlobalTimeline) || ($i != null && $i.policies.gtlAvailable && defaultStore.state.showGlobalTimeline);
|
const isGlobalTimelineAvailable = ($i == null && instance.policies.gtlAvailable && defaultStore.state.showGlobalTimeline) || ($i != null && $i.policies.gtlAvailable && defaultStore.state.showGlobalTimeline);
|
||||||
const keymap = {
|
const keymap = {
|
||||||
't': focus,
|
't': focus,
|
||||||
};
|
};
|
||||||
|
|
||||||
const tlComponent = shallowRef<InstanceType<typeof MkTimeline>>();
|
const tlComponent = shallowRef<InstanceType<typeof MkTimeline>>();
|
||||||
|
@ -68,29 +68,33 @@ const src = computed({ get: () => ($i ? defaultStore.reactiveState.tl.value.src
|
||||||
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 onlyFiles = ref(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(src, () => queue.value = 0);
|
||||||
|
|
||||||
watch(withReplies, (x) => {
|
watch(withReplies, (x) => {
|
||||||
if ($i) defaultStore.set('tlWithReplies', x);
|
if ($i) defaultStore.set('tlWithReplies', x);
|
||||||
});
|
});
|
||||||
|
|
||||||
function queueUpdated(q: number): void {
|
function queueUpdated(q: number): void {
|
||||||
queue.value = q;
|
queue.value = q;
|
||||||
}
|
}
|
||||||
|
|
||||||
function top(): void {
|
function top(): void {
|
||||||
if (rootEl.value) scroll(rootEl.value, { top: 0 });
|
if (rootEl.value) scroll(rootEl.value, { top: 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function chooseList(ev: MouseEvent): Promise<void> {
|
async function chooseList(ev: MouseEvent): Promise<void> {
|
||||||
const lists = await userListsCache.fetch();
|
const lists = await userListsCache.fetch();
|
||||||
const items : MenuItem[] = [
|
const items : MenuItem[] = [
|
||||||
... lists.map(list => ({
|
... lists.map(list => ({
|
||||||
type: 'link' as const,
|
type: 'link' as const,
|
||||||
text: list.name,
|
text: list.name,
|
||||||
to: `/timeline/list/${list.id}`,})),
|
to: `/timeline/list/${list.id}` })),
|
||||||
(lists.length === 0 ? undefined : { type: 'divider' }),
|
(lists.length === 0 ? undefined : { type: 'divider' }),
|
||||||
{
|
{
|
||||||
type: 'link' as const,
|
type: 'link' as const,
|
||||||
|
@ -98,18 +102,18 @@ async function chooseList(ev: MouseEvent): Promise<void> {
|
||||||
text: i18n.ts.createNew,
|
text: i18n.ts.createNew,
|
||||||
to: '/my/lists',
|
to: '/my/lists',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
os.popupMenu(items, ev.currentTarget ?? ev.target);
|
os.popupMenu(items, ev.currentTarget ?? ev.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function chooseAntenna(ev: MouseEvent): Promise<void> {
|
async function chooseAntenna(ev: MouseEvent): Promise<void> {
|
||||||
const antennas = await antennasCache.fetch();
|
const antennas = await antennasCache.fetch();
|
||||||
const items : MenuItem[] = [
|
const items : MenuItem[] = [
|
||||||
... antennas.map(antenna => ({
|
... antennas.map(antenna => ({
|
||||||
type: 'link' as const,
|
type: 'link' as const,
|
||||||
text: antenna.name,
|
text: antenna.name,
|
||||||
indicate: antenna.hasUnreadNote,
|
indicate: antenna.hasUnreadNote,
|
||||||
to: `/timeline/antenna/${antenna.id}`,})),
|
to: `/timeline/antenna/${antenna.id}` })),
|
||||||
(antennas.length === 0 ? undefined : { type: 'divider' }),
|
(antennas.length === 0 ? undefined : { type: 'divider' }),
|
||||||
{
|
{
|
||||||
type: 'link' as const,
|
type: 'link' as const,
|
||||||
|
@ -117,23 +121,23 @@ async function chooseAntenna(ev: MouseEvent): Promise<void> {
|
||||||
text: i18n.ts.createNew,
|
text: i18n.ts.createNew,
|
||||||
to: '/my/antennas',
|
to: '/my/antennas',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
os.popupMenu(items, ev.currentTarget ?? ev.target);
|
os.popupMenu(items, ev.currentTarget ?? ev.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function chooseChannel(ev: MouseEvent): Promise<void> {
|
async function chooseChannel(ev: MouseEvent): Promise<void> {
|
||||||
const channels = await misskeyApi('channels/my-favorites', {
|
const channels = await misskeyApi('channels/my-favorites', {
|
||||||
limit: 100,
|
limit: 100,
|
||||||
});
|
});
|
||||||
const items: MenuItem[] = [
|
const items: MenuItem[] = [
|
||||||
...channels.map(channel => {
|
...channels.map(channel => {
|
||||||
const lastReadedAt = miLocalStorage.getItemAsJson(`channelLastReadedAt:${channel.id}`) ?? null;
|
const lastReadedAt = miLocalStorage.getItemAsJson(`channelLastReadedAt:${channel.id}`) ?? null;
|
||||||
const hasUnreadNote = (lastReadedAt && channel.lastNotedAt) ? Date.parse(channel.lastNotedAt) > lastReadedAt : !!(!lastReadedAt && channel.lastNotedAt);
|
const hasUnreadNote = (lastReadedAt && channel.lastNotedAt) ? Date.parse(channel.lastNotedAt) > lastReadedAt : !!(!lastReadedAt && channel.lastNotedAt);
|
||||||
|
|
||||||
return {type: 'link' as const,
|
return { type: 'link' as const,
|
||||||
text: channel.name,
|
text: channel.name,
|
||||||
indicate: hasUnreadNote,
|
indicate: hasUnreadNote,
|
||||||
to: `/channels/${channel.id}`,};
|
to: `/channels/${channel.id}` };
|
||||||
}),
|
}),
|
||||||
(channels.length === 0 ? undefined : { type: 'divider' }),
|
(channels.length === 0 ? undefined : { type: 'divider' }),
|
||||||
{
|
{
|
||||||
|
@ -142,34 +146,34 @@ async function chooseChannel(ev: MouseEvent): Promise<void> {
|
||||||
text: i18n.ts.createNew,
|
text: i18n.ts.createNew,
|
||||||
to: '/channels',
|
to: '/channels',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
os.popupMenu(items, ev.currentTarget ?? ev.target);
|
os.popupMenu(items, ev.currentTarget ?? ev.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveSrc(newSrc: 'home' | 'local' | 'media' | 'social' | 'global' | `list:${string}`): void {
|
function saveSrc(newSrc: 'home' | 'local' | 'media' | 'social' | 'global' | `list:${string}`): void {
|
||||||
let userList = null;
|
let userList = null;
|
||||||
if (newSrc.startsWith('userList:')) {
|
if (newSrc.startsWith('userList:')) {
|
||||||
const id = newSrc.substring('userList:'.length);
|
const id = newSrc.substring('userList:'.length);
|
||||||
userList = defaultStore.reactiveState.pinnedUserLists.value.find(l => l.id === id);
|
userList = defaultStore.reactiveState.pinnedUserLists.value.find(l => l.id === id);
|
||||||
}
|
}
|
||||||
defaultStore.set('tl', {
|
defaultStore.set('tl', {
|
||||||
src: newSrc,
|
src: newSrc,
|
||||||
userList,
|
userList,
|
||||||
});
|
});
|
||||||
srcWhenNotSignin.value = newSrc;
|
srcWhenNotSignin.value = newSrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function timetravel(): Promise<void> {
|
async function timetravel(): Promise<void> {
|
||||||
const { canceled, result: date } = await os.inputDate({
|
const { canceled, result: date } = await os.inputDate({
|
||||||
title: i18n.ts.date,
|
title: i18n.ts.date,
|
||||||
});
|
});
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
|
|
||||||
tlComponent.value.timetravel(date);
|
tlComponent.value.timetravel(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
function focus(): void {
|
function focus(): void {
|
||||||
tlComponent.value.focus();
|
tlComponent.value.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeTutorial(): void {
|
function closeTutorial(): void {
|
||||||
|
@ -180,28 +184,28 @@ function closeTutorial(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
const headerActions = computed(() => {
|
const headerActions = computed(() => {
|
||||||
const tmp = [
|
const tmp = [
|
||||||
{icon: 'ti ti-dots',
|
{ icon: 'ti ti-dots',
|
||||||
text: i18n.ts.options,
|
text: i18n.ts.options,
|
||||||
handler: (ev) => {
|
handler: (ev) => {
|
||||||
os.popupMenu([{
|
os.popupMenu([{
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
text: i18n.ts.showRenotes,
|
text: i18n.ts.showRenotes,
|
||||||
|
|
||||||
ref: withRenotes,
|
ref: withRenotes,
|
||||||
}, src.value === 'local' || src.value === 'social' ? {
|
}, src.value === 'local' || src.value === 'social' ? {
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
text: i18n.ts.showRepliesToOthersInTimeline,
|
text: i18n.ts.showRepliesToOthersInTimeline,
|
||||||
ref: withReplies,
|
ref: withReplies,
|
||||||
disabled: onlyFiles,} : undefined, {
|
disabled: onlyFiles } : undefined, {
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
text: i18n.ts.fileAttachedOnly,
|
text: i18n.ts.fileAttachedOnly,
|
||||||
|
|
||||||
ref: onlyFiles,
|
ref: onlyFiles,
|
||||||
disabled: src.value === 'local' || src.value === 'social' ? withReplies : false,
|
disabled: src.value === 'local' || src.value === 'social' ? withReplies : false,
|
||||||
}], ev.currentTarget ?? ev.target);
|
}], ev.currentTarget ?? ev.target);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
if (deviceKind === 'desktop') {
|
if (deviceKind === 'desktop') {
|
||||||
tmp.unshift({
|
tmp.unshift({
|
||||||
|
@ -217,70 +221,95 @@ const headerActions = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const headerTabs = computed(() => [...(defaultStore.reactiveState.pinnedUserLists.value.map(l => ({
|
const headerTabs = computed(() => [...(defaultStore.reactiveState.pinnedUserLists.value.map(l => ({
|
||||||
key: 'list:' + l.id,
|
key: 'list:' + l.id,
|
||||||
title: l.name,
|
title: l.name,
|
||||||
icon: 'ti ti-star',
|
icon: 'ti ti-star',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
}))), {
|
}))), {
|
||||||
key: 'home',
|
key: 'home',
|
||||||
title: i18n.ts._timelines.home,
|
title: i18n.ts._timelines.home,
|
||||||
icon: 'ti ti-home',
|
icon: 'ti ti-home',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
}, ...(isLocalTimelineAvailable ? [{
|
}, ...(isLocalTimelineAvailable ? [{
|
||||||
key: 'local',
|
key: 'local',
|
||||||
title: i18n.ts._timelines.local,
|
title: i18n.ts._timelines.local,
|
||||||
icon: 'ti ti-planet',
|
icon: 'ti ti-planet',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
}, ...(isShowMediaTimeline.value ? [{
|
}, ...(isShowMediaTimeline.value ? [{
|
||||||
key: 'media',
|
key: 'media',
|
||||||
title: i18n.ts._timelines.media,
|
title: i18n.ts._timelines.media,
|
||||||
icon: 'ti ti-photo',
|
icon: 'ti ti-photo',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
}] : []), {
|
}] : []), {
|
||||||
key: 'social',
|
key: 'social',
|
||||||
title: i18n.ts._timelines.social,
|
title: i18n.ts._timelines.social,
|
||||||
icon: 'ti ti-universe',
|
icon: 'ti ti-universe',
|
||||||
iconOnly: true,
|
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 ? [{
|
}] : []), ...(isGlobalTimelineAvailable ? [{
|
||||||
key: 'global',
|
key: 'global',
|
||||||
title: i18n.ts._timelines.global,
|
title: i18n.ts._timelines.global,
|
||||||
icon: 'ti ti-whirl',
|
icon: 'ti ti-whirl',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
}] : []), {
|
}] : []), {
|
||||||
icon: 'ti ti-list',
|
icon: 'ti ti-list',
|
||||||
title: i18n.ts.lists,
|
title: i18n.ts.lists,
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
onClick: chooseList,
|
onClick: chooseList,
|
||||||
}, {
|
}, {
|
||||||
icon: 'ti ti-antenna',
|
icon: 'ti ti-antenna',
|
||||||
title: i18n.ts.antennas,
|
title: i18n.ts.antennas,
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
onClick: chooseAntenna,
|
onClick: chooseAntenna,
|
||||||
}, {
|
}, {
|
||||||
icon: 'ti ti-device-tv',
|
icon: 'ti ti-device-tv',
|
||||||
title: i18n.ts.channel,
|
title: i18n.ts.channel,
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
onClick: chooseChannel,
|
onClick: chooseChannel,
|
||||||
}] as Tab[]);
|
}] as Tab[]);
|
||||||
|
|
||||||
const headerTabsWhenNotLogin = computed(() => [
|
const headerTabsWhenNotLogin = computed(() => [
|
||||||
...(isLocalTimelineAvailable ? [{
|
...(isLocalTimelineAvailable ? [{
|
||||||
key: 'local',
|
key: 'local',
|
||||||
title: i18n.ts._timelines.local,
|
title: i18n.ts._timelines.local,
|
||||||
icon: 'ti ti-planet',
|
icon: 'ti ti-planet',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
}] : []),
|
}] : []),
|
||||||
...(isGlobalTimelineAvailable ? [{
|
...(isGlobalTimelineAvailable ? [{
|
||||||
key: 'global',
|
key: 'global',
|
||||||
title: i18n.ts._timelines.global,
|
title: i18n.ts._timelines.global,
|
||||||
icon: 'ti ti-whirl',
|
icon: 'ti ti-whirl',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
}] : []),
|
}] : []),
|
||||||
] as Tab[]);
|
] as Tab[]);
|
||||||
|
|
||||||
definePageMetadata(computed(() => ({
|
definePageMetadata(computed(() => ({
|
||||||
title: i18n.ts.timeline,
|
title: i18n.ts.timeline,
|
||||||
icon: src.value === 'local' ? 'ti ti-planet' : src.value === 'social' ? 'ti ti-universe' : src.value === 'global' ? 'ti ti-whirl' : 'ti ti-home',
|
icon: src.value === 'local' ? 'ti ti-planet' : src.value === 'social' ? 'ti ti-universe' : src.value === 'global' ? 'ti ti-whirl' : 'ti ti-home',
|
||||||
})));
|
})));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -465,6 +465,86 @@ export const defaultStore = markRaw(new Storage('base', {
|
||||||
where: 'device',
|
where: 'device',
|
||||||
default: 44,
|
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: {
|
onlyAndWithSave: {
|
||||||
where: 'device',
|
where: 'device',
|
||||||
default: false,
|
default: false,
|
||||||
|
|
Loading…
Reference in New Issue