131 lines
4.5 KiB
HTML
131 lines
4.5 KiB
HTML
|
<!doctype html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Mail4one Web config</title>
|
||
|
<script type="application/json" id="m41config">
|
||
|
{
|
||
|
"matches": [
|
||
|
{
|
||
|
"name": "mydomain",
|
||
|
"addr_rexs": [
|
||
|
".*@mydomain.com",
|
||
|
".*@m.mydomain.com"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "personal",
|
||
|
"addrs": [
|
||
|
"first.last@mydomain.com",
|
||
|
"secret.name@mydomain.com"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"boxes": [
|
||
|
{
|
||
|
"name": "spam",
|
||
|
"rules": [
|
||
|
{
|
||
|
"match_name": "mydomain",
|
||
|
"negate": true,
|
||
|
"stop_check": true
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "important",
|
||
|
"rules": [
|
||
|
{
|
||
|
"match_name": "personal"
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "all",
|
||
|
"rules": [
|
||
|
{
|
||
|
"match_name": "default_match_all"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"users": [
|
||
|
{
|
||
|
"username": "mymobile",
|
||
|
"password_hash": "AFTY5EVN7AX47ZL7UMH3BETYWFBTAV3XHR73CEFAJBPN2NIHPWDZHV2UQSMSPHSQQ2A2BFQBNC77VL7F2UKATQNJZGYLCSU6C43UQDAQXWXSWNGAEPGIMG2F3QDKBXL3MRHY6K2BPID64ZR6LABLPVSF",
|
||
|
"mbox": "important"
|
||
|
},
|
||
|
{
|
||
|
"username": "mydesk",
|
||
|
"password_hash": "AFTY5EVN7AX47ZL7UMH3BETYWFBTAV3XHR73CEFAJBPN2NIHPWDZHV2UQSMSPHSQQ2A2BFQBNC77VL7F2UKATQNJZGYLCSU6C43UQDAQXWXSWNGAEPGIMG2F3QDKBXL3MRHY6K2BPID64ZR6LABLPVSF",
|
||
|
"mbox": "all"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
</script>
|
||
|
<script type="application/javascript">
|
||
|
function main() {
|
||
|
console.log("hello world !!!")
|
||
|
var config = JSON.parse(document.getElementById('m41config').text);
|
||
|
matches_table = document.getElementById("web-cfg-matches")
|
||
|
console.log(matches_table)
|
||
|
for (match of config["matches"]) {
|
||
|
vals = []
|
||
|
matchType = ""
|
||
|
if ("addr_rexs" in match) {
|
||
|
vals = match["addr_rexs"]
|
||
|
matchType = "addr_rexs"
|
||
|
|
||
|
}else if ("addrs" in match) {
|
||
|
vals = match["addrs"]
|
||
|
matchType = "addrs"
|
||
|
}
|
||
|
row = matches_table.insertRow(-1)
|
||
|
name_cell = row.insertCell(-1)
|
||
|
name_cell.innerText = match["name"]
|
||
|
type_cell = row.insertCell(-1)
|
||
|
type_cell.innerText = matchType
|
||
|
value_cell = row.insertCell(-1)
|
||
|
value_cell.contentEditable = true
|
||
|
for (val of vals) {
|
||
|
const node = document.createElement("p");
|
||
|
const textnode = document.createTextNode(val);
|
||
|
node.appendChild(textnode);
|
||
|
value_cell.appendChild(node);
|
||
|
}
|
||
|
vt = value_cell.innerText
|
||
|
console.log(vt.split("\n"))
|
||
|
}
|
||
|
}
|
||
|
function addMatchRow() {
|
||
|
matches_table = document.getElementById("web-cfg-matches")
|
||
|
row_tmpl = document.getElementById("web-cfg-matches-row")
|
||
|
row_copy = row_tmpl.content.cloneNode(true)
|
||
|
tb = matches_table.tBodies[0]
|
||
|
tb.appendChild(row_copy)
|
||
|
}
|
||
|
</script>
|
||
|
</head>
|
||
|
<body onload="main()">
|
||
|
<template id="web-cfg-matches-row">
|
||
|
<tr>
|
||
|
<td>Name</td>
|
||
|
<td>Type</td>
|
||
|
<td>Values</td>
|
||
|
</tr>
|
||
|
</template>
|
||
|
<h1>Mail4one Web config</h1>
|
||
|
<table id="web-cfg-matches">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Name</th>
|
||
|
<th>Type</th>
|
||
|
<th>Values</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<button onClick="addMatchRow()">Add Match</button>
|
||
|
</body>
|
||
|
</html>
|