local command = require("luamods/command")
local layout = require("luamods/layout")

header = layout.getHeader()
footer = layout.getFooter()

log = command.ex("journalctl -n 100 -u \"openvpn@openvpn\"") or ""
status = command.ex("systemctl status \"openvpn@openvpn\"") or ""
routes = command.ex("ip route | grep tun 2>&1") or ""

content = [[
                    <div id="info">
                        <div style="background:url(images/openvpn.png); background-size:32px; background-repeat:no-repeat; background-position: 20px center;">
                            <center><h1>OpenVPN - Status</h1></center>
                        </div>
                    </div>
                    <h3>Service status:</h3>
                    <pre class="formLayoutfull" style="overflow: auto; height: 250px; border-radius: 0px;">
]]..status..[[
                    </pre>
                    <h3>Routing:</h3>
                    <pre class="formLayoutfull">
]]..routes..[[
                    </pre>
                    <h3>Log file (last 200 lines): </h3>
                    <pre class="formLayoutfull" style="overflow: auto; height: 400px; border-radius: 0px;">
                    <!-- log start -->
]]..log..[[
                    <!-- log end -->
                    </pre>
]]  

print(header..content..footer)
