From c70fa81482dc2934044b3d23abc274b155251d94 Mon Sep 17 00:00:00 2001 From: IndieKKY Date: Sat, 20 Jan 2024 13:31:00 +0800 Subject: [PATCH] chore: release 1.7.11 --- manifest.json | 2 +- package.json | 2 +- src/util/biz_util.ts | 16 ++++++ vite.config.ts.timestamp-1705728659971.mjs | 66 ++++++++++++++++++++++ 4 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 vite.config.ts.timestamp-1705728659971.mjs diff --git a/manifest.json b/manifest.json index 356ea4f..be2213a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "哔哩哔哩字幕列表", "description": "显示B站视频的字幕列表,可点击跳转与下载字幕,并支持翻译和总结字幕!", - "version": "1.7.10", + "version": "1.7.11", "manifest_version": 3, "permissions": [ "storage" diff --git a/package.json b/package.json index 58b0a93..a63f30d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "bilibili-subtitle", - "version": "1.7.10", + "version": "1.7.11", "type": "module", "description": "哔哩哔哩字幕列表", "main": "index.js", diff --git a/src/util/biz_util.ts b/src/util/biz_util.ts index 119c83b..dc9911c 100644 --- a/src/util/biz_util.ts +++ b/src/util/biz_util.ts @@ -253,6 +253,14 @@ export const extractJsonObject = (content: string) => { const start = content.indexOf('```') const end = content.lastIndexOf('```') if (start >= 0 && end >= 0) { + // 异常情况 + if (start === end) { + if (content.startsWith('```')) { + content = content.slice(3) + } else { + content = content.slice(0, -3) + } + } content = content.slice(start + 3, end) } // get content between { and } @@ -269,6 +277,14 @@ export const extractJsonArray = (content: string) => { const start = content.indexOf('```') const end = content.lastIndexOf('```') if (start >= 0 && end >= 0) { + // 异常情况 + if (start === end) { + if (content.startsWith('```')) { + content = content.slice(3) + } else { + content = content.slice(0, -3) + } + } content = content.slice(start + 3, end) } // get content between [ and ] diff --git a/vite.config.ts.timestamp-1705728659971.mjs b/vite.config.ts.timestamp-1705728659971.mjs new file mode 100644 index 0000000..d2c3687 --- /dev/null +++ b/vite.config.ts.timestamp-1705728659971.mjs @@ -0,0 +1,66 @@ +// vite.config.ts +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; +import { visualizer } from "rollup-plugin-visualizer"; +import { crx } from "@crxjs/vite-plugin"; + +// manifest.json +var manifest_default = { + name: "\u54D4\u54E9\u54D4\u54E9\u5B57\u5E55\u5217\u8868", + description: "\u663E\u793AB\u7AD9\u89C6\u9891\u7684\u5B57\u5E55\u5217\u8868,\u53EF\u70B9\u51FB\u8DF3\u8F6C\u4E0E\u4E0B\u8F7D\u5B57\u5E55,\u5E76\u652F\u6301\u7FFB\u8BD1\u548C\u603B\u7ED3\u5B57\u5E55!", + version: "1.7.11", + manifest_version: 3, + permissions: [ + "storage" + ], + background: { + service_worker: "src/chrome/background.ts" + }, + content_scripts: [ + { + matches: ["https://www.bilibili.com/video/*", "https://www.bilibili.com/list/*"], + js: ["src/chrome/content-script.cjs"] + } + ], + icons: { + "16": "favicon-16x16.png", + "32": "favicon-32x32.png", + "48": "favicon-48x48.png", + "128": "favicon-128x128.png" + }, + action: { + default_popup: "index.html", + default_icon: { + "16": "favicon-16x16.png", + "32": "favicon-32x32.png", + "48": "favicon-48x48.png", + "128": "favicon-128x128.png" + } + } +}; + +// vite.config.ts +var vite_config_default = ({ mode }) => { + const plugins = [ + react(), + visualizer() + ]; + if (mode === "production_chrome") { + plugins.push(crx({ + manifest: manifest_default + })); + } + return defineConfig({ + base: "/", + plugins, + css: { + modules: { + localsConvention: "camelCase" + } + } + }); +}; +export { + vite_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvVXNlcnMvZmVuZ3l1ZXhpYW5nL2RhdGEvcHJvamVjdC9iaWxpYmlsaS1zdWJ0aXRsZVwi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