added ftp and auto update

This commit is contained in:
wt committed 2024-06-27 14:50:57 +07:00
1 parent cf4946d4e3
commit 0a87be4d59
12 files changed
+241 -76

No files matched your search

+4 -14
View File
@@ -1,14 +1,12 @@
const dnsenabled = document.querySelector('#dnsenable')
const setdnssettingsbutton = document.querySelector('#set_dns_settings')
const confirmdnsform = document.querySelector('.confirmdnsform')
const canceldnsbutton = document.querySelector('#canceldns')
const confirmdnsbutton = document.querySelector('#confirmdns')
const get_dns_enabled_status = () => {
fetch(routes.dns_status(), {
method: 'POST',
body: `{"token":"${localStorage.getItem("token")}"}`
}).then(res => res.json()).then(jsondata => {
console.log(jsondata)
if (jsondata.enabled === '1') {
dnsenabled.checked = true
// dnssettingbody.classList.add('active')
@@ -21,10 +19,10 @@ const get_dns_enabled_status = () => {
get_dns_enabled_status()
const set_dns_enabled_status = (status) => {
const set_dns_enabled_status = () => {
fetch(routes.dns_status_set(), {
method: 'POST',
body: `{"token":"${localStorage.getItem("token")}","enabled":"${status?1:0}"}`
body: `{"token":"${localStorage.getItem("token")}","enabled":"${dnsenabled.checked?1:0}"}`
}).then(res => res.json()).then(jsondata => {
if (jsondata.enabled === '1') {
dnsenabled.checked = true
@@ -37,13 +35,5 @@ const set_dns_enabled_status = (status) => {
}
setdnssettingsbutton.addEventListener('click', () =>{
confirmdnsform.classList.add('active')
})
canceldnsbutton.addEventListener('click', () => {
confirmdnsform.classList.remove('active')
})
confirmdnsbutton.addEventListener('click', () => {
set_dns_enabled_status(dnsenabled.checked)
confirmdnsform.classList.remove('active')
get_confirm_form("Confirm dns settings?", set_dns_enabled_status)
})