Skip to content

Commit f7d9560

Browse files
committed
replace node-fetch with node:fetch and update for isIp and some lints
1 parent c012117 commit f7d9560

25 files changed

+1343
-1172
lines changed

lib/acl-checker.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict'
2-
/* eslint-disable node/no-deprecated-api */
2+
/* eslint-disable n/no-deprecated-api */
33

44
import { dirname } from 'path'
55
import rdf from 'rdflib'
@@ -10,7 +10,6 @@ import aclCheck from '@solid/acl-check'
1010
import Url, { URL } from 'url'
1111
import { promisify } from 'util'
1212
import fs from 'fs'
13-
import httpFetch from 'node-fetch'
1413

1514
export const DEFAULT_ACL_SUFFIX = '.acl'
1615
const ACL = rdf.Namespace('http://www.w3.org/ns/auth/acl#')
@@ -309,7 +308,7 @@ function fetchLocalOrRemote (mapper, serverUri) {
309308
body = await promisify(fs.readFile)(path, { encoding: 'utf8' })
310309
} else {
311310
// Fetch the acl from the internet
312-
const response = await httpFetch(url)
311+
const response = await fetch(url)
313312
body = await response.text()
314313
contentType = response.headers.get('content-type')
315314
}

lib/create-server.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ function createServer (argv, app) {
6565
}
6666

6767
const credentials = Object.assign({
68-
key: key,
69-
cert: cert
68+
key,
69+
cert
7070
}, argv)
7171

7272
if (ldp.webid && ldp.auth === 'tls') {

lib/handlers/copy.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable node/no-deprecated-api */
1+
/* eslint-disable n/no-deprecated-api */
22

33
import debug from '../debug.mjs'
44
import HTTPError from '../http-error.mjs'

lib/handlers/cors-proxy.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/* eslint-disable node/no-deprecated-api */
1+
/* eslint-disable n/no-deprecated-api */
22

33
import { createProxyMiddleware } from 'http-proxy-middleware'
44
import cors from 'cors'
55
import debug from '../debug.mjs'
66
import url from 'url'
77
import dns from 'dns'
8-
import isIp from 'is-ip'
8+
import { isIP } from 'is-ip'
99
import ipRange from 'ip-range-check'
1010
import validUrl from 'valid-url'
1111

@@ -75,7 +75,7 @@ function extractProxyConfig (req, res, next) {
7575

7676
// Parse the URL and retrieve its host's IP address
7777
const { protocol, host, hostname, path } = url.parse(uri)
78-
if (isIp(hostname)) {
78+
if (isIP(hostname)) {
7979
addProxyConfig(null, hostname)
8080
} else {
8181
dns.lookup(hostname, addProxyConfig)

lib/handlers/get.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ export default async function handler (req, res, next) {
4848

4949
const options = {
5050
hostname: req.hostname,
51-
path: path,
52-
includeBody: includeBody,
53-
possibleRDFType: possibleRDFType,
51+
path,
52+
includeBody,
53+
possibleRDFType,
5454
range: req.headers.range,
5555
contentType: req.headers.accept
5656
}

lib/handlers/index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable node/no-deprecated-api */
1+
/* eslint-disable n/no-deprecated-api */
22

33
import path from 'path'
44
import debugModule from 'debug'

lib/handlers/options.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable node/no-deprecated-api */
1+
/* eslint-disable n/no-deprecated-api */
22

33
import { addLink } from '../header.mjs'
44
import url from 'url'

lib/ldp.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable node/no-deprecated-api */
1+
/* eslint-disable n/no-deprecated-api */
22

33
import utilPath, { join, dirname } from 'path'
44
import intoStream from 'into-stream'
@@ -14,7 +14,6 @@ import extend from 'extend'
1414
import rimraf from 'rimraf'
1515
import { exec } from 'child_process'
1616
import * as ldpContainer from './ldp-container.mjs'
17-
import fetch from 'node-fetch'
1817
import { promisify } from 'util'
1918
import withLock from './lock.mjs'
2019
import { clearAclCache } from './acl-checker.mjs'

lib/models/account-manager.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ class AccountManager {
258258
const emailData = {
259259
to: userAccount.email,
260260
webId: userAccount.webId,
261-
deleteUrl: deleteUrl
261+
deleteUrl
262262
}
263263
return this.emailService.sendWithTemplate('delete-account.mjs', emailData)
264264
})

lib/resource-mapper.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable node/no-deprecated-api, no-mixed-operators */
1+
/* eslint-disable n/no-deprecated-api, no-mixed-operators */
22

33
import fs from 'fs'
44
import URL from 'url'

0 commit comments

Comments
 (0)