add cross channel reply setting
This commit is contained in:
parent
b942dd73cd
commit
e788d84194
@ -312,6 +312,13 @@ async function loadChannels() {
|
||||
currentChannel = channelname
|
||||
socket.send(JSON.stringify({"id":"switchChannel","data":channelname}))
|
||||
main()
|
||||
|
||||
let settings = await(await fetch("/api/settings")).json()
|
||||
if(settings != "null") {
|
||||
if(settings.ACCR == false) {
|
||||
unreply()
|
||||
}
|
||||
}
|
||||
})
|
||||
tab.appendChild(channelp)
|
||||
}
|
||||
|
@ -139,3 +139,18 @@ async function changeUsername() {
|
||||
setuser()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function setAllowCCR() {
|
||||
const ACCR = document.getElementById("ACCR_checkbox").checked
|
||||
const settingname = "ACCR" //Allow Cross-Channel reply (see #22 )
|
||||
|
||||
let r = await(await post("/api/settings",{setting: settingname, value: ACCR})).json()
|
||||
|
||||
if(r.status == "error") {
|
||||
alert("Couldn't change setting")
|
||||
console.log(r.code)
|
||||
} else if(r.status == "success") {
|
||||
//changed setting
|
||||
}
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
const allowed_settings = { //"settingname":["validtypes"]
|
||||
"ACCR": ["boolean"]
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
"setup": function(router,con,server) {
|
||||
router.get("/api/settings",function(req,res) {
|
||||
@ -14,7 +18,7 @@ module.exports = {
|
||||
res.json({"error":"no setting to change"})
|
||||
return
|
||||
}
|
||||
if((typeof req.body.value) != "string") {
|
||||
if(!((typeof req.body.value) in allowed_settings[req.body.setting])) {
|
||||
res.json({"error":"no new setting value given"})
|
||||
return
|
||||
}
|
||||
|
@ -59,6 +59,9 @@
|
||||
<br>
|
||||
<span id="response_pw"></span>
|
||||
</div>
|
||||
<div>
|
||||
<input type="checkbox" id="ACCR_checkbox" onchange="setAllowCCR()"> Cross-Channel Reply <br>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
|
Loading…
x
Reference in New Issue
Block a user