mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-27 04:17:51 -07:00
Add secure mode settings to Security tab
This commit is contained in:
parent
cdd9977c43
commit
b0d669833d
4 changed files with 82 additions and 0 deletions
|
@ -780,6 +780,13 @@ middle: "中"
|
||||||
low: "低"
|
low: "低"
|
||||||
emailNotConfiguredWarning: "メールアドレスの設定がされていません。"
|
emailNotConfiguredWarning: "メールアドレスの設定がされていません。"
|
||||||
ratio: "比率"
|
ratio: "比率"
|
||||||
|
secureMode: "セキュアモード (Authorized Fetch)"
|
||||||
|
instanceSecurity: "インスタンスのセキュリティー"
|
||||||
|
secureModeInfo: "他のインスタンスからリクエストするときに、証明を付けなければ返送しません。他のインスタンスの設定ファイルでsignToActivityPubGetはtrueにしてください。"
|
||||||
|
privateMode: "非公開モード"
|
||||||
|
privateModeInfo: "有効にして、許可されているインスタンスのみがリクエストできます。すべてのノートが公開に非表示にします。"
|
||||||
|
allowedInstances: "許可されたインスタンス"
|
||||||
|
allowedInstancesDescription: "許可したいインスタンスのホストを改行で区切って設定します。非公開モードだけで有効です。"
|
||||||
previewNoteText: "本文をプレビュー"
|
previewNoteText: "本文をプレビュー"
|
||||||
customCss: "カスタムCSS"
|
customCss: "カスタムCSS"
|
||||||
customCssWarn: "この設定は必ず知識のある方が行ってください。不適切な設定を行うとクライアントが正常に使用できなくなる恐れがあります。"
|
customCssWarn: "この設定は必ず知識のある方が行ってください。不適切な設定を行うとクライアントが正常に使用できなくなる恐れがあります。"
|
||||||
|
|
|
@ -187,6 +187,22 @@ export const meta = {
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
allowedHosts: {
|
||||||
|
type: 'array',
|
||||||
|
optional: true, nullable: false,
|
||||||
|
items: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
privateMode: {
|
||||||
|
type: 'boolean',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
|
secureMode: {
|
||||||
|
type: 'boolean',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
hcaptchaSecretKey: {
|
hcaptchaSecretKey: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: true, nullable: true,
|
optional: true, nullable: true,
|
||||||
|
@ -388,6 +404,9 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||||
pinnedUsers: instance.pinnedUsers,
|
pinnedUsers: instance.pinnedUsers,
|
||||||
hiddenTags: instance.hiddenTags,
|
hiddenTags: instance.hiddenTags,
|
||||||
blockedHosts: instance.blockedHosts,
|
blockedHosts: instance.blockedHosts,
|
||||||
|
allowedHosts: instance.allowedHosts,
|
||||||
|
privateMode: instance.privateMode,
|
||||||
|
secureMode: instance.secureMode,
|
||||||
hcaptchaSecretKey: instance.hcaptchaSecretKey,
|
hcaptchaSecretKey: instance.hcaptchaSecretKey,
|
||||||
recaptchaSecretKey: instance.recaptchaSecretKey,
|
recaptchaSecretKey: instance.recaptchaSecretKey,
|
||||||
sensitiveMediaDetection: instance.sensitiveMediaDetection,
|
sensitiveMediaDetection: instance.sensitiveMediaDetection,
|
||||||
|
|
|
@ -27,6 +27,11 @@ export const paramDef = {
|
||||||
blockedHosts: { type: 'array', nullable: true, items: {
|
blockedHosts: { type: 'array', nullable: true, items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
} },
|
} },
|
||||||
|
allowedHosts: { type: 'array', nullable: true, items: {
|
||||||
|
type: 'string',
|
||||||
|
} },
|
||||||
|
secureMode: { type: 'boolean', nullable: true },
|
||||||
|
privateMode: { type: 'boolean', nullable: true },
|
||||||
themeColor: { type: 'string', nullable: true, pattern: '^#[0-9a-fA-F]{6}$' },
|
themeColor: { type: 'string', nullable: true, pattern: '^#[0-9a-fA-F]{6}$' },
|
||||||
mascotImageUrl: { type: 'string', nullable: true },
|
mascotImageUrl: { type: 'string', nullable: true },
|
||||||
bannerUrl: { type: 'string', nullable: true },
|
bannerUrl: { type: 'string', nullable: true },
|
||||||
|
@ -142,6 +147,18 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||||
set.themeColor = ps.themeColor;
|
set.themeColor = ps.themeColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(ps.allowedHosts)) {
|
||||||
|
set.allowedHosts = ps.allowedHosts.filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof ps.privateMode === 'boolean') {
|
||||||
|
set.privateMode = ps.privateMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof ps.secureMode === 'boolean') {
|
||||||
|
set.secureMode = ps.secureMode;
|
||||||
|
}
|
||||||
|
|
||||||
if (ps.mascotImageUrl !== undefined) {
|
if (ps.mascotImageUrl !== undefined) {
|
||||||
set.mascotImageUrl = ps.mascotImageUrl;
|
set.mascotImageUrl = ps.mascotImageUrl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,26 @@
|
||||||
<FormButton primary class="_formBlock" @click="save"><i class="fas fa-save"></i> {{ i18n.ts.save }}</FormButton>
|
<FormButton primary class="_formBlock" @click="save"><i class="fas fa-save"></i> {{ i18n.ts.save }}</FormButton>
|
||||||
</div>
|
</div>
|
||||||
</FormFolder>
|
</FormFolder>
|
||||||
|
|
||||||
|
<FormFolder class="_formBlock">
|
||||||
|
<template #label>{{ i18n.ts.instanceSecurity }}</template>
|
||||||
|
|
||||||
|
<div class="_formRoot">
|
||||||
|
<FormSwitch v-if="!privateMode" v-model="secureMode">
|
||||||
|
<template #label>{{ i18n.ts.secureMode }}</template>
|
||||||
|
<template #caption>{{ i18n.ts.secureModeInfo }}</template>
|
||||||
|
</FormSwitch>
|
||||||
|
<FormSwitch v-model="privateMode">
|
||||||
|
<template #label>{{ i18n.ts.privateMode }}</template>
|
||||||
|
<template #caption>{{ i18n.ts.privateModeInfo }}</template>
|
||||||
|
</FormSwitch>
|
||||||
|
<FormTextarea v-if="privateMode" v-model="allowedHosts">
|
||||||
|
<template #label>{{ i18n.ts.allowedInstances }}</template>
|
||||||
|
<template #caption>{{ i18n.ts.allowedInstancesDescription }}</template>
|
||||||
|
</FormTextarea>
|
||||||
|
<FormButton primary class="_formBlock" @click="saveInstance"><i class="fas fa-save"></i> {{ i18n.ts.save }}</FormButton>
|
||||||
|
</div>
|
||||||
|
</FormFolder>
|
||||||
</div>
|
</div>
|
||||||
</FormSuspense>
|
</FormSuspense>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
|
@ -112,6 +132,7 @@ import FormSuspense from '@/components/form/suspense.vue';
|
||||||
import FormRange from '@/components/form/range.vue';
|
import FormRange from '@/components/form/range.vue';
|
||||||
import FormInput from '@/components/form/input.vue';
|
import FormInput from '@/components/form/input.vue';
|
||||||
import FormButton from '@/components/MkButton.vue';
|
import FormButton from '@/components/MkButton.vue';
|
||||||
|
import FormTextarea from '@/components/form/textarea.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { fetchInstance } from '@/instance';
|
import { fetchInstance } from '@/instance';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
|
@ -127,6 +148,10 @@ let enableSensitiveMediaDetectionForVideos: boolean = $ref(false);
|
||||||
let enableIpLogging: boolean = $ref(false);
|
let enableIpLogging: boolean = $ref(false);
|
||||||
let enableActiveEmailValidation: boolean = $ref(false);
|
let enableActiveEmailValidation: boolean = $ref(false);
|
||||||
|
|
||||||
|
let secureMode: boolean = $ref(false);
|
||||||
|
let privateMode: boolean = $ref(false);
|
||||||
|
let allowedHosts: string = $ref('');
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
const meta = await os.api('admin/meta');
|
const meta = await os.api('admin/meta');
|
||||||
summalyProxy = meta.summalyProxy;
|
summalyProxy = meta.summalyProxy;
|
||||||
|
@ -143,6 +168,10 @@ async function init() {
|
||||||
enableSensitiveMediaDetectionForVideos = meta.enableSensitiveMediaDetectionForVideos;
|
enableSensitiveMediaDetectionForVideos = meta.enableSensitiveMediaDetectionForVideos;
|
||||||
enableIpLogging = meta.enableIpLogging;
|
enableIpLogging = meta.enableIpLogging;
|
||||||
enableActiveEmailValidation = meta.enableActiveEmailValidation;
|
enableActiveEmailValidation = meta.enableActiveEmailValidation;
|
||||||
|
|
||||||
|
secureMode = meta.secureMode;
|
||||||
|
privateMode = meta.privateMode;
|
||||||
|
allowedHosts = meta.allowedHosts.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
@ -165,6 +194,16 @@ function save() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function saveInstance() {
|
||||||
|
os.apiWithDialog('admin/update-meta', {
|
||||||
|
secureMode,
|
||||||
|
privateMode,
|
||||||
|
allowedHosts: allowedHosts.split('\n'),
|
||||||
|
}).then(() => {
|
||||||
|
fetchInstance();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const headerActions = $computed(() => []);
|
const headerActions = $computed(() => []);
|
||||||
|
|
||||||
const headerTabs = $computed(() => []);
|
const headerTabs = $computed(() => []);
|
||||||
|
|
Loading…
Reference in a new issue