AI一键出片素材三选一与纯文本模型提示;修复/grab/网址反代两个致命bug;断网lint门禁external_refs归零
- 素材导入三选一:图片 / Word·PDF 文档(新 sourceImport.ts 解析正文与内嵌配图)/ 输入网址(抓取正文与配图)
- AI出片卡片新增提示「只需纯文本模型即可使用;模型支持多模态(视觉)就能自动生成出片」,四步说明第2步改为「AI 自动写口播文案,每段配好对应画面」
- /grab/ 反代改 X-Grab-Url 头传参:修复 encodeURIComponent 产物被 $arg_ 不解码误杀400、裸域名路径错位两个bug;SSRF防护(回环/内网/file/带凭据403、缺头400)保留
- 断网lint门禁 external_refs 20→0:PDF.js命名空间、example.com示例域名、${A}截断产物、ai/nav.88531.cn 自有域名登记白名单
- README/CHANGELOG 已同步本次更新
This commit is contained in:
1 parent
e06a3842fc
commit
5b8e53f9c8
15 files changed
+1049
-28
No files matched your search
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
@@ -6,6 +6,39 @@
|
||||
|
||||
## 2026-11-11
|
||||
|
||||
### ✨ 新功能
|
||||
|
||||
**AI 一键出片 · 素材三选一(图片 / Word·PDF 文档 / 网址)**
|
||||
|
||||
- 第 1 步素材来源新增三选一:默认「添加图片」;「上传文档」支持 Word(.docx) 与 PDF,自动提取正文,docx 内嵌图片一并取出当配图,PDF 文字层抽取 + 前几页渲染成画面(扫描件/受保护文档会明确提示换文件);「输入网址」抓取页面正文与配图
|
||||
- 网址抓取走同源 `/grab/` 反代(nginx 动态上游):仅放行 http/https,拒绝回环 / 内网 / 链路本地地址与带凭据(`user:pass@`)URL,防止被当跳板打内网;重定向折返回本域再次校验
|
||||
- 纯文档 / 纯文字素材没有配图时,自动生成一张标题封面,保证时间轴始终有画面可用
|
||||
- 来源打标:素材卡片显示「文档 / 网址」标签,便于区分最近一次导入
|
||||
- PDF.js worker 由 vite 打进本地产物,离线可用;新增依赖 `pdfjs-dist`
|
||||
|
||||
**纯文本对话模型也能出片(提示属实化)**
|
||||
|
||||
- AI 面板出片卡片新增提示:「只需纯文本模型即可使用;模型支持多模态(视觉)就能自动生成出片」
|
||||
- 未配视觉模型时:调用层剥掉消息里的 `image_url` 图片块(避免不支持多模态的主模型被图片顶回错误),文案 prompt 改为「你看不到图片本身,image 按图片编号顺序循环分配画面(第1段填1、第2段填2…循环)」——纯文本模型照样能出完整片
|
||||
- 已配视觉模型时行为不变:逐张压图后看图配画面;`aiVisionAvailable()`(对话模型已配置 && 视觉模型非空)作为唯一判据集中在 `localAi.ts`
|
||||
- 四步说明第 2 步同步改为不依赖视觉能力的表述:「AI 自动写口播文案,每段配好对应画面」
|
||||
|
||||
### 🔧 构建 / 质量
|
||||
|
||||
**`/grab/` 网址反代实测修复(首测即抓出两个致命 bug)**
|
||||
|
||||
- query 传参被误杀:`encodeURIComponent` 的产物 nginx `$arg_` 不做解码,合法目标全部匹配不到 `^https?://` 被打成 400——改为 `X-Grab-Url` 请求头传输目标(免编码),nginx 断言改读 `$http_x_grab_url`,上游侧同名头清空不外泄
|
||||
- 裸域名路径错位:`https://host`(无路径)反代时会把原始 `/grab/?url=…` 请求路径透给上游——前端 `new URL(cur).href` 规范化补默认路径 `/` 后再发
|
||||
- 实测断言:正例抓取成功;回环 127.0.0.1、内网 192.168.x、`file://` 协议、`user:pass@` 带凭据 URL 全部正确拒绝
|
||||
|
||||
**断网 lint 门禁修复(external_refs 20 → 0,门禁恢复全绿)**
|
||||
|
||||
- pdf.js 的 XFA/Adobe XML 命名空间字符串(w3.org / xfa.org / adobe.com 等 17 条)登记入 `NAMESPACE_HOSTS` —— 纯命名空间字符串,浏览器不发请求
|
||||
- pdf.worker 模板字面量 `http://${A}` 的提取截断产物入白名单(仅 `new URL()` 构造,不发起请求)
|
||||
- 代码内两处 `example.com` 示例域名删除:文章生成器占位域名改为中文示意文字、候选解析错误提示不再回显域名
|
||||
- 官方自有域名入白名单并注明理由:`ai.88531.cn`(官方 AI 网关默认接口 `https://ai.88531.cn/v1` +「获取 Key」引导链接)、`nav.88531.cn`(首页导航站入口)—— 产品默认配置本体,断网时静默降级,删掉功能即失效
|
||||
- 实测 `external_refs = 0`(`00_lint_dist.py --dist` 对构建产物复跑确认),`BUILD_EXIT=0`
|
||||
|
||||
### 🏠 首页调整
|
||||
|
||||
**移除「受到众多大品牌信赖」品牌背书块**
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
|
||||
### 最近更新(2026-11-11)
|
||||
|
||||
- **AI 一键出片素材三选一**:图片 / Word·PDF 文档(自动提取正文与配图,扫描件有提示)/ 网址自动抓取正文和配图(同源 `/grab/` 反代,拒绝内网回环目标);纯文字素材自动补标题封面;
|
||||
- **纯文本模型也能出片**:出片卡片新增提示「只需纯文本模型即可使用;模型支持多模态(视觉)就能自动生成出片」;未配视觉模型时剥掉图片块、按图片编号循环分配画面,纯文本主模型不再被顶回错误;
|
||||
- **断网 lint 门禁修复**:`external_refs` 20 → 0(PDF.js 命名空间入册、示例域名清除、官方自有域名注明理由入白名单),构建门禁恢复全绿;
|
||||
- **首页移除品牌背书块**:删掉「受到众多大品牌信赖」与 UCAP / 圆通 / 中国电信 / 中国移动 logo 区,功能展示与 AI 功能区直接衔接;
|
||||
- **移除 AI 视频生成 / AI 图片生成页签**:左侧「AI创作」面板只保留「一键出片」与「生成结果」,生图 / 生视频走 AI 助手对话;
|
||||
- **AI 默认接入官方网关**:接口地址与模型全部预填,用户只需粘贴 API Key;
|
||||
|
||||
@@ -109,7 +109,10 @@ def load_allowlist():
|
||||
return rules
|
||||
|
||||
|
||||
NAMESPACE_HOSTS = {'www.w3.org', 'purl.org', 'schemas.openxmlformats.org', 'www.opengis.net'}
|
||||
NAMESPACE_HOSTS = {'www.w3.org', 'purl.org', 'schemas.openxmlformats.org', 'www.opengis.net',
|
||||
# pdf.js XFA/XMP:XML 命名空间与 schema 标识符(xmlns:xfa=...、startsWith判断),
|
||||
# 浏览器不会发起请求,与 w3.org 同类
|
||||
'www.xfa.org', 'ns.adobe.com'}
|
||||
DOC_EXT = {'.md', '.map', '.txt'}
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
# 说明:unpkg.com / cdn.jsdelivr.net 不在清单里 —— 它们出现在 vendored ffmpeg/tesseract
|
||||
# 的默认参数中,已通过改写 public/ 下的文件指向本地路径,lint 必须能发现回归。
|
||||
|
||||
^http://\$$ allow pdf.worker 模板字面量 http://${A} 的提取截断产物,仅 new URL() 构造不发起请求
|
||||
^https://ai\.88531\.cn(/.*)?$ allow 自有域名:官方 AI 网关默认接口地址与「获取 Key」引导链接(产品默认配置本体,删掉功能即失效;断网时静默降级不拦功能)
|
||||
^https://nav\.88531\.cn(/.*)?$ allow 自有域名:首页导航站入口链接(纯跳转,断网时点击打不开但不影响编辑器功能)
|
||||
github\.com allow vendored 依赖(pixi/semi/opencv 等)压缩产物里的项目主页与许可证链接,仅字符串
|
||||
gist\.github\.com allow vendored 依赖 README 片段里的示例链接,仅字符串
|
||||
raw\.githubusercontent\.com allow vendored 依赖 README 片段里的源码链接,仅字符串
|
||||
|
||||
+22
@@ -99,6 +99,28 @@ server {
|
||||
client_max_body_size 1m;
|
||||
}
|
||||
|
||||
# 网址抓取(AI 一键出片「输入网址」):同源动态反代任意公网 URL。
|
||||
# 浏览器只请求 /grab/,避开跨域限制;只放行 http/https,
|
||||
# 并拒绝回环/内网/链路本地地址,防止被当成跳板打内网服务。
|
||||
# 目标放 X-Grab-Url 头里:query 传参要 percent-编码,而 nginx $arg_ 不做解码,
|
||||
# 会把 encodeURIComponent 过的合法目标误杀成 400(实测)。3xx 原样透传给前端,
|
||||
# 由 redirect:manual 逐跳重进 /grab/(每跳重新过一遍下面的断言)。
|
||||
location = /grab/ {
|
||||
resolver 223.5.5.5 119.29.29.29 valid=30s ipv6=off;
|
||||
if ($http_x_grab_url = '') { return 400; }
|
||||
if ($http_x_grab_url !~* '^https?://') { return 400; }
|
||||
if ($http_x_grab_url ~* '^https?://[^/?#]*@') { return 403; }
|
||||
if ($http_x_grab_url ~* '^https?://(localhost|127\.|0\.0\.0\.0|10\.|192\.168\.|169\.254\.|172\.(1[6-9]|2[0-9]|3[01])\.|\[?::1)') { return 403; }
|
||||
proxy_pass $http_x_grab_url;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header Connection "";
|
||||
proxy_set_header X-Grab-Url "";
|
||||
proxy_http_version 1.1;
|
||||
proxy_read_timeout 20s;
|
||||
proxy_send_timeout 20s;
|
||||
}
|
||||
|
||||
# 本机 LLM 网关(NewAPI,OpenAI 兼容 /v1)同源反代:
|
||||
# 浏览器只请求 https://<站点>/newapi/v1/*,既避免 HTTPS 页面直连 HTTP 被拦(混合内容),
|
||||
# 也保证站点在只有本机网络时可用。密钥仍留在服务端,前端不出现。
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
"p-limit": "^4.0.0",
|
||||
"pixi-color-effects": "^1.0.0",
|
||||
"pixi-filters": "^5.2.1",
|
||||
"pdfjs-dist": "^4.7.76",
|
||||
"pixi.js": "^7.3.0",
|
||||
"pubsub-js": "^1.9.4",
|
||||
"qrcode": "^1.5.4",
|
||||
|
||||
@@ -42,6 +42,7 @@ export default function AiMain() {
|
||||
<i>字幕动效</i>
|
||||
<i>画面转场</i>
|
||||
</div>
|
||||
<div className={styles.qvHeroHint}>只需纯文本模型即可使用;模型支持多模态(视觉)就能自动生成出片</div>
|
||||
<div className={styles.qvCta}>立即生成 →</div>
|
||||
</div>
|
||||
|
||||
@@ -61,7 +62,7 @@ export default function AiMain() {
|
||||
<h2 className={styles.qvIntroTitle}>四步出一条视频</h2>
|
||||
<ol className={styles.qvSteps}>
|
||||
<li>添加几张图片,写一个标题</li>
|
||||
<li>AI 看懂图片,自动写出口播文案</li>
|
||||
<li>AI 自动写口播文案,每段配好对应画面</li>
|
||||
<li>挑人声、情绪、语速,试听满意再合成</li>
|
||||
<li>确认生成:图片排进时间轴,自动加字幕、配音、运镜和转场</li>
|
||||
</ol>
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Modal, Steps, Button, Input, TextArea, Select, Slider, Toast, Spin, Tag, Empty } from '@douyinfe/semi-ui';
|
||||
import {
|
||||
Modal,
|
||||
Steps,
|
||||
Button,
|
||||
Input,
|
||||
TextArea,
|
||||
Select,
|
||||
Slider,
|
||||
Toast,
|
||||
Spin,
|
||||
Tag,
|
||||
Empty,
|
||||
Radio,
|
||||
RadioGroup,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { VolumeNotice, Delete, Up, Down, Plus, Play, MusicOne } from '@icon-park/react';
|
||||
import styles from './quickvideo.module.less';
|
||||
import { addImageVideoAudioItem } from '../addItem';
|
||||
@@ -15,6 +29,7 @@ import {
|
||||
synthesizeSegment,
|
||||
decodeAudio,
|
||||
} from '@utils/aiQuickVideo';
|
||||
import { parseDocx, parsePdf, importFromUrl, makeTitleCover } from '@utils/sourceImport';
|
||||
|
||||
/** 界面上的文案段(带稳定 uid,便于配音结果对应) */
|
||||
type Seg = QvSegment & { uid: string };
|
||||
@@ -37,7 +52,20 @@ interface PickImage {
|
||||
h: number;
|
||||
}
|
||||
|
||||
const STEP_TITLES = ['图片与标题', '生成文案', '配置声音', '确认生成'];
|
||||
const STEP_TITLES = ['素材与标题', '生成文案', '配置声音', '确认生成'];
|
||||
|
||||
/** 素材来源:图片 / 文档 / 网址(第 1 步的输入方式) */
|
||||
type SrcMode = 'image' | 'doc' | 'url';
|
||||
const GEN_LABEL: Record<SrcMode, string> = {
|
||||
image: '① 识别图片 · 生成文案',
|
||||
doc: '① 读取文档 · 生成文案',
|
||||
url: '① 分析网页 · 生成文案',
|
||||
};
|
||||
const GEN_LOADING: Record<SrcMode, string> = {
|
||||
image: '正在识别图片写文案…',
|
||||
doc: '正在读取文档写文案…',
|
||||
url: '正在分析网页写文案…',
|
||||
};
|
||||
const MAX_IMAGES = 8;
|
||||
|
||||
const { Option } = Select;
|
||||
@@ -305,6 +333,12 @@ export default function QuickVideo({
|
||||
const [title, setTitle] = useState('');
|
||||
const [style, setStyle] = useState(COPY_STYLES[0].value);
|
||||
|
||||
/* 素材来源:图片 / Word·PDF 文档 / 网址(src 是最近一次成功导入的正文) */
|
||||
const [mode, setMode] = useState<SrcMode>('image');
|
||||
const [src, setSrc] = useState<{ mode: SrcMode; text: string; name: string } | null>(null);
|
||||
const [urlInput, setUrlInput] = useState('');
|
||||
const [importing, setImporting] = useState(false);
|
||||
|
||||
const [segs, setSegs] = useState<Seg[]>([]);
|
||||
const [genLoading, setGenLoading] = useState(false);
|
||||
|
||||
@@ -328,6 +362,7 @@ export default function QuickVideo({
|
||||
const [capEnter, setCapEnter] = useState('zoom');
|
||||
|
||||
const fileRef = useRef<HTMLInputElement>(null);
|
||||
const docRef = useRef<HTMLInputElement>(null);
|
||||
const playingRef = useRef<Audio | null>(null);
|
||||
|
||||
const newSeg = (text: string, image: number): Seg => ({
|
||||
@@ -381,6 +416,89 @@ export default function QuickVideo({
|
||||
});
|
||||
};
|
||||
|
||||
/** 把一批 dataURL 追加进素材池(量好宽高、按上限截断),返回实际加入数 */
|
||||
const addImageUrls = async (urls: string[], namePrefix: string): Promise<number> => {
|
||||
const measured = await Promise.all(
|
||||
urls.map(
|
||||
url =>
|
||||
new Promise<PickImage | null>(resolve => {
|
||||
const img = new Image();
|
||||
img.onload = () =>
|
||||
resolve({
|
||||
id: util.randomID(),
|
||||
url,
|
||||
name: namePrefix,
|
||||
w: img.naturalWidth,
|
||||
h: img.naturalHeight,
|
||||
});
|
||||
img.onerror = () => resolve(null);
|
||||
img.src = url;
|
||||
}),
|
||||
),
|
||||
);
|
||||
const room = MAX_IMAGES - images.length;
|
||||
const add = measured.filter(Boolean).slice(0, Math.max(0, room)) as PickImage[];
|
||||
if (add.length) setImages(prev => prev.concat(add).slice(0, MAX_IMAGES));
|
||||
return add.length;
|
||||
};
|
||||
|
||||
/* ---------- 文档上传(Word / PDF) ---------- */
|
||||
const onPickDoc = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.[0];
|
||||
e.target.value = '';
|
||||
if (!file) return;
|
||||
const lower = file.name.toLowerCase();
|
||||
if (lower.endsWith('.doc')) {
|
||||
return Toast.warning('暂不支持旧版 .doc,请在 Word 里另存为 .docx 后再上传');
|
||||
}
|
||||
if (!lower.endsWith('.docx') && !lower.endsWith('.pdf')) {
|
||||
return Toast.warning('只支持 Word(.docx) 和 PDF 文件');
|
||||
}
|
||||
setImporting(true);
|
||||
try {
|
||||
const r = lower.endsWith('.pdf') ? await parsePdf(file) : await parseDocx(file);
|
||||
if (!r.text.trim() && !r.images.length) {
|
||||
Toast.error('没读到内容:文档可能是扫描件或受保护,请换一个文件');
|
||||
return;
|
||||
}
|
||||
setSrc({ mode: 'doc', text: r.text, name: file.name });
|
||||
const added = await addImageUrls(r.images, file.name.replace(/\.[^.]+$/, '').slice(0, 16));
|
||||
const bits: string[] = [];
|
||||
if (r.text.trim()) bits.push(`正文 ${r.text.length} 字`);
|
||||
if (r.images.length) bits.push(`提取配图 ${added} 张`);
|
||||
Toast.success(`已读取文档:${bits.join('、')}`);
|
||||
} catch (err: any) {
|
||||
Toast.error(err?.message || '文档解析失败');
|
||||
} finally {
|
||||
setImporting(false);
|
||||
}
|
||||
};
|
||||
|
||||
/* ---------- 网址抓取(正文 + 配图) ---------- */
|
||||
const onGrabUrl = async () => {
|
||||
const raw = urlInput.trim();
|
||||
if (!raw) return Toast.warning('请输入网址');
|
||||
setImporting(true);
|
||||
try {
|
||||
const r = await importFromUrl(raw);
|
||||
if (!r.text.trim() && !r.images.length) {
|
||||
Toast.error('这个页面没抓到文字和图片,换个网址试试');
|
||||
return;
|
||||
}
|
||||
setSrc({ mode: 'url', text: r.text, name: r.name });
|
||||
const added = await addImageUrls(r.images, (r.name || '网页配图').slice(0, 16));
|
||||
if (!title.trim() && r.name) setTitle(r.name.slice(0, 30));
|
||||
const bits: string[] = [];
|
||||
if (r.text.trim()) bits.push(`正文 ${r.text.length} 字`);
|
||||
if (r.images.length) bits.push(`图片 ${added} 张`);
|
||||
Toast.success(`已抓取:${bits.join('、')}`);
|
||||
} catch (err: any) {
|
||||
Toast.error(err?.message || '网址抓取失败');
|
||||
} finally {
|
||||
setImporting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const moveImage = (idx: number, dir: -1 | 1) => {
|
||||
setImages(prev => {
|
||||
const next = prev.slice();
|
||||
@@ -393,16 +511,27 @@ export default function QuickVideo({
|
||||
|
||||
/* ---------- 文案生成 ---------- */
|
||||
const genCopy = async () => {
|
||||
if (!images.length) return Toast.warning('请先添加图片');
|
||||
const bodyText = src?.text?.trim() || '';
|
||||
if (!images.length && !bodyText) {
|
||||
return Toast.warning(
|
||||
mode === 'doc' ? '请先上传 Word / PDF 文档' : mode === 'url' ? '请先抓取网址内容' : '请先添加图片',
|
||||
);
|
||||
}
|
||||
if (!title.trim()) return Toast.warning('请填写标题');
|
||||
setGenLoading(true);
|
||||
const [res, err] = await generateQuickVideoCopy({
|
||||
title: title.trim(),
|
||||
style,
|
||||
images: images.map(i => i.url),
|
||||
sourceText: bodyText || undefined,
|
||||
});
|
||||
setGenLoading(false);
|
||||
if (err || !res) return Toast.error(err || '文案生成失败');
|
||||
// 纯文档 / 纯文字素材没有配图时,自动生成一张标题封面,保证时间轴有画面可用
|
||||
if (!images.length) {
|
||||
const cover = makeTitleCover(title.trim());
|
||||
setImages([{ id: util.randomID(), url: cover.url, name: '标题封面', w: cover.w, h: cover.h }]);
|
||||
}
|
||||
const list = res.segments.map(s => newSeg(s.text, s.image));
|
||||
setSegs(list);
|
||||
setAudio({});
|
||||
@@ -596,6 +725,9 @@ export default function QuickVideo({
|
||||
|
||||
const resetAll = () => {
|
||||
setStep(0);
|
||||
setSrc(null);
|
||||
setUrlInput('');
|
||||
setMode('image');
|
||||
setSegs([]);
|
||||
setAudio({});
|
||||
setTitle('');
|
||||
@@ -609,7 +741,7 @@ export default function QuickVideo({
|
||||
if (step === 0) {
|
||||
return (
|
||||
<Button type="primary" loading={genLoading} onClick={genCopy}>
|
||||
{genLoading ? '正在识别图片写文案…' : '① 识别图片 · 生成文案'}
|
||||
{genLoading ? GEN_LOADING[mode] : GEN_LABEL[mode]}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -688,8 +820,67 @@ export default function QuickVideo({
|
||||
{step === 0 && (
|
||||
<>
|
||||
<div className={styles.desc}>
|
||||
添加几张图片 + 写一个标题,AI 会看懂图片内容,帮你写出口播文案、生成字幕和配音。
|
||||
素材三选一:上传图片,或上传 Word / PDF 文档,或输入网址自动抓取正文和配图 ——
|
||||
AI 看懂素材后写口播文案,再生成字幕和配音。
|
||||
</div>
|
||||
<div className={styles.modeRow}>
|
||||
<RadioGroup
|
||||
type="button"
|
||||
size="small"
|
||||
value={mode}
|
||||
onChange={e => setMode(e.target.value as SrcMode)}
|
||||
>
|
||||
<Radio value="image">图片</Radio>
|
||||
<Radio value="doc">Word / PDF</Radio>
|
||||
<Radio value="url">输入网址</Radio>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
{mode === 'doc' && (
|
||||
<>
|
||||
<div className={styles.srcBox} onClick={() => !importing && docRef.current?.click()}>
|
||||
{importing ? '正在读取文档…' : '点击选择 Word(.docx) / PDF 文件,自动提取正文和配图'}
|
||||
</div>
|
||||
<input
|
||||
ref={docRef}
|
||||
type="file"
|
||||
accept=".docx,.pdf"
|
||||
style={{ display: 'none' }}
|
||||
onChange={onPickDoc}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{mode === 'url' && (
|
||||
<div className={styles.urlRow}>
|
||||
<Input
|
||||
value={urlInput}
|
||||
onChange={setUrlInput}
|
||||
placeholder="粘贴网页地址(文章 / 博客 / 详情页链接均可)"
|
||||
style={{ flex: 1 }}
|
||||
showClear
|
||||
onPressEnter={onGrabUrl}
|
||||
/>
|
||||
<Button type="primary" loading={importing} onClick={onGrabUrl}>
|
||||
抓取内容和图片
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
{src && src.mode === mode && (
|
||||
<div className={styles.srcCard}>
|
||||
<div className={styles.srcHead}>
|
||||
<Tag color={src.mode === 'doc' ? 'blue' : 'green'}>
|
||||
{src.mode === 'doc' ? '文档' : '网址'}
|
||||
</Tag>
|
||||
<span className={styles.srcName}>{src.name || '(未命名)'}</span>
|
||||
<span className={styles.total}>{src.text.length} 字</span>
|
||||
<span className={styles.srcDel} onClick={() => setSrc(null)}>
|
||||
移除
|
||||
</span>
|
||||
</div>
|
||||
{src.text && (
|
||||
<div className={styles.srcPreview}>{src.text.replace(/\s+/g, ' ').slice(0, 160)}</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.imgGrid}>
|
||||
{images.map((img, i) => (
|
||||
<div key={img.id} className={styles.imgItem}>
|
||||
@@ -1052,7 +1243,8 @@ export default function QuickVideo({
|
||||
|
||||
<div className={styles.footer}>
|
||||
<span className={styles.total}>
|
||||
{step === 0 && '共可添加 ' + MAX_IMAGES + ' 张图片'}
|
||||
{step === 0 &&
|
||||
`素材池 ${images.length}/${MAX_IMAGES} 张图片${src?.text ? ` · 正文 ${src.text.length} 字` : ''}`}
|
||||
{step === 1 && `${segs.length} 段文案`}
|
||||
{step === 2 && `已配音 ${freshCount}/${segs.length} 段`}
|
||||
{step === 3 && `总长约 ${totalDur.toFixed(1)} 秒`}
|
||||
|
||||
@@ -221,3 +221,77 @@
|
||||
line-height: 1.7;
|
||||
margin: 2px 0 8px;
|
||||
}
|
||||
|
||||
/* 素材来源切换 + 文档 / 网址导入(AI 一键出片 第 1 步) */
|
||||
.modeRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin: 10px 0 12px;
|
||||
}
|
||||
|
||||
.urlRow {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.srcBox {
|
||||
border: 1px dashed var(--h5ds-border, #d4d7dc);
|
||||
border-radius: 8px;
|
||||
padding: 16px 14px;
|
||||
text-align: center;
|
||||
color: var(--h5ds-gray-1, #8a9099);
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
margin-bottom: 12px;
|
||||
|
||||
&:hover {
|
||||
border-color: #4d7cfe;
|
||||
color: #4d7cfe;
|
||||
}
|
||||
}
|
||||
|
||||
.srcCard {
|
||||
border: 1px solid var(--h5ds-border, #e6e8eb);
|
||||
border-radius: 8px;
|
||||
background: var(--h5ds-bg-1, #fafbfc);
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 12px;
|
||||
|
||||
.srcHead {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.srcName {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-weight: 600;
|
||||
color: var(--h5ds-gray-0, #1f2329);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.srcDel {
|
||||
flex: 0 0 auto;
|
||||
font-size: 12px;
|
||||
color: #d4380d;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.srcPreview {
|
||||
margin-top: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--h5ds-gray-1, #8a9099);
|
||||
line-height: 1.6;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
@@ -173,6 +173,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
.qvHeroHint {
|
||||
margin-top: 8px;
|
||||
font-size: 11.5px;
|
||||
line-height: 1.6;
|
||||
color: rgba(255, 255, 255, 0.68);
|
||||
}
|
||||
|
||||
.qvCta {
|
||||
margin-top: 11px;
|
||||
display: inline-block;
|
||||
|
||||
+47
-15
@@ -4,7 +4,7 @@
|
||||
* - 文案:用户在「AI 设置」填的对话模型(带图时直接用该模型,需其支持图片输入)
|
||||
* - 配音:本机 unicut-tts(edge-tts),走同源 /localtts 反代,无需登录、无需密钥
|
||||
*/
|
||||
import { localChatCompletion } from '@utils/localAi';
|
||||
import { aiVisionAvailable, localChatCompletion } from '@utils/localAi';
|
||||
|
||||
/** 一段口播 = 一句文案 + 对应第几张图(1 基) */
|
||||
export interface QvSegment {
|
||||
@@ -125,27 +125,59 @@ export async function generateQuickVideoCopy(params: {
|
||||
title: string;
|
||||
style: string;
|
||||
images: string[];
|
||||
/** 文档 / 网页正文:有正文时以正文为内容依据,图片决定每段配什么画面 */
|
||||
sourceText?: string;
|
||||
}): Promise<[{ title: string; segments: QvSegment[] } | null, string | null]> {
|
||||
const images = params.images || [];
|
||||
if (images.length === 0) return [null, '请先添加至少 1 张图片'];
|
||||
const sourceText = (params.sourceText || '').trim();
|
||||
if (!images.length && !sourceText) return [null, '请先添加图片、文档或网址内容'];
|
||||
if (!params.title.trim()) return [null, '请填写标题'];
|
||||
|
||||
// 只有配了视觉(多模态)模型才压图发图:纯文本模型看不了图、也会被 image_url 顶回错误,
|
||||
// 走纯文本路径按编号顺序配画面,照样能出片
|
||||
const useVision = await aiVisionAvailable();
|
||||
const shrunk: string[] = [];
|
||||
for (const img of images) {
|
||||
shrunk.push(await shrinkImageForVision(img));
|
||||
if (useVision) {
|
||||
for (const img of images) {
|
||||
shrunk.push(await shrinkImageForVision(img));
|
||||
}
|
||||
}
|
||||
|
||||
const prompt = [
|
||||
`我在做一个短视频,标题是《${params.title}》。文案风格:${params.style}。`,
|
||||
`共有 ${images.length} 张图片,编号从 1 到 ${images.length}(顺序就是它们出现的顺序)。`,
|
||||
'请你逐张看图,理解每张图里展示的内容,然后写一段适合朗读的口播文案:',
|
||||
`1. 段落数 ${Math.min(images.length + 1, Math.max(3, images.length))} 段左右,每段 15~40 字,口语化、能直接读出来;`,
|
||||
'2. 每段给一个 image 字段,填这段对应第几张图(只填数字 1~' + images.length + ');',
|
||||
'3. 让整段文案围绕标题讲一个完整的小故事,第一段抓人,最后一段收尾;',
|
||||
'4. 不要出现“图片”“第一张”这种字眼,也不要加表情符号和换行。',
|
||||
'只输出 JSON,不要任何解释,格式:',
|
||||
'{"segments":[{"text":"...","image":1}]}',
|
||||
].join('\n');
|
||||
const lines: string[] = [`我在做一个短视频,标题是《${params.title}》。文案风格:${params.style}。`];
|
||||
if (sourceText) {
|
||||
const body = sourceText.slice(0, 6000);
|
||||
lines.push(
|
||||
`素材正文(来自用户上传的 Word / PDF 文档或网页,共 ${sourceText.length} 字,先看前 ${body.length} 字):`,
|
||||
'"""',
|
||||
body,
|
||||
'"""',
|
||||
'文案必须基于上面的素材正文改写,不要编造素材里没有的事实;素材里的关键信息、数字、结论要保留在文案里。',
|
||||
);
|
||||
}
|
||||
if (images.length) {
|
||||
lines.push(
|
||||
`共有 ${images.length} 张图片,编号从 1 到 ${images.length}(顺序就是它们出现的顺序)。`,
|
||||
!useVision
|
||||
? '你看不到图片本身,image 按顺序循环分配(第1段填1、第2段填2,排到最后一张回到1);'
|
||||
: sourceText
|
||||
? '素材正文决定每段说什么,图片决定每段配哪张画面(image 填最贴合的编号)。'
|
||||
: '请你逐张看图,理解每张图里展示的内容,然后写一段适合朗读的口播文案:',
|
||||
`1. 段落数 ${Math.min(images.length + 1, Math.max(3, images.length))} 段左右,每段 15~40 字,口语化、能直接读出来;`,
|
||||
'2. 每段给一个 image 字段,填这段对应第几张图(只填数字 1~' + images.length + ');',
|
||||
'3. 让整段文案围绕标题讲一个完整的小故事,第一段抓人,最后一段收尾;',
|
||||
'4. 不要出现“图片”“第一张”这种字眼,也不要加表情符号和换行。',
|
||||
);
|
||||
} else {
|
||||
lines.push(
|
||||
'素材只有文字,没有配图:',
|
||||
'1. 写 4~6 段、每段 15~40 字,口语化、能直接读出来;',
|
||||
'2. 每段 image 字段一律填 1;',
|
||||
'3. 让整段文案围绕标题讲一个完整的小故事,第一段抓人,最后一段收尾;',
|
||||
'4. 不要加表情符号和换行。',
|
||||
);
|
||||
}
|
||||
lines.push('只输出 JSON,不要任何解释,格式:', '{"segments":[{"text":"...","image":1}]}');
|
||||
const prompt = lines.join('\n');
|
||||
|
||||
const content: any[] = [{ type: 'text', text: prompt }];
|
||||
shrunk.forEach(url => {
|
||||
|
||||
+22
-1
@@ -119,6 +119,17 @@ const withAuth = (apiKey: string): Record<string, string> => {
|
||||
return h;
|
||||
};
|
||||
|
||||
/** 是否配置了视觉(多模态)模型:只有配了才会把图片真发给模型看,否则调用方走纯文本路径 */
|
||||
export async function aiVisionAvailable(): Promise<boolean> {
|
||||
if (!isAiConfigured()) return false;
|
||||
try {
|
||||
const cfg = await loadLocalAiConfig();
|
||||
return !!cfg.chat.visionModel;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** OpenAI 兼容对话(一次性返回),返回 [数据, 错误] */
|
||||
export async function localChatCompletion(params: {
|
||||
model?: string;
|
||||
@@ -133,6 +144,16 @@ export async function localChatCompletion(params: {
|
||||
});
|
||||
const primary = hasImage && cfg.chat.visionModel ? cfg.chat.visionModel : cfg.chat.model;
|
||||
const models = [primary, ...(cfg.chat.fallbackModels || [])].filter(Boolean);
|
||||
// 未配视觉模型时把图片块剥掉:纯文本主模型会被 image_url 内容块顶回错误,
|
||||
// 剥掉后纯文本模型照样能出文案(调用方按图片编号配画面)
|
||||
let messages = params.messages;
|
||||
if (hasImage && !cfg.chat.visionModel) {
|
||||
messages = (params.messages || []).map((m: any) => {
|
||||
if (!Array.isArray(m?.content)) return m;
|
||||
const parts = m.content.filter((c: any) => c?.type !== 'image_url' && c?.type !== 'image');
|
||||
return parts.length ? { ...m, content: parts } : m;
|
||||
});
|
||||
}
|
||||
let lastErr = '';
|
||||
|
||||
for (const model of models) {
|
||||
@@ -140,7 +161,7 @@ export async function localChatCompletion(params: {
|
||||
const res = await fetch(`${cfg.chat.baseUrl}/chat/completions`, {
|
||||
method: 'POST',
|
||||
headers: withAuth(cfg.chat.apiKey),
|
||||
body: JSON.stringify({ model, messages: params.messages, stream: false, max_tokens: 4096 }),
|
||||
body: JSON.stringify({ model, messages, stream: false, max_tokens: 4096 }),
|
||||
});
|
||||
const text = await res.text();
|
||||
let data: any = null;
|
||||
|
||||
@@ -0,0 +1,420 @@
|
||||
/**
|
||||
* AI 一键出片 · 素材导入(Word / PDF / 网址)
|
||||
*
|
||||
* - Word(.docx):jszip 解压读 word/document.xml 提取正文,顺带提取 word/media/ 内嵌配图
|
||||
* - PDF:pdfjs-dist 提取文字层,并渲染前几页当配图(扫描件没有文字层也能出画面)
|
||||
* - 网址:经同源 /grab/ 反代抓页面(nginx 动态反代,绕开浏览器跨域),解析正文与配图
|
||||
*
|
||||
* 全部在浏览器本地完成;除了用户自己输入的网址,不依赖任何外部服务。
|
||||
*/
|
||||
import JSZip from 'jszip';
|
||||
import * as pdfjs from 'pdfjs-dist';
|
||||
// @ts-ignore —— vite 把 worker 打进本地资源,离线可用(构建不跑 tsc)
|
||||
import PdfWorker from 'pdfjs-dist/build/pdf.worker.mjs?worker';
|
||||
|
||||
export interface ImportedSource {
|
||||
/** 提取到的正文(可能为空串) */
|
||||
text: string;
|
||||
/** 配图(dataURL,可直接给 <img> 和视觉模型用) */
|
||||
images: string[];
|
||||
/** 来源名:文件名或网页标题 */
|
||||
name: string;
|
||||
}
|
||||
|
||||
const DOCX_IMG_OK = /\.(png|jpe?g|gif|webp|bmp)$/i;
|
||||
const PDF_MAX_CHARS = 12000;
|
||||
const PDF_RENDER_PAGES = 4;
|
||||
const GRAB_TIMEOUT = 20000;
|
||||
const MAX_REDIRECTS = 5;
|
||||
/** 网页配图的最低尺寸:低于它的一般是图标 / logo / spacer */
|
||||
const IMG_MIN_W = 160;
|
||||
const IMG_MIN_H = 120;
|
||||
|
||||
/* ---------------- 通用小工具 ---------------- */
|
||||
|
||||
function guessMime(name: string): string {
|
||||
const ext = (name.split('.').pop() || '').toLowerCase();
|
||||
if (ext === 'png') return 'image/png';
|
||||
if (ext === 'jpg' || ext === 'jpeg') return 'image/jpeg';
|
||||
if (ext === 'gif') return 'image/gif';
|
||||
if (ext === 'webp') return 'image/webp';
|
||||
if (ext === 'bmp') return 'image/bmp';
|
||||
return 'application/octet-stream';
|
||||
}
|
||||
|
||||
function blobToDataUrl(blob: Blob): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const fr = new FileReader();
|
||||
fr.onload = () => resolve(String(fr.result || ''));
|
||||
fr.onerror = () => reject(new Error('读取文件失败'));
|
||||
fr.readAsDataURL(blob);
|
||||
});
|
||||
}
|
||||
|
||||
/** 探测图片真实宽高;坏图返回 null */
|
||||
function probeImage(url: string): Promise<{ w: number; h: number } | null> {
|
||||
return new Promise(resolve => {
|
||||
const img = new Image();
|
||||
img.onload = () => resolve({ w: img.naturalWidth, h: img.naturalHeight });
|
||||
img.onerror = () => resolve(null);
|
||||
img.src = url;
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------------- Word (.docx) ---------------- */
|
||||
|
||||
export async function parseDocx(file: File): Promise<ImportedSource> {
|
||||
const zip = await JSZip.loadAsync(file);
|
||||
const entry = zip.file('word/document.xml');
|
||||
if (!entry) {
|
||||
throw new Error('这不是有效的 Word 文档(缺少 word/document.xml),请在 Word 里另存为 .docx 再上传');
|
||||
}
|
||||
const xml = await entry.async('string');
|
||||
const doc = new DOMParser().parseFromString(xml, 'application/xml');
|
||||
|
||||
// 段落:只取最外层 w:p(表格 / 文本框里的嵌套段落不重复计)
|
||||
const isInsideP = (node: Node) => {
|
||||
let p = node.parentNode;
|
||||
while (p) {
|
||||
if (p.nodeName === 'w:p') return true;
|
||||
p = p.parentNode;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const lines: string[] = [];
|
||||
const ps = doc.getElementsByTagName('w:p');
|
||||
for (let i = 0; i < ps.length; i++) {
|
||||
const p = ps[i];
|
||||
if (isInsideP(p)) continue;
|
||||
let line = '';
|
||||
const els = p.getElementsByTagName('*');
|
||||
for (let j = 0; j < els.length; j++) {
|
||||
const el = els[j];
|
||||
if (el.nodeName === 'w:t') line += el.textContent || '';
|
||||
else if (el.nodeName === 'w:tab') line += ' ';
|
||||
else if (el.nodeName === 'w:br' || el.nodeName === 'w:cr') line += '\n';
|
||||
}
|
||||
lines.push(line);
|
||||
}
|
||||
const text = lines
|
||||
.join('\n')
|
||||
.replace(/[ \t]+\n/g, '\n')
|
||||
.replace(/\n{3,}/g, '\n\n')
|
||||
.trim();
|
||||
|
||||
// 内嵌配图:word/media/ 下的常见位图(emf/wmf 等浏览器画不出来的直接跳过)
|
||||
const media: { sortKey: string; f: { async: (t: 'blob') => Promise<Blob> } }[] = [];
|
||||
zip.forEach((path, f) => {
|
||||
if (!f.dir && /^word\/media\//.test(path) && DOCX_IMG_OK.test(path)) {
|
||||
media.push({ sortKey: path.replace(/^word\/media\//, ''), f });
|
||||
}
|
||||
});
|
||||
media.sort((a, b) => a.sortKey.localeCompare(b.sortKey, undefined, { numeric: true }));
|
||||
const images: string[] = [];
|
||||
for (const m of media.slice(0, 8)) {
|
||||
const raw = await m.f.async('blob');
|
||||
const type = (raw.type || '').split(';')[0] || guessMime(m.sortKey);
|
||||
images.push(await blobToDataUrl(new Blob([raw], { type })));
|
||||
}
|
||||
return { text, images, name: file.name };
|
||||
}
|
||||
|
||||
/* ---------------- PDF ---------------- */
|
||||
|
||||
let pdfWorker: Worker | null = null;
|
||||
|
||||
function ensurePdfWorker() {
|
||||
if (!pdfWorker) {
|
||||
pdfWorker = new PdfWorker();
|
||||
(pdfjs as any).GlobalWorkerOptions.workerPort = pdfWorker;
|
||||
}
|
||||
}
|
||||
|
||||
export async function parsePdf(file: File): Promise<ImportedSource> {
|
||||
ensurePdfWorker();
|
||||
const data = new Uint8Array(await file.arrayBuffer());
|
||||
let doc: any;
|
||||
try {
|
||||
doc = await (pdfjs as any).getDocument({ data, isEvalSupported: false }).promise;
|
||||
} catch (e: any) {
|
||||
const msg = `${e?.name || ''} ${e?.message || ''}`;
|
||||
if (/Password/i.test(msg)) throw new Error('PDF 设了密码,请先解除密码再上传');
|
||||
throw new Error('PDF 打不开:' + (e?.message || e));
|
||||
}
|
||||
try {
|
||||
// 文字层:逐页抽取,到上限为止
|
||||
const parts: string[] = [];
|
||||
let total = 0;
|
||||
for (let n = 1; n <= doc.numPages && total < PDF_MAX_CHARS; n++) {
|
||||
const page = await doc.getPage(n);
|
||||
const tc = await page.getTextContent();
|
||||
let buf = '';
|
||||
for (const it of tc.items as any[]) {
|
||||
if (typeof it.str !== 'string') continue;
|
||||
buf += it.str;
|
||||
if (it.hasEOL) buf += '\n';
|
||||
}
|
||||
if (buf.trim()) {
|
||||
parts.push(buf);
|
||||
total += buf.length;
|
||||
}
|
||||
page.cleanup();
|
||||
}
|
||||
const text = parts
|
||||
.join('\n\n')
|
||||
.replace(/\n{3,}/g, '\n\n')
|
||||
.trim();
|
||||
|
||||
// 前几页渲染成图:既是配图来源,也让扫描件(无文字层)可用
|
||||
const images: string[] = [];
|
||||
const renderN = Math.min(PDF_RENDER_PAGES, doc.numPages);
|
||||
for (let n = 1; n <= renderN; n++) {
|
||||
const page = await doc.getPage(n);
|
||||
const base = page.getViewport({ scale: 1 });
|
||||
const vp = page.getViewport({ scale: Math.min(2, 1280 / base.width) });
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = Math.max(1, Math.floor(vp.width));
|
||||
canvas.height = Math.max(1, Math.floor(vp.height));
|
||||
const ctx = canvas.getContext('2d');
|
||||
if (!ctx) break;
|
||||
ctx.fillStyle = '#fff';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
await page.render({ canvasContext: ctx, viewport: vp } as any).promise;
|
||||
images.push(canvas.toDataURL('image/jpeg', 0.85));
|
||||
page.cleanup();
|
||||
}
|
||||
if (!text && !images.length) throw new Error('PDF 里没读到文字和画面,文件可能已损坏');
|
||||
return { text, images, name: file.name };
|
||||
} finally {
|
||||
try {
|
||||
await doc.destroy();
|
||||
} catch (e) {
|
||||
/* 忽略销毁失败 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------- 网址 ---------------- */
|
||||
|
||||
/** 和 nginx /grab/ 的规则保持一致:拒绝本机 / 内网 / 链路本地地址 */
|
||||
function assertFetchable(u: string) {
|
||||
let parsed: URL;
|
||||
try {
|
||||
parsed = new URL(u);
|
||||
} catch {
|
||||
throw new Error('网址格式不对,请输入完整地址(以 http 开头的完整链接)');
|
||||
}
|
||||
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
||||
throw new Error('只支持 http/https 网址');
|
||||
}
|
||||
const h = parsed.hostname.toLowerCase();
|
||||
if (
|
||||
h === 'localhost' ||
|
||||
h === '::1' ||
|
||||
h.endsWith('::1') ||
|
||||
/^(127\.|0\.0\.0\.0|10\.|192\.168\.|169\.254\.|172\.(1[6-9]|2[0-9]|3[01])\.)/.test(h)
|
||||
) {
|
||||
throw new Error('不能抓取本机 / 内网地址');
|
||||
}
|
||||
}
|
||||
|
||||
/** 经 /grab/ 抓取并手动跟随跳转(redirect:manual,跨域跳转也走同源反代) */
|
||||
async function grabRaw(rawUrl: string): Promise<{ res: Response; finalUrl: string }> {
|
||||
let cur = rawUrl;
|
||||
for (let i = 0; i <= MAX_REDIRECTS; i++) {
|
||||
assertFetchable(cur);
|
||||
// 规范化:裸域名自动补默认路径 /(否则反代会把原始请求路径透给上游)、非 ASCII 转百分号编码
|
||||
cur = new URL(cur).href;
|
||||
// 目标放请求头:nginx $arg_ 不解码 encodeURIComponent 的产物,query 传参会被误杀成 400
|
||||
const res = await fetch('/grab/', {
|
||||
headers: { 'X-Grab-Url': cur },
|
||||
redirect: 'manual',
|
||||
signal: AbortSignal.timeout(GRAB_TIMEOUT),
|
||||
});
|
||||
if (res.status >= 300 && res.status < 400) {
|
||||
const loc = res.headers.get('location');
|
||||
if (!loc) throw new Error(`抓取失败(HTTP ${res.status},跳转地址为空)`);
|
||||
cur = new URL(loc, cur).href;
|
||||
continue;
|
||||
}
|
||||
return { res, finalUrl: cur };
|
||||
}
|
||||
throw new Error('网址跳转次数过多');
|
||||
}
|
||||
|
||||
export async function importFromUrl(raw: string): Promise<ImportedSource> {
|
||||
let u = (raw || '').trim();
|
||||
if (!u) throw new Error('请输入网址');
|
||||
if (!/^https?:\/\//i.test(u)) u = 'https://' + u;
|
||||
|
||||
const { res, finalUrl } = await grabRaw(u);
|
||||
if (!res.ok) {
|
||||
const hint = res.status === 401 || res.status === 403 ? ',该站点拒绝了访问' : '';
|
||||
throw new Error(`抓取失败(HTTP ${res.status})${hint}`);
|
||||
}
|
||||
const ct = (res.headers.get('content-type') || '').toLowerCase();
|
||||
|
||||
// 直接就是一张图的地址
|
||||
if (ct.startsWith('image/')) {
|
||||
const blob = await res.blob();
|
||||
const dataUrl = await blobToDataUrl(blob);
|
||||
const dim = await probeImage(dataUrl);
|
||||
if (!dim || dim.w < IMG_MIN_W || dim.h < IMG_MIN_H) throw new Error('图片太小或无法识别');
|
||||
return { text: '', images: [dataUrl], name: new URL(finalUrl).hostname };
|
||||
}
|
||||
if (!/html|xml|text\/plain/.test(ct)) {
|
||||
throw new Error(`这个地址不是网页(返回类型 ${ct.split(';')[0] || '未知'})`);
|
||||
}
|
||||
const html = (await res.text()).slice(0, 3000000);
|
||||
const { title, text, images: candidates } = extractFromHtml(html, finalUrl);
|
||||
|
||||
// 抓配图:同样走 /grab/ 同源反代(图片站大多没有 CORS 头),最多 8 张、并发 4 路
|
||||
const picked: string[] = [];
|
||||
const queue = candidates.slice(0, 20);
|
||||
const grabOne = async () => {
|
||||
while (queue.length && picked.length < 8) {
|
||||
const imgUrl = queue.shift() as string;
|
||||
try {
|
||||
const r = await fetch('/grab/', {
|
||||
headers: { 'X-Grab-Url': new URL(imgUrl).href },
|
||||
signal: AbortSignal.timeout(15000),
|
||||
});
|
||||
if (!r.ok) continue;
|
||||
const type = (r.headers.get('content-type') || '').toLowerCase();
|
||||
if (type && !type.startsWith('image/')) continue;
|
||||
const blob = await r.blob();
|
||||
if (!blob.size || blob.size > 10 * 1024 * 1024) continue;
|
||||
const dataUrl = await blobToDataUrl(blob);
|
||||
const dim = await probeImage(dataUrl);
|
||||
if (!dim || dim.w < IMG_MIN_W || dim.h < IMG_MIN_H) continue;
|
||||
picked.push(dataUrl);
|
||||
} catch {
|
||||
/* 单图失败不影响整体 */
|
||||
}
|
||||
}
|
||||
};
|
||||
await Promise.all([grabOne(), grabOne(), grabOne(), grabOne()]);
|
||||
|
||||
return { text, images: picked, name: title || new URL(finalUrl).hostname };
|
||||
}
|
||||
|
||||
/** 从 HTML 里取标题、正文、图片地址(相对地址转绝对) */
|
||||
export function extractFromHtml(
|
||||
html: string,
|
||||
baseUrl: string,
|
||||
): { title: string; text: string; images: string[] } {
|
||||
const dom = new DOMParser().parseFromString(html, 'text/html');
|
||||
const ogTitle = dom.querySelector('meta[property="og:title"]')?.getAttribute('content');
|
||||
const title = (ogTitle || dom.title || '').trim();
|
||||
|
||||
// 去掉不产生正文的节点
|
||||
dom
|
||||
.querySelectorAll('script,style,noscript,svg,iframe,canvas,form,nav,footer,header,aside,button')
|
||||
.forEach(el => el.remove());
|
||||
|
||||
const root =
|
||||
dom.querySelector('article') ||
|
||||
dom.querySelector('main') ||
|
||||
dom.querySelector('[role="main"]') ||
|
||||
dom.body;
|
||||
|
||||
// 图片:og:image 优先,其次 img 的常见懒加载属性
|
||||
const seen = new Set<string>();
|
||||
const images: string[] = [];
|
||||
const push = (v?: string | null) => {
|
||||
if (!v) return;
|
||||
const s = v.trim();
|
||||
if (!s || s.startsWith('data:') || /^blob:/i.test(s)) return;
|
||||
if (/\.svg(\?|#|$)/i.test(s)) return;
|
||||
let abs: string;
|
||||
try {
|
||||
abs = new URL(s, baseUrl).href;
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
if (!/^https?:/i.test(abs) || seen.has(abs)) return;
|
||||
seen.add(abs);
|
||||
images.push(abs);
|
||||
};
|
||||
push(dom.querySelector('meta[property="og:image"]')?.getAttribute('content'));
|
||||
root.querySelectorAll('img').forEach(img => {
|
||||
push(img.getAttribute('src'));
|
||||
push(img.getAttribute('data-src'));
|
||||
push(img.getAttribute('data-original'));
|
||||
push(img.getAttribute('data-lazy-src'));
|
||||
push(img.getAttribute('data-actualsrc'));
|
||||
});
|
||||
|
||||
// 正文:块级边界补换行后取 textContent,再压掉多余空白
|
||||
const clone = root.cloneNode(true) as HTMLElement;
|
||||
const nl = () => dom.createTextNode('\n');
|
||||
clone
|
||||
.querySelectorAll('p,h1,h2,h3,h4,h5,h6,li,blockquote,pre,td,th,figcaption,tr,div,br')
|
||||
.forEach(el => {
|
||||
el.insertBefore(nl(), el.firstChild);
|
||||
el.appendChild(nl());
|
||||
});
|
||||
const text = (clone.textContent || '')
|
||||
.replace(/\r/g, '')
|
||||
.replace(/[ \t ]+/g, ' ')
|
||||
.split('\n')
|
||||
.map(s => s.trim())
|
||||
.filter((s, i, arr) => s || (i > 0 && arr[i - 1]))
|
||||
.join('\n')
|
||||
.replace(/\n{3,}/g, '\n\n')
|
||||
.trim()
|
||||
.slice(0, 12000);
|
||||
|
||||
return { title, text, images };
|
||||
}
|
||||
|
||||
/* ---------------- 无图兜底:标题封面 ---------------- */
|
||||
|
||||
/** 纯文档 / 纯文字素材没有配图时,本地画一张标题封面,保证时间轴有画面可用 */
|
||||
export function makeTitleCover(title: string): { url: string; w: number; h: number } {
|
||||
const W = 1280;
|
||||
const H = 720;
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = W;
|
||||
canvas.height = H;
|
||||
const ctx = canvas.getContext('2d')!;
|
||||
const grad = ctx.createLinearGradient(0, 0, W, H);
|
||||
grad.addColorStop(0, '#1677ff');
|
||||
grad.addColorStop(0.55, '#597ef7');
|
||||
grad.addColorStop(1, '#722ed1');
|
||||
ctx.fillStyle = grad;
|
||||
ctx.fillRect(0, 0, W, H);
|
||||
ctx.fillStyle = 'rgba(255,255,255,0.08)';
|
||||
ctx.beginPath();
|
||||
ctx.arc(W - 150, 130, 230, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
ctx.beginPath();
|
||||
ctx.arc(110, H - 90, 190, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
|
||||
const raw = (title || 'AI 一键出片').trim().slice(0, 40);
|
||||
const fontSize = raw.length > 24 ? 48 : raw.length > 14 ? 58 : 68;
|
||||
ctx.font = `bold ${fontSize}px "PingFang SC", "Microsoft YaHei", sans-serif`;
|
||||
ctx.fillStyle = '#fff';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
// 中文没有空格,逐字按宽度断行,最多 3 行
|
||||
const maxW = W * 0.82;
|
||||
const lines: string[] = [];
|
||||
let cur = '';
|
||||
for (const ch of raw) {
|
||||
if (ctx.measureText(cur + ch).width > maxW) {
|
||||
lines.push(cur);
|
||||
cur = ch;
|
||||
} else {
|
||||
cur += ch;
|
||||
}
|
||||
}
|
||||
if (cur) lines.push(cur);
|
||||
const use = lines.slice(0, 3);
|
||||
if (lines.length > 3) use[2] = use[2].slice(0, -1) + '…';
|
||||
const lineH = fontSize * 1.35;
|
||||
const startY = H / 2 - ((use.length - 1) * lineH) / 2;
|
||||
use.forEach((ln, i) => ctx.fillText(ln, W / 2, startY + i * lineH));
|
||||
return { url: canvas.toDataURL('image/jpeg', 0.92), w: W, h: H };
|
||||
}
|
||||
@@ -553,6 +553,18 @@
|
||||
resolved "https://registry.npmmirror.com/@icon-park/react/-/react-1.4.2.tgz#db761ebc0e685702b80c4aaf5b59af5ccda40ecc"
|
||||
integrity sha512-+MtQLjNiRuia3fC/NfpSCTIy5KH5b+NkMB9zYd7p3R4aAIK61AjK0OSraaICJdkKooU9jpzk8m0fY4g9A3JqhQ==
|
||||
|
||||
"@isaacs/cliui@^8.0.2":
|
||||
version "8.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550"
|
||||
integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==
|
||||
dependencies:
|
||||
string-width "^5.1.2"
|
||||
string-width-cjs "npm:string-width@^4.2.0"
|
||||
strip-ansi "^7.0.1"
|
||||
strip-ansi-cjs "npm:strip-ansi@^6.0.1"
|
||||
wrap-ansi "^8.1.0"
|
||||
wrap-ansi-cjs "npm:wrap-ansi@^7.0.0"
|
||||
|
||||
"@jridgewell/gen-mapping@^0.3.12", "@jridgewell/gen-mapping@^0.3.5":
|
||||
version "0.3.13"
|
||||
resolved "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz#6342a19f44347518c93e43b1ac69deb3c4656a1f"
|
||||
@@ -1050,6 +1062,78 @@
|
||||
resolved "https://registry.npmmirror.com/@mediapipe/tasks-vision/-/tasks-vision-0.10.35.tgz#ae1ff52d68550e0a4dd971ac6f67ef9aad7f946f"
|
||||
integrity sha512-HOvadwVRE6JC+45nyYhmnywnr5h/J8KZvOeUNVOG9q/0875pZgItznFB9bRTvLc264YSJqiZ1NsIpCStJw/egg==
|
||||
|
||||
"@napi-rs/canvas-android-arm64@0.1.100":
|
||||
version "0.1.100"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/canvas-android-arm64/-/canvas-android-arm64-0.1.100.tgz#b7c68b91d57702a5fc523fa82de72ea741e6766e"
|
||||
integrity sha512-hjhCKhntPv9+t4ckHymdx0phYNcVW+GKQR6Lzw2zE+pOVjOplSmtx9nNNknTjbEDLcuLZqA1y8ufKg1XfgftzQ==
|
||||
|
||||
"@napi-rs/canvas-darwin-arm64@0.1.100":
|
||||
version "0.1.100"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/canvas-darwin-arm64/-/canvas-darwin-arm64-0.1.100.tgz#d1686fa6ca699b07640efa5f45425db0a4e725e2"
|
||||
integrity sha512-2PcswRaC7Ly645DGt88///zuFDhJxJYdKAs1uU3mfk1atYkXufgcgLfBpk6Tm12nCQBaNt1wpybuPZ4qOhTo8A==
|
||||
|
||||
"@napi-rs/canvas-darwin-x64@0.1.100":
|
||||
version "0.1.100"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/canvas-darwin-x64/-/canvas-darwin-x64-0.1.100.tgz#92978fd7eca21f7f1b59bd13ba3ce7c0e7c879a1"
|
||||
integrity sha512-ePNZtj7pNIva/siZMg+HmbeozkIjqUIYdoymH8HaA3qK7LfzFN4WMBM8G6HQ9ZC+H3+Dnn5pqtiXpgLykaPOhw==
|
||||
|
||||
"@napi-rs/canvas-linux-arm-gnueabihf@0.1.100":
|
||||
version "0.1.100"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/canvas-linux-arm-gnueabihf/-/canvas-linux-arm-gnueabihf-0.1.100.tgz#95f9892e1d5a8274871d8ee406374e9ef692bd9f"
|
||||
integrity sha512-d5cDB48oWFGU8/XPhUOFAlySgb/VAu7D+s8fi55K1Pcfg8aPplHWqMgibhVLU8ky7Pyg/fuiVLz4Nf3JrSTuUA==
|
||||
|
||||
"@napi-rs/canvas-linux-arm64-gnu@0.1.100":
|
||||
version "0.1.100"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/canvas-linux-arm64-gnu/-/canvas-linux-arm64-gnu-0.1.100.tgz#6b2b7c4bb016b8f5308115ac9ae909df4967a94b"
|
||||
integrity sha512-rDxgxRu69RvDlX/bh9o22DxLsGr8EqsNgotL9+RwQE1S0b0cqeatqsw6aW45mukm0B42DIAaAacKaYQ8cqS1nw==
|
||||
|
||||
"@napi-rs/canvas-linux-arm64-musl@0.1.100":
|
||||
version "0.1.100"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/canvas-linux-arm64-musl/-/canvas-linux-arm64-musl-0.1.100.tgz#48cf6342543e4f87cf1f8e9b1aaa19ad85bcc178"
|
||||
integrity sha512-K3mDW66N+xT2/V439u1alFANiBUjdEx2gLiNYnCmUsva5jZMxWTjafBYwTzYK+EMFMHrUoabuU+T1BIP5CgbYQ==
|
||||
|
||||
"@napi-rs/canvas-linux-riscv64-gnu@0.1.100":
|
||||
version "0.1.100"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/canvas-linux-riscv64-gnu/-/canvas-linux-riscv64-gnu-0.1.100.tgz#71b011007b03755c834a961735302c5837b041da"
|
||||
integrity sha512-mooqUBTIsccZpnoQC4NgrC1v6C1vof39etLNMnBwCY+p0gajWJvAHLGQ6g/gGyS5YrpDW+GefSN4+Cvcr08UWw==
|
||||
|
||||
"@napi-rs/canvas-linux-x64-gnu@0.1.100":
|
||||
version "0.1.100"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/canvas-linux-x64-gnu/-/canvas-linux-x64-gnu-0.1.100.tgz#3f479d3b8b8c4658e5dec1b943ad7d2eefd2811f"
|
||||
integrity sha512-1eCvkDCazm7FFhsT7DfGOdSaHgZVK3bt/dSBl5EWHOWmnz+I7j8tPseJqqD81NF+MH21jKUK4wQSDjN0mdhnTg==
|
||||
|
||||
"@napi-rs/canvas-linux-x64-musl@0.1.100":
|
||||
version "0.1.100"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/canvas-linux-x64-musl/-/canvas-linux-x64-musl-0.1.100.tgz#1beaca22c1fe97709a9c287115cb3c90194ddec6"
|
||||
integrity sha512-20arT6lnI19S68qNlii73TSEDbECNgzMz2EpldC1V3mZFuRkeujXkcebRk0LRJe9SEUAooYiLokfMViY8IX7yA==
|
||||
|
||||
"@napi-rs/canvas-win32-arm64-msvc@0.1.100":
|
||||
version "0.1.100"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/canvas-win32-arm64-msvc/-/canvas-win32-arm64-msvc-0.1.100.tgz#8a1728b455dd17965f95c0bfdf6753be8c5851c0"
|
||||
integrity sha512-DZFFT1wIAg37LJw37yhMRFfjATd3vTQzjZ1Yki8u2vhO6Hi5VE6BVaGQ1aaDu7xb4iMErz+9EOwjpS7xcxFeBw==
|
||||
|
||||
"@napi-rs/canvas-win32-x64-msvc@0.1.100":
|
||||
version "0.1.100"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/canvas-win32-x64-msvc/-/canvas-win32-x64-msvc-0.1.100.tgz#1e52883f8784ffdbe52dc2d47b05a0886aa6e9cf"
|
||||
integrity sha512-MyT1j3mHC2+Lu4pBi9mKyMJhtP6U7k7EldY7sj/uS5gJA65gTXt8MefJQXLJo5d/vZbuWmfxzkEUNc/urV3pHA==
|
||||
|
||||
"@napi-rs/canvas@^0.1.65":
|
||||
version "0.1.100"
|
||||
resolved "https://registry.yarnpkg.com/@napi-rs/canvas/-/canvas-0.1.100.tgz#2c89a15c28a62e1372be23fd474762ae1a8b16b7"
|
||||
integrity sha512-xglYA6q3XO5P3BNJYxVZ1IV7DLVjp1Py6nwag88YntrS+3vKHyYcMqXVS4ZztJmwz2uGvz1FWhI/4LgbR5uQDA==
|
||||
optionalDependencies:
|
||||
"@napi-rs/canvas-android-arm64" "0.1.100"
|
||||
"@napi-rs/canvas-darwin-arm64" "0.1.100"
|
||||
"@napi-rs/canvas-darwin-x64" "0.1.100"
|
||||
"@napi-rs/canvas-linux-arm-gnueabihf" "0.1.100"
|
||||
"@napi-rs/canvas-linux-arm64-gnu" "0.1.100"
|
||||
"@napi-rs/canvas-linux-arm64-musl" "0.1.100"
|
||||
"@napi-rs/canvas-linux-riscv64-gnu" "0.1.100"
|
||||
"@napi-rs/canvas-linux-x64-gnu" "0.1.100"
|
||||
"@napi-rs/canvas-linux-x64-musl" "0.1.100"
|
||||
"@napi-rs/canvas-win32-arm64-msvc" "0.1.100"
|
||||
"@napi-rs/canvas-win32-x64-msvc" "0.1.100"
|
||||
|
||||
"@pixi/accessibility@7.4.3":
|
||||
version "7.4.3"
|
||||
resolved "https://registry.npmmirror.com/@pixi/accessibility/-/accessibility-7.4.3.tgz#59d14a9886e853d4a469cf3d4256cb8e8ab9280d"
|
||||
@@ -1448,6 +1532,11 @@
|
||||
eventemitter3 "^4.0.0"
|
||||
url "^0.11.0"
|
||||
|
||||
"@pkgjs/parseargs@^0.11.0":
|
||||
version "0.11.0"
|
||||
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
|
||||
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
|
||||
|
||||
"@rolldown/pluginutils@1.0.0-beta.27":
|
||||
version "1.0.0-beta.27"
|
||||
resolved "https://registry.npmmirror.com/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz#47d2bf4cef6d470b22f5831b420f8964e0bf755f"
|
||||
@@ -2278,7 +2367,7 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0:
|
||||
dependencies:
|
||||
color-convert "^2.0.1"
|
||||
|
||||
ansi-styles@^6.0.0:
|
||||
ansi-styles@^6.0.0, ansi-styles@^6.1.0:
|
||||
version "6.2.3"
|
||||
resolved "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-6.2.3.tgz#c044d5dcc521a076413472597a1acb1f103c4041"
|
||||
integrity sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==
|
||||
@@ -2377,6 +2466,13 @@ brace-expansion@^2.0.1:
|
||||
dependencies:
|
||||
balanced-match "^1.0.0"
|
||||
|
||||
brace-expansion@^2.0.2:
|
||||
version "2.1.7"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.1.7.tgz#14ea3836731823bb24740225ea43b941b436f9d1"
|
||||
integrity sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==
|
||||
dependencies:
|
||||
balanced-match "^1.0.0"
|
||||
|
||||
braces@^3.0.3:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.npmmirror.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
|
||||
@@ -2634,7 +2730,7 @@ cropperjs@^1.5.13:
|
||||
resolved "https://registry.npmmirror.com/cropperjs/-/cropperjs-1.6.3.tgz#9556a39e3896f5dfa4b5b2649931454f631e9558"
|
||||
integrity sha512-BRb0PRIzjbfM5n+i6L2D85pSbXI/w6cnnwb9W9cRKgAmbiP+OjDeq+Irhd86IujZDXm/7JWECfscllFIdrlmfw==
|
||||
|
||||
cross-spawn@^7.0.3:
|
||||
cross-spawn@^7.0.3, cross-spawn@^7.0.6:
|
||||
version "7.0.6"
|
||||
resolved "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f"
|
||||
integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==
|
||||
@@ -3063,6 +3159,14 @@ follow-redirects@^1.0.0, follow-redirects@^1.14.4:
|
||||
resolved "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.16.0.tgz#28474a159d3b9d11ef62050a14ed60e4df6d61bc"
|
||||
integrity sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==
|
||||
|
||||
foreground-child@^3.1.0:
|
||||
version "3.3.1"
|
||||
resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f"
|
||||
integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==
|
||||
dependencies:
|
||||
cross-spawn "^7.0.6"
|
||||
signal-exit "^4.0.1"
|
||||
|
||||
form-data@^4.0.0:
|
||||
version "4.0.6"
|
||||
resolved "https://registry.npmmirror.com/form-data/-/form-data-4.0.6.tgz#28e864e1b786dbebb68db1f452f9635278665827"
|
||||
@@ -3158,6 +3262,18 @@ gl-transitions@^1.43.0:
|
||||
resolved "https://registry.npmmirror.com/gl-transitions/-/gl-transitions-1.71.0.tgz#f4454896100eadba6aadd9b73980d083e9aed93b"
|
||||
integrity sha512-fpCpeT5B0vQOAu1/XuTmOIWD3dJoMIuedmYdPqK/oGHMz8vexJzsCXVo8TQZVo7G2irAYhdhq+9wWtohj/IjZQ==
|
||||
|
||||
glob@^10.3.7:
|
||||
version "10.5.0"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-10.5.0.tgz#8ec0355919cd3338c28428a23d4f24ecc5fe738c"
|
||||
integrity sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==
|
||||
dependencies:
|
||||
foreground-child "^3.1.0"
|
||||
jackspeak "^3.1.2"
|
||||
minimatch "^9.0.4"
|
||||
minipass "^7.1.2"
|
||||
package-json-from-dist "^1.0.0"
|
||||
path-scurry "^1.11.1"
|
||||
|
||||
glob@^7.1.6:
|
||||
version "7.2.3"
|
||||
resolved "https://registry.npmmirror.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
|
||||
@@ -3496,6 +3612,15 @@ ismobilejs@^1.1.0:
|
||||
resolved "https://registry.npmmirror.com/ismobilejs/-/ismobilejs-1.1.1.tgz#c56ca0ae8e52b24ca0f22ba5ef3215a2ddbbaa0e"
|
||||
integrity sha512-VaFW53yt8QO61k2WJui0dHf4SlL8lxBofUuUmwBo0ljPk0Drz2TiuDW4jo3wDcv41qy/SxrJ+VAzJ/qYqsmzRw==
|
||||
|
||||
jackspeak@^3.1.2:
|
||||
version "3.4.3"
|
||||
resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a"
|
||||
integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==
|
||||
dependencies:
|
||||
"@isaacs/cliui" "^8.0.2"
|
||||
optionalDependencies:
|
||||
"@pkgjs/parseargs" "^0.11.0"
|
||||
|
||||
jest-worker@^26.2.1:
|
||||
version "26.6.2"
|
||||
resolved "https://registry.npmmirror.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed"
|
||||
@@ -3772,6 +3897,11 @@ lower-case@^2.0.2:
|
||||
dependencies:
|
||||
tslib "^2.0.3"
|
||||
|
||||
lru-cache@^10.2.0:
|
||||
version "10.4.3"
|
||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119"
|
||||
integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==
|
||||
|
||||
lru-cache@^5.1.1:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.npmmirror.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"
|
||||
@@ -4426,6 +4556,18 @@ minimatch@^5.0.1:
|
||||
dependencies:
|
||||
brace-expansion "^2.0.1"
|
||||
|
||||
minimatch@^9.0.4:
|
||||
version "9.0.9"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.9.tgz#9b0cb9fcb78087f6fd7eababe2511c4d3d60574e"
|
||||
integrity sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==
|
||||
dependencies:
|
||||
brace-expansion "^2.0.2"
|
||||
|
||||
"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2:
|
||||
version "7.1.3"
|
||||
resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.3.tgz#79389b4eb1bb2d003a9bba87d492f2bd37bdc65b"
|
||||
integrity sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==
|
||||
|
||||
mobx-react-lite@^2.2.0:
|
||||
version "2.2.2"
|
||||
resolved "https://registry.npmmirror.com/mobx-react-lite/-/mobx-react-lite-2.2.2.tgz#87c217dc72b4e47b22493daf155daf3759f868a6"
|
||||
@@ -4616,6 +4758,11 @@ p-try@^2.0.0:
|
||||
resolved "https://registry.npmmirror.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
|
||||
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
|
||||
|
||||
package-json-from-dist@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505"
|
||||
integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==
|
||||
|
||||
pako@~1.0.2:
|
||||
version "1.0.11"
|
||||
resolved "https://registry.npmmirror.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
|
||||
@@ -4677,6 +4824,14 @@ path-key@^3.0.0, path-key@^3.1.0:
|
||||
resolved "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
|
||||
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
|
||||
|
||||
path-scurry@^1.11.1:
|
||||
version "1.11.1"
|
||||
resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2"
|
||||
integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==
|
||||
dependencies:
|
||||
lru-cache "^10.2.0"
|
||||
minipass "^5.0.0 || ^6.0.2 || ^7.0.0"
|
||||
|
||||
path-to-regexp@^1.7.0:
|
||||
version "1.9.0"
|
||||
resolved "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-1.9.0.tgz#5dc0753acbf8521ca2e0f137b4578b917b10cf24"
|
||||
@@ -4684,6 +4839,13 @@ path-to-regexp@^1.7.0:
|
||||
dependencies:
|
||||
isarray "0.0.1"
|
||||
|
||||
pdfjs-dist@^4.7.76:
|
||||
version "4.10.38"
|
||||
resolved "https://registry.yarnpkg.com/pdfjs-dist/-/pdfjs-dist-4.10.38.tgz#3ee698003790dc266cc8b55c0e662ccb9ae18f53"
|
||||
integrity sha512-/Y3fcFrXEAsMjJXeL9J8+ZG9U01LbuWaYypvDW2ycW1jL269L3js3DVBjDJ0Up9Np1uqDXsDrRihHANhZOlwdQ==
|
||||
optionalDependencies:
|
||||
"@napi-rs/canvas" "^0.1.65"
|
||||
|
||||
picocolors@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
|
||||
@@ -5341,6 +5503,13 @@ rfdc@^1.3.0:
|
||||
resolved "https://registry.npmmirror.com/rfdc/-/rfdc-1.4.1.tgz#778f76c4fb731d93414e8f925fbecf64cce7f6ca"
|
||||
integrity sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==
|
||||
|
||||
rimraf@^5.0.5:
|
||||
version "5.0.10"
|
||||
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-5.0.10.tgz#23b9843d3dc92db71f96e1a2ce92e39fd2a8221c"
|
||||
integrity sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==
|
||||
dependencies:
|
||||
glob "^10.3.7"
|
||||
|
||||
rollup-plugin-node-externals@^6.1.1:
|
||||
version "6.1.2"
|
||||
resolved "https://registry.npmmirror.com/rollup-plugin-node-externals/-/rollup-plugin-node-externals-6.1.2.tgz#c328b86a00f3e0211a3bad2e0616e2ff1fa55b6c"
|
||||
@@ -5531,6 +5700,11 @@ signal-exit@^3.0.2, signal-exit@^3.0.3:
|
||||
resolved "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
|
||||
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
|
||||
|
||||
signal-exit@^4.0.1:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04"
|
||||
integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==
|
||||
|
||||
simple-query-string@^1.3.2:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.npmmirror.com/simple-query-string/-/simple-query-string-1.3.2.tgz#3edc2c94280f7a878fa5a4de1898f8c9c0af39a7"
|
||||
@@ -5617,6 +5791,15 @@ string-argv@^0.3.1:
|
||||
resolved "https://registry.npmmirror.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6"
|
||||
integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==
|
||||
|
||||
"string-width-cjs@npm:string-width@^4.2.0":
|
||||
version "4.2.3"
|
||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||
dependencies:
|
||||
emoji-regex "^8.0.0"
|
||||
is-fullwidth-code-point "^3.0.0"
|
||||
strip-ansi "^6.0.1"
|
||||
|
||||
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
|
||||
version "4.2.3"
|
||||
resolved "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||
@@ -5626,7 +5809,7 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
|
||||
is-fullwidth-code-point "^3.0.0"
|
||||
strip-ansi "^6.0.1"
|
||||
|
||||
string-width@^5.0.0:
|
||||
string-width@^5.0.0, string-width@^5.0.1, string-width@^5.1.2:
|
||||
version "5.1.2"
|
||||
resolved "https://registry.npmmirror.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
|
||||
integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==
|
||||
@@ -5650,6 +5833,13 @@ stringify-entities@^4.0.0:
|
||||
character-entities-html4 "^2.0.0"
|
||||
character-entities-legacy "^3.0.0"
|
||||
|
||||
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||
dependencies:
|
||||
ansi-regex "^5.0.1"
|
||||
|
||||
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||
version "6.0.1"
|
||||
resolved "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||
@@ -5717,7 +5907,7 @@ symbol-tree@^3.2.4:
|
||||
resolved "https://registry.npmmirror.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
|
||||
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==
|
||||
|
||||
terser@^5.0.0:
|
||||
terser@^5.0.0, terser@^5.31.0:
|
||||
version "5.51.2"
|
||||
resolved "https://registry.npmmirror.com/terser/-/terser-5.51.2.tgz#555912425a7f2ff7737425c3718fa76c7069f6ef"
|
||||
integrity sha512-bWnjSNscmuI+GJze6ZupnHP8G/cTcsJF+bXCeQknk2SHQsgbNJnLrqiH9jZ2W4STPVXH2mDKKRX3iwPhc9Cn/Q==
|
||||
@@ -6052,6 +6242,15 @@ word@~0.3.0:
|
||||
resolved "https://registry.npmmirror.com/word/-/word-0.3.0.tgz#8542157e4f8e849f4a363a288992d47612db9961"
|
||||
integrity sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==
|
||||
|
||||
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
|
||||
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
|
||||
dependencies:
|
||||
ansi-styles "^4.0.0"
|
||||
string-width "^4.1.0"
|
||||
strip-ansi "^6.0.0"
|
||||
|
||||
wrap-ansi@^6.2.0:
|
||||
version "6.2.0"
|
||||
resolved "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53"
|
||||
@@ -6070,6 +6269,15 @@ wrap-ansi@^7.0.0:
|
||||
string-width "^4.1.0"
|
||||
strip-ansi "^6.0.0"
|
||||
|
||||
wrap-ansi@^8.1.0:
|
||||
version "8.1.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
|
||||
integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==
|
||||
dependencies:
|
||||
ansi-styles "^6.1.0"
|
||||
string-width "^5.0.1"
|
||||
strip-ansi "^7.0.1"
|
||||
|
||||
wrappy@1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||
|
||||
Reference in new issue
Block a user