fix few more DeprecationWarning: url.parse()
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Apr 1, 2026 at 20:56 UTC
c3423831015fb4e82d6da56bb7cfe1716ddf4469
2 files changed
+6
-8
firebase.js
+2
-2
@@ -166,7 +166,7 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) {
166
const WebSocket = require('ws');
167
const https = require('https');
168
const querystring = require('querystring');
169
- const relayUrl = require('url').parse(url);
169
+ const relayUrl = new URL(url);
170
parent.debug('email', 'CreateFirebaseRelay-Setup');
171
172
// Setup logging
@@ -294,7 +294,7 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) {
294
const httpOptions = {
295
hostname: relayUrl.hostname,
296
port: relayUrl.port ? relayUrl.port : 443,
297
- path: relayUrl.path + (key ? ('?key=' + key) : ''),
297
+ path: relayUrl.pathname + (key ? ('?key=' + key) : ''),
298
method: 'POST',
299
//rejectUnauthorized: false, // DEBUG
300
headers: {
pluginHandler.js
+4
-6
@@ -422,8 +422,7 @@ module.exports.pluginHandler = function (parent) {
422
var dl_url = plugin.downloadUrl;
423
if (version_only != null && version_only != false) dl_url = version_only.url;
424
if (force_url != null) dl_url = force_url;
425
- var url = require('url');
426
- var q = url.parse(dl_url, true);
425
+ var q = new URL(dl_url);
426
var http = (q.protocol == "http:") ? require('http') : require('https');
427
var opts = {
428
path: q.pathname,
@@ -436,7 +435,7 @@ module.exports.pluginHandler = function (parent) {
435
method: 'GET'
436
};
437
if (typeof parent.config.settings.plugins.proxy == 'string' || process.env['HTTP_PROXY'] || process.env['HTTPS_PROXY'] || process.env['http_proxy'] || process.env['https_proxy']) { // Proxy support
439
- opts.agent = new (require('https-proxy-agent').HttpsProxyAgent)(require('url').parse(parent.config.settings.plugins.proxy) || process.env['HTTP_PROXY'] || process.env['HTTPS_PROXY'] || process.env['http_proxy'] || process.env['https_proxy']);
438
+ opts.agent = new (require('https-proxy-agent').HttpsProxyAgent)(new URL(parent.config.settings.plugins.proxy) || process.env['HTTP_PROXY'] || process.env['HTTPS_PROXY'] || process.env['http_proxy'] || process.env['https_proxy']);
439
}
440
var done = false;
441
var request = http.get(opts, function (response) {
@@ -522,8 +521,7 @@ module.exports.pluginHandler = function (parent) {
521
parent.db.getPlugin(id, function (err, docs) {
522
var plugin = docs[0];
523
if (plugin.versionHistoryUrl == null) reject("No version history available for this plugin.");
525
- var url = require('url');
526
- var q = url.parse(plugin.versionHistoryUrl, true);
524
+ var q = new URL(plugin.versionHistoryUrl);
525
var http = (q.protocol == 'http:') ? require('http') : require('https');
526
var opts = {
527
path: q.pathname,
@@ -535,7 +533,7 @@ module.exports.pluginHandler = function (parent) {
533
}
534
};
535
if (typeof parent.config.settings.plugins.proxy == 'string' || process.env['HTTP_PROXY'] || process.env['HTTPS_PROXY'] || process.env['http_proxy'] || process.env['https_proxy']) { // Proxy support
538
- options.agent = new (require('https-proxy-agent').HttpsProxyAgent)(require('url').parse(parent.config.settings.plugins.proxy) || process.env['HTTP_PROXY'] || process.env['HTTPS_PROXY'] || process.env['http_proxy'] || process.env['https_proxy']);
536
+ options.agent = new (require('https-proxy-agent').HttpsProxyAgent)(new URL(parent.config.settings.plugins.proxy) || process.env['HTTP_PROXY'] || process.env['HTTPS_PROXY'] || process.env['http_proxy'] || process.env['https_proxy']);
537
}
538
http.get(opts, function (res) {
539
var versStr = '';