From 5e07109055536c30029e3ad3411437613cd5a83f Mon Sep 17 00:00:00 2001 From: luchenqun Date: Thu, 9 Mar 2017 20:29:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E5=A4=9A=E4=B8=AA=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=B8=8B=E8=BD=BDfavicon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/api.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/routes/api.js b/routes/api.js index 9fbe6ea..54aa9a5 100644 --- a/routes/api.js +++ b/routes/api.js @@ -593,13 +593,13 @@ api.post('/uploadBookmarkFile', upload.single('bookmark'), function(req, res) { var tags = []; item.tags.forEach((tag) => { - allTags.forEach((at) => { - if (at.name == tag) { - tags.push(at.id); - } - }) + allTags.forEach((at) => { + if (at.name == tag) { + tags.push(at.id); + } }) - // 插入书签 + }) + // 插入书签 db.addBookmark(userId, bookmark) // 插入书签 .then((bookmark_id) => { db.delBookmarkTags(bookmark_id); // 不管3721,先删掉旧的分类 @@ -959,13 +959,13 @@ api.getFaviconByTimer = function() { busy = false }); } else { - // 尝试用http试一下:手动抓取成功后会被缓存起来,直接使用[http]即可访问.请勿批量使用[https] + // http://www.cnblogs.com/zhangwei595806165/p/4984912.html 各种方法都试一遍 + var faviconUrl = "http://g.soz.im/" + url; // 默认地址 if (faviconState == 1) { - if (url.startsWith("https")) { - url = "http" + url.substring(5); - } + faviconUrl = "http://www.google.com/s2/favicons?domain=" + url; + } else if (faviconState == 2) { + faviconUrl = "http://favicon.byi.pw/?url=" + url; } - var faviconUrl = "http://g.soz.im/" + url; download(faviconUrl).then(data => { fs.writeFileSync(faviconPath, data); db.updateBookmarkFaviconState(id, -1)