Replace valid-url library by standard node method

This commit is contained in:
rejas
2021-03-16 19:25:23 +01:00
parent 90112d1a7d
commit 7635dea3e9
3 changed files with 9 additions and 5 deletions

View File

@@ -5,7 +5,6 @@
* MIT Licensed.
*/
const NodeHelper = require("node_helper");
const validUrl = require("valid-url");
const CalendarFetcher = require("./calendarfetcher.js");
const Log = require("logger");
@@ -38,7 +37,9 @@ module.exports = NodeHelper.create({
* @param {string} identifier ID of the module
*/
createFetcher: function (url, fetchInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, broadcastPastEvents, selfSignedCert, identifier) {
if (!validUrl.isUri(url)) {
try {
new URL(url);
} catch (error) {
this.sendSocketNotification("INCORRECT_URL", { id: identifier, url: url });
return;
}