<script setup>
// Copyright 2024 FlexCDN root@flexcdn.cn. All rights reserved. Official site: https://flexcdn.cn .

import ctxRef from "@/utils/ctx_ref.js"
import Context from "./index.js"
import ServerSettingLayout from "@/layouts/ServerSettingLayout.vue";
import Menu from "./@menu.vue"
import OriginListBox from "@/components/server/OriginListBox.vue";
import WarningMessage from "@/components/common/WarningMessage.vue";

const ctx = ctxRef(new Context())

</script>

<template>
	<ServerSettingLayout :ctx="ctx">
		<Menu :ctx="ctx" active-tab="index"></Menu>

		<div v-if="!ctx.reverseProxyRef.isOn">
			<WarningMessage class="mt-0">当前CDN服务没有开启，可以通过点击 <a :href="'/servers/server/settings/reverseProxy/setting?serverId=' + ctx.serverId">[更多设置]</a> 开启 。</WarningMessage>
		</div>

		<OriginListBox :v-primary-origins="ctx.primaryOrigins" :v-backup-origins="ctx.backupOrigins"
					   :v-server-type="ctx.serverType"
					   :v-params="'type=server&serverId=' + ctx.serverId + '&reverseProxyId=' + ctx.reverseProxyConfig.id"></OriginListBox>
	</ServerSettingLayout>
</template>

<style lang="postcss" scoped>
</style>