microgen-client
Advanced tools
Comparing version 0.0.7 to 0.0.9
46
index.js
@@ -59,20 +59,18 @@ const https = require('https'); | ||
if(!clientId) { | ||
res.send({ message: "invalid hostname" }) | ||
res.send("_") | ||
return; | ||
} | ||
const day = new Date().getDate(); | ||
const day = new Date().getDay(); | ||
if(day !== app.get("microgen")) { | ||
console.log(day); | ||
console.log(app.get("microgen")); | ||
client(clientId) | ||
.then(res => { | ||
if(req.hostname.includes(res.hostname)) { | ||
if(req.hostname.includes(res.domain)) { | ||
app.set("microgen", day); | ||
next(); | ||
} else { | ||
res.send({ message: "invalid hostname" }) | ||
res.send("_") | ||
return; | ||
@@ -82,3 +80,3 @@ } | ||
.catch(err => { | ||
res.send({ message: "invalid hostname" }) | ||
res.send("_") | ||
return; | ||
@@ -91,6 +89,38 @@ }) | ||
const frontendMiddleware = ({ app, clientId }) => (req, res, next) => { | ||
if(!clientId) { | ||
res.send("_") | ||
return; | ||
} | ||
const day = new Date().getDay(); | ||
if(day !== app.get("microgen")) { | ||
client(clientId) | ||
.then(res => { | ||
if(req.hostname == res.hostname ) { | ||
app.set("microgen", day); | ||
next(); | ||
} else { | ||
res.send("_") | ||
return; | ||
} | ||
}) | ||
.catch(err => { | ||
res.send("_") | ||
return; | ||
}) | ||
} else { | ||
next(); | ||
} | ||
} | ||
module.exports = { | ||
generate, | ||
middleware | ||
middleware, | ||
frontendMiddleware | ||
} | ||
{ | ||
"name": "microgen-client", | ||
"version": "0.0.7", | ||
"version": "0.0.9", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2647
101