|
|
@ -19,7 +19,7 @@ class TaJian { |
|
|
|
URL=https://microsoft.com/
|
|
|
|
URL=https://microsoft.com/
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async saveUrlShortcut(filename, data) { |
|
|
|
async saveUrlShortcut(filename, data) { |
|
|
|
console.log('TaJian try to save shortcut url', data); |
|
|
|
//console.log('TaJian try to save shortcut url');
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
@ -39,7 +39,7 @@ URL=${data.url} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async saveDescriptionFiles(filename, data) { |
|
|
|
async saveDescriptionFiles(filename, data) { |
|
|
|
console.log('TaJian try to save description files', data); |
|
|
|
//console.log('TaJian try to save description files');
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
const dirPath = path.resolve(this.save_dir); |
|
|
|
const dirPath = path.resolve(this.save_dir); |
|
|
@ -49,9 +49,19 @@ URL=${data.url} |
|
|
|
let content = data.title; |
|
|
|
let content = data.title; |
|
|
|
await writeFile(filepath, content, { encoding: 'utf8' }); |
|
|
|
await writeFile(filepath, content, { encoding: 'utf8' }); |
|
|
|
|
|
|
|
|
|
|
|
filepath = `${dirPath}/${filename}_cover.txt`; |
|
|
|
if (typeof(data.cover_base64) != 'undefined' && data.cover_base64) { |
|
|
|
content = data.cover; |
|
|
|
filepath = `${dirPath}/${filename}.${data.cover_type}`; |
|
|
|
await writeFile(filepath, content, { encoding: 'utf8' }); |
|
|
|
content = Buffer.from(data.cover_base64, "base64"); //保存图片文件
|
|
|
|
|
|
|
|
await writeFile(filepath, content, { encoding: 'utf8' }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filepath = `${dirPath}/${filename}_cover.txt`; |
|
|
|
|
|
|
|
content = `${filename}.${data.cover_type}`; //保存图片路径
|
|
|
|
|
|
|
|
await writeFile(filepath, content, { encoding: 'utf8' }); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
filepath = `${dirPath}/${filename}_cover.txt`; |
|
|
|
|
|
|
|
content = data.cover; //保存图片网址
|
|
|
|
|
|
|
|
await writeFile(filepath, content, { encoding: 'utf8' }); |
|
|
|
|
|
|
|
} |
|
|
|
}catch(error) { |
|
|
|
}catch(error) { |
|
|
|
console.error('Save description files failed: %s', error); |
|
|
|
console.error('Save description files failed: %s', error); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|