From 0a57d0d0f785c3ef979fc02e76319bcac82a73a3 Mon Sep 17 00:00:00 2001 From: Karl0ss Date: Wed, 8 Jun 2022 13:09:23 +0000 Subject: [PATCH] move username/password to config.json --- config-sample.json | 4 +++- jd-link-adder.js | 3 ++- main.js | 3 +-- package.json | 1 - 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config-sample.json b/config-sample.json index f473317..14bee1b 100644 --- a/config-sample.json +++ b/config-sample.json @@ -1,5 +1,7 @@ { - "RSS_Feed": "", + "JDUserName": "", + "JDPassword": "", + "RSSFeed": "", "Quality": "720", "Autostart": false, "Shows": [] diff --git a/jd-link-adder.js b/jd-link-adder.js index d92fced..0ba9d91 100644 --- a/jd-link-adder.js +++ b/jd-link-adder.js @@ -3,7 +3,8 @@ const fs = require("fs"); async function linkAdder(links) { - const client = new JDownloaderClient(process.env.JDUSERNAME, process.env.JDPASSWORD) + + const client = new JDownloaderClient(JSON.parse(fs.readFileSync('config.json')).JDUserName, JSON.parse(fs.readFileSync('config.json')).JDPassword) await client.connect() const devices = await client.listDevices() const addLinks = await client.linkGrabberAddLinks(devices[0].id, { diff --git a/main.js b/main.js index 02ee489..b3f6918 100644 --- a/main.js +++ b/main.js @@ -1,5 +1,4 @@ // Import dependencies -require('dotenv').config() const fs = require("fs"); const Parser = require("rss-parser"); const { filterFeed } = require("./feed"); @@ -12,7 +11,7 @@ const { filterFeed } = require("./feed"); const parser = new Parser(); // Get all the items in the RSS feed - const feed = await parser.parseURL(JSON.parse(fs.readFileSync('config.json')).RSS_Feed); + const feed = await parser.parseURL(JSON.parse(fs.readFileSync('config.json')).RSSFeed); let items = []; diff --git a/package.json b/package.json index fe58ad7..8802ca3 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ "author": "Karl0ss", "license": "ISC", "dependencies": { - "dotenv": "^16.0.1", "extract-urls": "^1.3.2", "jdownloader-client": "^1.0.0", "rss-parser": "^3.12.0",