Merge branch 'main' of github.com:zjamnik/WNtoEmail
This commit is contained in:
+6
-6
@@ -40,7 +40,7 @@ function padNumber(num, len) {
|
|||||||
function log(text) {
|
function log(text) {
|
||||||
let d = new Date();
|
let d = new Date();
|
||||||
let datetime = `${d.getFullYear()}.${padNumber((d.getMonth() + 1), 2)}.${padNumber(d.getDate(), 2)}_${padNumber(d.getHours(), 2)}:${padNumber(d.getMinutes(), 2)}:${padNumber(d.getSeconds(), 2)}.${padNumber(d.getMilliseconds(), 3)}`;
|
let datetime = `${d.getFullYear()}.${padNumber((d.getMonth() + 1), 2)}.${padNumber(d.getDate(), 2)}_${padNumber(d.getHours(), 2)}:${padNumber(d.getMinutes(), 2)}:${padNumber(d.getSeconds(), 2)}.${padNumber(d.getMilliseconds(), 3)}`;
|
||||||
fs.appendFile(cleanPath('./WNtoEmail.log'), `${datetime} ${text}\n`);
|
fs.appendFile(cleanPath(`${__dirname}/WNtoEmail.log`), `${datetime} ${text}\n`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function mkDir(dirPath) {
|
async function mkDir(dirPath) {
|
||||||
@@ -101,7 +101,7 @@ async function loadConfig() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
config = JSON.parse(await readFile('./novelConfig.conf'));
|
config = JSON.parse(await readFile(`${__dirname}/novelConfig.conf`));
|
||||||
transporter = nodemailer.createTransport({
|
transporter = nodemailer.createTransport({
|
||||||
service: config['emailProvider'],
|
service: config['emailProvider'],
|
||||||
auth: {
|
auth: {
|
||||||
@@ -109,11 +109,11 @@ async function loadConfig() {
|
|||||||
pass: config['emailPassword']
|
pass: config['emailPassword']
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
await writeFile('.', 'novelConfig.conf', JSON.stringify(config, null, 4));
|
await writeFile(__dirname, 'novelConfig.conf', JSON.stringify(config, null, 4));
|
||||||
await writeFile('.', 'novelConfig.bak.conf', JSON.stringify(config, null, 4));
|
await writeFile(__dirname, 'novelConfig.bak.conf', JSON.stringify(config, null, 4));
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
await writeFile('.', 'novelConfig.conf', JSON.stringify(novelConfigDefault, null, 4));
|
await writeFile(__dirname, 'novelConfig.conf', JSON.stringify(novelConfigDefault, null, 4));
|
||||||
config = novelConfigDefault;
|
config = novelConfigDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ async function loadConfig() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function saveConfig() {
|
async function saveConfig() {
|
||||||
await writeFile('.', 'novelConfig.conf', JSON.stringify(config, null, 4));
|
await writeFile(__dirname, 'novelConfig.conf', JSON.stringify(config, null, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function convertEbook(dir, file, params = { "cover": false, "authors": false, "title": false }, format = 'html') {
|
async function convertEbook(dir, file, params = { "cover": false, "authors": false, "title": false }, format = 'html') {
|
||||||
|
|||||||
Reference in New Issue
Block a user