{$layout}
{$template "../settings_menu"}
{$template "/left_menu_with_menu"}

<div class="right-box with-menu http-config-container">
	<div class="http-config-form">
		<div class="form-title">HTTP配置</div>
		
		<form method="post" class="ui form" data-tea-action="$" data-tea-success="success" id="http-config-form">
			<input type="hidden" name="serverId" :value="serverId"/>
			<input type="hidden" name="webId" :value="webId"/>
			<input type="hidden" name="serverType" :value="serverType"/>
			
			<div class="config-section">
				<div class="section-title">
					<i class="icon globe"></i>
					<span>基本设置</span>
				</div>
				
				<div class="config-item">
					<div class="item-label">启用HTTP</div>
					<div class="item-content">
						<p-switch name="isOn" value="1" v-model="httpConfig.isOn" binary @change="submit"></p-switch>
					</div>
				</div>
				<div class="config-item">
					<div class="item-label">HTTP端口</div>
					<div class="item-content">
						<p class="comment" v-if="httpConfig.isOn && (httpConfig.addresses == null || httpConfig.addresses.length == 0)">
							<span class="red">还没有添加端口绑定，会导致HTTP服务无法访问。</span>
						</p>
						<network-addresses-box :v-server-type="serverType" :v-addresses="httpConfig.addresses" :v-protocol="'http'"></network-addresses-box>
						<p class="comment" v-if="conflictingPorts.length > 0">
							<span class="red">配置错误：<span v-for="(port, index) in conflictingPorts">{{port}}<span v-if="index != conflictingPorts.length - 1">、</span></span><span v-if="conflictingPorts.length > 1">等</span>端口同HTTPS设置的端口冲突，请删除HTTP或HTTPS中的相关端口。</span>
						</p>
					</div>
				</div>
			</div>
			<div class="config-section" v-show="httpConfig.isOn">
				<div class="section-title">
					<i class="icon exchange"></i>
					<span>跳转设置</span>
				</div>
				
				<div class="config-item">
					<div class="item-label">自动跳转到HTTPS</div>
					<div class="item-content">
						<http-redirect-to-https-box :v-redirect-to-https-config="redirectToHTTPSConfig" @submit="submit"></http-redirect-to-https-box>
					</div>
				</div>
			</div>
			
			<div class="margin"></div>
			<submit-btn v-show="httpConfig.isOn"></submit-btn>
		</form>
	</div>
</div>