2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-04-22 15:29:33 +02:00
|
|
|
<template>
|
2022-06-20 10:38:49 +02:00
|
|
|
<MkStickyContainer>
|
2023-03-02 12:47:24 +01:00
|
|
|
<template #header><XHeader :tabs="headerTabs"/></template>
|
2023-05-19 13:52:15 +02:00
|
|
|
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
|
2022-06-20 10:38:49 +02:00
|
|
|
<FormSuspense :p="init">
|
2023-01-06 05:40:17 +01:00
|
|
|
<div class="_gaps_m">
|
2023-01-07 06:59:54 +01:00
|
|
|
<MkSwitch v-model="useObjectStorage">{{ i18n.ts.useObjectStorage }}</MkSwitch>
|
2022-06-20 10:38:49 +02:00
|
|
|
|
|
|
|
<template v-if="useObjectStorage">
|
2023-10-30 05:41:40 +01:00
|
|
|
<MkInput v-model="objectStorageBaseUrl" :placeholder="'https://example.com'" type="url">
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #label>{{ i18n.ts.objectStorageBaseUrl }}</template>
|
|
|
|
<template #caption>{{ i18n.ts.objectStorageBaseUrlDesc }}</template>
|
2023-01-07 07:09:46 +01:00
|
|
|
</MkInput>
|
2021-12-30 13:47:48 +01:00
|
|
|
|
2023-01-07 07:09:46 +01:00
|
|
|
<MkInput v-model="objectStorageBucket">
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #label>{{ i18n.ts.objectStorageBucket }}</template>
|
|
|
|
<template #caption>{{ i18n.ts.objectStorageBucketDesc }}</template>
|
2023-01-07 07:09:46 +01:00
|
|
|
</MkInput>
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-01-07 07:09:46 +01:00
|
|
|
<MkInput v-model="objectStoragePrefix">
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #label>{{ i18n.ts.objectStoragePrefix }}</template>
|
|
|
|
<template #caption>{{ i18n.ts.objectStoragePrefixDesc }}</template>
|
2023-01-07 07:09:46 +01:00
|
|
|
</MkInput>
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-04-03 05:47:30 +02:00
|
|
|
<MkInput v-model="objectStorageEndpoint" :placeholder="'example.com'">
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #label>{{ i18n.ts.objectStorageEndpoint }}</template>
|
2023-04-03 05:47:30 +02:00
|
|
|
<template #prefix>https://</template>
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #caption>{{ i18n.ts.objectStorageEndpointDesc }}</template>
|
2023-01-07 07:09:46 +01:00
|
|
|
</MkInput>
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-01-07 07:09:46 +01:00
|
|
|
<MkInput v-model="objectStorageRegion">
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #label>{{ i18n.ts.objectStorageRegion }}</template>
|
|
|
|
<template #caption>{{ i18n.ts.objectStorageRegionDesc }}</template>
|
2023-01-07 07:09:46 +01:00
|
|
|
</MkInput>
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-05-19 13:52:15 +02:00
|
|
|
<FormSplit :minWidth="280">
|
2023-01-07 07:09:46 +01:00
|
|
|
<MkInput v-model="objectStorageAccessKey">
|
2022-12-19 11:01:30 +01:00
|
|
|
<template #prefix><i class="ti ti-key"></i></template>
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #label>Access key</template>
|
2023-01-07 07:09:46 +01:00
|
|
|
</MkInput>
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-01-23 08:08:09 +01:00
|
|
|
<MkInput v-model="objectStorageSecretKey" type="password">
|
2022-12-19 11:01:30 +01:00
|
|
|
<template #prefix><i class="ti ti-key"></i></template>
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #label>Secret key</template>
|
2023-01-07 07:09:46 +01:00
|
|
|
</MkInput>
|
2022-06-20 10:38:49 +02:00
|
|
|
</FormSplit>
|
|
|
|
|
2023-01-07 06:59:54 +01:00
|
|
|
<MkSwitch v-model="objectStorageUseSSL">
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #label>{{ i18n.ts.objectStorageUseSSL }}</template>
|
|
|
|
<template #caption>{{ i18n.ts.objectStorageUseSSLDesc }}</template>
|
2023-01-07 06:59:54 +01:00
|
|
|
</MkSwitch>
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-01-07 06:59:54 +01:00
|
|
|
<MkSwitch v-model="objectStorageUseProxy">
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #label>{{ i18n.ts.objectStorageUseProxy }}</template>
|
|
|
|
<template #caption>{{ i18n.ts.objectStorageUseProxyDesc }}</template>
|
2023-01-07 06:59:54 +01:00
|
|
|
</MkSwitch>
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-01-07 06:59:54 +01:00
|
|
|
<MkSwitch v-model="objectStorageSetPublicRead">
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #label>{{ i18n.ts.objectStorageSetPublicRead }}</template>
|
2023-01-07 06:59:54 +01:00
|
|
|
</MkSwitch>
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-01-07 06:59:54 +01:00
|
|
|
<MkSwitch v-model="objectStorageS3ForcePathStyle">
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #label>s3ForcePathStyle</template>
|
2023-04-03 05:47:30 +02:00
|
|
|
<template #caption>{{ i18n.ts.s3ForcePathStyleDesc }}</template>
|
2023-01-07 06:59:54 +01:00
|
|
|
</MkSwitch>
|
2022-06-20 10:38:49 +02:00
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</FormSuspense>
|
|
|
|
</MkSpacer>
|
2023-03-02 12:47:24 +01:00
|
|
|
<template #footer>
|
|
|
|
<div :class="$style.footer">
|
2023-05-19 13:52:15 +02:00
|
|
|
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="16">
|
2023-03-02 12:47:24 +01:00
|
|
|
<MkButton primary rounded @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
|
|
|
|
</MkSpacer>
|
|
|
|
</div>
|
|
|
|
</template>
|
2022-06-20 10:38:49 +02:00
|
|
|
</MkStickyContainer>
|
2021-04-22 15:29:33 +02:00
|
|
|
</template>
|
|
|
|
|
2022-05-17 18:31:32 +02:00
|
|
|
<script lang="ts" setup>
|
2023-12-07 06:42:09 +01:00
|
|
|
import { ref, computed } from 'vue';
|
2022-06-20 10:38:49 +02:00
|
|
|
import XHeader from './_header_.vue';
|
2023-01-07 06:59:54 +01:00
|
|
|
import MkSwitch from '@/components/MkSwitch.vue';
|
2023-01-07 07:09:46 +01:00
|
|
|
import MkInput from '@/components/MkInput.vue';
|
2021-12-30 13:47:48 +01:00
|
|
|
import FormSuspense from '@/components/form/suspense.vue';
|
|
|
|
import FormSplit from '@/components/form/split.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { fetchInstance } from '@/instance.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
2023-03-02 12:47:24 +01:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2022-05-17 18:31:32 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const useObjectStorage = ref<boolean>(false);
|
|
|
|
const objectStorageBaseUrl = ref<string | null>(null);
|
|
|
|
const objectStorageBucket = ref<string | null>(null);
|
|
|
|
const objectStoragePrefix = ref<string | null>(null);
|
|
|
|
const objectStorageEndpoint = ref<string | null>(null);
|
|
|
|
const objectStorageRegion = ref<string | null>(null);
|
|
|
|
const objectStoragePort = ref<number | null>(null);
|
|
|
|
const objectStorageAccessKey = ref<string | null>(null);
|
|
|
|
const objectStorageSecretKey = ref<string | null>(null);
|
|
|
|
const objectStorageUseSSL = ref<boolean>(false);
|
|
|
|
const objectStorageUseProxy = ref<boolean>(false);
|
|
|
|
const objectStorageSetPublicRead = ref<boolean>(false);
|
|
|
|
const objectStorageS3ForcePathStyle = ref<boolean>(true);
|
2022-05-17 18:31:32 +02:00
|
|
|
|
|
|
|
async function init() {
|
|
|
|
const meta = await os.api('admin/meta');
|
2023-12-07 06:42:09 +01:00
|
|
|
useObjectStorage.value = meta.useObjectStorage;
|
|
|
|
objectStorageBaseUrl.value = meta.objectStorageBaseUrl;
|
|
|
|
objectStorageBucket.value = meta.objectStorageBucket;
|
|
|
|
objectStoragePrefix.value = meta.objectStoragePrefix;
|
|
|
|
objectStorageEndpoint.value = meta.objectStorageEndpoint;
|
|
|
|
objectStorageRegion.value = meta.objectStorageRegion;
|
|
|
|
objectStoragePort.value = meta.objectStoragePort;
|
|
|
|
objectStorageAccessKey.value = meta.objectStorageAccessKey;
|
|
|
|
objectStorageSecretKey.value = meta.objectStorageSecretKey;
|
|
|
|
objectStorageUseSSL.value = meta.objectStorageUseSSL;
|
|
|
|
objectStorageUseProxy.value = meta.objectStorageUseProxy;
|
|
|
|
objectStorageSetPublicRead.value = meta.objectStorageSetPublicRead;
|
|
|
|
objectStorageS3ForcePathStyle.value = meta.objectStorageS3ForcePathStyle;
|
2022-05-17 18:31:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function save() {
|
|
|
|
os.apiWithDialog('admin/update-meta', {
|
2023-12-07 06:42:09 +01:00
|
|
|
useObjectStorage: useObjectStorage.value,
|
|
|
|
objectStorageBaseUrl: objectStorageBaseUrl.value,
|
|
|
|
objectStorageBucket: objectStorageBucket.value,
|
|
|
|
objectStoragePrefix: objectStoragePrefix.value,
|
|
|
|
objectStorageEndpoint: objectStorageEndpoint.value,
|
|
|
|
objectStorageRegion: objectStorageRegion.value,
|
|
|
|
objectStoragePort: objectStoragePort.value,
|
|
|
|
objectStorageAccessKey: objectStorageAccessKey.value,
|
|
|
|
objectStorageSecretKey: objectStorageSecretKey.value,
|
|
|
|
objectStorageUseSSL: objectStorageUseSSL.value,
|
|
|
|
objectStorageUseProxy: objectStorageUseProxy.value,
|
|
|
|
objectStorageSetPublicRead: objectStorageSetPublicRead.value,
|
|
|
|
objectStorageS3ForcePathStyle: objectStorageS3ForcePathStyle.value,
|
2022-05-17 18:31:32 +02:00
|
|
|
}).then(() => {
|
|
|
|
fetchInstance();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const headerTabs = computed(() => []);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.objectStorage,
|
2022-12-19 11:01:30 +01:00
|
|
|
icon: 'ti ti-cloud',
|
2021-04-22 15:29:33 +02:00
|
|
|
});
|
|
|
|
</script>
|
2023-03-02 12:47:24 +01:00
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.footer {
|
|
|
|
-webkit-backdrop-filter: var(--blur, blur(15px));
|
|
|
|
backdrop-filter: var(--blur, blur(15px));
|
|
|
|
}
|
|
|
|
</style>
|