This commit is contained in:
かっこかり 2025-10-01 23:05:55 +02:00 committed by GitHub
commit 897d94bf2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 36 additions and 4 deletions

View File

@ -20,6 +20,7 @@
- Enhance: 時刻計算のための基準値を一か所で管理するようにし、パフォーマンスを向上
- Fix: iOSで、デバイスがダークモードだと初回読み込み時にエラーになる問題を修正
- Fix: アクティビティウィジェットのグラフモードが動作しない問題を修正
- Fix: サーバー情報が非公開のサーバーで「サーバーメトリクス」ウィジェットが利用できる問題を修正
### Server
- Enhance: ユーザーIPを確実に取得できるために設定ファイルにFastifyOptions.trustProxyを追加しました

6
locales/index.d.ts vendored
View File

@ -9598,6 +9598,12 @@ export interface Locale extends ILocale {
*
*/
"serverMetric": string;
"_serverMetric": {
/**
*
*/
"notAvailable": string;
};
/**
* AiScriptコンソール
*/

View File

@ -2523,6 +2523,8 @@ _widgets:
onlineUsers: "オンラインユーザー"
jobQueue: "ジョブキュー"
serverMetric: "サーバーメトリクス"
_serverMetric:
notAvailable: "このサーバーではメトリクスが利用できません"
aiscript: "AiScriptコンソール"
aiscriptApp: "AiScript App"
aichan: "藍"

View File

@ -135,6 +135,7 @@ export class MetaEntityService {
noteSearchableScope: (this.config.meilisearch == null || this.config.meilisearch.scope !== 'local') ? 'global' : 'local',
maxFileSize: this.config.maxFileSize,
federation: this.meta.federation,
enableServerMachineStats: instance.enableServerMachineStats,
};
return packed;

View File

@ -310,6 +310,10 @@ export const packedMetaLiteSchema = {
enum: ['all', 'specified', 'none'],
optional: false, nullable: false,
},
enableServerMachineStats: {
type: 'boolean',
optional: false, nullable: false,
},
},
} as const;

View File

@ -68,11 +68,17 @@ const props = defineProps<{
}>();
const _widgetDefs = computed(() => {
let wd = widgetDefs;
if (instance.federation === 'none') {
return widgetDefs.filter(x => !federationWidgets.includes(x));
} else {
return widgetDefs;
wd = wd.filter(x => !federationWidgets.includes(x));
}
if (!instance.enableServerMachineStats) {
wd = wd.filter(x => x !== 'serverMetric');
}
return wd;
});
const _widgets = computed(() => props.widgets.filter(x => _widgetDefs.value.includes(x.name)));

View File

@ -10,7 +10,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #func="{ buttonStyleClass }"><button class="_button" :class="buttonStyleClass" @click="toggleView()"><i class="ti ti-selector"></i></button></template>
<div v-if="meta" data-cy-mkw-serverMetric class="mkw-serverMetric">
<XCpuMemory v-if="widgetProps.view === 0" :connection="connection" :meta="meta"/>
<div v-if="!instance.enableServerMachineStats" :class="$style.notAvailable">{{ i18n.ts._widgets._serverMetric.notAvailable }}</div>
<XCpuMemory v-else-if="widgetProps.view === 0" :connection="connection" :meta="meta"/>
<XNet v-else-if="widgetProps.view === 1" :connection="connection" :meta="meta"/>
<XCpu v-else-if="widgetProps.view === 2" :connection="connection" :meta="meta"/>
<XMemory v-else-if="widgetProps.view === 3" :connection="connection" :meta="meta"/>
@ -34,6 +35,7 @@ import type { FormWithDefault, GetFormResultType } from '@/utility/form.js';
import { misskeyApiGet } from '@/utility/misskey-api.js';
import { useStream } from '@/stream.js';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
const name = 'serverMetric';
@ -90,3 +92,12 @@ defineExpose<WidgetComponentExpose>({
id: props.widget ? props.widget.id : null,
});
</script>
<style module>
.notAvailable {
text-align: center;
padding: 32px 16px;
color: var(--text-muted);
font-size: 0.9em;
}
</style>

View File

@ -5449,6 +5449,7 @@ export type components = {
maxFileSize: number;
/** @enum {string} */
federation: 'all' | 'specified' | 'none';
enableServerMachineStats: boolean;
};
MetaDetailedOnly: {
features?: {