<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 CopyToClipboard from "@/components/common/CopyToClipboard.vue";
import DefinitionTable from "@/components/common/DefinitionTable.vue";

const ctx = ctxRef(new Context())

</script>

<template>
	<ServerSettingLayout :ctx="ctx">
		<DefinitionTable>
			<tbody>
			<tr>
				<td class="title">当前网站CNAME</td>
				<td>
					<span id="cname-text"><span v-if="ctx.dnsName.length > 0">{{ ctx.dnsName }}</span><span v-else>子域名</span>.<span v-if="ctx.dnsDomain.length > 0">{{ ctx.dnsDomain }}</span><span v-else>根域名</span></span> &nbsp;
					<CopyToClipboard :text="ctx.dnsName + '.' + ctx.dnsDomain"></CopyToClipboard>
					<p class="comment">你需要为你的每个<a :href="'/servers/server/settings/serverNames?serverId=' + ctx.serverId">网站域名</a>设置一个CNAME解析，值为上面内容。
					</p>
				</td>
			</tr>
			</tbody>
		</DefinitionTable>
	</ServerSettingLayout>
</template>

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