<%+header%>
<%
	local running = luci.sys.exec("pgrep -x /usr/bin/daed")
%>
<% if tonumber(running) ~= nil then %>
	<div class="cbi-map">
		<iframe id="daed" style="width: 100%; min-height: 780px; border: none; border-radius: .375rem;box-shadow: rgba(0, 0, 0, 0.75) 0px 0px 15px -5px;"></iframe>
	</div>
	<script type="text/javascript">
		var listenAddr = "<%=luci.model.uci.cursor():get_first("daed", "daed", "listen_addr")%>";
		var portRegex = /:(\d+)/;
		var match = listenAddr.match(portRegex);
		if (match && match[1]) {
			var port = match[1];
			// 使用提取到的端口号进行后续操作
			document.getElementById("daed").src = window.location.protocol + "//" + window.location.hostname + ":" + port;
		}
		document.getElementById("daed").height = document.documentElement.clientHeight;
		window.onresize = function(){
			document.getElementById("daed").height = document.documentElement.clientHeight;
		}
	</script>
<% else %>
	<style>.notrunning{text-align: center;} h1{font-size: 25px; color: #333; margin-bottom: 16px;} p{font-size: 18px; color: #666; margin-bottom: 24px;}</style>
	<div class="notrunning">
		<img src="data:image/png;base64,[encoded data, 77076 characters]" height="90px" />
		<h1><font color="color:red"><%:DAED is not running%></font></h1>
		<p><%:Please start the DAED service first and try again%></p>
    </div>
<% end -%>

<%+footer%>
