From 2d0c73fff8bc226411a374e59f69dac4bf7fbf4b Mon Sep 17 00:00:00 2001 From: yangmingming Date: Sun, 27 Oct 2024 12:03:02 +0800 Subject: [PATCH 1/7] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8gitee=E4=BD=9C?= =?UTF-8?q?=E4=B8=BA=E6=A3=80=E6=9F=A5=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/pages/customer_task/utils.ts | 2 +- src/config/common.ts | 2 +- upgrade_config/readme.md | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/client/src/pages/customer_task/utils.ts b/client/src/pages/customer_task/utils.ts index b4024b3..b185c2d 100644 --- a/client/src/pages/customer_task/utils.ts +++ b/client/src/pages/customer_task/utils.ts @@ -137,7 +137,7 @@ export function startBackupTask() { } export async function asyncCheckNeedUpdate() { - let checkUpgradeUri = 'https://cdn.jsdelivr.net/gh/YaoZeyuan/stablog@master/upgrade_config/version.json'; + let checkUpgradeUri = 'https://gitee.com/yaozeyuan/stablog/raw/master/upgrade_config/version.json'; let remoteVersionConfig = await http .asyncGet(checkUpgradeUri, { params: { diff --git a/src/config/common.ts b/src/config/common.ts index 62f87c9..4a56df9 100644 --- a/src/config/common.ts +++ b/src/config/common.ts @@ -5,6 +5,6 @@ let version = parseFloat(packageJson.version) class Common { static readonly version = version // 感谢jsdeliver, 免费cdn - static readonly checkUpgradeUri = 'https://cdn.jsdelivr.net/gh/YaoZeyuan/stablog@master/upgrade_config/version.json' + static readonly checkUpgradeUri = 'https://gitee.com/yaozeyuan/stablog/raw/master/upgrade_config/version.json' } export default Common diff --git a/upgrade_config/readme.md b/upgrade_config/readme.md index 0f6fba9..d528c53 100644 --- a/upgrade_config/readme.md +++ b/upgrade_config/readme.md @@ -1,10 +1,9 @@ -利用jsdelivr作为静态资源接口 +利用gitee.com作为静态资源接口 接口api地址: -- https://cdn.jsdelivr.net/gh/YaoZeyuan/stablog@master/upgrade_config/thank_you/list.json -- https://cdn.jsdelivr.net/gh/YaoZeyuan/stablog@master/upgrade_config/version.json +- https://gitee.com/yaozeyuan/stablog/raw/master/upgrade_config/version.json +- https://gitee.com/yaozeyuan/stablog/raw/master/upgrade_config/thank_you/list.json 刷新接口内容: -- https://purge.jsdelivr.net/gh/YaoZeyuan/stablog@master/upgrade_config/thank_you/list.json -- https://purge.jsdelivr.net/gh/YaoZeyuan/stablog@master/upgrade_config/version.json \ No newline at end of file +- https://gitee.com/yaozeyuan/stablog 点击强制同步 \ No newline at end of file From 82795b7f33013c65a578fdb3ac6a9be9e3cf4104 Mon Sep 17 00:00:00 2001 From: yangmingming Date: Sun, 27 Oct 2024 12:32:24 +0800 Subject: [PATCH 2/7] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4=E5=86=97?= =?UTF-8?q?=E4=BD=99=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/command/debug.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/command/debug.ts b/src/command/debug.ts index 8edc812..e1a11a1 100644 --- a/src/command/debug.ts +++ b/src/command/debug.ts @@ -8,8 +8,6 @@ import path from 'path' // import { BrowserWindow } from 'electron' // import CommonUtil from '~/src/library/util/common' // import { TypeTransConfigPackageList } from './generate/trans_config' -import imageSize from 'image-size' -import * as mozjpeg from "mozjpeg-js" import sharp from "sharp" // const outputUri = path.resolve('F:/www/share/github/stablog/缓存文件/pdf_debug_1.pdf') From ceefca1ac9ae1afe95f57be0425e293d7e044a0d Mon Sep 17 00:00:00 2001 From: yangmingming Date: Sun, 27 Oct 2024 12:32:43 +0800 Subject: [PATCH 3/7] =?UTF-8?q?feat:=20=E6=9B=BF=E6=8D=A2=E4=B8=BA?= =?UTF-8?q?=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/command/generate/customer.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/command/generate/customer.ts b/src/command/generate/customer.ts index a4383ee..7daa562 100644 --- a/src/command/generate/customer.ts +++ b/src/command/generate/customer.ts @@ -37,7 +37,11 @@ const Pixel_Zoom_Rate = 2 /** * 渲染webview最大高度(经实验, 当Electron窗口高度超过16380时, 会直接黑屏卡死, 所以需要专门限制下) */ -const Const_Max_Webview_Render_Height_Px = 5000 +const Const_Max_Webview_Render_Height_Px = 3000 +/** + * webview中, js滚动返回和实际完成滚动时间不一致, 因此需要额外休眠等待. 等待时间过短会截取到错误图片 + */ +const Const_Webview_Js_Scroll_Sleep_Second = 0.5 /** * 单卷中最多只能有5000条微博 */ @@ -645,7 +649,7 @@ class GenerateCustomer extends Base { // 然后对界面截屏 // js指令执行后, 滚动到指定位置还需要时间, 所以截屏前需要sleep一下 - await CommonUtil.asyncSleep(1000 * 0.2) + await CommonUtil.asyncSleep(1000 * Const_Webview_Js_Scroll_Sleep_Second) let nativeImg = await webview.capturePage(); let content = await nativeImg.toJPEG(100) @@ -681,7 +685,7 @@ class GenerateCustomer extends Base { await webview.executeJavaScript(command); // 然后对界面截屏 // js指令执行后, 滚动到指定位置还需要时间, 所以截屏前需要sleep一下 - await CommonUtil.asyncSleep(1000 * 0.2) + await CommonUtil.asyncSleep(1000 * Const_Webview_Js_Scroll_Sleep_Second) let nativeImg = await webview.capturePage(); let content = await nativeImg.toJPEG(100) From a0feb92709cffca747988d251b6807308ee8faed Mon Sep 17 00:00:00 2001 From: yangmingming Date: Sun, 27 Oct 2024 12:35:05 +0800 Subject: [PATCH 4/7] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 +++--- pnpm-lock.yaml | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 00a97bb..5485f2a 100644 --- a/package.json +++ b/package.json @@ -70,13 +70,14 @@ "@adonisjs/ace": "^5.0.8", "archiver": "^3.0.0", "axios": "^1.7.7", + "better-sqlite3": "^11.5.0", "cross-env": "^5.2.0", "dayjs": "^1.11.13", "decode-html": "^2.0.0", "dotenv": "^4.0.0", "fflate": "^0.8", "fs-extra": "^10.0.0", - "image-size": "^0.8.3", + "image-size": "^1.1.1", "json5": "^2.1.0", "jspdf": "^2.3.0", "knex": "^2.2.0", @@ -89,8 +90,7 @@ "request": "^2.88.2", "request-promise": "^4.2.6", "sharp": "^0.33.5", - "shelljs": "^0.8.5", - "better-sqlite3": "^11.5.0" + "shelljs": "^0.8.5" }, "devDependencies": { "@babel/cli": "^7.18.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 38d828e..adad825 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,8 +39,8 @@ importers: specifier: ^10.0.0 version: 10.1.0 image-size: - specifier: ^0.8.3 - version: 0.8.3 + specifier: ^1.1.1 + version: 1.1.1 json5: specifier: ^2.1.0 version: 2.2.3 @@ -2923,9 +2923,9 @@ packages: engines: {node: '>=0.10.0'} hasBin: true - image-size@0.8.3: - resolution: {integrity: sha512-SMtq1AJ+aqHB45c3FsB4ERK0UCiA2d3H1uq8s+8T0Pf8A3W4teyBQyaFaktH6xvZqh+npwlKU7i4fJo0r7TYTg==} - engines: {node: '>=6.9.0'} + image-size@1.1.1: + resolution: {integrity: sha512-541xKlUw6jr/6gGuk92F+mYM5zaFAc5ahphvkqvNe2bQ6gVBkd6bfrmVJ2t4KDAfikAYZyIqTnktX3i6/aQDrQ==} + engines: {node: '>=16.x'} hasBin: true import-fresh@3.3.0: @@ -3965,8 +3965,8 @@ packages: queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - queue@6.0.1: - resolution: {integrity: sha512-AJBQabRCCNr9ANq8v77RJEv73DPbn55cdTb+Giq4X0AVnNVZvMHlYp7XlQiN+1npCZj1DuSmaA2hYVUUDgxFDg==} + queue@6.0.2: + resolution: {integrity: sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==} quick-lru@5.1.1: resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==} @@ -8216,9 +8216,9 @@ snapshots: image-size@0.5.5: optional: true - image-size@0.8.3: + image-size@1.1.1: dependencies: - queue: 6.0.1 + queue: 6.0.2 import-fresh@3.3.0: dependencies: @@ -9335,7 +9335,7 @@ snapshots: queue-microtask@1.2.3: {} - queue@6.0.1: + queue@6.0.2: dependencies: inherits: 2.0.4 From 74c8374773826d31c0bd3ed941b8d6f8878adf0d Mon Sep 17 00:00:00 2001 From: yangmingming Date: Sun, 27 Oct 2024 20:21:22 +0800 Subject: [PATCH 5/7] =?UTF-8?q?feat:=20=E5=89=94=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E6=A0=87=E7=AD=BE,=20=E7=89=B9=E5=88=AB=E6=98=AFscrip?= =?UTF-8?q?t,=20=E9=81=BF=E5=85=8D=E5=9C=A8=E6=B8=B2=E6=9F=93=E6=97=B6,=20?= =?UTF-8?q?=E9=98=BB=E5=A1=9E=E9=A1=B5=E9=9D=A2=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/command/generate/base.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/command/generate/base.ts b/src/command/generate/base.ts index d26cec4..b918a60 100644 --- a/src/command/generate/base.ts +++ b/src/command/generate/base.ts @@ -109,11 +109,16 @@ class GenerateBase extends Base { processContent(content: string) { let that = this // 删除noscript标签内的元素 - function removeNoScript(rawHtml: string) { + function removeUselessEle(rawHtml: string) { + // 规范br标签 rawHtml = _.replace(rawHtml, /<\/br>/g, '') rawHtml = _.replace(rawHtml, /
/g, '
') + // 修复跳转链接 rawHtml = _.replace(rawHtml, /href="\/\/link.zhihu.com'/g, 'href="https://link.zhihu.com') // 修复跳转链接 + // 移除noscript标签 rawHtml = _.replace(rawHtml, /\.*?\<\/noscript\>/g, '') + // 移除script标签 + rawHtml = _.replace(rawHtml, /\