Skip to content

Commit

Permalink
Update dependencies (#1454)
Browse files Browse the repository at this point in the history
* Update dependencies

* npm install

* npx npm-check-updates -u && npm install

* standard --fix

* globals in auth-buttons.js

* Suppress some lint warnings

* disable some more lint rules

* disable some more lint rules

* npm run standard passing

* adapt to new sinon api

* Fix http-proxy-middleware api change

* downgrade bootstrap to get fonts back

* all bar one integration test passing again

* investigating cors-proxy-test

* adapt to nock

* [email protected]

* 3 JSON-LD related tests failing in mashlib-dev now

* remove rp client key

* remove rp client key for bob

* remove more client keys from test resources

* client keys generated by npm test

* use mashlib/dist/databrowser.html

* npm install

* update published packages

* solid-auth-cli is now a peerDependency of rdflib :/

* npm install --save-dev  @solid/[email protected]

* update

* solid-auth-cli is being moved from dependencies to devDependencies

* npm install --save-dev @solid/[email protected]
  • Loading branch information
michielbdejong authored Jul 30, 2020
1 parent 40544b2 commit 0542fa2
Show file tree
Hide file tree
Showing 117 changed files with 5,291 additions and 6,057 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
sudo: false
language: node_js
node_js:
- "8"
- "10"
- "lts/*"
- "node"
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ also add to `config.json`
```

### Upgrading from version <5.3
Make sure you're running Node version 10 or later.
Please take into account the [v5.3 upgrade notes](https://github.com/solid/node-solid-server/blob/master/CHANGELOG.md#530-upgrade-notes).

### Upgrading from version <5.0
Expand Down
4 changes: 2 additions & 2 deletions bin/lib/cli-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function loadConfig (program, options) {
...options,
version: program.version()
}
let configFile = argv['configFile'] || './config.json'
const configFile = argv.configFile || './config.json'

try {
const file = fs.readFileSync(configFile)
Expand All @@ -42,7 +42,7 @@ function loadConfig (program, options) {
argv = { ...config, ...argv }
} catch (err) {
// If config file was specified, but it doesn't exist, stop with error message
if (typeof argv['configFile'] !== 'undefined') {
if (typeof argv.configFile !== 'undefined') {
if (!fs.existsSync(configFile)) {
console.log(red(bold('ERR')), 'Config file ' + configFile + ' doesn\'t exist.')
process.exit(1)
Expand Down
1 change: 0 additions & 1 deletion bin/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ function getVersion () {
return version
}
}

2 changes: 1 addition & 1 deletion bin/lib/migrateLegacyResources.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = function (program) {
.action(async (opts) => {
const verbose = opts.verbose
const suffix = opts.suffix || '$.ttl'
let paths = opts.path ? [ opts.path ] : [ 'data', 'config/templates' ]
let paths = opts.path ? [opts.path] : ['data', 'config/templates']
paths = paths.map(path => path.startsWith(Path.sep) ? path : Path.join(process.cwd(), path))
try {
for (const path of paths) {
Expand Down
4 changes: 2 additions & 2 deletions bin/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ module.exports = [
if (!value.match(/^[0-9]+(,[0-9]+)*$/)) {
return 'direct-port(s) must be a comma-separated list of integers.'
}
let list = value.split(/,/).map(v => parseInt(v))
let bad = list.find(v => { return v < 1 || v > 65535 })
const list = value.split(/,/).map(v => parseInt(v))
const bad = list.find(v => { return v < 1 || v > 65535 })
if (bad.length) {
return 'redirect-http-from port(s) ' + bad + ' out of range'
}
Expand Down
16 changes: 8 additions & 8 deletions bin/lib/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ module.exports = function (program, server) {
function bin (argv, server) {
if (!argv.email) {
argv.email = {
host: argv['emailHost'],
port: argv['emailPort'],
host: argv.emailHost,
port: argv.emailPort,
secure: true,
auth: {
user: argv['emailAuthUser'],
pass: argv['emailAuthPass']
user: argv.emailAuthUser,
pass: argv.emailAuthPass
}
}
delete argv['emailHost']
delete argv['emailPort']
delete argv['emailAuthUser']
delete argv['emailAuthPass']
delete argv.emailHost
delete argv.emailPort
delete argv.emailAuthUser
delete argv.emailAuthPass
}

if (!argv.tokenTypesSupported) {
Expand Down
3 changes: 2 additions & 1 deletion common/js/auth-buttons.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global location, alert, solid */
/* Provide functionality for authentication buttons */

(({ auth }) => {
Expand Down Expand Up @@ -41,7 +42,7 @@
const session = await auth.popupLogin()
if (session) {
// Make authenticated request to the server to establish a session cookie
const {status} = await auth.fetch(location, { method: 'HEAD' })
const { status } = await auth.fetch(location, { method: 'HEAD' })
if (status === 401) {
alert(`Invalid login.\n\nDid you set ${session.idp} as your OIDC provider in your profile ${session.webId}?`)
await auth.logout()
Expand Down
20 changes: 10 additions & 10 deletions common/js/solid.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@

// Add the errors in the stack to the DOM
this.errors.map((error) => {
let text = document.createTextNode(error)
let paragraph = document.createElement('p')
const text = document.createTextNode(error)
const paragraph = document.createElement('p')
paragraph.appendChild(text)
this.passwordHelpText.appendChild(paragraph)
})
Expand Down Expand Up @@ -419,29 +419,29 @@
* @returns {string[]}
*/
PasswordValidator.prototype.tokenize = function () {
let tokenArray = []
for (let i in arguments) {
const tokenArray = []
for (const i in arguments) {
tokenArray.push(arguments[i])
}
return tokenArray.join(' ').split(' ')
}

PasswordValidator.prototype.sha1 = function (str) {
let buffer = new TextEncoder('utf-8').encode(str)
const buffer = new TextEncoder('utf-8').encode(str)

return crypto.subtle.digest('SHA-1', buffer).then((hash) => {
return this.hex(hash)
})
}

PasswordValidator.prototype.hex = function (buffer) {
let hexCodes = []
let view = new DataView(buffer)
const hexCodes = []
const view = new DataView(buffer)
for (let i = 0; i < view.byteLength; i += 4) {
let value = view.getUint32(i)
let stringValue = value.toString(16)
const value = view.getUint32(i)
const stringValue = value.toString(16)
const padding = '00000000'
let paddedValue = (padding + stringValue).slice(-padding.length)
const paddedValue = (padding + stringValue).slice(-padding.length)
hexCodes.push(paddedValue)
}
return hexCodes.join('')
Expand Down
24 changes: 12 additions & 12 deletions config/defaults.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
'use strict'

module.exports = {
'auth': 'oidc',
'localAuth': {
'tls': true,
'password': true
auth: 'oidc',
localAuth: {
tls: true,
password: true
},
'configPath': './config',
'dbPath': './.db',
'port': 8443,
'serverUri': 'https://localhost:8443',
'webid': true,
'strictOrigin': true,
'trustedOrigins': [],
'dataBrowserPath': 'default'
configPath: './config',
dbPath: './.db',
port: 8443,
serverUri: 'https://localhost:8443',
webid: true,
strictOrigin: true,
trustedOrigins: [],
dataBrowserPath: 'default'

// For use in Enterprises to configure a HTTP proxy for all outbound HTTP requests from the SOLID server (we use
// https://www.npmjs.com/package/global-tunnel-ng).
Expand Down
7 changes: 4 additions & 3 deletions lib/acl-checker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict'
/* eslint-disable node/no-deprecated-api */

const rdf = require('rdflib')
const debug = require('./debug').ACL
Expand Down Expand Up @@ -139,7 +140,7 @@ class ACLChecker {
// Gets all possible ACL paths that apply to the resource
getPossibleACLs () {
// Obtain the resource URI and the length of its base
let { resource: uri, suffix } = this
const { resource: uri, suffix } = this
const [{ length: base }] = uri.match(/^[^:]+:\/*[^/]+/)

// If the URI points to a file, append the file's ACL
Expand Down Expand Up @@ -174,7 +175,7 @@ class ACLChecker {
suffix: ldp.suffixAcl,
strictOrigin: ldp.strictOrigin,
trustedOrigins,
slug: decodeURIComponent(req.headers['slug'])
slug: decodeURIComponent(req.headers.slug)
})
}
}
Expand All @@ -200,7 +201,7 @@ function fetchLocalOrRemote (mapper, serverUri) {
throw new HTTPError(404, err)
}
// Read the file from disk
body = await promisify(fs.readFile)(path, { 'encoding': 'utf8' })
body = await promisify(fs.readFile)(path, { encoding: 'utf8' })
} else {
// Fetch the acl from the internet
const response = await httpFetch(url)
Expand Down
4 changes: 2 additions & 2 deletions lib/api/accounts/user-accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const DeleteAccountConfirmRequest = require('../../requests/delete-account-confi
*/
function checkAccountExists (accountManager) {
return (req, res, next) => {
let accountUri = req.hostname
const accountUri = req.hostname

accountManager.accountUriExists(accountUri)
.then(found => {
Expand Down Expand Up @@ -63,7 +63,7 @@ function newCertificate (accountManager) {
* @return {Router}
*/
function middleware (accountManager) {
let router = express.Router('/')
const router = express.Router('/')

router.get('/', checkAccountExists(accountManager))

Expand Down
14 changes: 7 additions & 7 deletions lib/api/authn/webid-oidc.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function initialize (app, argv) {
next()
})
.catch(err => {
let error = new Error('Could not verify Web ID from token claims')
const error = new Error('Could not verify Web ID from token claims')
error.statusCode = 401
error.statusText = 'Invalid login'
error.cause = err
Expand Down Expand Up @@ -118,7 +118,7 @@ function middleware (oidc) {
// router.post('/token', token.bind(provider))
// router.get('/userinfo', userinfo.bind(provider))
// router.get('/logout', logout.bind(provider))
let oidcProviderApi = require('oidc-op-express')(oidc.provider)
const oidcProviderApi = require('oidc-op-express')(oidc.provider)
router.use('/', oidcProviderApi)

return router
Expand All @@ -133,17 +133,17 @@ function middleware (oidc) {
* @param err {Error}
*/
function setAuthenticateHeader (req, res, err) {
let locals = req.app.locals
const locals = req.app.locals

let errorParams = {
const errorParams = {
realm: locals.host.serverUri,
scope: 'openid webid',
error: err.error,
error_description: err.error_description,
error_uri: err.error_uri
}

let challengeParams = Object.keys(errorParams)
const challengeParams = Object.keys(errorParams)
.filter(key => !!errorParams[key])
.map(key => `${key}="${errorParams[key]}"`)
.join(', ')
Expand Down Expand Up @@ -176,12 +176,12 @@ function statusCodeOverride (statusCode, req) {
* @returns {boolean}
*/
function isEmptyToken (req) {
let header = req.get('Authorization')
const header = req.get('Authorization')

if (!header) { return false }

if (header.startsWith('Bearer')) {
let fragments = header.split(' ')
const fragments = header.split(' ')

if (fragments.length === 1) {
return true
Expand Down
2 changes: 1 addition & 1 deletion lib/api/authn/webid-tls.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function setEmptySession (req) {
* @param res {ServerResponse}
*/
function setAuthenticateHeader (req, res) {
let locals = req.app.locals
const locals = req.app.locals

res.set('WWW-Authenticate', `WebID-TLS realm="${locals.host.serverUri}"`)
}
Expand Down
1 change: 0 additions & 1 deletion lib/common/template-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ function writeTemplate (filePath, template, substitutions) {
const source = template(substitutions)
writeFile(filePath, source)
}

8 changes: 4 additions & 4 deletions lib/create-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function createApp (argv = {}) {

// Serve the public 'common' directory (for shared CSS files, etc)
app.use('/common', express.static(path.join(__dirname, '../common')))
app.use('/', express.static(path.dirname(require.resolve('mashlib/dist/index.html')), { index: false }))
app.use('/', express.static(path.dirname(require.resolve('mashlib/dist/databrowser.html')), { index: false }))
routeResolvedFile(app, '/common/js/', 'solid-auth-client/dist-lib/solid-auth-client.bundle.js')
routeResolvedFile(app, '/common/js/', 'solid-auth-client/dist-lib/solid-auth-client.bundle.js.map')
app.use('/.well-known', express.static(path.join(__dirname, '../common/well-known')))
Expand Down Expand Up @@ -132,7 +132,7 @@ function createApp (argv = {}) {
*/
function initAppLocals (app, argv, ldp) {
app.locals.ldp = ldp
app.locals.appUrls = argv.apps // used for service capability discovery
app.locals.appUrls = argv.apps // used for service capability discovery
app.locals.host = argv.host
app.locals.authMethod = argv.auth
app.locals.localAuth = argv.localAuth
Expand Down Expand Up @@ -237,7 +237,7 @@ function initWebId (argv, app, ldp) {
next()
})

let accountManager = AccountManager.from({
const accountManager = AccountManager.from({
authMethod: argv.auth,
emailService: app.locals.emailService,
tokenService: app.locals.tokenService,
Expand Down Expand Up @@ -295,7 +295,7 @@ function initAuthentication (app, argv) {
* @return {Object} `express-session` settings object
*/
function sessionSettings (secureCookies, host) {
let sessionSettings = {
const sessionSettings = {
name: 'nssidp.sid',
secret: uuid.v1(),
saveUninitialized: false,
Expand Down
8 changes: 4 additions & 4 deletions lib/create-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ function createServer (argv, app) {
// Look for port or list of ports to redirect to argv.port
if ('redirectHttpFrom' in argv) {
const redirectHttpFroms = argv.redirectHttpFrom.constructor === Array
? argv.redirectHttpFrom
: [argv.redirectHttpFrom]
? argv.redirectHttpFrom
: [argv.redirectHttpFrom]
const portStr = argv.port === 443 ? '' : ':' + argv.port
redirectHttpFroms.forEach(redirectHttpFrom => {
debug.settings('will redirect from port ' + redirectHttpFrom + ' to port ' + argv.port)
let redirectingServer = express()
const redirectingServer = express()
redirectingServer.get('*', function (req, res) {
let host = req.headers.host.split(':') // ignore port
const host = req.headers.host.split(':') // ignore port
debug.server(host, '=> https://' + host + portStr + req.url)
res.redirect('https://' + host + portStr + req.url)
})
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/allow.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function allow (mode, checkPermissionsForDirectory) {
resourcePath += '/'
}

let trustedOrigins = [ldp.resourceMapper.resolveUrl(req.hostname)].concat(ldp.trustedOrigins)
const trustedOrigins = [ldp.resourceMapper.resolveUrl(req.hostname)].concat(ldp.trustedOrigins)
if (ldp.multiuser) {
trustedOrigins.push(ldp.serverUri)
}
Expand Down
6 changes: 3 additions & 3 deletions lib/handlers/auth-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// that sends a logged-in Solid user's details to a backend
module.exports = addAuthProxyHandlers

const createProxy = require('http-proxy-middleware')
const { createProxyMiddleware } = require('http-proxy-middleware')
const debug = require('../debug')
const allow = require('./allow')

Expand Down Expand Up @@ -38,8 +38,8 @@ function addAuthProxyHandler (app, sourcePath, target) {
}, PROXY_SETTINGS)

// Activate the proxy
const proxy = createProxy(settings)
for (let action in REQUIRED_PERMISSIONS) {
const proxy = createProxyMiddleware(settings)
for (const action in REQUIRED_PERMISSIONS) {
const permissions = REQUIRED_PERMISSIONS[action]
app[action](`${sourcePath}*`, setOriginalUrl, ...permissions.map(allow), proxy)
}
Expand Down
Loading

0 comments on commit 0542fa2

Please sign in to comment.