From 6f4e50ceabb3fc6275b122b89cf5bc0b8769982a Mon Sep 17 00:00:00 2001 From: JiJi Date: Fri, 26 Aug 2022 23:27:39 +0800 Subject: [PATCH] Fix & Use images/bangumis sub path --- dist/templates/bgm-template.ejs | 4 ++-- src/index.js | 4 ++-- src/lib/get-bgm-data.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/templates/bgm-template.ejs b/dist/templates/bgm-template.ejs index 3aad476..04cf79f 100644 --- a/dist/templates/bgm-template.ejs +++ b/dist/templates/bgm-template.ejs @@ -1,9 +1,9 @@
<% if(download_image) { %> - " data-src="<%= `/images/${item.image}` %>" referrerPolicy="no-referrer" width="110" style="width:110px;margin:<%= margin %> auto;" /> + " data-src="<%= `/images/bangumis/${item.image}` %>" referrerPolicy="no-referrer" width="110" style="width:110px;margin:<%= margin %> auto;" /> <% } else { %> - " data-src="<%= `/images/${item.image}` %>" referrerPolicy="no-referrer" width="110" style="width:110px;margin:<%= margin %> auto;" /> + " data-src="<%= `https://lain.bgm.tv/pic/cover/${image_level}/${item.image}` %>" referrerPolicy="no-referrer" width="110" style="width:110px;margin:<%= margin %> auto;" /> <% } %>
diff --git a/src/index.js b/src/index.js index 223092a..668c151 100644 --- a/src/index.js +++ b/src/index.js @@ -22,8 +22,8 @@ hexo.extend.generator.register('bangumis', function (locals) { if (!this?.config?.bangumis?.enable) { return; } - if (!fs.existsSync(path.join(this.source_dir, '/images/loading.gif'))) { - fs.copyFile(path.join(__dirname, 'img/loading.gif'), path.join(this.source_dir, '/images/loading.gif')); + if (!fs.existsSync(path.join(this.source_dir, '/images/bangumis/loading.gif'))) { + fs.copyFile(path.join(__dirname, 'img/loading.gif'), path.join(this.source_dir, '/images/bangumis/loading.gif')); } return require('./dist/bangumi-generator').call(this, locals); }); diff --git a/src/lib/get-bgm-data.js b/src/lib/get-bgm-data.js index 68a83c3..5bd5a07 100644 --- a/src/lib/get-bgm-data.js +++ b/src/lib/get-bgm-data.js @@ -181,7 +181,7 @@ module.exports.getBgmData = async (bgmtv_uid, download_image, image_level, sourc // create folders if not exist const bangumisPath = path.join(source_dir, '/_data/bangumis'); const cachePath = path.join(bangumisPath, '/cache'); - const imagesPath = path.join(source_dir, '/images'); + const imagesPath = path.join(source_dir, '/images/bangumis'); const pathList = [bangumisPath, cachePath, imagesPath]; for (const i of pathList) { if (!fs.existsSync(i)) {