added logging
This commit is contained in:
parent
451bd64751
commit
50500cded2
|
@ -55,6 +55,8 @@ async function handle_request(request, response) {
|
|||
var page_sigil
|
||||
var data = ""
|
||||
var available_sigils = fs.readdirSync(sigils_dir)
|
||||
|
||||
console.log(`Got request for "${target_url}"`)
|
||||
|
||||
await Promise.race([
|
||||
win.loadURL(target_url)
|
||||
|
@ -80,12 +82,14 @@ async function handle_request(request, response) {
|
|||
for (let sigil_name of available_sigils) {
|
||||
if (current_url.host === sigil_name) {
|
||||
page_sigil_name = sigil_name
|
||||
console.log(`Using sigil "${sigil_name}"`)
|
||||
break
|
||||
} else if (
|
||||
sigil_name[0] === "*"
|
||||
&& current_url.host.endsWith(sigil_name.replace("*.", ""))
|
||||
){
|
||||
page_sigil_name = sigil_name
|
||||
console.log(`Using sigil "${sigil_name}"`)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -114,8 +118,10 @@ async function handle_request(request, response) {
|
|||
|
||||
if (error) {
|
||||
response.data(error)
|
||||
console.log(`Error handling request for "${target_url}": ${error}`)
|
||||
} else {
|
||||
response.data(data, mimeType="text/gemini")
|
||||
console.log(`Handled request for "${target_url}"`)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,6 +132,6 @@ app.on('window-all-closed', () => {
|
|||
app.whenReady().then(() => {
|
||||
server.on("*", handle_request)
|
||||
server.listen(() => {
|
||||
console.log("listening on localhost:" + gemini_port)
|
||||
console.log(`listening on localhost:${gemini_port}`)
|
||||
}, gemini_port)
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue