diff --git a/CHANGELOG.md b/CHANGELOG.md index 76abe42e10..e5bbda36fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ -## 2024.10.2 +## 2024.11.0 ### General - Feat: コンテンツの表示にログインを必須にできるように - Feat: 過去のノートを非公開化/フォロワーのみ表示可能にできるように +- Enhance: 依存関係の更新 +- Enhance: l10nの更新 ### Client - Enhance: Bull DashboardでRelationship Queueの状態も確認できるように @@ -25,12 +27,14 @@ - Fix: リンク切れを修正 = Fix: ノート投稿ボタンにホバー時のスタイルが適用されていないのを修正 (Cherry-picked from https://github.com/taiyme/misskey/pull/305) +- Fix: メールアドレス登録有効化時の「完了」ダイアログボックスの表示条件を修正 ### Server - Enhance: 起動前の疎通チェックで、DBとメイン以外のRedisの疎通確認も行うように (Based on https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/588) (Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/715) -- fix(backend): フォロワーへのメッセージの絵文字をemojisに含めるように +- Enhance: リモートユーザーの照会をオリジナルにリダイレクトするように +- Fix: フォロワーへのメッセージの絵文字をemojisに含めるように - Fix: Nested proxy requestsを検出した際にブロックするように [ghsa-gq5q-c77c-v236](https://github.com/misskey-dev/misskey/security/advisories/ghsa-gq5q-c77c-v236) - Fix: 招待コードの発行可能な残り数算出に使用すべきロールポリシーの値が違う問題を修正 @@ -41,7 +45,6 @@ (Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/712) - Fix: FTT無効時にユーザーリストタイムラインが使用できない問題を修正 (Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/709) -- Enhance: リモートユーザーの照会をオリジナルにリダイレクトするように ### Misskey.js - Fix: Stream初期化時、別途WebSocketを指定する場合の型定義を修正 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 76a5f42eac..f8af6b3df0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -85,6 +85,7 @@ Be willing to comment on the good points and not just the things you want fixed 読んでおくといいやつ - https://blog.lacolaco.net/posts/1e2cf439b3c2/ +- https://konifar-zatsu.hatenadiary.jp/entry/2024/11/05/192421 ### Review perspective - Scope diff --git a/package.json b/package.json index 532c4cb7c9..ca3366ff74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2024.11.0-yumechinokuni.0", + "version": "2024.11.0-yumechinokuni.1", "codename": "nasubi", "repository": { "type": "git", diff --git a/packages/backend/src/config.ts b/packages/backend/src/config.ts index db5c9357e3..54f77764f0 100644 --- a/packages/backend/src/config.ts +++ b/packages/backend/src/config.ts @@ -155,6 +155,8 @@ export type Config = { signToActivityPubGet: boolean | undefined; version: string; + gitDescribe: string; + gitCommit: string; publishTarballInsteadOfProvideRepositoryUrl: boolean; setupPassword: string | undefined; host: string; @@ -218,7 +220,7 @@ export function loadConfig(): Config { const config = yaml.load(fs.readFileSync(path, 'utf-8')) as Source; const url = tryCreateUrl(config.url ?? process.env.MISSKEY_URL ?? ''); - const version = meta.version; + const { version, gitDescribe, gitCommit } = meta; const host = url.host; const hostname = url.hostname; const scheme = url.protocol.replace(/:$/, ''); @@ -236,6 +238,8 @@ export function loadConfig(): Config { return { version, + gitCommit, + gitDescribe, publishTarballInsteadOfProvideRepositoryUrl: !!config.publishTarballInsteadOfProvideRepositoryUrl, setupPassword: config.setupPassword, url: url.origin, diff --git a/packages/backend/src/server/NodeinfoServerService.ts b/packages/backend/src/server/NodeinfoServerService.ts index 9a641007ee..740d6b6a58 100644 --- a/packages/backend/src/server/NodeinfoServerService.ts +++ b/packages/backend/src/server/NodeinfoServerService.ts @@ -105,6 +105,8 @@ export class NodeinfoServerService { name: meta.maintainerName, email: meta.maintainerEmail, }, + gitCommit: this.config.gitCommit, + gitDescribe: this.config.gitDescribe, langs: meta.langs, tosUrl: meta.termsOfServiceUrl, privacyPolicyUrl: meta.privacyPolicyUrl, diff --git a/packages/frontend/src/components/MkSignupDialog.form.vue b/packages/frontend/src/components/MkSignupDialog.form.vue index 3d1c44fc90..e1f4e26d62 100644 --- a/packages/frontend/src/components/MkSignupDialog.form.vue +++ b/packages/frontend/src/components/MkSignupDialog.form.vue @@ -277,7 +277,7 @@ async function onSubmit(): Promise { return null; }); - if (res) { + if (res && res.ok) { if (res.status === 204 || instance.emailRequiredForSignup) { os.alert({ type: 'success', @@ -295,6 +295,8 @@ async function onSubmit(): Promise { await login(resJson.token); } } + } else { + onSignupApiError(); } submitting.value = false; diff --git a/packages/frontend/src/stream.ts b/packages/frontend/src/stream.ts index e63dac951c..57fae49d4b 100644 --- a/packages/frontend/src/stream.ts +++ b/packages/frontend/src/stream.ts @@ -7,45 +7,91 @@ import * as Misskey from 'misskey-js'; import { markRaw } from 'vue'; import { $i } from '@/account.js'; import { wsOrigin } from '@@/js/config.js'; +import { DEFAULT_DEVICE_KIND } from '@/scripts/device-kind.js'; // TODO: No WebsocketモードでStreamMockが使えそう //import { StreamMock } from '@/scripts/stream-mock.js'; // heart beat interval in ms -const HEART_BEAT_INTERVAL = 1000 * 60; +const HEART_BEAT_INTERVAL = DEFAULT_DEVICE_KIND === 'desktop' ? 1000 * 15 : 1000 * 30; + +const RECONNECT_MAX_ATTEMPTS = 10; +const RECONNECT_INITIAL_DELAY = 1000; +const RECONNECT_MAX_DELAY = 1000 * 30; let stream: Misskey.IStream | null = null; let timeoutHeartBeat: number | null = null; let lastHeartbeatCall = 0; +let reconnectAttempts = 0; +let reconnectTimeout: number | null = null; + +function getReconnectDelay(): number { + const delay = RECONNECT_INITIAL_DELAY * Math.pow(2, reconnectAttempts); + return Math.min(delay, RECONNECT_MAX_DELAY); +} + +function createStream(): Misskey.IStream { + const newStream = markRaw(new Misskey.Stream(wsOrigin, $i ? { + token: $i.token, + } : null)); + + newStream.on('_disconnected_', () => { + console.log('Stream disconnected, attempting to reconnect...'); + if (reconnectAttempts < RECONNECT_MAX_ATTEMPTS) { + const delay = getReconnectDelay(); + reconnectTimeout = window.setTimeout(() => { + reconnectAttempts++; + stream = null; + useStream(); + }, delay); + } else { + console.error('Max reconnection attempts reached'); + } + }); + + newStream.on('_connected_', () => { + console.log('Stream connected successfully'); + reconnectAttempts = 0; + if (reconnectTimeout) { + clearTimeout(reconnectTimeout); + reconnectTimeout = null; + } + }); + + return newStream; +} export function useStream(): Misskey.IStream { - if (stream) return stream; + if (stream) return stream; - // TODO: No Websocketモードもここで判定 - stream = markRaw(new Misskey.Stream(wsOrigin, $i ? { - token: $i.token, - } : null)); + stream = createStream(); - if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat); - timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL); + if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat); + timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL); - // send heartbeat right now when last send time is over HEART_BEAT_INTERVAL - document.addEventListener('visibilitychange', () => { - if ( - !stream - || document.visibilityState !== 'visible' - || Date.now() - lastHeartbeatCall < HEART_BEAT_INTERVAL - ) return; - heartbeat(); - }); + const target = () => { + if ( + !stream + || document.visibilityState !== 'visible' + || Date.now() - lastHeartbeatCall < HEART_BEAT_INTERVAL + ) return; + heartbeat(); + }; - return stream; + // send heartbeat right now when last send time is over HEART_BEAT_INTERVAL + document.addEventListener('visibilitychange', target); + + stream.on('_disconnected_', () => { + document.removeEventListener('visibilitychange', target); + }); + + return stream; } function heartbeat(): void { - if (stream != null && document.visibilityState === 'visible') { - stream.heartbeat(); - } - lastHeartbeatCall = Date.now(); - if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat); - timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL); + if (stream != null && document.visibilityState === 'visible') { + stream.heartbeat(); + } + lastHeartbeatCall = Date.now(); + if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat); + timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL); } diff --git a/scripts/build-pre.js b/scripts/build-pre.js index a90d53c75d..d269754196 100644 --- a/scripts/build-pre.js +++ b/scripts/build-pre.js @@ -4,14 +4,23 @@ */ const fs = require('fs'); +const child_process = require('child_process'); const packageJsonPath = __dirname + '/../package.json' function build() { try { + const gitDescribe = child_process.execSync('git describe --tags --always').toString().trim(); + const gitCommit = child_process.execSync('git rev-parse HEAD').toString().trim(); const json = fs.readFileSync(packageJsonPath, 'utf-8') const meta = JSON.parse(json); fs.mkdirSync(__dirname + '/../built', { recursive: true }); - fs.writeFileSync(__dirname + '/../built/meta.json', JSON.stringify({ version: meta.version }), 'utf-8'); + fs.writeFileSync(__dirname + '/../built/meta.json', + JSON.stringify( + { + version: meta.version, + gitCommit: gitCommit, + gitDescribe: gitDescribe, + }), 'utf-8'); } catch (e) { console.error(e) } diff --git a/yume-mods/misskey-auto-deploy/src/lib.rs b/yume-mods/misskey-auto-deploy/src/lib.rs index d23c209f94..93f3ae5153 100644 --- a/yume-mods/misskey-auto-deploy/src/lib.rs +++ b/yume-mods/misskey-auto-deploy/src/lib.rs @@ -49,6 +49,7 @@ pub struct RefConfig { pub stdout: Option, pub stderr: Option, pub working_dir: PathBuf, + pub profiles: Option>, pub compose_flags: Option>, pub env: Option>, pub uid: u32, @@ -200,6 +201,17 @@ impl App { let mut command = Command::new("docker") .arg("compose") + .args( + matched_ref + .config + .profiles + .as_ref() + .map(|profiles| + profiles.iter() + .flat_map(|profiles| ["--profile", profiles.as_str()]) + .collect::>()) + .unwrap_or(Vec::new()), + ) .arg("up") .arg("--detach") .arg("--build") @@ -289,7 +301,7 @@ impl App { State(state): State, Query(query): Query, ) -> Result, ApiError> { - let ref_ = match (&query.ref_, &query.branch) { + let ref_ = match (query.ref_.as_ref(), query.branch.as_ref()) { (Some(ref_), None) => ref_.clone(), (None, Some(branch)) => format!("refs/heads/{}", branch), _ => {