microgen-client
Advanced tools
Comparing version 0.0.5 to 0.0.6
20
index.js
const http = require('http'); | ||
const url = 'http://localhost:3000'; | ||
const url = "https://admin.microgen.id"; | ||
@@ -57,6 +57,2 @@ const generate = () => { | ||
const middleware = ({ app, clientId }) => (req, res, next) => { | ||
if(app.get("microgen") == "unauthorized") { | ||
res.send({ message: "invalid hostname" }) | ||
return; | ||
} | ||
@@ -67,11 +63,16 @@ if(!clientId) { | ||
} | ||
const day = new Date().getDate(); | ||
if((app.get("microgen") !== "authorized")) { | ||
if(day !== app.get("microgen")) { | ||
console.log(day); | ||
console.log(app.get("microgen")); | ||
client(clientId) | ||
.then(res => { | ||
if(req.hostname.includes(res.hostname)) { | ||
app.set("microgen", "authorized") | ||
return; | ||
app.set("microgen", day); | ||
next(); | ||
} else { | ||
app.set("microgen", "unauthorized") | ||
res.send({ message: "invalid hostname" }) | ||
@@ -82,3 +83,2 @@ return; | ||
.catch(err => { | ||
app.set("microgen", "unauthorized") | ||
res.send({ message: "invalid hostname" }) | ||
@@ -85,0 +85,0 @@ return; |
{ | ||
"name": "microgen-client", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"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
2272
77