Compare commits
21 Commits
12b7ec3046
...
0a29c8de90
| Author | SHA1 | Date |
|---|---|---|
|
|
0a29c8de90 | |
|
|
22766fc7a2 | |
|
|
2bc15c09ed | |
|
|
1995400dac | |
|
|
f65e85c319 | |
|
|
28e394eddc | |
|
|
a0e9ebfb83 | |
|
|
54fa83f1c5 | |
|
|
fab470d64d | |
|
|
e2cac3d949 | |
|
|
5fa8735cc4 | |
|
|
3439a29c14 | |
|
|
879f2d2b7e | |
|
|
4406af58f1 | |
|
|
8a735c23e7 | |
|
|
d6fb3c3342 | |
|
|
31d811f145 | |
|
|
b02f724475 | |
|
|
2834e54e78 | |
|
|
828749be64 | |
|
|
bfca457510 |
12
CHANGELOG.md
12
CHANGELOG.md
|
|
@ -12,6 +12,18 @@
|
|||
|
||||
-->
|
||||
|
||||
## 2023.x.x (unreleased)
|
||||
|
||||
### General
|
||||
-
|
||||
|
||||
### Client
|
||||
-
|
||||
|
||||
### Server
|
||||
- Fix: トークンのないプラグインをアンインストールするときにエラーが出ないように
|
||||
- Fix: 投稿通知がオンでもダイレクト投稿はユーザーに通知されないようにされました
|
||||
|
||||
## 2023.11.0
|
||||
|
||||
### Note
|
||||
|
|
|
|||
|
|
@ -595,7 +595,6 @@ export interface Locale {
|
|||
"poll": string;
|
||||
"schedulePost": string;
|
||||
"useCw": string;
|
||||
"schedulePostList": string;
|
||||
"enablePlayer": string;
|
||||
"disablePlayer": string;
|
||||
"expandTweet": string;
|
||||
|
|
@ -2469,6 +2468,14 @@ export interface Locale {
|
|||
};
|
||||
};
|
||||
};
|
||||
"_schedulePost": {
|
||||
"list": string;
|
||||
"postDate": string;
|
||||
"postTime": string;
|
||||
"localTime": string;
|
||||
"addSchedule": string;
|
||||
"willBePostedAtX": string;
|
||||
};
|
||||
}
|
||||
declare const locales: {
|
||||
[lang: string]: Locale;
|
||||
|
|
|
|||
|
|
@ -592,7 +592,6 @@ visibility: "公開範囲"
|
|||
poll: "アンケート"
|
||||
schedulePost: "予約投稿"
|
||||
useCw: "内容を隠す"
|
||||
schedulePostList: "予約投稿一覧"
|
||||
enablePlayer: "プレイヤーを開く"
|
||||
disablePlayer: "プレイヤーを閉じる"
|
||||
expandTweet: "ポストを展開する"
|
||||
|
|
@ -2356,3 +2355,11 @@ _externalResourceInstaller:
|
|||
_themeInstallFailed:
|
||||
title: "テーマのインストールに失敗しました"
|
||||
description: "テーマのインストール中に問題が発生しました。もう一度お試しください。エラーの詳細はJavascriptコンソールをご覧ください。"
|
||||
|
||||
_schedulePost:
|
||||
list: "予約投稿一覧"
|
||||
postDate: "日付"
|
||||
postTime: "時刻"
|
||||
localTime: "端末に設定されているタイムゾーンの時刻で投稿されます。"
|
||||
addSchedule: "予約設定"
|
||||
willBePostedAtX: "{date}に投稿予約しました。"
|
||||
|
|
|
|||
|
|
@ -15,19 +15,16 @@ import { extractHashtags } from '@/misc/extract-hashtags.js';
|
|||
import type { IMentionedRemoteUsers } from '@/models/Note.js';
|
||||
import { MiNote } from '@/models/Note.js';
|
||||
import type { ChannelFollowingsRepository, ChannelsRepository, FollowingsRepository, InstancesRepository, MiFollowing, MutingsRepository, NotesRepository, NoteThreadMutingsRepository, UserListMembershipsRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
|
||||
import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||
import type { MiApp } from '@/models/App.js';
|
||||
import { concat } from '@/misc/prelude/array.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import type { MiUser, MiLocalUser, MiRemoteUser } from '@/models/User.js';
|
||||
import type { IPoll } from '@/models/Poll.js';
|
||||
import { MiPoll } from '@/models/Poll.js';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
|
||||
import { checkWordMute } from '@/misc/check-word-mute.js';
|
||||
import type { MiChannel } from '@/models/Channel.js';
|
||||
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||
import { MemorySingleCache } from '@/misc/cache.js';
|
||||
import type { MiUserProfile } from '@/models/UserProfile.js';
|
||||
import type { MiNoteCreateOption as Option, MiMinimumUser as MinimumUser } from '@/types.js';
|
||||
import { RelayService } from '@/core/RelayService.js';
|
||||
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
|
|
@ -57,7 +54,6 @@ import { FeaturedService } from '@/core/FeaturedService.js';
|
|||
import { FunoutTimelineService } from '@/core/FunoutTimelineService.js';
|
||||
import { UtilityService } from '@/core/UtilityService.js';
|
||||
import { UserBlockingService } from '@/core/UserBlockingService.js';
|
||||
import { MiNoteSchedule } from '@/models/_.js';
|
||||
|
||||
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
|
||||
|
||||
|
|
@ -117,36 +113,6 @@ class NotificationManager {
|
|||
}
|
||||
}
|
||||
|
||||
type MinimumUser = {
|
||||
id: MiUser['id'];
|
||||
host: MiUser['host'];
|
||||
username: MiUser['username'];
|
||||
uri: MiUser['uri'];
|
||||
};
|
||||
|
||||
type Option = {
|
||||
createdAt?: Date | null;
|
||||
name?: string | null;
|
||||
text?: string | null;
|
||||
reply?: MiNote | null;
|
||||
renote?: MiNote | null;
|
||||
files?: MiDriveFile[] | null;
|
||||
poll?: IPoll | null;
|
||||
schedule?: MiNoteSchedule | null;
|
||||
localOnly?: boolean | null;
|
||||
reactionAcceptance?: MiNote['reactionAcceptance'];
|
||||
cw?: string | null;
|
||||
visibility?: string;
|
||||
visibleUsers?: MinimumUser[] | null;
|
||||
channel?: MiChannel | null;
|
||||
apMentions?: MinimumUser[] | null;
|
||||
apHashtags?: string[] | null;
|
||||
apEmojis?: string[] | null;
|
||||
uri?: string | null;
|
||||
url?: string | null;
|
||||
app?: MiApp | null;
|
||||
};
|
||||
|
||||
@Injectable()
|
||||
export class NoteCreateService implements OnApplicationShutdown {
|
||||
#shutdownController = new AbortController();
|
||||
|
|
@ -522,11 +488,13 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
followeeId: user.id,
|
||||
notify: 'normal',
|
||||
}).then(followings => {
|
||||
for (const following of followings) {
|
||||
// TODO: ワードミュート考慮
|
||||
this.notificationService.createNotification(following.followerId, 'note', {
|
||||
noteId: note.id,
|
||||
}, user.id);
|
||||
if (note.visibility !== 'specified') {
|
||||
for (const following of followings) {
|
||||
// TODO: ワードミュート考慮
|
||||
this.notificationService.createNotification(following.followerId, 'note', {
|
||||
noteId: note.id,
|
||||
}, user.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export const DI = {
|
|||
//#region Repositories
|
||||
usersRepository: Symbol('usersRepository'),
|
||||
notesRepository: Symbol('notesRepository'),
|
||||
noteScheduleRepository: Symbol('noteScheduleRepository'),
|
||||
scheduledNotesRepository: Symbol('scheduledNotesRepository'),
|
||||
announcementsRepository: Symbol('announcementsRepository'),
|
||||
announcementReadsRepository: Symbol('announcementReadsRepository'),
|
||||
appsRepository: Symbol('appsRepository'),
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
|
||||
import { noteVisibilities } from '@/types.js';
|
||||
import { MiNote } from '@/models/Note.js';
|
||||
import { id } from './util/id.js';
|
||||
import { MiUser } from './User.js';
|
||||
import { MiChannel } from './Channel.js';
|
||||
import type { MiDriveFile } from './DriveFile.js';
|
||||
|
||||
@Entity('note_schedule')
|
||||
export class MiNoteSchedule {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('jsonb')
|
||||
public note:{createdAt?: Date | undefined ; apEmojis: any[] | undefined; visibility: any; apMentions: any[] | undefined; visibleUsers: MiUser[]; channel: null | MiChannel; poll: { multiple: any; choices: any; expiresAt: Date | null } | undefined; renote: null | MiNote; localOnly: any; cw: any; apHashtags: any[] | undefined; reactionAcceptance: any; files: MiDriveFile[]; text: any; reply: null | MiNote };
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 260,
|
||||
})
|
||||
public userId: MiUser['id'];
|
||||
|
||||
@Column('timestamp with time zone')
|
||||
public expiresAt: Date;
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ import {
|
|||
MiUserPublickey,
|
||||
MiUserSecurityKey,
|
||||
MiWebhook,
|
||||
MiNoteSchedule,
|
||||
MiScheduledNote,
|
||||
} from './_.js';
|
||||
import type { DataSource } from 'typeorm';
|
||||
import type { Provider } from '@nestjs/common';
|
||||
|
|
@ -88,9 +88,9 @@ const $notesRepository: Provider = {
|
|||
inject: [DI.db],
|
||||
};
|
||||
|
||||
const $noteScheduleRepository: Provider = {
|
||||
provide: DI.noteScheduleRepository,
|
||||
useFactory: (db: DataSource) => db.getRepository(MiNoteSchedule),
|
||||
const $scheduledNotesRepository: Provider = {
|
||||
provide: DI.scheduledNotesRepository,
|
||||
useFactory: (db: DataSource) => db.getRepository(MiScheduledNote),
|
||||
inject: [DI.db],
|
||||
};
|
||||
|
||||
|
|
@ -478,7 +478,7 @@ const $userMemosRepository: Provider = {
|
|||
providers: [
|
||||
$usersRepository,
|
||||
$notesRepository,
|
||||
$noteScheduleRepository,
|
||||
$scheduledNotesRepository,
|
||||
$announcementsRepository,
|
||||
$announcementReadsRepository,
|
||||
$appsRepository,
|
||||
|
|
@ -546,7 +546,7 @@ const $userMemosRepository: Provider = {
|
|||
exports: [
|
||||
$usersRepository,
|
||||
$notesRepository,
|
||||
$noteScheduleRepository,
|
||||
$scheduledNotesRepository,
|
||||
$announcementsRepository,
|
||||
$announcementReadsRepository,
|
||||
$appsRepository,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
|
||||
import type { MiNoteCreateOption } from '@/types.js';
|
||||
import { id } from './util/id.js';
|
||||
import { MiUser } from './User.js';
|
||||
|
||||
@Entity('note_schedule')
|
||||
export class MiScheduledNote {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('jsonb')
|
||||
public note: MiNoteCreateOption;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 260,
|
||||
})
|
||||
public userId: MiUser['id'];
|
||||
|
||||
@Column('timestamp with time zone')
|
||||
public expiresAt: Date;
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ import { MiRoleAssignment } from '@/models/RoleAssignment.js';
|
|||
import { MiFlash } from '@/models/Flash.js';
|
||||
import { MiFlashLike } from '@/models/FlashLike.js';
|
||||
import { MiUserListFavorite } from '@/models/UserListFavorite.js';
|
||||
import { MiNoteSchedule } from './NoteSchedule.js';
|
||||
import { MiScheduledNote } from './ScheduledNote.js';
|
||||
import type { Repository } from 'typeorm';
|
||||
|
||||
export {
|
||||
|
|
@ -105,7 +105,7 @@ export {
|
|||
MiNoteReaction,
|
||||
MiNoteThreadMuting,
|
||||
MiNoteUnread,
|
||||
MiNoteSchedule,
|
||||
MiScheduledNote,
|
||||
MiPage,
|
||||
MiPageLike,
|
||||
MiPasswordResetRequest,
|
||||
|
|
@ -173,7 +173,7 @@ export type NoteFavoritesRepository = Repository<MiNoteFavorite>;
|
|||
export type NoteReactionsRepository = Repository<MiNoteReaction>;
|
||||
export type NoteThreadMutingsRepository = Repository<MiNoteThreadMuting>;
|
||||
export type NoteUnreadsRepository = Repository<MiNoteUnread>;
|
||||
export type NoteScheduleRepository = Repository<MiNoteSchedule>;
|
||||
export type ScheduledNotesRepository = Repository<MiScheduledNote>;
|
||||
export type PagesRepository = Repository<MiPage>;
|
||||
export type PageLikesRepository = Repository<MiPageLike>;
|
||||
export type PasswordResetRequestsRepository = Repository<MiPasswordResetRequest>;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ import { MiRoleAssignment } from '@/models/RoleAssignment.js';
|
|||
import { MiFlash } from '@/models/Flash.js';
|
||||
import { MiFlashLike } from '@/models/FlashLike.js';
|
||||
import { MiUserMemo } from '@/models/UserMemo.js';
|
||||
import { MiNoteSchedule } from '@/models/NoteSchedule.js';
|
||||
import { MiScheduledNote } from '@/models/ScheduledNote.js';
|
||||
|
||||
import { Config } from '@/config.js';
|
||||
import MisskeyLogger from '@/logger.js';
|
||||
|
|
@ -150,7 +150,7 @@ export const entities = [
|
|||
MiRenoteMuting,
|
||||
MiBlocking,
|
||||
MiNote,
|
||||
MiNoteSchedule,
|
||||
MiScheduledNote,
|
||||
MiNoteFavorite,
|
||||
MiNoteReaction,
|
||||
MiNoteThreadMuting,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
|||
import type Logger from '@/logger.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { NoteCreateService } from '@/core/NoteCreateService.js';
|
||||
import type { NoteScheduleRepository, UsersRepository } from '@/models/_.js';
|
||||
import type { ScheduledNotesRepository, UsersRepository } from '@/models/_.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||
import type * as Bull from 'bullmq';
|
||||
|
|
@ -18,8 +18,8 @@ export class ScheduleNotePostProcessorService {
|
|||
private logger: Logger;
|
||||
|
||||
constructor(
|
||||
@Inject(DI.noteScheduleRepository)
|
||||
private noteScheduleRepository: NoteScheduleRepository,
|
||||
@Inject(DI.scheduledNotesRepository)
|
||||
private scheduledNotesRepository: ScheduledNotesRepository,
|
||||
|
||||
@Inject(DI.usersRepository)
|
||||
private usersRepository: UsersRepository,
|
||||
|
|
@ -32,14 +32,14 @@ export class ScheduleNotePostProcessorService {
|
|||
|
||||
@bindThis
|
||||
public async process(job: Bull.Job<ScheduleNotePostJobData>): Promise<void> {
|
||||
this.noteScheduleRepository.findOneBy({ id: job.data.scheduleNoteId }).then(async (data) => {
|
||||
this.scheduledNotesRepository.findOneBy({ id: job.data.scheduledNoteId }).then(async (data) => {
|
||||
if (!data) {
|
||||
this.logger.warn(`Schedule note ${job.data.scheduleNoteId} not found`);
|
||||
this.logger.warn(`Schedule note ${job.data.scheduledNoteId} not found`);
|
||||
} else {
|
||||
data.note.createdAt = new Date();
|
||||
const me = await this.usersRepository.findOneByOrFail({ id: data.userId });
|
||||
await this.noteCreateService.create(me, data.note);
|
||||
await this.noteScheduleRepository.remove(data);
|
||||
await this.scheduledNotesRepository.remove(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import type { MiLocalUser, MiUser } from '@/models/User.js';
|
|||
import type { MiWebhook } from '@/models/Webhook.js';
|
||||
import type { IActivity } from '@/core/activitypub/type.js';
|
||||
import { IPoll } from '@/models/Poll.js';
|
||||
import { MiNoteSchedule } from '@/models/NoteSchedule.js';
|
||||
import { MiScheduledNote } from '@/models/ScheduledNote.js';
|
||||
import { MiChannel } from '@/models/Channel.js';
|
||||
import { MiApp } from '@/models/App.js';
|
||||
import type httpSignature from '@peertube/http-signature';
|
||||
|
|
@ -109,7 +109,7 @@ export type EndedPollNotificationJobData = {
|
|||
};
|
||||
|
||||
export type ScheduleNotePostJobData = {
|
||||
scheduleNoteId: MiNote['id'];
|
||||
scheduledNoteId: MiNote['id'];
|
||||
}
|
||||
|
||||
type MinimumUser = {
|
||||
|
|
|
|||
|
|
@ -263,10 +263,9 @@ import * as ep___notes_children from './endpoints/notes/children.js';
|
|||
import * as ep___notes_clips from './endpoints/notes/clips.js';
|
||||
import * as ep___notes_conversation from './endpoints/notes/conversation.js';
|
||||
import * as ep___notes_create from './endpoints/notes/create.js';
|
||||
import * as ep___notes_schedule_create from './endpoints/notes/create-schedule.js';
|
||||
import * as ep___notes_schedule_list from './endpoints/notes/list-schedule.js';
|
||||
import * as ep___notes_schedule_delete from './endpoints/notes/schedule/delete.js';
|
||||
import * as ep___notes_schedule_list from './endpoints/notes/schedule/list.js';
|
||||
import * as ep___notes_delete from './endpoints/notes/delete.js';
|
||||
import * as ep___notes_schedule_delete from './endpoints/notes/delete-schedule.js';
|
||||
import * as ep___notes_favorites_create from './endpoints/notes/favorites/create.js';
|
||||
import * as ep___notes_favorites_delete from './endpoints/notes/favorites/delete.js';
|
||||
import * as ep___notes_featured from './endpoints/notes/featured.js';
|
||||
|
|
@ -624,10 +623,9 @@ const $notes_children: Provider = { provide: 'ep:notes/children', useClass: ep__
|
|||
const $notes_clips: Provider = { provide: 'ep:notes/clips', useClass: ep___notes_clips.default };
|
||||
const $notes_conversation: Provider = { provide: 'ep:notes/conversation', useClass: ep___notes_conversation.default };
|
||||
const $notes_create: Provider = { provide: 'ep:notes/create', useClass: ep___notes_create.default };
|
||||
const $notes_schedule_create: Provider = { provide: 'ep:notes/create-schedule', useClass: ep___notes_schedule_create.default };
|
||||
const $notes_schedule_list: Provider = { provide: 'ep:notes/list-schedule', useClass: ep___notes_schedule_list.default };
|
||||
const $notes_schedule_delete: Provider = { provide: 'ep:notes/schedule/delete', useClass: ep___notes_schedule_delete.default };
|
||||
const $notes_schedule_list: Provider = { provide: 'ep:notes/schedule/list', useClass: ep___notes_schedule_list.default };
|
||||
const $notes_delete: Provider = { provide: 'ep:notes/delete', useClass: ep___notes_delete.default };
|
||||
const $notes_schedule_delete: Provider = { provide: 'ep:notes/delete-schedule', useClass: ep___notes_schedule_delete.default };
|
||||
const $notes_favorites_create: Provider = { provide: 'ep:notes/favorites/create', useClass: ep___notes_favorites_create.default };
|
||||
const $notes_favorites_delete: Provider = { provide: 'ep:notes/favorites/delete', useClass: ep___notes_favorites_delete.default };
|
||||
const $notes_featured: Provider = { provide: 'ep:notes/featured', useClass: ep___notes_featured.default };
|
||||
|
|
@ -989,10 +987,9 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
|||
$notes_clips,
|
||||
$notes_conversation,
|
||||
$notes_create,
|
||||
$notes_schedule_create,
|
||||
$notes_schedule_delete,
|
||||
$notes_schedule_list,
|
||||
$notes_delete,
|
||||
$notes_schedule_delete,
|
||||
$notes_favorites_create,
|
||||
$notes_favorites_delete,
|
||||
$notes_featured,
|
||||
|
|
@ -1348,10 +1345,9 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
|||
$notes_clips,
|
||||
$notes_conversation,
|
||||
$notes_create,
|
||||
$notes_schedule_create,
|
||||
$notes_schedule_delete,
|
||||
$notes_schedule_list,
|
||||
$notes_delete,
|
||||
$notes_schedule_delete,
|
||||
$notes_favorites_create,
|
||||
$notes_favorites_delete,
|
||||
$notes_featured,
|
||||
|
|
|
|||
|
|
@ -263,10 +263,9 @@ import * as ep___notes_children from './endpoints/notes/children.js';
|
|||
import * as ep___notes_clips from './endpoints/notes/clips.js';
|
||||
import * as ep___notes_conversation from './endpoints/notes/conversation.js';
|
||||
import * as ep___notes_create from './endpoints/notes/create.js';
|
||||
import * as ep___notes_schedule_create from './endpoints/notes/create-schedule.js';
|
||||
import * as ep___notes_schedule_list from './endpoints/notes/list-schedule.js';
|
||||
import * as ep___notes_schedule_delete from './endpoints/notes/schedule/delete.js';
|
||||
import * as ep___notes_schedule_list from './endpoints/notes/schedule/list.js';
|
||||
import * as ep___notes_delete from './endpoints/notes/delete.js';
|
||||
import * as ep___notes_schedule_delete from './endpoints/notes/delete-schedule.js';
|
||||
import * as ep___notes_favorites_create from './endpoints/notes/favorites/create.js';
|
||||
import * as ep___notes_favorites_delete from './endpoints/notes/favorites/delete.js';
|
||||
import * as ep___notes_featured from './endpoints/notes/featured.js';
|
||||
|
|
@ -622,10 +621,9 @@ const eps = [
|
|||
['notes/clips', ep___notes_clips],
|
||||
['notes/conversation', ep___notes_conversation],
|
||||
['notes/create', ep___notes_create],
|
||||
['notes/create-schedule', ep___notes_schedule_create],
|
||||
['notes/list-schedule', ep___notes_schedule_list],
|
||||
['notes/schedule/delete', ep___notes_schedule_delete],
|
||||
['notes/schedule/list', ep___notes_schedule_list],
|
||||
['notes/delete', ep___notes_delete],
|
||||
['notes/delete-schedule', ep___notes_schedule_delete],
|
||||
['notes/favorites/create', ep___notes_favorites_create],
|
||||
['notes/favorites/delete', ep___notes_favorites_delete],
|
||||
['notes/featured', ep___notes_featured],
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export const paramDef = {
|
|||
type: 'object',
|
||||
properties: {
|
||||
tokenId: { type: 'string', format: 'misskey:id' },
|
||||
token: { type: 'string' },
|
||||
token: { type: 'string', nullable: true },
|
||||
},
|
||||
anyOf: [
|
||||
{ required: ['tokenId'] },
|
||||
|
|
|
|||
|
|
@ -1,403 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import ms from 'ms';
|
||||
import { DataSource, In } from 'typeorm';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import type { MiUser } from '@/models/User.js';
|
||||
import type {
|
||||
UsersRepository,
|
||||
NotesRepository,
|
||||
BlockingsRepository,
|
||||
DriveFilesRepository,
|
||||
ChannelsRepository,
|
||||
NoteScheduleRepository,
|
||||
} from '@/models/_.js';
|
||||
import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||
import type { MiNote } from '@/models/Note.js';
|
||||
import type { MiChannel } from '@/models/Channel.js';
|
||||
import { MAX_NOTE_TEXT_LENGTH } from '@/const.js';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { NoteCreateService } from '@/core/NoteCreateService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { isPureRenote } from '@/misc/is-pure-renote.js';
|
||||
import { QueueService } from '@/core/QueueService.js';
|
||||
import { MiNoteSchedule } from '@/models/_.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['notes'],
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
prohibitMoved: true,
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 300,
|
||||
},
|
||||
|
||||
kind: 'write:notes',
|
||||
|
||||
errors: {
|
||||
noSuchRenoteTarget: {
|
||||
message: 'No such renote target.',
|
||||
code: 'NO_SUCH_RENOTE_TARGET',
|
||||
id: 'b5c90186-4ab0-49c8-9bba-a1f76c282ba4',
|
||||
},
|
||||
|
||||
cannotReRenote: {
|
||||
message: 'You can not Renote a pure Renote.',
|
||||
code: 'CANNOT_RENOTE_TO_A_PURE_RENOTE',
|
||||
id: 'fd4cc33e-2a37-48dd-99cc-9b806eb2031a',
|
||||
},
|
||||
|
||||
cannotRenoteDueToVisibility: {
|
||||
message: 'You can not Renote due to target visibility.',
|
||||
code: 'CANNOT_RENOTE_DUE_TO_VISIBILITY',
|
||||
id: 'be9529e9-fe72-4de0-ae43-0b363c4938af',
|
||||
},
|
||||
|
||||
noSuchReplyTarget: {
|
||||
message: 'No such reply target.',
|
||||
code: 'NO_SUCH_REPLY_TARGET',
|
||||
id: '749ee0f6-d3da-459a-bf02-282e2da4292c',
|
||||
},
|
||||
|
||||
cannotReplyToPureRenote: {
|
||||
message: 'You can not reply to a pure Renote.',
|
||||
code: 'CANNOT_REPLY_TO_A_PURE_RENOTE',
|
||||
id: '3ac74a84-8fd5-4bb0-870f-01804f82ce15',
|
||||
},
|
||||
|
||||
cannotCreateAlreadyExpiredPoll: {
|
||||
message: 'Poll is already expired.',
|
||||
code: 'CANNOT_CREATE_ALREADY_EXPIRED_POLL',
|
||||
id: '04da457d-b083-4055-9082-955525eda5a5',
|
||||
},
|
||||
|
||||
cannotCreateAlreadyExpiredSchedule: {
|
||||
message: 'Schedule is already expired.',
|
||||
code: 'CANNOT_CREATE_ALREADY_EXPIRED_SCHEDULE',
|
||||
id: '8a9bfb90-fc7e-4878-a3e8-d97faaf5fb07',
|
||||
},
|
||||
|
||||
noSuchChannel: {
|
||||
message: 'No such channel.',
|
||||
code: 'NO_SUCH_CHANNEL',
|
||||
id: 'b1653923-5453-4edc-b786-7c4f39bb0bbb',
|
||||
},
|
||||
noSuchSchedule: {
|
||||
message: 'No such schedule.',
|
||||
code: 'NO_SUCH_SCHEDULE',
|
||||
id: '44dee229-8da1-4a61-856d-e3a4bbc12032',
|
||||
},
|
||||
youHaveBeenBlocked: {
|
||||
message: 'You have been blocked by this user.',
|
||||
code: 'YOU_HAVE_BEEN_BLOCKED',
|
||||
id: 'b390d7e1-8a5e-46ed-b625-06271cafd3d3',
|
||||
},
|
||||
|
||||
noSuchFile: {
|
||||
message: 'Some files are not found.',
|
||||
code: 'NO_SUCH_FILE',
|
||||
id: 'b6992544-63e7-67f0-fa7f-32444b1b5306',
|
||||
},
|
||||
|
||||
cannotRenoteOutsideOfChannel: {
|
||||
message: 'Cannot renote outside of channel.',
|
||||
code: 'CANNOT_RENOTE_OUTSIDE_OF_CHANNEL',
|
||||
id: '33510210-8452-094c-6227-4a6c05d99f00',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
visibility: { type: 'string', enum: ['public', 'home', 'followers', 'specified'], default: 'public' },
|
||||
visibleUserIds: { type: 'array', uniqueItems: true, items: {
|
||||
type: 'string', format: 'misskey:id',
|
||||
} },
|
||||
cw: { type: 'string', nullable: true, minLength: 1, maxLength: 100 },
|
||||
localOnly: { type: 'boolean', default: false },
|
||||
reactionAcceptance: { type: 'string', nullable: true, enum: [null, 'likeOnly', 'likeOnlyForRemote', 'nonSensitiveOnly', 'nonSensitiveOnlyForLocalLikeOnlyForRemote'], default: null },
|
||||
noExtractMentions: { type: 'boolean', default: false },
|
||||
noExtractHashtags: { type: 'boolean', default: false },
|
||||
noExtractEmojis: { type: 'boolean', default: false },
|
||||
replyId: { type: 'string', format: 'misskey:id', nullable: true },
|
||||
renoteId: { type: 'string', format: 'misskey:id', nullable: true },
|
||||
channelId: { type: 'string', format: 'misskey:id', nullable: true },
|
||||
|
||||
// anyOf内にバリデーションを書いても最初の一つしかチェックされない
|
||||
// See https://github.com/misskey-dev/misskey/pull/10082
|
||||
text: {
|
||||
type: 'string',
|
||||
minLength: 1,
|
||||
maxLength: MAX_NOTE_TEXT_LENGTH,
|
||||
nullable: true,
|
||||
},
|
||||
fileIds: {
|
||||
type: 'array',
|
||||
uniqueItems: true,
|
||||
minItems: 1,
|
||||
maxItems: 16,
|
||||
items: { type: 'string', format: 'misskey:id' },
|
||||
},
|
||||
mediaIds: {
|
||||
type: 'array',
|
||||
uniqueItems: true,
|
||||
minItems: 1,
|
||||
maxItems: 16,
|
||||
items: { type: 'string', format: 'misskey:id' },
|
||||
},
|
||||
poll: {
|
||||
type: 'object',
|
||||
nullable: true,
|
||||
properties: {
|
||||
choices: {
|
||||
type: 'array',
|
||||
uniqueItems: true,
|
||||
minItems: 2,
|
||||
maxItems: 10,
|
||||
items: { type: 'string', minLength: 1, maxLength: 50 },
|
||||
},
|
||||
multiple: { type: 'boolean' },
|
||||
expiresAt: { type: 'integer', nullable: true },
|
||||
expiredAfter: { type: 'integer', nullable: true, minimum: 1 },
|
||||
},
|
||||
required: ['choices'],
|
||||
},
|
||||
schedule: {
|
||||
type: 'object',
|
||||
nullable: false,
|
||||
properties: {
|
||||
expiresAt: { type: 'integer', nullable: false },
|
||||
},
|
||||
},
|
||||
},
|
||||
// (re)note with text, files and poll are optional
|
||||
anyOf: [
|
||||
{ required: ['text'] },
|
||||
{ required: ['renoteId'] },
|
||||
{ required: ['fileIds'] },
|
||||
{ required: ['mediaIds'] },
|
||||
{ required: ['poll'] },
|
||||
{ required: ['schedule'] },
|
||||
],
|
||||
} as const;
|
||||
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||
constructor(
|
||||
@Inject(DI.usersRepository)
|
||||
private usersRepository: UsersRepository,
|
||||
|
||||
@Inject(DI.notesRepository)
|
||||
private notesRepository: NotesRepository,
|
||||
|
||||
@Inject(DI.noteScheduleRepository)
|
||||
private noteScheduleRepository: NoteScheduleRepository,
|
||||
|
||||
@Inject(DI.blockingsRepository)
|
||||
private blockingsRepository: BlockingsRepository,
|
||||
|
||||
@Inject(DI.driveFilesRepository)
|
||||
private driveFilesRepository: DriveFilesRepository,
|
||||
|
||||
@Inject(DI.channelsRepository)
|
||||
private channelsRepository: ChannelsRepository,
|
||||
|
||||
private queueService: QueueService,
|
||||
private idService: IdService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
let visibleUsers: MiUser[] = [];
|
||||
if (ps.visibleUserIds) {
|
||||
visibleUsers = await this.usersRepository.findBy({
|
||||
id: In(ps.visibleUserIds),
|
||||
});
|
||||
}
|
||||
|
||||
let files: MiDriveFile[] = [];
|
||||
const fileIds = ps.fileIds ?? ps.mediaIds ?? null;
|
||||
if (fileIds != null) {
|
||||
files = await this.driveFilesRepository.createQueryBuilder('file')
|
||||
.where('file.userId = :userId AND file.id IN (:...fileIds)', {
|
||||
userId: me.id,
|
||||
fileIds,
|
||||
})
|
||||
.orderBy('array_position(ARRAY[:...fileIds], "id"::text)')
|
||||
.setParameters({ fileIds })
|
||||
.getMany();
|
||||
|
||||
if (files.length !== fileIds.length) {
|
||||
throw new ApiError(meta.errors.noSuchFile);
|
||||
}
|
||||
}
|
||||
|
||||
let renote: MiNote | null = null;
|
||||
if (ps.renoteId != null) {
|
||||
// Fetch renote to note
|
||||
renote = await this.notesRepository.findOneBy({ id: ps.renoteId });
|
||||
|
||||
if (renote == null) {
|
||||
throw new ApiError(meta.errors.noSuchRenoteTarget);
|
||||
} else if (isPureRenote(renote)) {
|
||||
throw new ApiError(meta.errors.cannotReRenote);
|
||||
}
|
||||
|
||||
// Check blocking
|
||||
if (renote.userId !== me.id) {
|
||||
const blockExist = await this.blockingsRepository.exist({
|
||||
where: {
|
||||
blockerId: renote.userId,
|
||||
blockeeId: me.id,
|
||||
},
|
||||
});
|
||||
if (blockExist) {
|
||||
throw new ApiError(meta.errors.youHaveBeenBlocked);
|
||||
}
|
||||
}
|
||||
|
||||
if (renote.visibility === 'followers' && renote.userId !== me.id) {
|
||||
// 他人のfollowers noteはreject
|
||||
throw new ApiError(meta.errors.cannotRenoteDueToVisibility);
|
||||
} else if (renote.visibility === 'specified') {
|
||||
// specified / direct noteはreject
|
||||
throw new ApiError(meta.errors.cannotRenoteDueToVisibility);
|
||||
}
|
||||
|
||||
if (renote.channelId && renote.channelId !== ps.channelId) {
|
||||
// チャンネルのノートに対しリノート要求がきたとき、チャンネル外へのリノート可否をチェック
|
||||
// リノートのユースケースのうち、チャンネル内→チャンネル外は少数だと考えられるため、JOINはせず必要な時に都度取得する
|
||||
const renoteChannel = await this.channelsRepository.findOneById(renote.channelId);
|
||||
if (renoteChannel == null) {
|
||||
// リノートしたいノートが書き込まれているチャンネルが無い
|
||||
throw new ApiError(meta.errors.noSuchChannel);
|
||||
} else if (!renoteChannel.allowRenoteToExternal) {
|
||||
// リノート作成のリクエストだが、対象チャンネルがリノート禁止だった場合
|
||||
throw new ApiError(meta.errors.cannotRenoteOutsideOfChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let reply: MiNote | null = null;
|
||||
if (ps.replyId != null) {
|
||||
// Fetch reply
|
||||
reply = await this.notesRepository.findOneBy({ id: ps.replyId });
|
||||
|
||||
if (reply == null) {
|
||||
throw new ApiError(meta.errors.noSuchReplyTarget);
|
||||
} else if (isPureRenote(reply)) {
|
||||
throw new ApiError(meta.errors.cannotReplyToPureRenote);
|
||||
}
|
||||
|
||||
// Check blocking
|
||||
if (reply.userId !== me.id) {
|
||||
const blockExist = await this.blockingsRepository.exist({
|
||||
where: {
|
||||
blockerId: reply.userId,
|
||||
blockeeId: me.id,
|
||||
},
|
||||
});
|
||||
if (blockExist) {
|
||||
throw new ApiError(meta.errors.youHaveBeenBlocked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ps.poll) {
|
||||
if (typeof ps.poll.expiresAt === 'number') {
|
||||
if (ps.poll.expiresAt < Date.now()) {
|
||||
throw new ApiError(meta.errors.cannotCreateAlreadyExpiredPoll);
|
||||
}
|
||||
} else if (typeof ps.poll.expiredAfter === 'number') {
|
||||
ps.poll.expiresAt = Date.now() + ps.poll.expiredAfter;
|
||||
}
|
||||
}
|
||||
|
||||
let channel: MiChannel | null = null;
|
||||
if (ps.channelId != null) {
|
||||
channel = await this.channelsRepository.findOneBy({ id: ps.channelId, isArchived: false });
|
||||
|
||||
if (channel == null) {
|
||||
throw new ApiError(meta.errors.noSuchChannel);
|
||||
}
|
||||
}
|
||||
if (ps.schedule) {
|
||||
if (typeof ps.schedule.expiresAt === 'number') {
|
||||
if (ps.schedule.expiresAt < Date.now()) {
|
||||
throw new ApiError(meta.errors.cannotCreateAlreadyExpiredSchedule);
|
||||
}
|
||||
}
|
||||
}
|
||||
type NoteType = {
|
||||
createdAt?: Date | undefined;
|
||||
apEmojis: any[] | undefined;
|
||||
visibility: any;
|
||||
apMentions: any[] | undefined;
|
||||
visibleUsers: MiUser[];
|
||||
channel: null | MiChannel;
|
||||
poll: {
|
||||
multiple: any;
|
||||
choices: any;
|
||||
expiresAt: Date | null;
|
||||
} | undefined;
|
||||
renote: null | MiNote;
|
||||
localOnly: any;
|
||||
cw: any;
|
||||
apHashtags: any[] | undefined;
|
||||
reactionAcceptance: any;
|
||||
files: MiDriveFile[];
|
||||
text: any;
|
||||
reply: null | MiNote;
|
||||
};
|
||||
const note:NoteType = {
|
||||
files: files,
|
||||
poll: ps.poll ? {
|
||||
choices: ps.poll.choices,
|
||||
multiple: ps.poll.multiple ?? false,
|
||||
expiresAt: ps.poll.expiresAt ? new Date(ps.poll.expiresAt) : null,
|
||||
} : undefined,
|
||||
text: ps.text ?? undefined,
|
||||
reply,
|
||||
renote,
|
||||
cw: ps.cw,
|
||||
localOnly: ps.localOnly,
|
||||
reactionAcceptance: ps.reactionAcceptance,
|
||||
visibility: ps.visibility,
|
||||
visibleUsers,
|
||||
channel,
|
||||
apMentions: ps.noExtractMentions ? [] : undefined,
|
||||
apHashtags: ps.noExtractHashtags ? [] : undefined,
|
||||
apEmojis: ps.noExtractEmojis ? [] : undefined,
|
||||
};
|
||||
|
||||
if (ps.schedule && ps.schedule.expiresAt) {
|
||||
me.token = null;
|
||||
const noteId = this.idService.gen(new Date().getTime());
|
||||
await this.noteScheduleRepository.insert({
|
||||
id: noteId,
|
||||
note: note,
|
||||
userId: me.id,
|
||||
expiresAt: new Date(ps.schedule.expiresAt),
|
||||
});
|
||||
|
||||
const delay = new Date(ps.schedule.expiresAt).getTime() - Date.now();
|
||||
await this.queueService.ScheduleNotePostQueue.add(String(delay), {
|
||||
scheduleNoteId: noteId,
|
||||
}, {
|
||||
delay,
|
||||
removeOnComplete: true,
|
||||
});
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,8 @@ import ms from 'ms';
|
|||
import { In } from 'typeorm';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import type { MiUser } from '@/models/User.js';
|
||||
import type { UsersRepository, NotesRepository, BlockingsRepository, DriveFilesRepository, ChannelsRepository } from '@/models/_.js';
|
||||
import type { UsersRepository, NotesRepository, ScheduledNotesRepository, BlockingsRepository, DriveFilesRepository, ChannelsRepository } from '@/models/_.js';
|
||||
import type { MiNoteCreateOption } from '@/types.js';
|
||||
import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||
import type { MiNote } from '@/models/Note.js';
|
||||
import type { MiChannel } from '@/models/Channel.js';
|
||||
|
|
@ -15,6 +16,8 @@ import { MAX_NOTE_TEXT_LENGTH } from '@/const.js';
|
|||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { NoteCreateService } from '@/core/NoteCreateService.js';
|
||||
import { QueueService } from '@/core/QueueService.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { isPureRenote } from '@/misc/is-pure-renote.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
|
|
@ -39,9 +42,17 @@ export const meta = {
|
|||
properties: {
|
||||
createdNote: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
optional: false, nullable: true,
|
||||
ref: 'Note',
|
||||
},
|
||||
scheduledNoteId: {
|
||||
type: 'string',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
scheduledNote: {
|
||||
type: 'object',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -105,6 +116,22 @@ export const meta = {
|
|||
code: 'CANNOT_RENOTE_OUTSIDE_OF_CHANNEL',
|
||||
id: '33510210-8452-094c-6227-4a6c05d99f00',
|
||||
},
|
||||
|
||||
cannotCreateAlreadyExpiredSchedule: {
|
||||
message: 'Schedule is already expired.',
|
||||
code: 'CANNOT_CREATE_ALREADY_EXPIRED_SCHEDULE',
|
||||
id: '8a9bfb90-fc7e-4878-a3e8-d97faaf5fb07',
|
||||
},
|
||||
specifyScheduleDate: {
|
||||
message: 'Please specify schedule date.',
|
||||
code: 'PLEASE_SPECIFY_SCHEDULE_DATE',
|
||||
id: 'c93a6ad6-f7e2-4156-a0c2-3d03529e5e0f',
|
||||
},
|
||||
noSuchSchedule: {
|
||||
message: 'No such schedule.',
|
||||
code: 'NO_SUCH_SCHEDULE',
|
||||
id: '44dee229-8da1-4a61-856d-e3a4bbc12032',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
|
@ -164,6 +191,13 @@ export const paramDef = {
|
|||
},
|
||||
required: ['choices'],
|
||||
},
|
||||
schedule: {
|
||||
type: 'object',
|
||||
nullable: true,
|
||||
properties: {
|
||||
expiresAt: { type: 'integer', nullable: false },
|
||||
},
|
||||
},
|
||||
},
|
||||
// (re)note with text, files and poll are optional
|
||||
anyOf: [
|
||||
|
|
@ -172,6 +206,7 @@ export const paramDef = {
|
|||
{ required: ['fileIds'] },
|
||||
{ required: ['mediaIds'] },
|
||||
{ required: ['poll'] },
|
||||
{ required: ['schedule'] },
|
||||
],
|
||||
} as const;
|
||||
|
||||
|
|
@ -184,6 +219,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
@Inject(DI.notesRepository)
|
||||
private notesRepository: NotesRepository,
|
||||
|
||||
@Inject(DI.scheduledNotesRepository)
|
||||
private scheduledNotesRepository: ScheduledNotesRepository,
|
||||
|
||||
@Inject(DI.blockingsRepository)
|
||||
private blockingsRepository: BlockingsRepository,
|
||||
|
||||
|
|
@ -195,6 +233,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
private noteEntityService: NoteEntityService,
|
||||
private noteCreateService: NoteCreateService,
|
||||
|
||||
private queueService: QueueService,
|
||||
private idService: IdService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
let visibleUsers: MiUser[] = [];
|
||||
|
|
@ -311,8 +352,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
}
|
||||
}
|
||||
|
||||
// 投稿を作成
|
||||
const note = await this.noteCreateService.create(me, {
|
||||
const note: MiNoteCreateOption = {
|
||||
createdAt: new Date(),
|
||||
files: files,
|
||||
poll: ps.poll ? {
|
||||
|
|
@ -332,11 +372,45 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
apMentions: ps.noExtractMentions ? [] : undefined,
|
||||
apHashtags: ps.noExtractHashtags ? [] : undefined,
|
||||
apEmojis: ps.noExtractEmojis ? [] : undefined,
|
||||
});
|
||||
|
||||
return {
|
||||
createdNote: await this.noteEntityService.pack(note, me),
|
||||
};
|
||||
|
||||
if (ps.schedule) {
|
||||
if (!ps.schedule.expiresAt) {
|
||||
throw new ApiError(meta.errors.specifyScheduleDate);
|
||||
}
|
||||
|
||||
me.token = null;
|
||||
const scheduledNoteId = this.idService.gen(new Date().getTime());
|
||||
await this.scheduledNotesRepository.insert({
|
||||
id: scheduledNoteId,
|
||||
note: note,
|
||||
userId: me.id,
|
||||
expiresAt: new Date(ps.schedule.expiresAt),
|
||||
});
|
||||
|
||||
const delay = new Date(ps.schedule.expiresAt).getTime() - Date.now();
|
||||
await this.queueService.ScheduleNotePostQueue.add(String(delay), {
|
||||
scheduledNoteId,
|
||||
}, {
|
||||
jobId: scheduledNoteId,
|
||||
delay,
|
||||
removeOnComplete: true,
|
||||
});
|
||||
|
||||
return {
|
||||
scheduledNoteId,
|
||||
scheduledNote: note,
|
||||
|
||||
// ↓互換性のため(微妙)
|
||||
createdNote: null,
|
||||
};
|
||||
} else {
|
||||
// 投稿を作成
|
||||
const createdNoteRaw = await this.noteCreateService.create(me, note);
|
||||
return {
|
||||
createdNote: await this.noteEntityService.pack(createdNoteRaw, me),
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import ms from 'ms';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { NoteScheduleRepository } from '@/models/_.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['notes'],
|
||||
|
||||
requireCredential: true,
|
||||
res: {
|
||||
type: 'array',
|
||||
optional: false, nullable: false,
|
||||
items: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
ref: 'Note',
|
||||
},
|
||||
},
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 300,
|
||||
},
|
||||
|
||||
errors: {
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
},
|
||||
required: [],
|
||||
} as const;
|
||||
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||
constructor(
|
||||
@Inject(DI.noteScheduleRepository)
|
||||
private noteScheduleRepository: NoteScheduleRepository,
|
||||
private userEntityService: UserEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const scheduleNotes = await this.noteScheduleRepository.findBy({ userId: me.id });
|
||||
const user = await this.userEntityService.pack(me, me);
|
||||
scheduleNotes.forEach((item: any) => {
|
||||
item.note.user = user;
|
||||
item.note.createdAt = new Date(item.expiresAt);
|
||||
item.note.isSchedule = true;
|
||||
item.note.id = item.id;
|
||||
});
|
||||
return scheduleNotes;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
import ms from 'ms';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import type { NoteScheduleRepository } from '@/models/_.js';
|
||||
import type { ScheduledNotesRepository } from '@/models/_.js';
|
||||
import { QueueService } from '@/core/QueueService.js';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
|
||||
|
|
@ -31,19 +32,24 @@ export const meta = {
|
|||
export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
noteId: { type: 'string', format: 'misskey:id' },
|
||||
scheduledNoteId: { type: 'string', format: 'misskey:id' },
|
||||
},
|
||||
required: ['noteId'],
|
||||
required: ['scheduledNoteId'],
|
||||
} as const;
|
||||
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||
constructor(
|
||||
@Inject(DI.noteScheduleRepository)
|
||||
private noteScheduleRepository: NoteScheduleRepository,
|
||||
@Inject(DI.scheduledNotesRepository)
|
||||
private scheduledNotesRepository: ScheduledNotesRepository,
|
||||
|
||||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
await this.noteScheduleRepository.delete({ id: ps.noteId });
|
||||
await this.scheduledNotesRepository.delete({ id: ps.scheduledNoteId });
|
||||
if (ps.scheduledNoteId) {
|
||||
await this.queueService.ScheduleNotePostQueue.remove(ps.scheduledNoteId);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import ms from 'ms';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { ScheduledNotesRepository } from '@/models/_.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['notes'],
|
||||
|
||||
requireCredential: true,
|
||||
res: {
|
||||
type: 'array',
|
||||
optional: false, nullable: false,
|
||||
items: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
properties: {
|
||||
id: { type: 'string', optional: false, nullable: false },
|
||||
note: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
properties: {
|
||||
id: { type: 'string', optional: false, nullable: false },
|
||||
text: { type: 'string', optional: false, nullable: false },
|
||||
files: { type: 'array', optional: false, nullable: false, items: { type: 'any' } },
|
||||
localOnly: { type: 'boolean', optional: false, nullable: false },
|
||||
visibility: { type: 'string', optional: false, nullable: false },
|
||||
visibleUsers: { type: 'array', optional: false, nullable: false, items: { type: 'any' } },
|
||||
reactionAcceptance: { type: 'string', optional: false, nullable: false },
|
||||
user: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
ref: 'User',
|
||||
},
|
||||
createdAt: { type: 'string', optional: false, nullable: false },
|
||||
isSchedule: { type: 'boolean', optional: false, nullable: false },
|
||||
},
|
||||
},
|
||||
userId: { type: 'string', optional: false, nullable: false },
|
||||
expiresAt: { type: 'string', optional: false, nullable: false },
|
||||
},
|
||||
},
|
||||
},
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 300,
|
||||
},
|
||||
|
||||
errors: {
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
} as const;
|
||||
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||
constructor(
|
||||
@Inject(DI.scheduledNotesRepository)
|
||||
private scheduledNotesRepository: ScheduledNotesRepository,
|
||||
private userEntityService: UserEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const scheduleNotes = await this.scheduledNotesRepository.findBy({ userId: me.id });
|
||||
const user = await this.userEntityService.pack(me, me);
|
||||
const scheduleNotesPack: {
|
||||
id: string;
|
||||
note: {
|
||||
id: string;
|
||||
text: string;
|
||||
files: any[];
|
||||
localOnly: boolean;
|
||||
visibility: string;
|
||||
visibleUsers: any[];
|
||||
reactionAcceptance: string;
|
||||
user: any;
|
||||
createdAt: string;
|
||||
isSchedule: boolean;
|
||||
};
|
||||
userId: string;
|
||||
expiresAt: string;
|
||||
}[] = scheduleNotes.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
note: {
|
||||
...item.note,
|
||||
user: user,
|
||||
createdAt: new Date(item.expiresAt),
|
||||
isSchedule: true,
|
||||
// ↓TODO: NoteのIDに予約投稿IDを入れたくない(本来別ものなため)
|
||||
id: item.id,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
return scheduleNotesPack;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -185,6 +185,7 @@ export class ClientServerService {
|
|||
serverErrorImageUrl: meta.serverErrorImageUrl ?? 'https://xn--931a.moe/assets/error.jpg',
|
||||
infoImageUrl: meta.infoImageUrl ?? 'https://xn--931a.moe/assets/info.jpg',
|
||||
notFoundImageUrl: meta.notFoundImageUrl ?? 'https://xn--931a.moe/assets/not-found.jpg',
|
||||
instanceUrl: this.config.url,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ html
|
|||
meta(name='theme-color' content= themeColor || '#86b300')
|
||||
meta(name='theme-color-orig' content= themeColor || '#86b300')
|
||||
meta(property='og:site_name' content= instanceName || 'Misskey')
|
||||
meta(property='instance_url' content= instanceUrl)
|
||||
meta(name='viewport' content='width=device-width, initial-scale=1')
|
||||
link(rel='icon' href= icon || '/favicon.ico')
|
||||
link(rel='apple-touch-icon' href= appleTouchIcon || '/apple-touch-icon.png')
|
||||
|
|
|
|||
|
|
@ -3,6 +3,14 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||
import type { IPoll } from '@/models/Poll.js';
|
||||
import type { MiChannel } from '@/models/Channel.js';
|
||||
import type { MiApp } from '@/models/App.js';
|
||||
import type { MiUser } from '@/models/User.js';
|
||||
import type { MiNote } from '@/models/Note.js';
|
||||
import type { MiScheduledNote } from '@/models/ScheduledNote.js';
|
||||
|
||||
/**
|
||||
* note - 通知オンにしているユーザーが投稿した
|
||||
* follow - フォローされた
|
||||
|
|
@ -239,6 +247,36 @@ export type ModerationLogPayloads = {
|
|||
};
|
||||
};
|
||||
|
||||
export type MiMinimumUser = {
|
||||
id: MiUser['id'];
|
||||
host: MiUser['host'];
|
||||
username: MiUser['username'];
|
||||
uri: MiUser['uri'];
|
||||
};
|
||||
|
||||
export type MiNoteCreateOption = {
|
||||
createdAt?: Date | null;
|
||||
name?: string | null;
|
||||
text?: string | null;
|
||||
reply?: MiNote | null;
|
||||
renote?: MiNote | null;
|
||||
files?: MiDriveFile[] | null;
|
||||
poll?: IPoll | null;
|
||||
schedule?: MiScheduledNote | null;
|
||||
localOnly?: boolean | null;
|
||||
reactionAcceptance?: MiNote['reactionAcceptance'];
|
||||
cw?: string | null;
|
||||
visibility?: string;
|
||||
visibleUsers?: MiMinimumUser[] | null;
|
||||
channel?: MiChannel | null;
|
||||
apMentions?: MiMinimumUser[] | null;
|
||||
apHashtags?: string[] | null;
|
||||
apEmojis?: string[] | null;
|
||||
uri?: string | null;
|
||||
url?: string | null;
|
||||
app?: MiApp | null;
|
||||
};
|
||||
|
||||
export type Serialized<T> = {
|
||||
[K in keyof T]:
|
||||
T[K] extends Date
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export async function mainBoot() {
|
|||
});
|
||||
|
||||
for (const plugin of ColdDeviceStorage.get('plugins').filter(p => p.active)) {
|
||||
import('../plugin').then(async ({ install }) => {
|
||||
import('@/plugin.js').then(async ({ install }) => {
|
||||
// Workaround for https://bugs.webkit.org/show_bug.cgi?id=242740
|
||||
await new Promise(r => setTimeout(r, 0));
|
||||
install(plugin);
|
||||
|
|
|
|||
|
|
@ -421,9 +421,9 @@ onBeforeUnmount(() => {
|
|||
.indicator {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 13px;
|
||||
right: 18px;
|
||||
color: var(--indicator);
|
||||
font-size: 12px;
|
||||
font-size: 8px;
|
||||
animation: blink 1s infinite;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -202,11 +202,17 @@ let note = $ref(deepClone(props.note));
|
|||
// plugin
|
||||
if (noteViewInterruptors.length > 0) {
|
||||
onMounted(async () => {
|
||||
let result:Misskey.entities.Note | null = deepClone(note);
|
||||
let result: Misskey.entities.Note | null = deepClone(note);
|
||||
for (const interruptor of noteViewInterruptors) {
|
||||
result = await interruptor.handler(result);
|
||||
|
||||
if (result === null) return isDeleted.value = true;
|
||||
try {
|
||||
result = await interruptor.handler(result);
|
||||
if (result === null) {
|
||||
isDeleted.value = true;
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
note = result;
|
||||
});
|
||||
|
|
@ -228,8 +234,8 @@ const clipButton = shallowRef<HTMLElement>();
|
|||
let appearNote = $computed(() => isRenote ? note.renote as Misskey.entities.Note : note);
|
||||
const isMyRenote = $i && ($i.id === note.userId);
|
||||
const showContent = ref(false);
|
||||
const parsed = appearNote.text ? mfm.parse(appearNote.text) : null;
|
||||
const urls = parsed ? extractUrlFromMfm(parsed) : null;
|
||||
const parsed = $computed(() => appearNote.text ? mfm.parse(appearNote.text) : null);
|
||||
const urls = $computed(() => parsed ? extractUrlFromMfm(parsed) : null);
|
||||
const isLong = shouldCollapsed(appearNote, urls ?? []);
|
||||
const collapsed = ref(appearNote.cw == null && isLong);
|
||||
const isDeleted = ref(false);
|
||||
|
|
@ -298,7 +304,7 @@ function renote(viaKeyboard = false) {
|
|||
const { menu } = getRenoteMenu({ note: note, renoteButton, mock: props.mock });
|
||||
os.popupMenu(menu, renoteButton.value, {
|
||||
viaKeyboard,
|
||||
}).then(focus);
|
||||
});
|
||||
}
|
||||
|
||||
function reply(viaKeyboard = false): void {
|
||||
|
|
|
|||
|
|
@ -239,11 +239,17 @@ let note = $ref(deepClone(props.note));
|
|||
// plugin
|
||||
if (noteViewInterruptors.length > 0) {
|
||||
onMounted(async () => {
|
||||
let result:Misskey.entities.Note | null = deepClone(note);
|
||||
let result: Misskey.entities.Note | null = deepClone(note);
|
||||
for (const interruptor of noteViewInterruptors) {
|
||||
result = await interruptor.handler(result);
|
||||
|
||||
if (result === null) return isDeleted.value = true;
|
||||
try {
|
||||
result = await interruptor.handler(result);
|
||||
if (result === null) {
|
||||
isDeleted.value = true;
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
note = result;
|
||||
});
|
||||
|
|
@ -344,7 +350,7 @@ function renote(viaKeyboard = false) {
|
|||
const { menu } = getRenoteMenu({ note: note, renoteButton });
|
||||
os.popupMenu(menu, renoteButton.value, {
|
||||
viaKeyboard,
|
||||
}).then(focus);
|
||||
});
|
||||
}
|
||||
|
||||
function reply(viaKeyboard = false): void {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@ const props = defineProps<{
|
|||
}>();
|
||||
|
||||
async function deleteScheduleNote() {
|
||||
await os.apiWithDialog('notes/delete-schedule', { noteId: props.note.id })
|
||||
if (!props.note.isSchedule) return;
|
||||
// スケジュールつきノートの場合は、ノートIDのフィールドに予約投稿ID(scheduledNoteId)が入るので注意!!!!
|
||||
await os.apiWithDialog('notes/schedule/delete', { scheduledNoteId: props.note.id })
|
||||
.then(() => {
|
||||
isDeleted.value = true;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</button>
|
||||
</div>
|
||||
<div :class="$style.headerRight">
|
||||
<button v-tooltip="i18n.ts.schedulePost" class="_button" :class="[$style.headerRightItem, { [$style.headerRightButtonActive]: schedule }]" @click="toggleSchedule"><i class="ti ti-calendar-time"></i></button>
|
||||
<button v-tooltip="i18n.ts.schedulePostList" class="_button" :class="[$style.headerRightItem]" @click="listSchedulePost"><i class="ti ti-calendar-event"></i></button>
|
||||
<template v-if="!(channel != null && fixed)">
|
||||
<button v-if="channel == null" ref="visibilityButton" v-click-anime v-tooltip="i18n.ts.visibility" :class="['_button', $style.headerRightItem, $style.visibility]" @click="setVisibility">
|
||||
<span v-if="visibility === 'public'"><i class="ti ti-world"></i></span>
|
||||
|
|
@ -38,17 +36,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<span v-if="!localOnly"><i class="ti ti-rocket"></i></span>
|
||||
<span v-else><i class="ti ti-rocket-off"></i></span>
|
||||
</button>
|
||||
<button v-click-anime v-tooltip="i18n.ts.reactionAcceptance" class="_button" :class="[$style.headerRightItem, { [$style.danger]: reactionAcceptance === 'likeOnly' }]" @click="toggleReactionAcceptance">
|
||||
<span v-if="reactionAcceptance === 'likeOnly'"><i class="ti ti-heart"></i></span>
|
||||
<span v-else-if="reactionAcceptance === 'likeOnlyForRemote'"><i class="ti ti-heart-plus"></i></span>
|
||||
<span v-else><i class="ti ti-icons"></i></span>
|
||||
</button>
|
||||
<button v-tooltip="i18n.ts.otherSettings" class="_button" :class="[$style.headerRightItem]" @click="openOtherSettingsMenu"><i class="ti ti-dots"></i></button>
|
||||
<button v-click-anime class="_button" :class="$style.submit" :disabled="!canPost" data-cy-open-post-form-submit @click="post">
|
||||
<div :class="$style.submitInner">
|
||||
<template v-if="posted"></template>
|
||||
<template v-else-if="posting"><MkEllipsis/></template>
|
||||
<template v-else>{{ submitText }}</template>
|
||||
<i style="margin-left: 6px;" :class="posted ? 'ti ti-check' : reply ? 'ti ti-arrow-back-up' : renote ? 'ti ti-quote' : 'ti ti-send'"></i>
|
||||
<i style="margin-left: 6px;" :class="posted ? 'ti ti-check' : reply ? 'ti ti-arrow-back-up' : renote ? 'ti ti-quote' : schedule ? 'ti ti-clock-hour-4' : 'ti ti-send'"></i>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -117,6 +111,7 @@ import { formatTimeString } from '@/scripts/format-time-string.js';
|
|||
import { Autocomplete } from '@/scripts/autocomplete.js';
|
||||
import * as os from '@/os.js';
|
||||
import { selectFiles } from '@/scripts/select-file.js';
|
||||
import { dateTimeFormat } from '@/scripts/intl-const.js';
|
||||
import { defaultStore, notePostInterruptors, postFormActions } from '@/store.js';
|
||||
import MkInfo from '@/components/MkInfo.vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
|
@ -242,7 +237,9 @@ const submitText = $computed((): string => {
|
|||
? i18n.ts.quote
|
||||
: props.reply
|
||||
? i18n.ts.reply
|
||||
: i18n.ts.note;
|
||||
: schedule
|
||||
? i18n.ts._schedulePost.addSchedule
|
||||
: i18n.ts.note;
|
||||
});
|
||||
|
||||
const textLength = $computed((): number => {
|
||||
|
|
@ -563,6 +560,7 @@ function removeVisibleUser(user) {
|
|||
|
||||
function clear() {
|
||||
text = '';
|
||||
schedule = null;
|
||||
files = [];
|
||||
poll = null;
|
||||
quoteId = null;
|
||||
|
|
@ -752,8 +750,8 @@ async function post(ev?: MouseEvent) {
|
|||
replyId: props.reply ? props.reply.id : undefined,
|
||||
renoteId: props.renote ? props.renote.id : quoteId ? quoteId : undefined,
|
||||
channelId: props.channel ? props.channel.id : undefined,
|
||||
schedule: schedule,
|
||||
poll: poll,
|
||||
schedule,
|
||||
poll,
|
||||
cw: useCw ? cw ?? '' : null,
|
||||
localOnly: localOnly,
|
||||
visibility: visibility,
|
||||
|
|
@ -769,19 +767,27 @@ async function post(ev?: MouseEvent) {
|
|||
// plugin
|
||||
if (notePostInterruptors.length > 0) {
|
||||
for (const interruptor of notePostInterruptors) {
|
||||
postData = await interruptor.handler(deepClone(postData));
|
||||
try {
|
||||
postData = await interruptor.handler(deepClone(postData));
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (postData.schedule?.expiresAt && typeof postData.schedule.expiresAt === 'string') {
|
||||
postData.schedule.expiresAt = parseInt(postData.schedule.expiresAt);
|
||||
}
|
||||
|
||||
let token = undefined;
|
||||
|
||||
if (postAccount) {
|
||||
const storedAccounts = await getAccounts();
|
||||
token = storedAccounts.find(x => x.id === postAccount.id)?.token;
|
||||
token = storedAccounts.find(x => x.id === postAccount?.id)?.token;
|
||||
}
|
||||
|
||||
posting = true;
|
||||
os.api(postData.schedule ? 'notes/create-schedule' : 'notes/create', postData, token).then(() => {
|
||||
os.api('notes/create', postData, token).then(() => {
|
||||
if (props.freezeAfterPosted) {
|
||||
posted = true;
|
||||
} else {
|
||||
|
|
@ -802,6 +808,13 @@ async function post(ev?: MouseEvent) {
|
|||
if (notesCount === 1) {
|
||||
claimAchievement('notes1');
|
||||
}
|
||||
poll = null;
|
||||
|
||||
if (postData.schedule?.expiresAt) {
|
||||
const d = new Date(postData.schedule.expiresAt);
|
||||
const str = dateTimeFormat.format(d);
|
||||
os.toast(i18n.t('_schedulePost.willBePostedAtX', { date: str }));
|
||||
}
|
||||
|
||||
const text = postData.text ?? '';
|
||||
const lowerCase = text.toLowerCase();
|
||||
|
|
@ -897,6 +910,45 @@ function openAccountMenu(ev: MouseEvent) {
|
|||
}, ev);
|
||||
}
|
||||
|
||||
function openOtherSettingsMenu(ev: MouseEvent) {
|
||||
let reactionAcceptanceIcon: string;
|
||||
switch (reactionAcceptance) {
|
||||
case 'likeOnly':
|
||||
reactionAcceptanceIcon = 'ti ti-heart';
|
||||
break;
|
||||
case 'likeOnlyForRemote':
|
||||
reactionAcceptanceIcon = 'ti ti-heart-plus';
|
||||
break;
|
||||
default:
|
||||
reactionAcceptanceIcon = 'ti ti-icons';
|
||||
break;
|
||||
}
|
||||
|
||||
os.popupMenu([{
|
||||
type: 'button',
|
||||
text: i18n.ts.reactionAcceptance,
|
||||
icon: reactionAcceptanceIcon,
|
||||
action: toggleReactionAcceptance,
|
||||
}, {
|
||||
type: 'button',
|
||||
text: i18n.ts.schedulePost,
|
||||
icon: 'ti ti-calendar-time',
|
||||
indicate: (schedule != null),
|
||||
action: toggleSchedule,
|
||||
}, null, {
|
||||
type: 'button',
|
||||
text: i18n.ts._schedulePost.list,
|
||||
icon: 'ti ti-calendar-event',
|
||||
action: () => {
|
||||
// 投稿フォームが二重に出ないようにとじておく
|
||||
emit('cancel');
|
||||
listSchedulePost();
|
||||
},
|
||||
}], ev.currentTarget ?? ev.target, {
|
||||
align: 'right',
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (props.autofocus) {
|
||||
focus();
|
||||
|
|
|
|||
|
|
@ -5,12 +5,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<template>
|
||||
<div style="padding: 8px 16px">
|
||||
<section>
|
||||
<section class="_gaps_s">
|
||||
<MkInput v-model="atDate" small type="date" class="input">
|
||||
<template #label>{{ i18n.ts._poll.deadlineDate }}</template>
|
||||
<template #label>{{ i18n.ts._schedulePost.postDate }}</template>
|
||||
</MkInput>
|
||||
<MkInput v-model="atTime" small type="time" class="input">
|
||||
<template #label>{{ i18n.ts._poll.deadlineTime }}</template>
|
||||
<template #label>{{ i18n.ts._schedulePost.postTime }}</template>
|
||||
<template #caption>{{ i18n.ts._schedulePost.localTime }}</template>
|
||||
</MkInput>
|
||||
</section>
|
||||
</div>
|
||||
|
|
@ -53,6 +54,6 @@ function get() {
|
|||
}
|
||||
|
||||
watch([atDate, atTime], () => emit('update:modelValue', get()), {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
@close="cancel()"
|
||||
@closed="$emit('closed')"
|
||||
>
|
||||
<template #header> 予約投稿一覧</template>
|
||||
<template #header>{{ i18n.ts._schedulePost.list }}</template>
|
||||
<div v-for="item in notes">
|
||||
<MkSpacer :marginMin="14" :marginMax="16">
|
||||
<MkNoteSimple scheduled="true" :note="item.note"/>
|
||||
|
|
@ -26,7 +26,8 @@ import * as Misskey from 'misskey-js';
|
|||
import MkModalWindow from '@/components/MkModalWindow.vue';
|
||||
import * as os from '@/os.js';
|
||||
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
||||
import MkSignin from '@/components/MkSignin.vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'ok', selected: Misskey.entities.UserDetailed): void;
|
||||
(ev: 'cancel'): void;
|
||||
|
|
@ -41,7 +42,7 @@ const cancel = () => {
|
|||
};
|
||||
|
||||
onMounted(async () => {
|
||||
notes.value = await os.api('notes/list-schedule');
|
||||
notes.value = await os.api('notes/schedule/list');
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import { miLocalStorage } from '@/local-storage.js';
|
||||
|
||||
const address = new URL(location.href);
|
||||
const address = new URL(document.querySelector<HTMLMetaElement>('meta[property="instance_url"]')?.content || location.href);
|
||||
const siteName = document.querySelector<HTMLMetaElement>('meta[property="og:site_name"]')?.content;
|
||||
|
||||
export const host = address.host;
|
||||
|
|
|
|||
|
|
@ -171,4 +171,11 @@ export const navbarItemDef = reactive({
|
|||
show: computed(() => $i != null),
|
||||
to: `/@${$i?.username}`,
|
||||
},
|
||||
scheduledNotes: {
|
||||
title: i18n.ts._schedulePost.list,
|
||||
icon: 'ti ti-calendar-event',
|
||||
action: (ev) => {
|
||||
os.listSchedulePost();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,10 +11,9 @@ import { Plugin, noteActions, notePostInterruptors, noteViewInterruptors, postFo
|
|||
const parser = new Parser();
|
||||
const pluginContexts = new Map<string, Interpreter>();
|
||||
|
||||
export function install(plugin: Plugin): void {
|
||||
export async function install(plugin: Plugin): Promise<void> {
|
||||
// 後方互換性のため
|
||||
if (plugin.src == null) return;
|
||||
console.info('Plugin installed:', plugin.name, 'v' + plugin.version);
|
||||
|
||||
const aiscript = new Interpreter(createPluginEnv({
|
||||
plugin: plugin,
|
||||
|
|
@ -42,7 +41,14 @@ export function install(plugin: Plugin): void {
|
|||
|
||||
initPlugin({ plugin, aiscript });
|
||||
|
||||
aiscript.exec(parser.parse(plugin.src));
|
||||
try {
|
||||
await aiscript.exec(parser.parse(plugin.src));
|
||||
} catch (err) {
|
||||
console.error('Plugin install failed:', plugin.name, 'v' + plugin.version);
|
||||
return;
|
||||
}
|
||||
|
||||
console.info('Plugin installed:', plugin.name, 'v' + plugin.version);
|
||||
}
|
||||
|
||||
function createPluginEnv(opts: { plugin: Plugin; storageKey: string }): Record<string, values.Value> {
|
||||
|
|
|
|||
|
|
@ -1748,6 +1748,9 @@ export type Endpoints = {
|
|||
expiresAt?: null | number;
|
||||
expiredAfter?: null | number;
|
||||
};
|
||||
schedule?: null | {
|
||||
expiresAt?: null | number;
|
||||
};
|
||||
};
|
||||
res: {
|
||||
createdNote: Note;
|
||||
|
|
@ -1759,6 +1762,21 @@ export type Endpoints = {
|
|||
};
|
||||
res: null;
|
||||
};
|
||||
'notes/schedule/delete': {
|
||||
req: {
|
||||
scheduledNoteId: Note['id'];
|
||||
};
|
||||
res: null;
|
||||
};
|
||||
'notes/schedule/list': {
|
||||
req: TODO;
|
||||
res: {
|
||||
id: Note['id'];
|
||||
userId: User['id'];
|
||||
expiresAt: number;
|
||||
note: Note;
|
||||
}[];
|
||||
};
|
||||
'notes/favorites/create': {
|
||||
req: {
|
||||
noteId: Note['id'];
|
||||
|
|
@ -3035,7 +3053,7 @@ type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+u
|
|||
//
|
||||
// src/api.types.ts:16:32 - (ae-forgotten-export) The symbol "TODO" needs to be exported by the entry point index.d.ts
|
||||
// src/api.types.ts:18:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts
|
||||
// src/api.types.ts:632:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
|
||||
// src/api.types.ts:642:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
|
||||
// src/entities.ts:116:2 - (ae-forgotten-export) The symbol "notificationTypes_2" needs to be exported by the entry point index.d.ts
|
||||
// src/entities.ts:627:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
|
||||
// src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts
|
||||
|
|
|
|||
|
|
@ -507,8 +507,18 @@ export type Endpoints = {
|
|||
expiresAt?: null | number;
|
||||
expiredAfter?: null | number;
|
||||
};
|
||||
schedule?: null | {
|
||||
expiresAt?: null | number;
|
||||
};
|
||||
}; res: { createdNote: Note }; };
|
||||
'notes/delete': { req: { noteId: Note['id']; }; res: null; };
|
||||
'notes/schedule/delete': { req: { scheduledNoteId: Note['id']; }; res: null; };
|
||||
'notes/schedule/list': { req: TODO; res: {
|
||||
id: Note['id'];
|
||||
userId: User['id'];
|
||||
expiresAt: number;
|
||||
note: Note;
|
||||
}[]; };
|
||||
'notes/favorites/create': { req: { noteId: Note['id']; }; res: null; };
|
||||
'notes/favorites/delete': { req: { noteId: Note['id']; }; res: null; };
|
||||
'notes/featured': { req: TODO; res: Note[]; };
|
||||
|
|
|
|||
Loading…
Reference in New Issue