Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into forward_hashtag_…
Browse files Browse the repository at this point in the history
…search
  • Loading branch information
Sayamame-beans committed May 25, 2024
2 parents 6ed48fc + e0b4799 commit a1513dd
Show file tree
Hide file tree
Showing 29 changed files with 297 additions and 32 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Note
- コントロールパネル内にあるサマリープロキシの設定個所がセキュリティから全般へ変更となります。
- 悪意のある第三者がリモートユーザーになりすましたアクティビティを受け取れてしまう問題を修正しました。詳しくは[GitHub security advisory](https://github.com/misskey-dev/misskey/security/advisories/GHSA-2vxv-pv3m-3wvj)をご覧ください。
- 管理者向け権限 `read:admin:show-users``read:admin:show-user` に統合されました。必要に応じてAPIトークンを再発行してください。

### General
- Enhance: URLプレビューの有効化・無効化を設定できるように #13569
Expand All @@ -15,6 +16,9 @@
- サスペンド済みユーザーか
- 鍵アカウントユーザーか
- 「アカウントを見つけやすくする」が有効なユーザーか
- Enhance: Goneを出さずに終了したサーバーへの配信停止を自動的に行うように
- もしそのようなサーバーからから配信が届いた場合には自動的に配信を再開します
- Enhance: 配信停止の理由を表示するように
- Fix: Play作成時に設定した公開範囲が機能していない問題を修正
- Fix: 正規化されていない状態のhashtagが連合されてきたhtmlに含まれているとhashtagが正しくhashtagに復元されない問題を修正
- Fix: みつけるのアンケート欄にてチャンネルのアンケートが含まれてしまう問題を修正
Expand Down Expand Up @@ -42,6 +46,7 @@
- Enhance: `Ui:C:postForm` および `Ui:C:postFormButton``localOnly``visibility` を設定できるように
- Enhance: AiScriptを0.18.0にバージョンアップ
- Enhance: 通常のノートでも、お気に入りに登録したチャンネルにリノートできるように
- Enhance: 長いテキストをペーストした際にテキストファイルとして添付するかどうかを選択できるように
- Enhance: ノート検索で `#` から始まる文字列を入力すると、そのハッシュタグのノート一覧ページが表示されるように
- Enhance: ユーザー検索で `#` から始まる文字列を入力すると、そのハッシュタグのユーザー一覧ページが表示されるように
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
Expand Down
2 changes: 1 addition & 1 deletion healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# SPDX-License-Identifier: AGPL-3.0-only

PORT=$(grep '^port:' /misskey/.config/default.yml | awk 'NR==1{print $2; exit}')
curl -s -S -o /dev/null "http://localhost:${PORT}"
curl -Sfso/dev/null "http://localhost:${PORT}/healthz"
2 changes: 1 addition & 1 deletion locales/de-DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ smtpSecureInfo: "Schalte dies aus, falls du STARTTLS verwendest."
testEmail: "Emailversand testen"
wordMute: "Wortstummschaltung"
regexpError: "Fehler in einem regulären Ausdruck"
regexpErrorDescription: "Im regulären Ausdruck deiner {tab}en Wortstummschaltungen ist ein Fehler aufgetreten:"
regexpErrorDescription: "Im regulären Ausdruck deiner in Zeile {line} von {tab}en Wortstummschaltungen ist ein Fehler aufgetreten:"
instanceMute: "Instanzstummschaltungen"
userSaysSomething: "{name} hat etwas gesagt"
makeActive: "Aktivieren"
Expand Down
42 changes: 37 additions & 5 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ export interface Locale extends ILocale {
*/
"silencedInstances": string;
/**
* サイレンスしたいサーバーのホストを改行で区切って設定します。サイレンスされたサーバーに所属するアカウントはすべて「サイレンス」として扱われ、フォローがすべてリクエストになり、フォロワーでないローカルアカウントにはメンションできなくなります。ブロックしたインスタンスには影響しません。
* サイレンスしたいサーバーのホストを改行で区切って設定します。サイレンスされたサーバーに所属するアカウントはすべて「サイレンス」として扱われ、フォローがすべてリクエストになります。ブロックしたインスタンスには影響しません。
*/
"silencedInstancesDescription": string;
/**
Expand Down Expand Up @@ -1900,6 +1900,10 @@ export interface Locale extends ILocale {
* 引用として添付しますか?
*/
"quoteQuestion": string;
/**
* クリップボードのテキストが長いです。テキストファイルとして添付しますか?
*/
"attachAsFileQuestion": string;
/**
* まだチャットはありません
*/
Expand Down Expand Up @@ -4968,6 +4972,38 @@ export interface Locale extends ILocale {
* お問い合わせ
*/
"inquiry": string;
"_delivery": {
/**
* 配信状態
*/
"status": string;
/**
* 配信停止
*/
"stop": string;
/**
* 配信再開
*/
"resume": string;
"_type": {
/**
* 配信中
*/
"none": string;
/**
* 手動停止中
*/
"manuallySuspended": string;
/**
* サーバー削除のため停止中
*/
"goneSuspended": string;
/**
* サーバー応答なしのため停止中
*/
"autoSuspendedForNotResponding": string;
};
};
"_bubbleGame": {
/**
* 遊び方
Expand Down Expand Up @@ -7899,10 +7935,6 @@ export interface Locale extends ILocale {
* ユーザーのプライベートな情報を見る
*/
"read:admin:show-user": string;
/**
* ユーザーのプライベートな情報を見る
*/
"read:admin:show-users": string;
/**
* ユーザーを凍結する
*/
Expand Down
12 changes: 11 additions & 1 deletion locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ retype: "再入力"
noteOf: "{user}のノート"
quoteAttached: "引用付き"
quoteQuestion: "引用として添付しますか?"
attachAsFileQuestion: "クリップボードのテキストが長いです。テキストファイルとして添付しますか?"
noMessagesYet: "まだチャットはありません"
newMessageExists: "新しいメッセージがあります"
onlyOneFileCanBeAttached: "メッセージに添付できるファイルはひとつです"
Expand Down Expand Up @@ -1239,6 +1240,16 @@ noDescription: "説明文はありません"
alwaysConfirmFollow: "フォローの際常に確認する"
inquiry: "お問い合わせ"

_delivery:
status: "配信状態"
stop: "配信停止"
resume: "配信再開"
_type:
none: "配信中"
manuallySuspended: "手動停止中"
goneSuspended: "サーバー削除のため停止中"
autoSuspendedForNotResponding: "サーバー応答なしのため停止中"

_bubbleGame:
howToPlay: "遊び方"
hold: "ホールド"
Expand Down Expand Up @@ -2074,7 +2085,6 @@ _permissions:
"read:admin:server-info": "サーバーの情報を見る"
"read:admin:show-moderation-log": "モデレーションログを見る"
"read:admin:show-user": "ユーザーのプライベートな情報を見る"
"read:admin:show-users": "ユーザーのプライベートな情報を見る"
"write:admin:suspend-user": "ユーザーを凍結する"
"write:admin:unset-user-avatar": "ユーザーのアバターを削除する"
"write:admin:unset-user-banner": "ユーザーのバーナーを削除する"
Expand Down
2 changes: 1 addition & 1 deletion locales/pl-PL.yml
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ check: "Zweryfikuj"
driveCapOverrideLabel: "Zmień limit pojemności dysku użytkownika"
requireAdminForView: "Aby to zobaczyć, musisz być administratorem"
isSystemAccount: "To jest konto stworzone i zarządzane przez system"
typeToConfirm: "Wielki chuj "
typeToConfirm: "Wprowadź {x}, aby potwierdzić"
deleteAccount: "Usuń konto"
document: "Dokumentacja"
numberOfPageCache: "Ilość stron w cache"
Expand Down
3 changes: 3 additions & 0 deletions locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,14 @@ enterEmoji: "输入表情符号"
renote: "转发"
unrenote: "取消转发"
renoted: "已转发。"
renotedToX: "转帖给 {name}"
cantRenote: "该帖无法转发。"
cantReRenote: "转发无法被再次转发。"
quote: "引用"
inChannelRenote: "在频道内转发"
inChannelQuote: "在频道内引用"
renoteToChannel: "转帖至频道"
renoteToOtherChannel: "转帖至其它频道"
pinnedNote: "已置顶的帖子"
pinned: "置顶"
you: ""
Expand Down
16 changes: 16 additions & 0 deletions packages/backend/migration/1716345015347-NotRespondingSince.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

export class NotRespondingSince1716345015347 {
name = 'NotRespondingSince1716345015347'

async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "instance" ADD "notRespondingSince" TIMESTAMP WITH TIME ZONE`);
}

async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "notRespondingSince"`);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

export class SuspensionStateInsteadOfIsSspended1716345771510 {
name = 'SuspensionStateInsteadOfIsSspended1716345771510'

async up(queryRunner) {
await queryRunner.query(`CREATE TYPE "public"."instance_suspensionstate_enum" AS ENUM('none', 'manuallySuspended', 'goneSuspended', 'autoSuspendedForNotResponding')`);

await queryRunner.query(`DROP INDEX "public"."IDX_34500da2e38ac393f7bb6b299c"`);

await queryRunner.query(`ALTER TABLE "instance" RENAME COLUMN "isSuspended" TO "suspensionState"`);

await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "suspensionState" DROP DEFAULT`);

await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "suspensionState" TYPE "public"."instance_suspensionstate_enum" USING (
CASE "suspensionState"
WHEN TRUE THEN 'manuallySuspended'::instance_suspensionstate_enum
ELSE 'none'::instance_suspensionstate_enum
END
)`);

await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "suspensionState" SET DEFAULT 'none'`);

await queryRunner.query(`CREATE INDEX "IDX_3ede46f507c87ad698051d56a8" ON "instance" ("suspensionState") `);
}

async down(queryRunner) {
await queryRunner.query(`DROP INDEX "public"."IDX_3ede46f507c87ad698051d56a8"`);

await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "suspensionState" DROP DEFAULT`);

await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "suspensionState" TYPE boolean USING (
CASE "suspensionState"
WHEN 'none'::instance_suspensionstate_enum THEN FALSE
ELSE TRUE
END
)`);

await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "suspensionState" SET DEFAULT false`);

await queryRunner.query(`ALTER TABLE "instance" RENAME COLUMN "suspensionState" TO "isSuspended"`);

await queryRunner.query(`CREATE INDEX "IDX_34500da2e38ac393f7bb6b299c" ON "instance" ("isSuspended") `);

await queryRunner.query(`DROP TYPE "public"."instance_suspensionstate_enum"`);
}
}
3 changes: 3 additions & 0 deletions packages/backend/src/boot/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Logger from '@/logger.js';
import { envOption } from '../env.js';
import { masterMain } from './master.js';
import { workerMain } from './worker.js';
import { readyRef } from './ready.js';

import 'reflect-metadata';

Expand Down Expand Up @@ -79,6 +80,8 @@ if (cluster.isWorker || envOption.disableClustering) {
await workerMain();
}

readyRef.value = true;

// ユニットテスト時にMisskeyが子プロセスで起動された時のため
// それ以外のときは process.send は使えないので弾く
if (process.send) {
Expand Down
6 changes: 6 additions & 0 deletions packages/backend/src/boot/ready.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

export const readyRef = { value: false };
3 changes: 2 additions & 1 deletion packages/backend/src/core/entities/InstanceEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export class InstanceEntityService {
followingCount: instance.followingCount,
followersCount: instance.followersCount,
isNotResponding: instance.isNotResponding,
isSuspended: instance.isSuspended,
isSuspended: instance.suspensionState !== 'none',
suspensionState: instance.suspensionState,
isBlocked: this.utilityService.isBlockedHost(meta.blockedHosts, instance.host),
softwareName: instance.softwareName,
softwareVersion: instance.softwareVersion,
Expand Down
17 changes: 13 additions & 4 deletions packages/backend/src/models/Instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,22 @@ export class MiInstance {
public isNotResponding: boolean;

/**
* このインスタンスへの配信を停止するか
* このインスタンスと不通になった日時
*/
@Column('timestamp with time zone', {
nullable: true,
})
public notRespondingSince: Date | null;

/**
* このインスタンスへの配信状態
*/
@Index()
@Column('boolean', {
default: false,
@Column('enum', {
default: 'none',
enum: ['none', 'manuallySuspended', 'goneSuspended', 'autoSuspendedForNotResponding'],
})
public isSuspended: boolean;
public suspensionState: 'none' | 'manuallySuspended' | 'goneSuspended' | 'autoSuspendedForNotResponding';

@Column('varchar', {
length: 64, nullable: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export const packedFederationInstanceSchema = {
type: 'boolean',
optional: false, nullable: false,
},
suspensionState: {
type: 'string',
nullable: false, optional: false,
enum: ['none', 'manuallySuspended', 'goneSuspended', 'autoSuspendedForNotResponding'],
},
isBlocked: {
type: 'boolean',
optional: false, nullable: false,
Expand Down
14 changes: 12 additions & 2 deletions packages/backend/src/queue/processors/DeliverProcessorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { Inject, Injectable } from '@nestjs/common';
import * as Bull from 'bullmq';
import { Not } from 'typeorm';
import { DI } from '@/di-symbols.js';
import type { InstancesRepository } from '@/models/_.js';
import type Logger from '@/logger.js';
Expand Down Expand Up @@ -62,7 +63,7 @@ export class DeliverProcessorService {
if (suspendedHosts == null) {
suspendedHosts = await this.instancesRepository.find({
where: {
isSuspended: true,
suspensionState: Not('none'),
},
});
this.suspendedHostsCache.set(suspendedHosts);
Expand All @@ -79,6 +80,7 @@ export class DeliverProcessorService {
if (i.isNotResponding) {
this.federatedInstanceService.update(i.id, {
isNotResponding: false,
notRespondingSince: null,
});
}

Expand All @@ -98,7 +100,15 @@ export class DeliverProcessorService {
if (!i.isNotResponding) {
this.federatedInstanceService.update(i.id, {
isNotResponding: true,
notRespondingSince: new Date(),
});
} else if (i.notRespondingSince) {
// 1週間以上不通ならサスペンド
if (i.suspensionState === 'none' && i.notRespondingSince.getTime() <= Date.now() - 1000 * 60 * 60 * 24 * 7) {
this.federatedInstanceService.update(i.id, {
suspensionState: 'autoSuspendedForNotResponding',
});
}
}

this.apRequestChart.deliverFail();
Expand All @@ -116,7 +126,7 @@ export class DeliverProcessorService {
if (job.data.isSharedInbox && res.statusCode === 410) {
this.federatedInstanceService.fetch(host).then(i => {
this.federatedInstanceService.update(i.id, {
isSuspended: true,
suspensionState: 'goneSuspended',
});
});
throw new Bull.UnrecoverableError(`${host} is gone`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ export class InboxProcessorService {
this.federatedInstanceService.update(i.id, {
latestRequestReceivedAt: new Date(),
isNotResponding: false,
// もしサーバーが死んでるために配信が止まっていた場合には自動的に復活させてあげる
suspensionState: i.suspensionState === 'autoSuspendedForNotResponding' ? 'none' : undefined,
});

this.fetchInstanceMetadataService.fetchInstanceMetadata(i);
Expand Down
Loading

0 comments on commit a1513dd

Please sign in to comment.