Commit 6fd59a84 authored by VCNguen's avatar VCNguen
Browse files

refresh 60s

parent 1309e616
......@@ -153,7 +153,6 @@ function changeToRussian() {
$(".btn_save").text("Сохранить");
$(".success").text("----- Успех ------");
$(".fail").text("Ошибка! Вводить толко IP-адрес!");
}
function disableBot() {
......@@ -262,21 +261,21 @@ function refreshPara() {
checked = "";
}
$(".bodyUser").append(`<tr>
<th class="disappear">${e[0]}</th>
<th class="disappear">${e[1]}</th>
<th>${e[2]}</th>
<th class="disappear">${e[3]}</th>
<th>
<input class="shorter" type="datetime-local" name="extime" value=${e[4]} max="2100-12-31" min="1970-01-01">
</th>
<th>
<input type="checkbox" value=${e[1]} name="chk" ${checked}>
<label class="send disappear" for="check_u">Send</label>
</th>
<th>
<input class="shorter" type="text" name="text" value=${e[6]}>
</th>
</tr>`);
<th class="disappear">${e[0]}</th>
<th class="disappear">${e[1]}</th>
<th>${e[2]}</th>
<th class="disappear">${e[3]}</th>
<th>
<input class="shorter" type="datetime-local" name="extime" value=${e[4]} max="2100-12-31" min="1970-01-01">
</th>
<th>
<input type="checkbox" value=${e[1]} name="chk" ${checked}>
<label class="send disappear" for="check_u">Send</label>
</th>
<th>
<input class="shorter" type="text" name="text" value=${e[6]}>
</th>
</tr>`);
});
// refresh data of the table Time
$(".timeCycle").html(
......@@ -348,42 +347,14 @@ function changepass() {
});
}
function verifyIP4(address) {
var ip4DecimalPattern =
"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))$";
var ip4HexPattern = "^(?:(?:0x[0-9a-f]{1,2}).){3}(?:0x[0-9a-f]{1,2})$";
var ip4OctalPattern =
"^(?:(?:03[1-7][0-7]|0[12][0-7]{1,2}|[0-7]{1,2}).){3}(?:03[1-7][0-7]|0[12][0-7]{1,2}|[0-7]{1,2})$";
var isIP4Decimal = (isIP4Hex = isIP4Octal = false);
var base = 10;
isIP4Decimal = address.match(ip4DecimalPattern) != null;
isIP4Hex = address.match(ip4HexPattern) != null;
isIP4Octal = address.match(ip4OctalPattern) != null;
if (isIP4Hex || isIP4Octal) {
if (isIP4Hex) {
base = 16;
} else if (isIP4Octal) {
base = 8;
}
return address
.split(".")
.map((num) => parseInt(num, base))
.join(".");
}
return false;
}
function parseIP(ip) {
if (
/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ip)
/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(
ip
)
) {
return true;
}
$(".success").css("display", "none");
$(".fail").css("display", "block");
return false;
}
......@@ -391,6 +362,8 @@ function changeip() {
// const dataSend = { ip: "192.168.1.1" };
const ip = $("#ipaddress_in").val();
if (parseIP(ip) == false) {
$(".success").css("display", "none");
$(".fail").css("display", "block");
// console.log('true',parseIP(ip))
return;
}
......@@ -424,4 +397,4 @@ function changeip() {
// tắt checkbox => tắt modal
}
refreshPara();
// setInterval(refreshPara, 10000); /* time in milliseconds (ie 2 seconds)*/
setInterval(refreshPara, 60000); /* time in milliseconds (ie 2 seconds)*/
......@@ -61,6 +61,7 @@ def refresh():
@app.route('/logout', methods=['GET'])
def getLogout():
session.pop('username')
session.pop('language')
return redirect(url_for('login'))
# --------------------------------------------------------------------------------------------------
......@@ -334,28 +335,6 @@ def getCameraPara():
)
return paraTable
# def getUserPara():
# sql1 = "SELECT user_id,time_create,user_name,permission,language,comment,expiration FROM alert_list;"
# rows1 = sqlselect(sql1)
# userTable.clear()
# if len(rows1) > 0:
# for i in range(len(rows1)):
# user_id = rows1[i][0]
# # to display datetime on webpage have to
# # change its format to "2020-10-09T22:10"
# # add letter 'T' between date and time
# # print("user data",rows1)
# var_time = str(rows1[i][6])
# var_time = var_time.replace(" ", "T")
# userTable[user_id] = {
# 'id': i,
# 'user_name': rows1[i][2],
# 'time_create': str(rows1[i][1]),
# 'expiration': var_time,
# 'permission': rows1[i][3],
# 'comment': rows1[i][5]
# }
# return userTable
def getUserPara():
sql1 = "SELECT user_id,time_create,user_name,permission,language,comment,expiration FROM alert_list;"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment