Merge branch 'develop' into re-ed25519
This commit is contained in:
commit
d01cd153d1
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -1,12 +1,26 @@
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### General
|
||||||
|
-
|
||||||
|
|
||||||
|
### Client
|
||||||
|
-
|
||||||
|
|
||||||
|
### Server
|
||||||
|
-
|
||||||
|
|
||||||
|
|
||||||
## 2024.8.0
|
## 2024.8.0
|
||||||
|
|
||||||
### General
|
### General
|
||||||
- Enhance: モデレーターはすべてのユーザーのフォロー・フォロワーの一覧を見られるように
|
- Enhance: モデレーターはすべてのユーザーのフォロー・フォロワーの一覧を見られるように
|
||||||
- Enhance: アカウントの削除のモデレーションログを残すように
|
- Enhance: アカウントの削除のモデレーションログを残すように
|
||||||
|
- Enhance: 不適切なページ、ギャラリー、Playを管理者権限で削除できるように
|
||||||
- Fix: リモートユーザのフォロー・フォロワーの一覧が非公開設定の場合も表示できてしまう問題を修正
|
- Fix: リモートユーザのフォロー・フォロワーの一覧が非公開設定の場合も表示できてしまう問題を修正
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
- Enhance: 「自分のPlay」ページにおいてPlayが非公開かどうかが一目でわかるように
|
- Enhance: 「自分のPlay」ページにおいてPlayが非公開かどうかが一目でわかるように
|
||||||
|
- Enhance: 不適切なページ、ギャラリー、Playを通報できるように
|
||||||
- Fix: Play編集時に公開範囲が「パブリック」にリセットされる問題を修正
|
- Fix: Play編集時に公開範囲が「パブリック」にリセットされる問題を修正
|
||||||
- Fix: ページ遷移に失敗することがある問題を修正
|
- Fix: ページ遷移に失敗することがある問題を修正
|
||||||
- Fix: iOSでユーザー名などがリンクとして誤検知される現象を抑制
|
- Fix: iOSでユーザー名などがリンクとして誤検知される現象を抑制
|
||||||
|
@ -15,6 +29,7 @@
|
||||||
- Fix: 特定の条件下でノートの削除ボタンが出ないのを修正
|
- Fix: 特定の条件下でノートの削除ボタンが出ないのを修正
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
|
- Enhance: 照会時にURLがhtmlかつheadタグ内に`rel="alternate"`, `type="application/activity+json"`の`link`タグがある場合に追ってリンク先を照会できるように
|
||||||
- Enhance: 凍結されたアカウントのフォローリクエストを表示しないように
|
- Enhance: 凍結されたアカウントのフォローリクエストを表示しないように
|
||||||
- Fix: WSの`readAllNotifications` メッセージが `body` を持たない場合に動作しない問題 #14374
|
- Fix: WSの`readAllNotifications` メッセージが `body` を持たない場合に動作しない問題 #14374
|
||||||
- 通知ページや通知カラム(デッキ)を開いている状態において、新たに発生した通知が既読されない問題が修正されます。
|
- 通知ページや通知カラム(デッキ)を開いている状態において、新たに発生した通知が既読されない問題が修正されます。
|
||||||
|
@ -30,6 +45,8 @@
|
||||||
- Fix: 無制限にストリーミングのチャンネルに接続できる問題を修正
|
- Fix: 無制限にストリーミングのチャンネルに接続できる問題を修正
|
||||||
- Fix: ベースロールのポリシーを変更した際にモデログに記録されないのを修正
|
- Fix: ベースロールのポリシーを変更した際にモデログに記録されないのを修正
|
||||||
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/700)
|
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/700)
|
||||||
|
- Fix: Prevent memory leak from memory caches (#14310)
|
||||||
|
- Fix: More reliable memory cache eviction (#14311)
|
||||||
|
|
||||||
## 2024.7.0
|
## 2024.7.0
|
||||||
|
|
||||||
|
|
|
@ -2316,6 +2316,7 @@ _pages:
|
||||||
eyeCatchingImageSet: "Set thumbnail"
|
eyeCatchingImageSet: "Set thumbnail"
|
||||||
eyeCatchingImageRemove: "Delete thumbnail"
|
eyeCatchingImageRemove: "Delete thumbnail"
|
||||||
chooseBlock: "Add a block"
|
chooseBlock: "Add a block"
|
||||||
|
enterSectionTitle: "Enter a section title"
|
||||||
selectType: "Select a type"
|
selectType: "Select a type"
|
||||||
contentBlocks: "Content"
|
contentBlocks: "Content"
|
||||||
inputBlocks: "Input"
|
inputBlocks: "Input"
|
||||||
|
@ -2499,6 +2500,10 @@ _moderationLogTypes:
|
||||||
createAbuseReportNotificationRecipient: "Create a recipient for abuse reports"
|
createAbuseReportNotificationRecipient: "Create a recipient for abuse reports"
|
||||||
updateAbuseReportNotificationRecipient: "Update recipients for abuse reports"
|
updateAbuseReportNotificationRecipient: "Update recipients for abuse reports"
|
||||||
deleteAbuseReportNotificationRecipient: "Delete a recipient for abuse reports"
|
deleteAbuseReportNotificationRecipient: "Delete a recipient for abuse reports"
|
||||||
|
deleteAccount: "Delete the account"
|
||||||
|
deletePage: "Delete the page"
|
||||||
|
deleteFlash: "Delete Play"
|
||||||
|
deleteGalleryPost: "Delete the gallery post"
|
||||||
_fileViewer:
|
_fileViewer:
|
||||||
title: "File details"
|
title: "File details"
|
||||||
type: "File type"
|
type: "File type"
|
||||||
|
|
|
@ -2829,7 +2829,7 @@ export interface Locale extends ILocale {
|
||||||
*/
|
*/
|
||||||
"reportAbuseOf": ParameterizedString<"name">;
|
"reportAbuseOf": ParameterizedString<"name">;
|
||||||
/**
|
/**
|
||||||
* 通報理由の詳細を記入してください。対象のノートがある場合はそのURLも記入してください。
|
* 通報理由の詳細を記入してください。対象のノートやページなどがある場合はそのURLも記入してください。
|
||||||
*/
|
*/
|
||||||
"fillAbuseReportDescription": string;
|
"fillAbuseReportDescription": string;
|
||||||
/**
|
/**
|
||||||
|
@ -9687,6 +9687,18 @@ export interface Locale extends ILocale {
|
||||||
* アカウントを削除
|
* アカウントを削除
|
||||||
*/
|
*/
|
||||||
"deleteAccount": string;
|
"deleteAccount": string;
|
||||||
|
/**
|
||||||
|
* ページを削除
|
||||||
|
*/
|
||||||
|
"deletePage": string;
|
||||||
|
/**
|
||||||
|
* Playを削除
|
||||||
|
*/
|
||||||
|
"deleteFlash": string;
|
||||||
|
/**
|
||||||
|
* ギャラリーの投稿を削除
|
||||||
|
*/
|
||||||
|
"deleteGalleryPost": string;
|
||||||
};
|
};
|
||||||
"_fileViewer": {
|
"_fileViewer": {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -703,7 +703,7 @@ abuseReports: "通報"
|
||||||
reportAbuse: "通報"
|
reportAbuse: "通報"
|
||||||
reportAbuseRenote: "リノートを通報"
|
reportAbuseRenote: "リノートを通報"
|
||||||
reportAbuseOf: "{name}を通報する"
|
reportAbuseOf: "{name}を通報する"
|
||||||
fillAbuseReportDescription: "通報理由の詳細を記入してください。対象のノートがある場合はそのURLも記入してください。"
|
fillAbuseReportDescription: "通報理由の詳細を記入してください。対象のノートやページなどがある場合はそのURLも記入してください。"
|
||||||
abuseReported: "内容が送信されました。ご報告ありがとうございました。"
|
abuseReported: "内容が送信されました。ご報告ありがとうございました。"
|
||||||
reporter: "通報者"
|
reporter: "通報者"
|
||||||
reporteeOrigin: "通報先"
|
reporteeOrigin: "通報先"
|
||||||
|
@ -2569,6 +2569,9 @@ _moderationLogTypes:
|
||||||
updateAbuseReportNotificationRecipient: "通報の通知先を更新"
|
updateAbuseReportNotificationRecipient: "通報の通知先を更新"
|
||||||
deleteAbuseReportNotificationRecipient: "通報の通知先を削除"
|
deleteAbuseReportNotificationRecipient: "通報の通知先を削除"
|
||||||
deleteAccount: "アカウントを削除"
|
deleteAccount: "アカウントを削除"
|
||||||
|
deletePage: "ページを削除"
|
||||||
|
deleteFlash: "Playを削除"
|
||||||
|
deleteGalleryPost: "ギャラリーの投稿を削除"
|
||||||
|
|
||||||
_fileViewer:
|
_fileViewer:
|
||||||
title: "ファイルの詳細"
|
title: "ファイルの詳細"
|
||||||
|
|
|
@ -2316,6 +2316,7 @@ _pages:
|
||||||
eyeCatchingImageSet: "设置封面图片"
|
eyeCatchingImageSet: "设置封面图片"
|
||||||
eyeCatchingImageRemove: "删除封面图片"
|
eyeCatchingImageRemove: "删除封面图片"
|
||||||
chooseBlock: "添加块"
|
chooseBlock: "添加块"
|
||||||
|
enterSectionTitle: "输入会话标题"
|
||||||
selectType: "选择类型"
|
selectType: "选择类型"
|
||||||
contentBlocks: "内容"
|
contentBlocks: "内容"
|
||||||
inputBlocks: "输入"
|
inputBlocks: "输入"
|
||||||
|
@ -2499,6 +2500,10 @@ _moderationLogTypes:
|
||||||
createAbuseReportNotificationRecipient: "新建了举报通知"
|
createAbuseReportNotificationRecipient: "新建了举报通知"
|
||||||
updateAbuseReportNotificationRecipient: "更新了举报通知"
|
updateAbuseReportNotificationRecipient: "更新了举报通知"
|
||||||
deleteAbuseReportNotificationRecipient: "删除了举报通知"
|
deleteAbuseReportNotificationRecipient: "删除了举报通知"
|
||||||
|
deleteAccount: "删除了账户"
|
||||||
|
deletePage: "删除了页面"
|
||||||
|
deleteFlash: "删除了 Play"
|
||||||
|
deleteGalleryPost: "删除了图库稿件"
|
||||||
_fileViewer:
|
_fileViewer:
|
||||||
title: "文件信息"
|
title: "文件信息"
|
||||||
type: "文件类型"
|
type: "文件类型"
|
||||||
|
|
|
@ -2316,6 +2316,7 @@ _pages:
|
||||||
eyeCatchingImageSet: "設定封面影像"
|
eyeCatchingImageSet: "設定封面影像"
|
||||||
eyeCatchingImageRemove: "刪除封面影像"
|
eyeCatchingImageRemove: "刪除封面影像"
|
||||||
chooseBlock: "新增方塊"
|
chooseBlock: "新增方塊"
|
||||||
|
enterSectionTitle: "輸入區段的標題"
|
||||||
selectType: "選擇類型"
|
selectType: "選擇類型"
|
||||||
contentBlocks: "內容"
|
contentBlocks: "內容"
|
||||||
inputBlocks: "輸入"
|
inputBlocks: "輸入"
|
||||||
|
@ -2499,6 +2500,10 @@ _moderationLogTypes:
|
||||||
createAbuseReportNotificationRecipient: "建立接收檢舉的通知對象"
|
createAbuseReportNotificationRecipient: "建立接收檢舉的通知對象"
|
||||||
updateAbuseReportNotificationRecipient: "更新接收檢舉的通知對象"
|
updateAbuseReportNotificationRecipient: "更新接收檢舉的通知對象"
|
||||||
deleteAbuseReportNotificationRecipient: "刪除接收檢舉的通知對象"
|
deleteAbuseReportNotificationRecipient: "刪除接收檢舉的通知對象"
|
||||||
|
deleteAccount: "刪除帳戶"
|
||||||
|
deletePage: "刪除頁面"
|
||||||
|
deleteFlash: "刪除 Play"
|
||||||
|
deleteGalleryPost: "刪除相簿的貼文"
|
||||||
_fileViewer:
|
_fileViewer:
|
||||||
title: "檔案詳細資訊"
|
title: "檔案詳細資訊"
|
||||||
type: "檔案類型 "
|
type: "檔案類型 "
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"version": "2024.8.0-beta.2",
|
"version": "2024.8.0",
|
||||||
"codename": "nasubi",
|
"codename": "nasubi",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -29,7 +29,7 @@ export class AvatarDecorationService implements OnApplicationShutdown {
|
||||||
private moderationLogService: ModerationLogService,
|
private moderationLogService: ModerationLogService,
|
||||||
private globalEventService: GlobalEventService,
|
private globalEventService: GlobalEventService,
|
||||||
) {
|
) {
|
||||||
this.cache = new MemorySingleCache<MiAvatarDecoration[]>(1000 * 60 * 30);
|
this.cache = new MemorySingleCache<MiAvatarDecoration[]>(1000 * 60 * 30); // 30s
|
||||||
|
|
||||||
this.redisForSub.on('message', this.onMessage);
|
this.redisForSub.on('message', this.onMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,10 +56,10 @@ export class CacheService implements OnApplicationShutdown {
|
||||||
) {
|
) {
|
||||||
//this.onMessage = this.onMessage.bind(this);
|
//this.onMessage = this.onMessage.bind(this);
|
||||||
|
|
||||||
this.userByIdCache = new MemoryKVCache<MiUser>(Infinity);
|
this.userByIdCache = new MemoryKVCache<MiUser>(1000 * 60 * 5); // 5m
|
||||||
this.localUserByNativeTokenCache = new MemoryKVCache<MiLocalUser | null>(Infinity);
|
this.localUserByNativeTokenCache = new MemoryKVCache<MiLocalUser | null>(1000 * 60 * 5); // 5m
|
||||||
this.localUserByIdCache = new MemoryKVCache<MiLocalUser>(Infinity);
|
this.localUserByIdCache = new MemoryKVCache<MiLocalUser>(1000 * 60 * 5); // 5m
|
||||||
this.uriPersonCache = new MemoryKVCache<MiUser | null>(Infinity);
|
this.uriPersonCache = new MemoryKVCache<MiUser | null>(1000 * 60 * 5); // 5m
|
||||||
|
|
||||||
this.userProfileCache = new RedisKVCache<MiUserProfile>(this.redisClient, 'userProfile', {
|
this.userProfileCache = new RedisKVCache<MiUserProfile>(this.redisClient, 'userProfile', {
|
||||||
lifetime: 1000 * 60 * 30, // 30m
|
lifetime: 1000 * 60 * 30, // 30m
|
||||||
|
@ -135,14 +135,14 @@ export class CacheService implements OnApplicationShutdown {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
this.userByIdCache.delete(body.id);
|
this.userByIdCache.delete(body.id);
|
||||||
this.localUserByIdCache.delete(body.id);
|
this.localUserByIdCache.delete(body.id);
|
||||||
for (const [k, v] of this.uriPersonCache.cache.entries()) {
|
for (const [k, v] of this.uriPersonCache.entries) {
|
||||||
if (v.value?.id === body.id) {
|
if (v.value?.id === body.id) {
|
||||||
this.uriPersonCache.delete(k);
|
this.uriPersonCache.delete(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.userByIdCache.set(user.id, user);
|
this.userByIdCache.set(user.id, user);
|
||||||
for (const [k, v] of this.uriPersonCache.cache.entries()) {
|
for (const [k, v] of this.uriPersonCache.entries) {
|
||||||
if (v.value?.id === user.id) {
|
if (v.value?.id === user.id) {
|
||||||
this.uriPersonCache.set(k, user);
|
this.uriPersonCache.set(k, user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ const parseEmojiStrRegexp = /^([-\w]+)(?:@([\w.-]+))?$/;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CustomEmojiService implements OnApplicationShutdown {
|
export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
private cache: MemoryKVCache<MiEmoji | null>;
|
private emojisCache: MemoryKVCache<MiEmoji | null>;
|
||||||
public localEmojisCache: RedisSingleCache<Map<string, MiEmoji>>;
|
public localEmojisCache: RedisSingleCache<Map<string, MiEmoji>>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -40,7 +40,7 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
private moderationLogService: ModerationLogService,
|
private moderationLogService: ModerationLogService,
|
||||||
private globalEventService: GlobalEventService,
|
private globalEventService: GlobalEventService,
|
||||||
) {
|
) {
|
||||||
this.cache = new MemoryKVCache<MiEmoji | null>(1000 * 60 * 60 * 12);
|
this.emojisCache = new MemoryKVCache<MiEmoji | null>(1000 * 60 * 60 * 12); // 12h
|
||||||
|
|
||||||
this.localEmojisCache = new RedisSingleCache<Map<string, MiEmoji>>(this.redisClient, 'localEmojis', {
|
this.localEmojisCache = new RedisSingleCache<Map<string, MiEmoji>>(this.redisClient, 'localEmojis', {
|
||||||
lifetime: 1000 * 60 * 30, // 30m
|
lifetime: 1000 * 60 * 30, // 30m
|
||||||
|
@ -334,7 +334,7 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
host,
|
host,
|
||||||
})) ?? null;
|
})) ?? null;
|
||||||
|
|
||||||
const emoji = await this.cache.fetch(`${name} ${host}`, queryOrNull);
|
const emoji = await this.emojisCache.fetch(`${name} ${host}`, queryOrNull);
|
||||||
|
|
||||||
if (emoji == null) return null;
|
if (emoji == null) return null;
|
||||||
return emoji.publicUrl || emoji.originalUrl; // || emoji.originalUrl してるのは後方互換性のため(publicUrlはstringなので??はだめ)
|
return emoji.publicUrl || emoji.originalUrl; // || emoji.originalUrl してるのは後方互換性のため(publicUrlはstringなので??はだめ)
|
||||||
|
@ -361,7 +361,7 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public async prefetchEmojis(emojis: { name: string; host: string | null; }[]): Promise<void> {
|
public async prefetchEmojis(emojis: { name: string; host: string | null; }[]): Promise<void> {
|
||||||
const notCachedEmojis = emojis.filter(emoji => this.cache.get(`${emoji.name} ${emoji.host}`) == null);
|
const notCachedEmojis = emojis.filter(emoji => this.emojisCache.get(`${emoji.name} ${emoji.host}`) == null);
|
||||||
const emojisQuery: any[] = [];
|
const emojisQuery: any[] = [];
|
||||||
const hosts = new Set(notCachedEmojis.map(e => e.host));
|
const hosts = new Set(notCachedEmojis.map(e => e.host));
|
||||||
for (const host of hosts) {
|
for (const host of hosts) {
|
||||||
|
@ -376,7 +376,7 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
select: ['name', 'host', 'originalUrl', 'publicUrl'],
|
select: ['name', 'host', 'originalUrl', 'publicUrl'],
|
||||||
}) : [];
|
}) : [];
|
||||||
for (const emoji of _emojis) {
|
for (const emoji of _emojis) {
|
||||||
this.cache.set(`${emoji.name} ${emoji.host}`, emoji);
|
this.emojisCache.set(`${emoji.name} ${emoji.host}`, emoji);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
this.cache.dispose();
|
this.emojisCache.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
|
|
@ -38,7 +38,7 @@ export class RelayService {
|
||||||
private apRendererService: ApRendererService,
|
private apRendererService: ApRendererService,
|
||||||
private userKeypairService: UserKeypairService,
|
private userKeypairService: UserKeypairService,
|
||||||
) {
|
) {
|
||||||
this.relaysCache = new MemorySingleCache<MiRelay[]>(1000 * 60 * 10);
|
this.relaysCache = new MemorySingleCache<MiRelay[]>(1000 * 60 * 10); // 10m
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
|
|
@ -127,10 +127,8 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
|
||||||
private moderationLogService: ModerationLogService,
|
private moderationLogService: ModerationLogService,
|
||||||
private fanoutTimelineService: FanoutTimelineService,
|
private fanoutTimelineService: FanoutTimelineService,
|
||||||
) {
|
) {
|
||||||
//this.onMessage = this.onMessage.bind(this);
|
this.rolesCache = new MemorySingleCache<MiRole[]>(1000 * 60 * 60); // 1h
|
||||||
|
this.roleAssignmentByUserIdCache = new MemoryKVCache<MiRoleAssignment[]>(1000 * 60 * 5); // 5m
|
||||||
this.rolesCache = new MemorySingleCache<MiRole[]>(1000 * 60 * 60 * 1);
|
|
||||||
this.roleAssignmentByUserIdCache = new MemoryKVCache<MiRoleAssignment[]>(1000 * 60 * 60 * 1);
|
|
||||||
|
|
||||||
this.redisForSub.on('message', this.onMessage);
|
this.redisForSub.on('message', this.onMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ export class UserKeypairService implements OnApplicationShutdown {
|
||||||
) {
|
) {
|
||||||
this.keypairEntityCache = new RedisKVCache<MiUserKeypair>(this.redisClient, 'userKeypair', {
|
this.keypairEntityCache = new RedisKVCache<MiUserKeypair>(this.redisClient, 'userKeypair', {
|
||||||
lifetime: 1000 * 60 * 60 * 24, // 24h
|
lifetime: 1000 * 60 * 60 * 24, // 24h
|
||||||
memoryCacheLifetime: Infinity,
|
memoryCacheLifetime: 1000 * 60 * 60, // 1h
|
||||||
fetcher: (key) => this.userKeypairsRepository.findOneByOrFail({ userId: key }),
|
fetcher: (key) => this.userKeypairsRepository.findOneByOrFail({ userId: key }),
|
||||||
toRedisConverter: (value) => JSON.stringify(value),
|
toRedisConverter: (value) => JSON.stringify(value),
|
||||||
fromRedisConverter: (value) => JSON.parse(value),
|
fromRedisConverter: (value) => JSON.parse(value),
|
||||||
|
|
|
@ -64,7 +64,7 @@ export class ApDbResolverService implements OnApplicationShutdown {
|
||||||
private apLoggerService: ApLoggerService,
|
private apLoggerService: ApLoggerService,
|
||||||
private utilityService: UtilityService,
|
private utilityService: UtilityService,
|
||||||
) {
|
) {
|
||||||
this.publicKeyByUserIdCache = new MemoryKVCache<MiUserPublickey[] | null>(Infinity);
|
this.publicKeyByUserIdCache = new MemoryKVCache<MiUserPublickey[] | null>(1000 * 60 * 60 * 12); // 12h
|
||||||
this.logger = this.apLoggerService.logger.createSubLogger('db-resolver');
|
this.logger = this.apLoggerService.logger.createSubLogger('db-resolver');
|
||||||
this.redisForSub.on('message', this.onMessage);
|
this.redisForSub.on('message', this.onMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
import { URL } from 'node:url';
|
import { URL } from 'node:url';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { genRFC3230DigestHeader, signAsDraftToRequest } from '@misskey-dev/node-http-message-signatures';
|
import { genRFC3230DigestHeader, signAsDraftToRequest } from '@misskey-dev/node-http-message-signatures';
|
||||||
|
import { Window } from 'happy-dom';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import type { MiUser } from '@/models/User.js';
|
import type { MiUser } from '@/models/User.js';
|
||||||
|
@ -126,7 +127,9 @@ export class ApRequestService {
|
||||||
* @param url URL to fetch
|
* @param url URL to fetch
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public async signedGet(url: string, user: { id: MiUser['id'] }, level: string): Promise<unknown> {
|
public async signedGet(url: string, user: { id: MiUser['id'] }, level: string, followAlternate?: boolean): Promise<unknown> {
|
||||||
|
const _followAlternate = followAlternate ?? true;
|
||||||
|
|
||||||
const key = await this.userKeypairService.getLocalUserPrivateKey(user.id, level);
|
const key = await this.userKeypairService.getLocalUserPrivateKey(user.id, level);
|
||||||
const req = await createSignedGet({
|
const req = await createSignedGet({
|
||||||
level,
|
level,
|
||||||
|
@ -152,9 +155,29 @@ export class ApRequestService {
|
||||||
headers: req.request.headers,
|
headers: req.request.headers,
|
||||||
}, {
|
}, {
|
||||||
throwErrorWhenResponseNotOk: true,
|
throwErrorWhenResponseNotOk: true,
|
||||||
validators: [validateContentTypeSetAsActivityPub],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//#region リクエスト先がhtmlかつactivity+jsonへのalternate linkタグがあるとき
|
||||||
|
const contentType = res.headers.get('content-type');
|
||||||
|
|
||||||
|
if ((contentType ?? '').split(';')[0].trimEnd().toLowerCase() === 'text/html' && _followAlternate === true) {
|
||||||
|
const html = await res.text();
|
||||||
|
const window = new Window();
|
||||||
|
const document = window.document;
|
||||||
|
document.documentElement.innerHTML = html;
|
||||||
|
|
||||||
|
const alternate = document.querySelector('head > link[rel="alternate"][type="application/activity+json"]');
|
||||||
|
if (alternate) {
|
||||||
|
const href = alternate.getAttribute('href');
|
||||||
|
if (href) {
|
||||||
|
return await this.signedGet(href, user, level, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
validateContentTypeSetAsActivityPub(res);
|
||||||
|
|
||||||
return await res.json();
|
return await res.json();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,23 +7,23 @@ import * as Redis from 'ioredis';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
||||||
export class RedisKVCache<T> {
|
export class RedisKVCache<T> {
|
||||||
private redisClient: Redis.Redis;
|
private readonly lifetime: number;
|
||||||
private name: string;
|
private readonly memoryCache: MemoryKVCache<T>;
|
||||||
private lifetime: number;
|
private readonly fetcher: (key: string) => Promise<T>;
|
||||||
private memoryCache: MemoryKVCache<T>;
|
private readonly toRedisConverter: (value: T) => string;
|
||||||
private fetcher: (key: string) => Promise<T>;
|
private readonly fromRedisConverter: (value: string) => T | undefined;
|
||||||
private toRedisConverter: (value: T) => string;
|
|
||||||
private fromRedisConverter: (value: string) => T | undefined;
|
|
||||||
|
|
||||||
constructor(redisClient: RedisKVCache<T>['redisClient'], name: RedisKVCache<T>['name'], opts: {
|
constructor(
|
||||||
lifetime: RedisKVCache<T>['lifetime'];
|
private redisClient: Redis.Redis,
|
||||||
memoryCacheLifetime: number;
|
private name: string,
|
||||||
fetcher: RedisKVCache<T>['fetcher'];
|
opts: {
|
||||||
toRedisConverter: RedisKVCache<T>['toRedisConverter'];
|
lifetime: RedisKVCache<T>['lifetime'];
|
||||||
fromRedisConverter: RedisKVCache<T>['fromRedisConverter'];
|
memoryCacheLifetime: number;
|
||||||
}) {
|
fetcher: RedisKVCache<T>['fetcher'];
|
||||||
this.redisClient = redisClient;
|
toRedisConverter: RedisKVCache<T>['toRedisConverter'];
|
||||||
this.name = name;
|
fromRedisConverter: RedisKVCache<T>['fromRedisConverter'];
|
||||||
|
},
|
||||||
|
) {
|
||||||
this.lifetime = opts.lifetime;
|
this.lifetime = opts.lifetime;
|
||||||
this.memoryCache = new MemoryKVCache(opts.memoryCacheLifetime);
|
this.memoryCache = new MemoryKVCache(opts.memoryCacheLifetime);
|
||||||
this.fetcher = opts.fetcher;
|
this.fetcher = opts.fetcher;
|
||||||
|
@ -55,7 +55,13 @@ export class RedisKVCache<T> {
|
||||||
|
|
||||||
const cached = await this.redisClient.get(`kvcache:${this.name}:${key}`);
|
const cached = await this.redisClient.get(`kvcache:${this.name}:${key}`);
|
||||||
if (cached == null) return undefined;
|
if (cached == null) return undefined;
|
||||||
return this.fromRedisConverter(cached);
|
|
||||||
|
const value = this.fromRedisConverter(cached);
|
||||||
|
if (value !== undefined) {
|
||||||
|
this.memoryCache.set(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
@ -66,6 +72,10 @@ export class RedisKVCache<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* キャッシュがあればそれを返し、無ければfetcherを呼び出して結果をキャッシュ&返します
|
* キャッシュがあればそれを返し、無ければfetcherを呼び出して結果をキャッシュ&返します
|
||||||
|
* This awaits the call to Redis to ensure that the write succeeded, which is important for a few reasons:
|
||||||
|
* * Other code uses this to synchronize changes between worker processes. A failed write can internally de-sync the cluster.
|
||||||
|
* * Without an `await`, consecutive calls could race. An unlucky race could result in the older write overwriting the newer value.
|
||||||
|
* * Not awaiting here makes the entire cache non-consistent. The prevents many possible uses.
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public async fetch(key: string): Promise<T> {
|
public async fetch(key: string): Promise<T> {
|
||||||
|
@ -77,14 +87,14 @@ export class RedisKVCache<T> {
|
||||||
|
|
||||||
// Cache MISS
|
// Cache MISS
|
||||||
const value = await this.fetcher(key);
|
const value = await this.fetcher(key);
|
||||||
this.set(key, value);
|
await this.set(key, value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async refresh(key: string) {
|
public async refresh(key: string) {
|
||||||
const value = await this.fetcher(key);
|
const value = await this.fetcher(key);
|
||||||
this.set(key, value);
|
await this.set(key, value);
|
||||||
|
|
||||||
// TODO: イベント発行して他プロセスのメモリキャッシュも更新できるようにする
|
// TODO: イベント発行して他プロセスのメモリキャッシュも更新できるようにする
|
||||||
}
|
}
|
||||||
|
@ -101,23 +111,23 @@ export class RedisKVCache<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RedisSingleCache<T> {
|
export class RedisSingleCache<T> {
|
||||||
private redisClient: Redis.Redis;
|
private readonly lifetime: number;
|
||||||
private name: string;
|
private readonly memoryCache: MemorySingleCache<T>;
|
||||||
private lifetime: number;
|
private readonly fetcher: () => Promise<T>;
|
||||||
private memoryCache: MemorySingleCache<T>;
|
private readonly toRedisConverter: (value: T) => string;
|
||||||
private fetcher: () => Promise<T>;
|
private readonly fromRedisConverter: (value: string) => T | undefined;
|
||||||
private toRedisConverter: (value: T) => string;
|
|
||||||
private fromRedisConverter: (value: string) => T | undefined;
|
|
||||||
|
|
||||||
constructor(redisClient: RedisSingleCache<T>['redisClient'], name: RedisSingleCache<T>['name'], opts: {
|
constructor(
|
||||||
lifetime: RedisSingleCache<T>['lifetime'];
|
private redisClient: Redis.Redis,
|
||||||
memoryCacheLifetime: number;
|
private name: string,
|
||||||
fetcher: RedisSingleCache<T>['fetcher'];
|
opts: {
|
||||||
toRedisConverter: RedisSingleCache<T>['toRedisConverter'];
|
lifetime: number;
|
||||||
fromRedisConverter: RedisSingleCache<T>['fromRedisConverter'];
|
memoryCacheLifetime: number;
|
||||||
}) {
|
fetcher: RedisSingleCache<T>['fetcher'];
|
||||||
this.redisClient = redisClient;
|
toRedisConverter: RedisSingleCache<T>['toRedisConverter'];
|
||||||
this.name = name;
|
fromRedisConverter: RedisSingleCache<T>['fromRedisConverter'];
|
||||||
|
},
|
||||||
|
) {
|
||||||
this.lifetime = opts.lifetime;
|
this.lifetime = opts.lifetime;
|
||||||
this.memoryCache = new MemorySingleCache(opts.memoryCacheLifetime);
|
this.memoryCache = new MemorySingleCache(opts.memoryCacheLifetime);
|
||||||
this.fetcher = opts.fetcher;
|
this.fetcher = opts.fetcher;
|
||||||
|
@ -149,7 +159,18 @@ export class RedisSingleCache<T> {
|
||||||
|
|
||||||
const cached = await this.redisClient.get(`singlecache:${this.name}`);
|
const cached = await this.redisClient.get(`singlecache:${this.name}`);
|
||||||
if (cached == null) return undefined;
|
if (cached == null) return undefined;
|
||||||
return this.fromRedisConverter(cached);
|
|
||||||
|
const value = this.fromRedisConverter(cached);
|
||||||
|
if (value !== undefined) {
|
||||||
|
this.memoryCache.set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
public getRaw(): T | undefined {
|
||||||
|
return this.memoryCache.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
@ -160,6 +181,10 @@ export class RedisSingleCache<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* キャッシュがあればそれを返し、無ければfetcherを呼び出して結果をキャッシュ&返します
|
* キャッシュがあればそれを返し、無ければfetcherを呼び出して結果をキャッシュ&返します
|
||||||
|
* This awaits the call to Redis to ensure that the write succeeded, which is important for a few reasons:
|
||||||
|
* * Other code uses this to synchronize changes between worker processes. A failed write can internally de-sync the cluster.
|
||||||
|
* * Without an `await`, consecutive calls could race. An unlucky race could result in the older write overwriting the newer value.
|
||||||
|
* * Not awaiting here makes the entire cache non-consistent. The prevents many possible uses.
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public async fetch(): Promise<T> {
|
public async fetch(): Promise<T> {
|
||||||
|
@ -171,14 +196,14 @@ export class RedisSingleCache<T> {
|
||||||
|
|
||||||
// Cache MISS
|
// Cache MISS
|
||||||
const value = await this.fetcher();
|
const value = await this.fetcher();
|
||||||
this.set(value);
|
await this.set(value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async refresh() {
|
public async refresh() {
|
||||||
const value = await this.fetcher();
|
const value = await this.fetcher();
|
||||||
this.set(value);
|
await this.set(value);
|
||||||
|
|
||||||
// TODO: イベント発行して他プロセスのメモリキャッシュも更新できるようにする
|
// TODO: イベント発行して他プロセスのメモリキャッシュも更新できるようにする
|
||||||
}
|
}
|
||||||
|
@ -187,25 +212,12 @@ export class RedisSingleCache<T> {
|
||||||
// TODO: メモリ節約のためあまり参照されないキーを定期的に削除できるようにする?
|
// TODO: メモリ節約のためあまり参照されないキーを定期的に削除できるようにする?
|
||||||
|
|
||||||
export class MemoryKVCache<T> {
|
export class MemoryKVCache<T> {
|
||||||
/**
|
private readonly cache = new Map<string, { date: number; value: T; }>();
|
||||||
* データを持つマップ
|
private readonly gcIntervalHandle = setInterval(() => this.gc(), 1000 * 60 * 3); // 3m
|
||||||
* @deprecated これを直接操作するべきではない
|
|
||||||
*/
|
|
||||||
public cache: Map<string, { date: number; value: T; }>;
|
|
||||||
private lifetime: number;
|
|
||||||
private gcIntervalHandle: NodeJS.Timeout;
|
|
||||||
|
|
||||||
/**
|
constructor(
|
||||||
* @param lifetime キャッシュの生存期間 (ms)
|
private readonly lifetime: number,
|
||||||
*/
|
) {}
|
||||||
constructor(lifetime: MemoryKVCache<never>['lifetime']) {
|
|
||||||
this.cache = new Map();
|
|
||||||
this.lifetime = lifetime;
|
|
||||||
|
|
||||||
this.gcIntervalHandle = setInterval(() => {
|
|
||||||
this.gc();
|
|
||||||
}, 1000 * 60 * 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
/**
|
/**
|
||||||
|
@ -290,10 +302,14 @@ export class MemoryKVCache<T> {
|
||||||
@bindThis
|
@bindThis
|
||||||
public gc(): void {
|
public gc(): void {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
|
||||||
for (const [key, { date }] of this.cache.entries()) {
|
for (const [key, { date }] of this.cache.entries()) {
|
||||||
if ((now - date) > this.lifetime) {
|
// The map is ordered from oldest to youngest.
|
||||||
this.cache.delete(key);
|
// We can stop once we find an entry that's still active, because all following entries must *also* be active.
|
||||||
}
|
const age = now - date;
|
||||||
|
if (age < this.lifetime) break;
|
||||||
|
|
||||||
|
this.cache.delete(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,16 +317,19 @@ export class MemoryKVCache<T> {
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
clearInterval(this.gcIntervalHandle);
|
clearInterval(this.gcIntervalHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get entries() {
|
||||||
|
return this.cache.entries();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MemorySingleCache<T> {
|
export class MemorySingleCache<T> {
|
||||||
private cachedAt: number | null = null;
|
private cachedAt: number | null = null;
|
||||||
private value: T | undefined;
|
private value: T | undefined;
|
||||||
private lifetime: number;
|
|
||||||
|
|
||||||
constructor(lifetime: MemorySingleCache<never>['lifetime']) {
|
constructor(
|
||||||
this.lifetime = lifetime;
|
private lifetime: number,
|
||||||
}
|
) {}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public set(value: T): void {
|
public set(value: T): void {
|
||||||
|
|
|
@ -45,7 +45,7 @@ export class DeliverProcessorService {
|
||||||
private queueLoggerService: QueueLoggerService,
|
private queueLoggerService: QueueLoggerService,
|
||||||
) {
|
) {
|
||||||
this.logger = this.queueLoggerService.logger.createSubLogger('deliver');
|
this.logger = this.queueLoggerService.logger.createSubLogger('deliver');
|
||||||
this.suspendedHostsCache = new MemorySingleCache<MiInstance[]>(1000 * 60 * 60);
|
this.suspendedHostsCache = new MemorySingleCache<MiInstance[]>(1000 * 60 * 60); // 1h
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
|
|
@ -141,7 +141,7 @@ export class NodeinfoServerService {
|
||||||
return document;
|
return document;
|
||||||
};
|
};
|
||||||
|
|
||||||
const cache = new MemorySingleCache<Awaited<ReturnType<typeof nodeinfo2>>>(1000 * 60 * 10);
|
const cache = new MemorySingleCache<Awaited<ReturnType<typeof nodeinfo2>>>(1000 * 60 * 10); // 10m
|
||||||
|
|
||||||
fastify.get(nodeinfo2_1path, async (request, reply) => {
|
fastify.get(nodeinfo2_1path, async (request, reply) => {
|
||||||
const base = await cache.fetch(() => nodeinfo2(21));
|
const base = await cache.fetch(() => nodeinfo2(21));
|
||||||
|
|
|
@ -37,7 +37,7 @@ export class AuthenticateService implements OnApplicationShutdown {
|
||||||
|
|
||||||
private cacheService: CacheService,
|
private cacheService: CacheService,
|
||||||
) {
|
) {
|
||||||
this.appCache = new MemoryKVCache<MiApp>(Infinity);
|
this.appCache = new MemoryKVCache<MiApp>(1000 * 60 * 60 * 24 * 7); // 1w
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
|
|
@ -4,9 +4,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import type { FlashsRepository } from '@/models/_.js';
|
import type { FlashsRepository, UsersRepository } from '@/models/_.js';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
@ -44,17 +46,35 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.flashsRepository)
|
@Inject(DI.flashsRepository)
|
||||||
private flashsRepository: FlashsRepository,
|
private flashsRepository: FlashsRepository,
|
||||||
|
|
||||||
|
@Inject(DI.usersRepository)
|
||||||
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
|
private moderationLogService: ModerationLogService,
|
||||||
|
private roleService: RoleService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const flash = await this.flashsRepository.findOneBy({ id: ps.flashId });
|
const flash = await this.flashsRepository.findOneBy({ id: ps.flashId });
|
||||||
|
|
||||||
if (flash == null) {
|
if (flash == null) {
|
||||||
throw new ApiError(meta.errors.noSuchFlash);
|
throw new ApiError(meta.errors.noSuchFlash);
|
||||||
}
|
}
|
||||||
if (flash.userId !== me.id) {
|
|
||||||
|
if (!await this.roleService.isModerator(me) && flash.userId !== me.id) {
|
||||||
throw new ApiError(meta.errors.accessDenied);
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.flashsRepository.delete(flash.id);
|
await this.flashsRepository.delete(flash.id);
|
||||||
|
|
||||||
|
if (flash.userId !== me.id) {
|
||||||
|
const user = await this.usersRepository.findOneByOrFail({ id: flash.userId });
|
||||||
|
this.moderationLogService.log(me, 'deleteFlash', {
|
||||||
|
flashId: flash.id,
|
||||||
|
flashUserId: flash.userId,
|
||||||
|
flashUserUsername: user.username,
|
||||||
|
flash,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import type { GalleryPostsRepository } from '@/models/_.js';
|
import type { GalleryPostsRepository, UsersRepository } from '@/models/_.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
import { ApiError } from '../../../error.js';
|
import { ApiError } from '../../../error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
@ -22,6 +24,12 @@ export const meta = {
|
||||||
code: 'NO_SUCH_POST',
|
code: 'NO_SUCH_POST',
|
||||||
id: 'ae52f367-4bd7-4ecd-afc6-5672fff427f5',
|
id: 'ae52f367-4bd7-4ecd-afc6-5672fff427f5',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
accessDenied: {
|
||||||
|
message: 'Access denied.',
|
||||||
|
code: 'ACCESS_DENIED',
|
||||||
|
id: 'c86e09de-1c48-43ac-a435-1c7e42ed4496',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -38,18 +46,35 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.galleryPostsRepository)
|
@Inject(DI.galleryPostsRepository)
|
||||||
private galleryPostsRepository: GalleryPostsRepository,
|
private galleryPostsRepository: GalleryPostsRepository,
|
||||||
|
|
||||||
|
@Inject(DI.usersRepository)
|
||||||
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
|
private moderationLogService: ModerationLogService,
|
||||||
|
private roleService: RoleService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const post = await this.galleryPostsRepository.findOneBy({
|
const post = await this.galleryPostsRepository.findOneBy({ id: ps.postId });
|
||||||
id: ps.postId,
|
|
||||||
userId: me.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (post == null) {
|
if (post == null) {
|
||||||
throw new ApiError(meta.errors.noSuchPost);
|
throw new ApiError(meta.errors.noSuchPost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!await this.roleService.isModerator(me) && post.userId !== me.id) {
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
}
|
||||||
|
|
||||||
await this.galleryPostsRepository.delete(post.id);
|
await this.galleryPostsRepository.delete(post.id);
|
||||||
|
|
||||||
|
if (post.userId !== me.id) {
|
||||||
|
const user = await this.usersRepository.findOneByOrFail({ id: post.userId });
|
||||||
|
this.moderationLogService.log(me, 'deleteGalleryPost', {
|
||||||
|
postId: post.id,
|
||||||
|
postUserId: post.userId,
|
||||||
|
postUserUsername: user.username,
|
||||||
|
post,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import type { PagesRepository } from '@/models/_.js';
|
import type { PagesRepository, UsersRepository } from '@/models/_.js';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
@ -44,17 +46,35 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.pagesRepository)
|
@Inject(DI.pagesRepository)
|
||||||
private pagesRepository: PagesRepository,
|
private pagesRepository: PagesRepository,
|
||||||
|
|
||||||
|
@Inject(DI.usersRepository)
|
||||||
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
|
private moderationLogService: ModerationLogService,
|
||||||
|
private roleService: RoleService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const page = await this.pagesRepository.findOneBy({ id: ps.pageId });
|
const page = await this.pagesRepository.findOneBy({ id: ps.pageId });
|
||||||
|
|
||||||
if (page == null) {
|
if (page == null) {
|
||||||
throw new ApiError(meta.errors.noSuchPage);
|
throw new ApiError(meta.errors.noSuchPage);
|
||||||
}
|
}
|
||||||
if (page.userId !== me.id) {
|
|
||||||
|
if (!await this.roleService.isModerator(me) && page.userId !== me.id) {
|
||||||
throw new ApiError(meta.errors.accessDenied);
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.pagesRepository.delete(page.id);
|
await this.pagesRepository.delete(page.id);
|
||||||
|
|
||||||
|
if (page.userId !== me.id) {
|
||||||
|
const user = await this.usersRepository.findOneByOrFail({ id: page.userId });
|
||||||
|
this.moderationLogService.log(me, 'deletePage', {
|
||||||
|
pageId: page.id,
|
||||||
|
pageUserId: page.userId,
|
||||||
|
pageUserUsername: user.username,
|
||||||
|
page,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,9 @@ export const moderationLogTypes = [
|
||||||
'updateAbuseReportNotificationRecipient',
|
'updateAbuseReportNotificationRecipient',
|
||||||
'deleteAbuseReportNotificationRecipient',
|
'deleteAbuseReportNotificationRecipient',
|
||||||
'deleteAccount',
|
'deleteAccount',
|
||||||
|
'deletePage',
|
||||||
|
'deleteFlash',
|
||||||
|
'deleteGalleryPost',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type ModerationLogPayloads = {
|
export type ModerationLogPayloads = {
|
||||||
|
@ -320,6 +323,24 @@ export type ModerationLogPayloads = {
|
||||||
userUsername: string;
|
userUsername: string;
|
||||||
userHost: string | null;
|
userHost: string | null;
|
||||||
};
|
};
|
||||||
|
deletePage: {
|
||||||
|
pageId: string;
|
||||||
|
pageUserId: string;
|
||||||
|
pageUserUsername: string;
|
||||||
|
page: any;
|
||||||
|
};
|
||||||
|
deleteFlash: {
|
||||||
|
flashId: string;
|
||||||
|
flashUserId: string;
|
||||||
|
flashUserUsername: string;
|
||||||
|
flash: any;
|
||||||
|
};
|
||||||
|
deleteGalleryPost: {
|
||||||
|
postId: string;
|
||||||
|
postUserId: string;
|
||||||
|
postUserUsername: string;
|
||||||
|
post: any;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Serialized<T> = {
|
export type Serialized<T> = {
|
||||||
|
|
|
@ -39,7 +39,7 @@ import * as os from '@/os.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
user: Misskey.entities.UserDetailed;
|
user: Misskey.entities.UserLite;
|
||||||
initialComment?: string;
|
initialComment?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="$style.preview">
|
<div :class="$style.preview">
|
||||||
<div :class="$style.preview__content1">
|
<div>
|
||||||
<MkInput v-model="text">
|
<MkInput v-model="text">
|
||||||
<template #label>Text</template>
|
<template #label>Text</template>
|
||||||
</MkInput>
|
</MkInput>
|
||||||
|
|
|
@ -4,25 +4,32 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<MkA v-adaptive-bg :to="forModeration ? `/admin/roles/${role.id}` : `/roles/${role.id}`" class="_panel" :class="$style.root" tabindex="-1" :style="{ '--color': role.color }">
|
<MkA :to="forModeration ? `/admin/roles/${role.id}` : `/roles/${role.id}`" :class="$style.root" tabindex="-1" :style="{ '--color': role.color }">
|
||||||
<div :class="$style.title">
|
<template v-if="forModeration">
|
||||||
<span :class="$style.icon">
|
<i v-if="role.isPublic" class="ti ti-world" :class="$style.icon" style="color: var(--success)"></i>
|
||||||
<template v-if="role.iconUrl">
|
<i v-else class="ti ti-lock" :class="$style.icon" style="color: var(--warn)"></i>
|
||||||
<img :class="$style.badge" :src="role.iconUrl"/>
|
</template>
|
||||||
|
|
||||||
|
<div v-adaptive-bg class="_panel" :class="$style.body">
|
||||||
|
<div :class="$style.bodyTitle">
|
||||||
|
<span :class="$style.bodyIcon">
|
||||||
|
<template v-if="role.iconUrl">
|
||||||
|
<img :class="$style.bodyBadge" :src="role.iconUrl"/>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<i v-if="role.isAdministrator" class="ti ti-crown" style="color: var(--accent);"></i>
|
||||||
|
<i v-else-if="role.isModerator" class="ti ti-shield" style="color: var(--accent);"></i>
|
||||||
|
<i v-else class="ti ti-user" style="opacity: 0.7;"></i>
|
||||||
|
</template>
|
||||||
|
</span>
|
||||||
|
<span :class="$style.bodyName">{{ role.name }}</span>
|
||||||
|
<template v-if="detailed">
|
||||||
|
<span v-if="role.target === 'manual'" :class="$style.bodyUsers">{{ role.usersCount }} users</span>
|
||||||
|
<span v-else-if="role.target === 'conditional'" :class="$style.bodyUsers">? users</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
</div>
|
||||||
<i v-if="role.isAdministrator" class="ti ti-crown" style="color: var(--accent);"></i>
|
<div :class="$style.bodyDescription">{{ role.description }}</div>
|
||||||
<i v-else-if="role.isModerator" class="ti ti-shield" style="color: var(--accent);"></i>
|
|
||||||
<i v-else class="ti ti-user" style="opacity: 0.7;"></i>
|
|
||||||
</template>
|
|
||||||
</span>
|
|
||||||
<span :class="$style.name">{{ role.name }}</span>
|
|
||||||
<template v-if="detailed">
|
|
||||||
<span v-if="role.target === 'manual'" :class="$style.users">{{ role.usersCount }} users</span>
|
|
||||||
<span v-else-if="role.target === 'conditional'" :class="$style.users">({{ i18n.ts._role.conditional }})</span>
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.description">{{ role.description }}</div>
|
|
||||||
</MkA>
|
</MkA>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -42,34 +49,44 @@ const props = withDefaults(defineProps<{
|
||||||
|
|
||||||
<style lang="scss" module>
|
<style lang="scss" module>
|
||||||
.root {
|
.root {
|
||||||
display: block;
|
|
||||||
padding: 16px 20px;
|
|
||||||
border-left: solid 6px var(--color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
|
margin: 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body {
|
||||||
|
display: block;
|
||||||
|
padding: 16px 20px;
|
||||||
|
flex: 1;
|
||||||
|
border-left: solid 6px var(--color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bodyTitle {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bodyIcon {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.badge {
|
.bodyBadge {
|
||||||
height: 1.3em;
|
height: 1.3em;
|
||||||
vertical-align: -20%;
|
vertical-align: -20%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.bodyName {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.users {
|
.bodyUsers {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.description {
|
.bodyDescription {
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
font-size: 85%;
|
font-size: 85%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { host as hostRaw } from '@/config.js';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
user: Misskey.entities.User;
|
user: Misskey.entities.UserLite;
|
||||||
detail?: boolean;
|
detail?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<img src="https://avatars.githubusercontent.com/u/4439005?v=4" :class="$style.contributorAvatar">
|
<img src="https://avatars.githubusercontent.com/u/4439005?v=4" :class="$style.contributorAvatar">
|
||||||
<span :class="$style.contributorUsername">@syuilo</span>
|
<span :class="$style.contributorUsername">@syuilo</span>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/tamaina" target="_blank" :class="$style.contributor">
|
|
||||||
<img src="https://avatars.githubusercontent.com/u/7973572?v=4" :class="$style.contributorAvatar">
|
|
||||||
<span :class="$style.contributorUsername">@tamaina</span>
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/acid-chicken" target="_blank" :class="$style.contributor">
|
<a href="https://github.com/acid-chicken" target="_blank" :class="$style.contributor">
|
||||||
<img src="https://avatars.githubusercontent.com/u/20679825?v=4" :class="$style.contributorAvatar">
|
<img src="https://avatars.githubusercontent.com/u/20679825?v=4" :class="$style.contributorAvatar">
|
||||||
<span :class="$style.contributorUsername">@acid-chicken</span>
|
<span :class="$style.contributorUsername">@acid-chicken</span>
|
||||||
|
@ -267,6 +263,9 @@ const patronsWithIcon = [{
|
||||||
}, {
|
}, {
|
||||||
name: 'Macop',
|
name: 'Macop',
|
||||||
icon: 'https://assets.misskey-hub.net/patrons/ee052bf550014d36a643ce3dce595640.jpg',
|
icon: 'https://assets.misskey-hub.net/patrons/ee052bf550014d36a643ce3dce595640.jpg',
|
||||||
|
}, {
|
||||||
|
name: 'なっかあ',
|
||||||
|
icon: 'https://assets.misskey-hub.net/patrons/c2f5f3e394e74a64912284a2f4ca710e.jpg',
|
||||||
}];
|
}];
|
||||||
|
|
||||||
const patrons = [
|
const patrons = [
|
||||||
|
|
|
@ -37,6 +37,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
'deleteSystemWebhook',
|
'deleteSystemWebhook',
|
||||||
'deleteAbuseReportNotificationRecipient',
|
'deleteAbuseReportNotificationRecipient',
|
||||||
'deleteAccount',
|
'deleteAccount',
|
||||||
|
'deletePage',
|
||||||
|
'deleteFlash',
|
||||||
|
'deleteGalleryPost',
|
||||||
].includes(log.type)
|
].includes(log.type)
|
||||||
}"
|
}"
|
||||||
>{{ i18n.ts._moderationLogTypes[log.type] }}</b>
|
>{{ i18n.ts._moderationLogTypes[log.type] }}</b>
|
||||||
|
@ -74,6 +77,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<span v-else-if="log.type === 'updateAbuseReportNotificationRecipient'">: {{ log.info.before.name }}</span>
|
<span v-else-if="log.type === 'updateAbuseReportNotificationRecipient'">: {{ log.info.before.name }}</span>
|
||||||
<span v-else-if="log.type === 'deleteAbuseReportNotificationRecipient'">: {{ log.info.recipient.name }}</span>
|
<span v-else-if="log.type === 'deleteAbuseReportNotificationRecipient'">: {{ log.info.recipient.name }}</span>
|
||||||
<span v-else-if="log.type === 'deleteAccount'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
|
<span v-else-if="log.type === 'deleteAccount'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
|
||||||
|
<span v-else-if="log.type === 'deletePage'">: @{{ log.info.pageUserUsername }}</span>
|
||||||
|
<span v-else-if="log.type === 'deleteFlash'">: @{{ log.info.flashUserUsername }}</span>
|
||||||
|
<span v-else-if="log.type === 'deleteGalleryPost'">: @{{ log.info.postUserUsername }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<MkAvatar :user="log.user" :class="$style.avatar"/>
|
<MkAvatar :user="log.user" :class="$style.avatar"/>
|
||||||
|
|
|
@ -23,6 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkButton v-else v-tooltip="i18n.ts.like" asLike class="button" rounded @click="like()"><i class="ti ti-heart"></i><span v-if="flash?.likedCount && flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
|
<MkButton v-else v-tooltip="i18n.ts.like" asLike class="button" rounded @click="like()"><i class="ti ti-heart"></i><span v-if="flash?.likedCount && flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
|
||||||
<MkButton v-tooltip="i18n.ts.copyLink" class="button" rounded @click="copyLink"><i class="ti ti-link ti-fw"></i></MkButton>
|
<MkButton v-tooltip="i18n.ts.copyLink" class="button" rounded @click="copyLink"><i class="ti ti-link ti-fw"></i></MkButton>
|
||||||
<MkButton v-tooltip="i18n.ts.share" class="button" rounded @click="share"><i class="ti ti-share ti-fw"></i></MkButton>
|
<MkButton v-tooltip="i18n.ts.share" class="button" rounded @click="share"><i class="ti ti-share ti-fw"></i></MkButton>
|
||||||
|
<MkButton v-if="$i && $i.id !== flash.user.id" class="button" rounded @mousedown="showMenu"><i class="ti ti-dots ti-fw"></i></MkButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -61,7 +62,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onDeactivated, onUnmounted, Ref, ref, watch, shallowRef } from 'vue';
|
import { computed, onDeactivated, onUnmounted, Ref, ref, watch, shallowRef, defineAsyncComponent } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import { Interpreter, Parser, values } from '@syuilo/aiscript';
|
import { Interpreter, Parser, values } from '@syuilo/aiscript';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
@ -79,6 +80,7 @@ import { defaultStore } from '@/store.js';
|
||||||
import { $i } from '@/account.js';
|
import { $i } from '@/account.js';
|
||||||
import { isSupportShare } from '@/scripts/navigator.js';
|
import { isSupportShare } from '@/scripts/navigator.js';
|
||||||
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
||||||
|
import { MenuItem } from '@/types/menu';
|
||||||
import { pleaseLogin } from '@/scripts/please-login.js';
|
import { pleaseLogin } from '@/scripts/please-login.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
@ -229,6 +231,53 @@ async function run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reportAbuse() {
|
||||||
|
if (!flash.value) return;
|
||||||
|
|
||||||
|
const pageUrl = `${url}/play/${flash.value.id}`;
|
||||||
|
|
||||||
|
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkAbuseReportWindow.vue')), {
|
||||||
|
user: flash.value.user,
|
||||||
|
initialComment: `Play: ${pageUrl}\n-----\n`,
|
||||||
|
}, {
|
||||||
|
closed: () => dispose(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMenu(ev: MouseEvent) {
|
||||||
|
if (!flash.value) return;
|
||||||
|
|
||||||
|
const menu: MenuItem[] = [
|
||||||
|
...($i && $i.id !== flash.value.userId ? [
|
||||||
|
{
|
||||||
|
icon: 'ti ti-exclamation-circle',
|
||||||
|
text: i18n.ts.reportAbuse,
|
||||||
|
action: reportAbuse,
|
||||||
|
},
|
||||||
|
...($i.isModerator || $i.isAdmin ? [
|
||||||
|
{
|
||||||
|
type: 'divider' as const,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'ti ti-trash',
|
||||||
|
text: i18n.ts.delete,
|
||||||
|
danger: true,
|
||||||
|
action: () => os.confirm({
|
||||||
|
type: 'warning',
|
||||||
|
text: i18n.ts.deleteConfirm,
|
||||||
|
}).then(({ canceled }) => {
|
||||||
|
if (canceled || !flash.value) return;
|
||||||
|
|
||||||
|
os.apiWithDialog('flash/delete', { flashId: flash.value.id });
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
] : []),
|
||||||
|
] : []),
|
||||||
|
];
|
||||||
|
|
||||||
|
os.popupMenu(menu, ev.currentTarget ?? ev.target);
|
||||||
|
}
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
if (aiscript.value) aiscript.value.abort();
|
if (aiscript.value) aiscript.value.abort();
|
||||||
started.value = false;
|
started.value = false;
|
||||||
|
|
|
@ -31,6 +31,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<button v-tooltip="i18n.ts.shareWithNote" v-click-anime class="_button" @click="shareWithNote"><i class="ti ti-repeat ti-fw"></i></button>
|
<button v-tooltip="i18n.ts.shareWithNote" v-click-anime class="_button" @click="shareWithNote"><i class="ti ti-repeat ti-fw"></i></button>
|
||||||
<button v-tooltip="i18n.ts.copyLink" v-click-anime class="_button" @click="copyLink"><i class="ti ti-link ti-fw"></i></button>
|
<button v-tooltip="i18n.ts.copyLink" v-click-anime class="_button" @click="copyLink"><i class="ti ti-link ti-fw"></i></button>
|
||||||
<button v-if="isSupportShare()" v-tooltip="i18n.ts.share" v-click-anime class="_button" @click="share"><i class="ti ti-share ti-fw"></i></button>
|
<button v-if="isSupportShare()" v-tooltip="i18n.ts.share" v-click-anime class="_button" @click="share"><i class="ti ti-share ti-fw"></i></button>
|
||||||
|
<button v-if="$i && $i.id !== post.user.id" v-click-anime class="_button" @mousedown="showMenu"><i class="ti ti-dots ti-fw"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="user">
|
<div class="user">
|
||||||
|
@ -62,7 +63,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, watch, ref } from 'vue';
|
import { computed, watch, ref, defineAsyncComponent } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
|
@ -79,6 +80,7 @@ import { $i } from '@/account.js';
|
||||||
import { isSupportShare } from '@/scripts/navigator.js';
|
import { isSupportShare } from '@/scripts/navigator.js';
|
||||||
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
||||||
import { useRouter } from '@/router/supplier.js';
|
import { useRouter } from '@/router/supplier.js';
|
||||||
|
import { MenuItem } from '@/types/menu';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
@ -153,13 +155,56 @@ function edit() {
|
||||||
router.push(`/gallery/${post.value.id}/edit`);
|
router.push(`/gallery/${post.value.id}/edit`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reportAbuse() {
|
||||||
|
if (!post.value) return;
|
||||||
|
|
||||||
|
const pageUrl = `${url}/gallery/${post.value.id}`;
|
||||||
|
|
||||||
|
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkAbuseReportWindow.vue')), {
|
||||||
|
user: post.value.user,
|
||||||
|
initialComment: `Post: ${pageUrl}\n-----\n`,
|
||||||
|
}, {
|
||||||
|
closed: () => dispose(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMenu(ev: MouseEvent) {
|
||||||
|
if (!post.value) return;
|
||||||
|
|
||||||
|
const menu: MenuItem[] = [
|
||||||
|
...($i && $i.id !== post.value.userId ? [
|
||||||
|
{
|
||||||
|
icon: 'ti ti-exclamation-circle',
|
||||||
|
text: i18n.ts.reportAbuse,
|
||||||
|
action: reportAbuse,
|
||||||
|
},
|
||||||
|
...($i.isModerator || $i.isAdmin ? [
|
||||||
|
{
|
||||||
|
type: 'divider' as const,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'ti ti-trash',
|
||||||
|
text: i18n.ts.delete,
|
||||||
|
danger: true,
|
||||||
|
action: () => os.confirm({
|
||||||
|
type: 'warning',
|
||||||
|
text: i18n.ts.deleteConfirm,
|
||||||
|
}).then(({ canceled }) => {
|
||||||
|
if (canceled || !post.value) return;
|
||||||
|
|
||||||
|
os.apiWithDialog('gallery/posts/delete', { postId: post.value.id });
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
] : []),
|
||||||
|
] : []),
|
||||||
|
];
|
||||||
|
|
||||||
|
os.popupMenu(menu, ev.currentTarget ?? ev.target);
|
||||||
|
}
|
||||||
|
|
||||||
watch(() => props.postId, fetchPost, { immediate: true });
|
watch(() => props.postId, fetchPost, { immediate: true });
|
||||||
|
|
||||||
const headerActions = computed(() => [{
|
const headerActions = computed(() => []);
|
||||||
icon: 'ti ti-pencil',
|
|
||||||
text: i18n.ts.edit,
|
|
||||||
handler: edit,
|
|
||||||
}]);
|
|
||||||
|
|
||||||
const headerTabs = computed(() => []);
|
const headerTabs = computed(() => []);
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkButton v-else v-tooltip="i18n.ts._pages.like" class="button" asLike @click="like()"><i class="ti ti-heart"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton>
|
<MkButton v-else v-tooltip="i18n.ts._pages.like" class="button" asLike @click="like()"><i class="ti ti-heart"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.other">
|
<div :class="$style.other">
|
||||||
|
<MkA v-if="page.userId === $i?.id" v-tooltip="i18n.ts._pages.editThisPage" :to="`/pages/edit/${page.id}`" class="_button" :class="$style.generalActionButton"><i class="ti ti-pencil ti-fw"></i></MkA>
|
||||||
<button v-tooltip="i18n.ts.copyLink" class="_button" :class="$style.generalActionButton" @click="copyLink"><i class="ti ti-link ti-fw"></i></button>
|
<button v-tooltip="i18n.ts.copyLink" class="_button" :class="$style.generalActionButton" @click="copyLink"><i class="ti ti-link ti-fw"></i></button>
|
||||||
<button v-tooltip="i18n.ts.share" class="_button" :class="$style.generalActionButton" @click="share"><i class="ti ti-share ti-fw"></i></button>
|
<button v-tooltip="i18n.ts.share" class="_button" :class="$style.generalActionButton" @click="share"><i class="ti ti-share ti-fw"></i></button>
|
||||||
|
<button v-if="$i" v-click-anime class="_button" :class="$style.generalActionButton" @mousedown="showMenu"><i class="ti ti-dots ti-fw"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.pageUser">
|
<div :class="$style.pageUser">
|
||||||
|
@ -78,14 +80,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div><i class="ti ti-clock"></i> {{ i18n.ts.createdAt }}: <MkTime :time="page.createdAt" mode="detail"/></div>
|
<div><i class="ti ti-clock"></i> {{ i18n.ts.createdAt }}: <MkTime :time="page.createdAt" mode="detail"/></div>
|
||||||
<div v-if="page.createdAt != page.updatedAt"><i class="ti ti-clock-edit"></i> {{ i18n.ts.updatedAt }}: <MkTime :time="page.updatedAt" mode="detail"/></div>
|
<div v-if="page.createdAt != page.updatedAt"><i class="ti ti-clock-edit"></i> {{ i18n.ts.updatedAt }}: <MkTime :time="page.updatedAt" mode="detail"/></div>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.pageLinks">
|
|
||||||
<MkA v-if="!$i || $i.id !== page.userId" :to="`/@${username}/pages/${pageName}/view-source`" class="link">{{ i18n.ts._pages.viewSource }}</MkA>
|
|
||||||
<template v-if="$i && $i.id === page.userId">
|
|
||||||
<MkA :to="`/pages/edit/${page.id}`" class="link">{{ i18n.ts._pages.editThisPage }}</MkA>
|
|
||||||
<button v-if="$i.pinnedPageId === page.id" class="link _textButton" @click="pin(false)">{{ i18n.ts.unpin }}</button>
|
|
||||||
<button v-else class="link _textButton" @click="pin(true)">{{ i18n.ts.pin }}</button>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<MkAd :prefer="['horizontal', 'horizontal-big']"/>
|
<MkAd :prefer="['horizontal', 'horizontal-big']"/>
|
||||||
<MkContainer :max-height="300" :foldable="true" class="other">
|
<MkContainer :max-height="300" :foldable="true" class="other">
|
||||||
|
@ -104,7 +98,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, watch, ref } from 'vue';
|
import { computed, watch, ref, defineAsyncComponent } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import XPage from '@/components/page/page.vue';
|
import XPage from '@/components/page/page.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
@ -126,6 +120,10 @@ import { isSupportShare } from '@/scripts/navigator.js';
|
||||||
import { instance } from '@/instance.js';
|
import { instance } from '@/instance.js';
|
||||||
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
|
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
|
||||||
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
||||||
|
import { useRouter } from '@/router/supplier.js';
|
||||||
|
import { MenuItem } from '@/types/menu';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
pageName: string;
|
pageName: string;
|
||||||
|
@ -242,6 +240,69 @@ function pin(pin) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reportAbuse() {
|
||||||
|
if (!page.value) return;
|
||||||
|
|
||||||
|
const pageUrl = `${url}/@${props.username}/pages/${props.pageName}`;
|
||||||
|
|
||||||
|
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkAbuseReportWindow.vue')), {
|
||||||
|
user: page.value.user,
|
||||||
|
initialComment: `Page: ${pageUrl}\n-----\n`,
|
||||||
|
}, {
|
||||||
|
closed: () => dispose(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMenu(ev: MouseEvent) {
|
||||||
|
if (!page.value) return;
|
||||||
|
|
||||||
|
const menu: MenuItem[] = [
|
||||||
|
...($i && $i.id === page.value.userId ? [
|
||||||
|
{
|
||||||
|
icon: 'ti ti-code',
|
||||||
|
text: i18n.ts._pages.viewSource,
|
||||||
|
action: () => router.push(`/@${props.username}/pages/${props.pageName}/view-source`),
|
||||||
|
},
|
||||||
|
...($i.pinnedPageId === page.value.id ? [{
|
||||||
|
icon: 'ti ti-pinned-off',
|
||||||
|
text: i18n.ts.unpin,
|
||||||
|
action: () => pin(false),
|
||||||
|
}] : [{
|
||||||
|
icon: 'ti ti-pin',
|
||||||
|
text: i18n.ts.pin,
|
||||||
|
action: () => pin(true),
|
||||||
|
}]),
|
||||||
|
] : []),
|
||||||
|
...($i && $i.id !== page.value.userId ? [
|
||||||
|
{
|
||||||
|
icon: 'ti ti-exclamation-circle',
|
||||||
|
text: i18n.ts.reportAbuse,
|
||||||
|
action: reportAbuse,
|
||||||
|
},
|
||||||
|
...($i.isModerator || $i.isAdmin ? [
|
||||||
|
{
|
||||||
|
type: 'divider' as const,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'ti ti-trash',
|
||||||
|
text: i18n.ts.delete,
|
||||||
|
danger: true,
|
||||||
|
action: () => os.confirm({
|
||||||
|
type: 'warning',
|
||||||
|
text: i18n.ts.deleteConfirm,
|
||||||
|
}).then(({ canceled }) => {
|
||||||
|
if (canceled || !page.value) return;
|
||||||
|
|
||||||
|
os.apiWithDialog('pages/delete', { pageId: page.value.id });
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
] : []),
|
||||||
|
] : []),
|
||||||
|
];
|
||||||
|
|
||||||
|
os.popupMenu(menu, ev.currentTarget ?? ev.target);
|
||||||
|
}
|
||||||
|
|
||||||
watch(() => path.value, fetchPage, { immediate: true });
|
watch(() => path.value, fetchPage, { immediate: true });
|
||||||
|
|
||||||
const headerActions = computed(() => []);
|
const headerActions = computed(() => []);
|
||||||
|
|
|
@ -240,7 +240,7 @@ function closeTutorial(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchTlIfNeeded() {
|
function switchTlIfNeeded() {
|
||||||
if (isBasicTimeline(src.value) && !availableBasicTimelines().includes(src.value)) {
|
if (isBasicTimeline(src.value) && !isAvailableBasicTimeline(src.value)) {
|
||||||
src.value = availableBasicTimelines()[0];
|
src.value = availableBasicTimelines()[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,21 +16,57 @@ function containsFocusTrappedElements(el: HTMLElement): boolean {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getZIndex(el: HTMLElement): number {
|
||||||
|
const zIndex = parseInt(window.getComputedStyle(el).zIndex || '0', 10);
|
||||||
|
if (isNaN(zIndex)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return zIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHighestZIndexElement(): { el: HTMLElement; zIndex: number; } | null {
|
||||||
|
let highestZIndexElement: HTMLElement | null = null;
|
||||||
|
let highestZIndex = -Infinity;
|
||||||
|
|
||||||
|
focusTrapElements.forEach((el) => {
|
||||||
|
const zIndex = getZIndex(el);
|
||||||
|
if (zIndex > highestZIndex) {
|
||||||
|
highestZIndex = zIndex;
|
||||||
|
highestZIndexElement = el;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return highestZIndexElement == null ? null : {
|
||||||
|
el: highestZIndexElement,
|
||||||
|
zIndex: highestZIndex,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function releaseFocusTrap(el: HTMLElement): void {
|
function releaseFocusTrap(el: HTMLElement): void {
|
||||||
focusTrapElements.delete(el);
|
focusTrapElements.delete(el);
|
||||||
if (el.inert === true) {
|
if (el.inert === true) {
|
||||||
el.inert = false;
|
el.inert = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const highestZIndexElement = getHighestZIndexElement();
|
||||||
|
|
||||||
if (el.parentElement != null && el !== document.body) {
|
if (el.parentElement != null && el !== document.body) {
|
||||||
el.parentElement.childNodes.forEach((siblingNode) => {
|
el.parentElement.childNodes.forEach((siblingNode) => {
|
||||||
const siblingEl = getHTMLElementOrNull(siblingNode);
|
const siblingEl = getHTMLElementOrNull(siblingNode);
|
||||||
if (!siblingEl) return;
|
if (!siblingEl) return;
|
||||||
if (siblingEl !== el && (focusTrapElements.has(siblingEl) || containsFocusTrappedElements(siblingEl) || focusTrapElements.size === 0)) {
|
if (
|
||||||
|
siblingEl !== el &&
|
||||||
|
(
|
||||||
|
highestZIndexElement == null ||
|
||||||
|
siblingEl === highestZIndexElement.el ||
|
||||||
|
siblingEl.contains(highestZIndexElement.el)
|
||||||
|
)
|
||||||
|
) {
|
||||||
siblingEl.inert = false;
|
siblingEl.inert = false;
|
||||||
} else if (
|
} else if (
|
||||||
focusTrapElements.size > 0 &&
|
highestZIndexElement != null &&
|
||||||
!containsFocusTrappedElements(siblingEl) &&
|
siblingEl !== highestZIndexElement.el &&
|
||||||
!focusTrapElements.has(siblingEl) &&
|
!siblingEl.contains(highestZIndexElement.el) &&
|
||||||
!ignoreElements.includes(siblingEl.tagName.toLowerCase())
|
!ignoreElements.includes(siblingEl.tagName.toLowerCase())
|
||||||
) {
|
) {
|
||||||
siblingEl.inert = true;
|
siblingEl.inert = true;
|
||||||
|
@ -45,9 +81,29 @@ function releaseFocusTrap(el: HTMLElement): void {
|
||||||
export function focusTrap(el: HTMLElement, hasInteractionWithOtherFocusTrappedEls: boolean, parent: true): void;
|
export function focusTrap(el: HTMLElement, hasInteractionWithOtherFocusTrappedEls: boolean, parent: true): void;
|
||||||
export function focusTrap(el: HTMLElement, hasInteractionWithOtherFocusTrappedEls?: boolean, parent?: false): { release: () => void; };
|
export function focusTrap(el: HTMLElement, hasInteractionWithOtherFocusTrappedEls?: boolean, parent?: false): { release: () => void; };
|
||||||
export function focusTrap(el: HTMLElement, hasInteractionWithOtherFocusTrappedEls = false, parent = false): { release: () => void; } | void {
|
export function focusTrap(el: HTMLElement, hasInteractionWithOtherFocusTrappedEls = false, parent = false): { release: () => void; } | void {
|
||||||
|
const highestZIndexElement = getHighestZIndexElement();
|
||||||
|
|
||||||
|
const highestZIndex = highestZIndexElement == null ? -Infinity : highestZIndexElement.zIndex;
|
||||||
|
const zIndex = getZIndex(el);
|
||||||
|
|
||||||
|
// If the element has a lower z-index than the highest z-index element, focus trap the highest z-index element instead
|
||||||
|
// Focus trapping for this element will be done in the release function
|
||||||
|
if (!parent && zIndex < highestZIndex) {
|
||||||
|
focusTrapElements.add(el);
|
||||||
|
if (highestZIndexElement) {
|
||||||
|
focusTrap(highestZIndexElement.el, hasInteractionWithOtherFocusTrappedEls);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
release: () => {
|
||||||
|
releaseFocusTrap(el);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (el.inert === true) {
|
if (el.inert === true) {
|
||||||
el.inert = false;
|
el.inert = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (el.parentElement != null && el !== document.body) {
|
if (el.parentElement != null && el !== document.body) {
|
||||||
el.parentElement.childNodes.forEach((siblingNode) => {
|
el.parentElement.childNodes.forEach((siblingNode) => {
|
||||||
const siblingEl = getHTMLElementOrNull(siblingNode);
|
const siblingEl = getHTMLElementOrNull(siblingNode);
|
||||||
|
|
|
@ -2464,6 +2464,9 @@ type ModerationLog = {
|
||||||
} | {
|
} | {
|
||||||
type: 'unsetUserAvatar';
|
type: 'unsetUserAvatar';
|
||||||
info: ModerationLogPayloads['unsetUserAvatar'];
|
info: ModerationLogPayloads['unsetUserAvatar'];
|
||||||
|
} | {
|
||||||
|
type: 'unsetUserBanner';
|
||||||
|
info: ModerationLogPayloads['unsetUserBanner'];
|
||||||
} | {
|
} | {
|
||||||
type: 'createSystemWebhook';
|
type: 'createSystemWebhook';
|
||||||
info: ModerationLogPayloads['createSystemWebhook'];
|
info: ModerationLogPayloads['createSystemWebhook'];
|
||||||
|
@ -2485,10 +2488,19 @@ type ModerationLog = {
|
||||||
} | {
|
} | {
|
||||||
type: 'deleteAccount';
|
type: 'deleteAccount';
|
||||||
info: ModerationLogPayloads['deleteAccount'];
|
info: ModerationLogPayloads['deleteAccount'];
|
||||||
|
} | {
|
||||||
|
type: 'deletePage';
|
||||||
|
info: ModerationLogPayloads['deletePage'];
|
||||||
|
} | {
|
||||||
|
type: 'deleteFlash';
|
||||||
|
info: ModerationLogPayloads['deleteFlash'];
|
||||||
|
} | {
|
||||||
|
type: 'deleteGalleryPost';
|
||||||
|
info: ModerationLogPayloads['deleteGalleryPost'];
|
||||||
});
|
});
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "updateRemoteInstanceNote", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "createInvitation", "createAd", "updateAd", "deleteAd", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner", "createSystemWebhook", "updateSystemWebhook", "deleteSystemWebhook", "createAbuseReportNotificationRecipient", "updateAbuseReportNotificationRecipient", "deleteAbuseReportNotificationRecipient", "deleteAccount"];
|
export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "updateRemoteInstanceNote", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "createInvitation", "createAd", "updateAd", "deleteAd", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner", "createSystemWebhook", "updateSystemWebhook", "deleteSystemWebhook", "createAbuseReportNotificationRecipient", "updateAbuseReportNotificationRecipient", "deleteAbuseReportNotificationRecipient", "deleteAccount", "deletePage", "deleteFlash", "deleteGalleryPost"];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type MuteCreateRequest = operations['mute___create']['requestBody']['content']['application/json'];
|
type MuteCreateRequest = operations['mute___create']['requestBody']['content']['application/json'];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"name": "misskey-js",
|
"name": "misskey-js",
|
||||||
"version": "2024.8.0-beta.2",
|
"version": "2024.8.0",
|
||||||
"description": "Misskey SDK for JavaScript",
|
"description": "Misskey SDK for JavaScript",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./built/index.js",
|
"main": "./built/index.js",
|
||||||
|
|
|
@ -4,9 +4,12 @@ import type {
|
||||||
Ad,
|
Ad,
|
||||||
Announcement,
|
Announcement,
|
||||||
EmojiDetailed,
|
EmojiDetailed,
|
||||||
|
Flash,
|
||||||
|
GalleryPost,
|
||||||
InviteCode,
|
InviteCode,
|
||||||
MetaDetailed,
|
MetaDetailed,
|
||||||
Note,
|
Note,
|
||||||
|
Page,
|
||||||
Role,
|
Role,
|
||||||
ReversiGameDetailed,
|
ReversiGameDetailed,
|
||||||
SystemWebhook,
|
SystemWebhook,
|
||||||
|
@ -155,6 +158,9 @@ export const moderationLogTypes = [
|
||||||
'updateAbuseReportNotificationRecipient',
|
'updateAbuseReportNotificationRecipient',
|
||||||
'deleteAbuseReportNotificationRecipient',
|
'deleteAbuseReportNotificationRecipient',
|
||||||
'deleteAccount',
|
'deleteAccount',
|
||||||
|
'deletePage',
|
||||||
|
'deleteFlash',
|
||||||
|
'deleteGalleryPost',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
// See: packages/backend/src/core/ReversiService.ts@L410
|
// See: packages/backend/src/core/ReversiService.ts@L410
|
||||||
|
@ -398,4 +404,22 @@ export type ModerationLogPayloads = {
|
||||||
userUsername: string;
|
userUsername: string;
|
||||||
userHost: string | null;
|
userHost: string | null;
|
||||||
};
|
};
|
||||||
|
deletePage: {
|
||||||
|
pageId: string;
|
||||||
|
pageUserId: string;
|
||||||
|
pageUserUsername: string;
|
||||||
|
page: Page;
|
||||||
|
};
|
||||||
|
deleteFlash: {
|
||||||
|
flashId: string;
|
||||||
|
flashUserId: string;
|
||||||
|
flashUserUsername: string;
|
||||||
|
flash: Flash;
|
||||||
|
};
|
||||||
|
deleteGalleryPost: {
|
||||||
|
postId: string;
|
||||||
|
postUserId: string;
|
||||||
|
postUserUsername: string;
|
||||||
|
post: GalleryPost;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -155,6 +155,9 @@ export type ModerationLog = {
|
||||||
} | {
|
} | {
|
||||||
type: 'unsetUserAvatar';
|
type: 'unsetUserAvatar';
|
||||||
info: ModerationLogPayloads['unsetUserAvatar'];
|
info: ModerationLogPayloads['unsetUserAvatar'];
|
||||||
|
} | {
|
||||||
|
type: 'unsetUserBanner';
|
||||||
|
info: ModerationLogPayloads['unsetUserBanner'];
|
||||||
} | {
|
} | {
|
||||||
type: 'createSystemWebhook';
|
type: 'createSystemWebhook';
|
||||||
info: ModerationLogPayloads['createSystemWebhook'];
|
info: ModerationLogPayloads['createSystemWebhook'];
|
||||||
|
@ -176,6 +179,15 @@ export type ModerationLog = {
|
||||||
} | {
|
} | {
|
||||||
type: 'deleteAccount';
|
type: 'deleteAccount';
|
||||||
info: ModerationLogPayloads['deleteAccount'];
|
info: ModerationLogPayloads['deleteAccount'];
|
||||||
|
} | {
|
||||||
|
type: 'deletePage';
|
||||||
|
info: ModerationLogPayloads['deletePage'];
|
||||||
|
} | {
|
||||||
|
type: 'deleteFlash';
|
||||||
|
info: ModerationLogPayloads['deleteFlash'];
|
||||||
|
} | {
|
||||||
|
type: 'deleteGalleryPost';
|
||||||
|
info: ModerationLogPayloads['deleteGalleryPost'];
|
||||||
});
|
});
|
||||||
|
|
||||||
export type ServerStats = {
|
export type ServerStats = {
|
||||||
|
|
Loading…
Reference in New Issue