<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 ServerFeatureRequired from "@/components/server/ServerFeatureRequired.vue";
import SubmitButton from "@/components/form/SubmitButton.vue";
import PostForm from "@/components/form/PostForm.vue";
import HTTPFirewallConfigBox from "@/components/server/HTTPFirewallConfigBox.vue";

const ctx = ctxRef(new Context())

</script>

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

		<div v-if="ctx.featureIsOn">
			<PostForm action="$" @success="ctx.success">
				<input type="hidden" name="webId" :value="ctx.webId"/>
				<HTTPFirewallConfigBox :v-firewall-config="ctx.firewallConfig" :v-firewall-policy="ctx.firewallPolicy"></HTTPFirewallConfigBox>
				<SubmitButton></SubmitButton>
			</PostForm>
		</div>

		<div v-if="!ctx.featureIsOn">
			<ServerFeatureRequired></ServerFeatureRequired>
		</div>
	</ServerSettingLayout>
</template>

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