add authentication
This commit is contained in:
parent
97502e8e53
commit
65a238578e
7
app.js
7
app.js
@ -2,6 +2,7 @@ const got = require('got')
|
||||
fs = require('fs');
|
||||
var tableify = require('tableify');
|
||||
const express = require('express')
|
||||
const basicAuth = require('express-basic-auth')
|
||||
const app = express()
|
||||
const port = 6969
|
||||
|
||||
@ -65,6 +66,12 @@ function arrayToTable(array) {
|
||||
|
||||
async function server() {
|
||||
|
||||
app.use(basicAuth({
|
||||
users: { 'BBLBTV': 'BBLBTV' },
|
||||
challenge: true,
|
||||
realm: 'foo',
|
||||
}))
|
||||
|
||||
app.get('/', async (req, res) => {
|
||||
let t = await main(url)
|
||||
let html = await arrayToTable(t)
|
||||
|
16
package-lock.json
generated
16
package-lock.json
generated
@ -68,6 +68,14 @@
|
||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
||||
},
|
||||
"basic-auth": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
|
||||
"integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.2"
|
||||
}
|
||||
},
|
||||
"body-parser": {
|
||||
"version": "1.19.0",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
||||
@ -243,6 +251,14 @@
|
||||
"vary": "~1.1.2"
|
||||
}
|
||||
},
|
||||
"express-basic-auth": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/express-basic-auth/-/express-basic-auth-1.2.0.tgz",
|
||||
"integrity": "sha512-iJ0h1Gk6fZRrFmO7tP9nIbxwNgCUJASfNj5fb0Hy15lGtbqqsxpt7609+wq+0XlByZjXmC/rslWQtnuSTVRIcg==",
|
||||
"requires": {
|
||||
"basic-auth": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"finalhandler": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
|
||||
|
@ -10,6 +10,7 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"express": "^4.17.1",
|
||||
"express-basic-auth": "^1.2.0",
|
||||
"fs": "0.0.1-security",
|
||||
"got": "^11.8.1",
|
||||
"http": "0.0.1-security",
|
||||
|
Loading…
x
Reference in New Issue
Block a user