openrouter and auth_service filtering in syslog
This commit is contained in:
@@ -151,6 +151,7 @@
|
||||
<div class="syslogheader">
|
||||
<h2 class="syslogheader">Syslog</h2>
|
||||
<button id="openrouterfilter">openrouter</button>
|
||||
<button id="authservicefilter">auth_service</button>
|
||||
<button id="refreshbutton">↺</button>
|
||||
</div>
|
||||
<div class="syslogdata"></div>
|
||||
|
||||
+42
-10
@@ -1,8 +1,10 @@
|
||||
const syslogdata = document.querySelector('.syslogdata')
|
||||
const refreshbutton = document.querySelector('#refreshbutton')
|
||||
const openrouterfilter = document.querySelector('#openrouterfilter')
|
||||
const authservicefilter = document.querySelector('#authservicefilter')
|
||||
|
||||
let openrouterfilterenable = false
|
||||
let authservicefilerenable = false
|
||||
|
||||
const get_syslog_data = () => {
|
||||
console.log("get_syslog_data")
|
||||
@@ -11,16 +13,11 @@ const get_syslog_data = () => {
|
||||
// body: `{"token":"${localStorage.getItem("token")}"}`
|
||||
}).then(data => data.text()).then(textdata => {
|
||||
if (openrouterfilterenable) {
|
||||
let syslogalldata = textdata.replace(/\n/g,'<br>')
|
||||
syslogalldata = syslogalldata.split("<br>")
|
||||
syslogalldata = syslogalldata.filter(data => {
|
||||
return data.includes("openrouter:")
|
||||
})
|
||||
console.log(syslogalldata)
|
||||
syslogdata.innerHTML = ""
|
||||
for (const data in syslogalldata) {
|
||||
syslogdata.innerHTML += syslogalldata[data] + "<br>"
|
||||
}
|
||||
openrouterfilterfunc(textdata)
|
||||
return
|
||||
}
|
||||
if (authservicefilerenable) {
|
||||
authservicefilterfunc(textdata)
|
||||
return
|
||||
}
|
||||
syslogdata.innerHTML = textdata.replace(/\n/g,'<br>')
|
||||
@@ -31,6 +28,7 @@ const get_syslog_data = () => {
|
||||
|
||||
refreshbutton.addEventListener('click', () => {
|
||||
openrouterfilterenable = false
|
||||
authservicefilerenable = false
|
||||
get_syslog_data()
|
||||
})
|
||||
|
||||
@@ -38,3 +36,37 @@ openrouterfilter.addEventListener('click', () => {
|
||||
openrouterfilterenable = true
|
||||
get_syslog_data()
|
||||
})
|
||||
|
||||
authservicefilter.addEventListener('click', () => {
|
||||
authservicefilerenable = true
|
||||
openrouterfilterenable = false
|
||||
get_syslog_data()
|
||||
})
|
||||
|
||||
const openrouterfilterfunc = (textdata) => {
|
||||
let syslogalldata = textdata.replace(/\n/g,'<br>')
|
||||
syslogalldata = syslogalldata.split("<br>")
|
||||
syslogalldata = syslogalldata.filter(data => {
|
||||
return data.includes("openrouter:")
|
||||
})
|
||||
console.log(syslogalldata)
|
||||
syslogdata.innerHTML = ""
|
||||
for (const data in syslogalldata) {
|
||||
syslogdata.innerHTML += syslogalldata[data] + "<br>"
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
const authservicefilterfunc = (textdata) => {
|
||||
let syslogalldata = textdata.replace(/\n/g,'<br>')
|
||||
syslogalldata = syslogalldata.split("<br>")
|
||||
syslogalldata = syslogalldata.filter(data => {
|
||||
return data.includes("auth_service:")
|
||||
})
|
||||
console.log(syslogalldata)
|
||||
syslogdata.innerHTML = ""
|
||||
for (const data in syslogalldata) {
|
||||
syslogdata.innerHTML += syslogalldata[data] + "<br>"
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user