Skip to content

Commit

Permalink
try getfrom fetch; fetch logger, remove custom.js
Browse files Browse the repository at this point in the history
  • Loading branch information
dbauszus-glx committed Oct 19, 2023
1 parent 08e820a commit 886f295
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 36 deletions.
24 changes: 18 additions & 6 deletions mod/templates/_templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,28 @@ const cloudfront = require('../provider/cloudfront')

const file = require('../provider/file')

const logger = require('../utils/logger')

const getFrom = {
https: async ref => {
https: async url => {

try {

const response = await fetch(url)

const response = await fetch(ref)
logger(`${response.status} - ${url}`,'fetch')

if (ref.match(/\.json$/i)) {
return await response.json()
if (url.match(/\.json$/i)) {
return await response.json()
}

return await response.text()

} catch (err) {
console.error(err)
return;
}

return await response.text()

},
file: ref => file(ref.split(':')[1]),
cloudfront: ref => cloudfront(ref.split(':')[1]),
Expand Down
28 changes: 0 additions & 28 deletions mod/templates/custom.js

This file was deleted.

2 changes: 0 additions & 2 deletions mod/user/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ async function view(req, res, message) {
msg: message || ' '
})

//res.clearCookie(process.env.TITLE)

// Clear user token cookie.
res.setHeader('Set-Cookie', `${process.env.TITLE}=null;HttpOnly;Max-Age=0;Path=${process.env.DIR || '/'}`)

Expand Down

0 comments on commit 886f295

Please sign in to comment.