本地化改造:免登录 + 本机 AI + 离线可用
在上游 gitee.com/676015863/unicut 基础上做的自托管改造,使其可脱离官方账号体系 与 CDN 独立运行。详见 CHANGELOG.md。 主要能力 - 免登录:GUEST_USER 直接使用核心功能,checkAuth 不再拦截 - 本机 AI:对话 mimo-v2.6-flash(同源 /newapi/v1)、视觉 deepseek-v4-flash-vision-exp、 生图 /omniai、生视频 /civideo;密钥仅存服务端(nginx 占位符 + entrypoint 注入) - AI 一键出片:图片+标题 → AI 文案 → 人声/语速/情绪 → 确认生成直接排时间轴, 并支持转场、图片运镜、字幕位置/大小/配色/入场动画 - 离线可用:工程数据 IndexedDB + 项目文件 JSON 双写;官方素材走同源 /cdn/ 反代; 无 OPFS 时素材回落 IndexedDB files 表 修复 - 账号类接口本地短路,不再反复弹「Header parameter [authorization] cannot be empty」 - isFSApiSupported 改取值判断,修 OPFS 判定错误导致卡在文件夹引导页 - 模板素材统一 /cdn/ 改写 + nginx 兜底转发,修缩略图全裂 - 剔除素材已失效的模板(上游 CDN 已删,点开必卡 loading 50%) - 补齐 SDK 内置 4 张滤镜贴图,修画布卡 loading 0% - 封面上传失败不再中断整次保存 品牌与页面 - 「云剪」改为 UniCut - 首页删除收费标准栏目;顶部菜单移除 GitHub/Gitee;底部栏整体下线 安全 - .env 与 public/local-ai.json(含密钥)已在 .gitignore,不入库 - public/local-ai.json.example 仅含占位符
No files matched your search
@@ -22,3 +22,13 @@ ssh
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# 本机 AI 接入配置(含密钥,勿提交)
|
||||
public/local-ai.json
|
||||
.env
|
||||
|
||||
# 数据质量检查的生成报告(每次运行都会变,不入库)
|
||||
data-quality/reports/
|
||||
|
||||
__pycache__/
|
||||
*.pyc
|
||||
@@ -0,0 +1,69 @@
|
||||
# 更新日志
|
||||
|
||||
本项目在 `gitee.com/676015863/unicut` 基础上做了本地化改造,使其可在自托管环境离线使用。
|
||||
|
||||
---
|
||||
|
||||
## 2026-10-26
|
||||
|
||||
### ✨ 新功能
|
||||
|
||||
**免登录使用**
|
||||
- 核心功能(编辑、模板、素材、导出、保存)全部免登录,`GUEST_USER` 直接进入
|
||||
- 移除登录态拦截,`checkAuth()` 不再阻断编辑器
|
||||
|
||||
**本机 AI 接入**
|
||||
- AI 对话主模型 `mimo-v2.6-flash`,走同源 `/newapi/v1` 反代,HTTPS 页面不触发混合内容拦截
|
||||
- 视觉模型 `deepseek-v4-flash-vision-exp`,备用 `glm-5.3-flash` / `deepseek-v4-flash`
|
||||
- AI 生图走 `/omniai`(本机 omniroute),AI 生视频走 `/civideo`(直连 cheaperinference,绕开网关视频白名单)
|
||||
- 密钥全部留在服务端:nginx 占位符由 `entrypoint.sh` 注入,前端与仓库均不出现明文
|
||||
|
||||
**AI 一键出片**
|
||||
- 四步向导:添加图片 + 标题 → AI 识别图片生成口播文案 → 配人声/语速/情绪试听 → 确认生成直接排入时间轴
|
||||
- 13 种中文音色(含四川话/粤语/台湾腔等方言),支持单段重合成或一键全部合成
|
||||
- 画面效果面板(生成前可调):
|
||||
- 图片转场 9 选(自动轮换 / 交叉缩放 / 推进穿门 / 水波涟漪 / 左侧擦除 / 立方翻转 / 柔和溶解 / 平滑缩放),转场名取自官方 GL-Transitions 素材库共 28 个
|
||||
- 图片动效 4 选(缓慢推近 / 缓慢拉远 / 左右平移 / 静止),基于元素关键帧 `frames` 做几何插值
|
||||
- 字幕位置(底部/居中/顶部)、大小(60%–200%)、配色(黄/白/橙 + 描边)、入场动画(放大弹入 / 淡入 / 放大+淡入)
|
||||
- AI 面板顶部常驻高亮入口卡,切到其他页签也始终可见,点卡片直达向导
|
||||
|
||||
**离线可用**
|
||||
- 工程数据双写:IndexedDB + 项目文件夹 `projects/<appId>.json`,IndexedDB 查不到时从文件读回
|
||||
- 素材上传在无 OPFS 目录句柄时(如以 `http://IP` 打开)回落到 IndexedDB `files` 表,整条「上传 → 加入时间轴 → 导出」链路仍可用
|
||||
- 官方素材统一走同源 `/cdn/` 反代,浏览器不再直连 CDN
|
||||
|
||||
### 🐛 修复
|
||||
|
||||
**账号类接口反复弹窗**
|
||||
- 现象:每隔数秒弹 `Header parameter [authorization] cannot be empty`
|
||||
- 根因:`/api/`、`/cgi-bin/` 反代到官方后端,其中 `/user/*`、`/account/*` 必须登录 token;自动保存每 10 秒触发一次,每次都失败
|
||||
- 修复:`BasicService._request()` 对账号类接口本地短路返回空成功结果,不发请求;保存与作品列表的本地分支判据由 OPFS 放宽为 IndexedDB(`canUseLocalSave()`)
|
||||
|
||||
**OPFS 判定错误导致卡在引导页**
|
||||
- 现象:页面停在「选择本地存储文件夹」弹窗,编辑器进不去
|
||||
- 根因:`isFSApiSupported()` 使用 `'showDirectoryPicker' in window`,`in` 只要属性名存在于原型链就为真
|
||||
- 修复:改为取值判断 `typeof window.showDirectoryPicker === 'function'`
|
||||
|
||||
**模板缩略图全部裂图**
|
||||
- 现象:模板面板列表能加载,但 26 张缩略图全裂
|
||||
- 根因:列表接口返回 `/video/…` 相对路径,同源取被 nginx `try_files` 兜底伪装成 `200 text/html` 的 SPA 首页
|
||||
- 修复:前端改写到 `/cdn/` 反代;nginx 增加 `location ~ ^/(video|video_business)/` 兜底直接转发 CDN,即使前端改写丢失也不会再裂图
|
||||
|
||||
**模板素材已失效**
|
||||
- 列表首位模板的 mp4 在上游 CDN 已删除(所有前缀均 404),点开必然卡在 loading 50%
|
||||
- 修复:`DEAD_TEMPLATE_IDS` 黑名单剔除,素材存活已逐个探测(24 好 1 坏)
|
||||
|
||||
**画布卡在 loading 0%**
|
||||
- 根因:`resourcesHost` 改同源后,SDK 内置 4 张滤镜贴图(overlay / colormap / displacement_map / lightmap)在容器镜像中缺失,加载失败导致后续流程不执行
|
||||
- 修复:补齐 4 张贴图资源
|
||||
|
||||
**封面上传失败导致整次保存失败**
|
||||
- 修复:`saveApp()` 中封面上传包 try/catch,失败只跳过封面,不影响工程保存
|
||||
|
||||
### 🎨 调整
|
||||
|
||||
- 品牌由「云剪」改为 **UniCut**
|
||||
- 首页删除「收费标准」栏目(含相关样式与死代码)
|
||||
- 顶部菜单栏移除 GitHub / Gitee 外链
|
||||
- 底部栏整体下线(`Footer` 返回 `null`,组件保留以便随时恢复)
|
||||
- 首页页脚版权、导航、支持链接、联系方式、二维码全部移除
|
||||
@@ -0,0 +1,17 @@
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
ENV NPM_CONFIG_REGISTRY=https://registry.npmmirror.com
|
||||
ENV NODE_OPTIONS=--max-old-space-size=4096
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn install
|
||||
COPY . .
|
||||
RUN yarn build
|
||||
|
||||
FROM nginx:1.27-alpine
|
||||
RUN apk add --no-cache openssl
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
EXPOSE 80 443
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
@@ -0,0 +1,507 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
00_lint_dist.py — UniCut 站点 dist 产物静态 lint(断网可用检查)
|
||||
|
||||
对构建产物做全量静态扫描,回答三个问题:
|
||||
1. 还有哪些外部 URL?(按 host 聚合 + file:line 明细,区分「会真发起请求」与
|
||||
「只是字符串/命名空间/文档」)
|
||||
2. 懒加载 chunk 的 import 指向哪里?有没有指向外域的 chunk?
|
||||
3. 音视频 / 字体 / SDK 的引用位置与当前取值是什么?本地文件是否齐全?
|
||||
|
||||
用法:
|
||||
python3 data-quality/scripts/site/00_lint_dist.py [--dist dist] [--out 报告.md]
|
||||
[--json 报告.json] [--no-fail]
|
||||
|
||||
退出码:外部网络引用(external_refs)为 0 时 0,否则 1(--no-fail 时恒 0)。
|
||||
报告里的「不可消除项」= external_ref_allowlist.txt 里登记的、位于第三方压缩产物内部、
|
||||
无法在不改动 vendored 代码的前提下删除的字符串,每条都带原因。
|
||||
"""
|
||||
import argparse
|
||||
import bisect
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
from collections import Counter, defaultdict
|
||||
from urllib.parse import urlparse
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
REPO = os.path.dirname(os.path.dirname(os.path.dirname(HERE)))
|
||||
ALLOWLIST = os.path.join(HERE, 'external_ref_allowlist.txt')
|
||||
|
||||
# 二进制扩展名:直接跳过(不解码扫描)
|
||||
BIN_EXT = {
|
||||
'.png', '.jpg', '.jpeg', '.gif', '.webp', '.ico', '.bmp', '.avif', '.mp4', '.webm',
|
||||
'.mov', '.m4v', '.mp3', '.m4a', '.aac', '.wav', '.ogg', '.flac', '.woff', '.woff2',
|
||||
'.ttf', '.otf', '.eot', '.wasm', '.data', '.bin', '.onnx', '.tflite', '.task',
|
||||
'.glb', '.gltf', '.zip', '.gz', '.br', '.pak', '.db', '.ico',
|
||||
}
|
||||
TEXT_EXT = {
|
||||
'.html', '.htm', '.js', '.mjs', '.cjs', '.css', '.less', '.json', '.svg', '.txt',
|
||||
'.md', '.webmanifest', '.map', '.xml', '.ts', '.tsx', '.conf', '.csv',
|
||||
}
|
||||
# 少量无扩展名但其实是文本的文件
|
||||
TEXT_NAMES = {'LICENSE', 'README', 'Makefile', 'CNAME', '.well-known'}
|
||||
|
||||
# 会真发起网络请求才算「外部依赖」的已知远程域(无 scheme 命中也算)
|
||||
KNOWN_HOST_RE = None # main() 里编译
|
||||
|
||||
KNOWN_REMOTE_HOSTS = [
|
||||
'esm.video.h5ds.com', 'esm-debug.video.h5ds.com', # video-core-sdk 远程 CDN 前缀
|
||||
'audio01.h5ds.com', 'qkgzjp.h5ds.com', # 远程音频域
|
||||
'cdn.h5ds.com', 'video.h5ds.com', 'fvideo.h5ds.com', 'videomix.h5ds.com',
|
||||
'water.i.h5ds.com', 'lf3-static.bytednsdoc.com', 'byteblacksmith.com',
|
||||
'unpkg.com', 'cdn.jsdelivr.net', 'registry.npmmirror.com', 'cdnjs.cloudflare.com',
|
||||
'fonts.googleapis.com', 'fonts.gstatic.com', 'map.qq.com', 'apis.map.qq.com',
|
||||
'player.bilibili.com', 'player.vimeo.com', 'www.youtube.com',
|
||||
]
|
||||
|
||||
URL_RE = re.compile(r'https?://[^\s"\'`<>()\[\]{}\\,;]+')
|
||||
# 字面量里带 scheme 的资源引用(含模板字符串里的完整地址)
|
||||
ASSET_URL_RE = re.compile(
|
||||
r'(?<![\w$./@:\-])[\w$./@\-]{1,300}\.(?:mp3|m4a|aac|wav|ogg|mp4|webm|mov|m4v|jpg|jpeg|png|gif|webp|svg|ico|'
|
||||
r'woff2?|ttf|otf|eot|wasm|task|onnx|tflite|json|js|css|lottie)(?:\?[^\s"\'`]*)?')
|
||||
IMPORT_RE = re.compile(r'import\(\s*["\'`]([^"\'`]+)["\'`]\s*\)')
|
||||
WORKER_RE = re.compile(r'new\s+Worker\(\s*["\'`]([^"\'`]+)["\'`]')
|
||||
|
||||
MEDIA_FONT_EXT = {
|
||||
'mp3', 'm4a', 'aac', 'wav', 'ogg', 'mp4', 'webm', 'mov', 'm4v',
|
||||
'woff', 'woff2', 'ttf', 'otf', 'eot', 'wasm', 'task', 'onnx', 'tflite',
|
||||
}
|
||||
SDK_MARKERS = ('video-core-sdk', 'ffmpeg', 'tesseract', 'ort.', 'mediapipe', 'effectcanvas',
|
||||
'lame', 'medianinfo', 'mp4box', 'opencv', 'onnxruntime')
|
||||
|
||||
|
||||
def is_probably_text(path):
|
||||
ext = os.path.splitext(path)[1].lower()
|
||||
if ext in BIN_EXT:
|
||||
return False
|
||||
if ext in TEXT_EXT or os.path.basename(path) in TEXT_NAMES:
|
||||
return True
|
||||
if ext:
|
||||
return False
|
||||
try:
|
||||
with open(path, 'rb') as f:
|
||||
head = f.read(4096)
|
||||
return b'\x00' not in head
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def load_allowlist():
|
||||
"""每行:regex<TAB>类别<TAB>原因"""
|
||||
rules = []
|
||||
if not os.path.exists(ALLOWLIST):
|
||||
return rules
|
||||
for raw in open(ALLOWURLS_FILE if False else ALLOWLIST, encoding='utf-8'):
|
||||
line = raw.strip()
|
||||
if not line or line.startswith('#'):
|
||||
continue
|
||||
parts = line.split('\t')
|
||||
if len(parts) < 3:
|
||||
continue
|
||||
try:
|
||||
rules.append((re.compile(parts[0]), parts[1], parts[2]))
|
||||
except re.error:
|
||||
print('[warn] allowlist 正则无效:', parts[0], file=sys.stderr)
|
||||
return rules
|
||||
|
||||
|
||||
NAMESPACE_HOSTS = {'www.w3.org', 'purl.org', 'schemas.openxmlformats.org', 'www.opengis.net'}
|
||||
DOC_EXT = {'.md', '.map', '.txt'}
|
||||
|
||||
|
||||
def ext_of(relpath):
|
||||
return os.path.splitext(relpath)[1].lower()
|
||||
|
||||
|
||||
def classify(url, relpath, allow_rules):
|
||||
"""返回 (category, reason)。category ∈ namespace|local|lan|doc|sourcemap|allow|net"""
|
||||
try:
|
||||
host = urlparse(url).netloc.lower().split('@')[-1].split(':')[0]
|
||||
except Exception:
|
||||
host = ''
|
||||
ext = os.path.splitext(relpath)[1].lower()
|
||||
|
||||
if host in NAMESPACE_HOSTS:
|
||||
return 'namespace', 'XML/SVG 命名空间 URI,浏览器不发起请求'
|
||||
if host in ('localhost', '127.0.0.1', '0.0.0.0', '::1', '[::1]'):
|
||||
if os.path.splitext(relpath)[1].lower() in DOC_EXT:
|
||||
return 'doc', '文档里写的本机示例地址,不会发起请求'
|
||||
return 'local', '本机地址(残留的开发期配置)'
|
||||
if re.match(r'^(192\.168\.\d+|10\.\d+|172\.(1[6-9]|2\d|3[01])|169\.254)\.\d+$', host):
|
||||
return 'lan', '内网地址,仍会发起网络请求'
|
||||
if ext in DOC_EXT:
|
||||
return 'doc', '文档/Source Map 文件'
|
||||
if relpath in ('stats.html',) or relpath.endswith('/stats.html'):
|
||||
return 'sourcemap', 'rollup 可视化报告,不被页面引用'
|
||||
for rx, cat, reason in allow_rules:
|
||||
if rx.search(url):
|
||||
return cat, reason
|
||||
return 'net', '未登记的外部 URL'
|
||||
|
||||
|
||||
class LineIndex:
|
||||
"""O(log n) 行号查询:大体积压缩产物(单行几 MB 的 JS)上避免 O(n^2)。"""
|
||||
|
||||
def __init__(self, text):
|
||||
self.nl = [m.start() for m in re.finditer('\n', text)]
|
||||
|
||||
def line(self, pos):
|
||||
return bisect.bisect_right(self.nl, pos) + 1
|
||||
|
||||
|
||||
def line_of(text, pos):
|
||||
return text.count('\n', 0, pos) + 1
|
||||
|
||||
|
||||
def snippet(text, pos, width=70):
|
||||
a, b = max(0, pos - width), min(len(text), pos + width)
|
||||
return text[a:b].replace('\n', '\\n')
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument('--dist', default=os.path.join(REPO, 'dist'))
|
||||
ap.add_argument('--out', default=None)
|
||||
ap.add_argument('--json', dest='json_out', default=None)
|
||||
ap.add_argument('--no-fail', action='store_true')
|
||||
ap.add_argument('--max-rows', type=int, default=200)
|
||||
args = ap.parse_args()
|
||||
|
||||
dist = os.path.abspath(args.dist)
|
||||
if not os.path.isdir(dist):
|
||||
print('dist 不存在:', dist, file=sys.stderr)
|
||||
return 2
|
||||
|
||||
t0 = time.time()
|
||||
allow_rules = load_allowlist()
|
||||
|
||||
# 预先收集 dist 内所有文件,避免上万次 os.path.exists 系统调用
|
||||
dist_files = set()
|
||||
for root, dirs, files in os.walk(dist):
|
||||
for fn in files:
|
||||
dist_files.add(os.path.relpath(os.path.join(root, fn), dist).replace(os.sep, '/'))
|
||||
|
||||
global KNOWN_HOST_RE
|
||||
KNOWN_HOST_RE = re.compile(r'(?<![\w.-])(' + '|'.join(re.escape(h) for h in KNOWN_REMOTE_HOSTS) + r')(?![\w-])')
|
||||
|
||||
url_hits = [] # {url, host, file, line, cat, reason, ctx}
|
||||
text_files = skipped_bin = 0
|
||||
known_host_hits = [] # 无 scheme 的已知远程域命中
|
||||
media_refs = [] # 音视频/字体/SDK 引用
|
||||
lazy_imports = [] # 懒加载 chunk
|
||||
missing_local = []
|
||||
|
||||
for root, dirs, files in os.walk(dist):
|
||||
dirs.sort()
|
||||
for fn in sorted(files):
|
||||
p = os.path.join(root, fn)
|
||||
rel = os.path.relpath(p, dist).replace(os.sep, '/')
|
||||
if not is_probably_text(p):
|
||||
skipped_bin += 1
|
||||
continue
|
||||
text_files += 1
|
||||
try:
|
||||
text = open(p, encoding='utf-8', errors='replace').read()
|
||||
except OSError:
|
||||
continue
|
||||
|
||||
li = LineIndex(text)
|
||||
seen_in_file = set()
|
||||
for m in URL_RE.finditer(text):
|
||||
url = m.group(0).rstrip('.,;:!?"\'')
|
||||
cat, reason = classify(url, rel, allow_rules)
|
||||
key = (url, li.line(m.start()))
|
||||
if key in seen_in_file:
|
||||
continue
|
||||
seen_in_file.add(key)
|
||||
url_hits.append({
|
||||
'url': url, 'host': urlparse(url).netloc.lower(), 'file': rel,
|
||||
'line': key[1], 'cat': cat, 'reason': reason,
|
||||
'ctx': snippet(text, m.start()),
|
||||
})
|
||||
|
||||
# 无 scheme 的已知远程域(例如 SDK 里拼出来的 host)。
|
||||
# 文档/SourceMap 里出现域名只是一句话,不会发起请求,跳过。
|
||||
for m in ([] if ext_of(rel) in DOC_EXT else KNOWN_HOST_RE.finditer(text)):
|
||||
h = m.group(0)
|
||||
key = (h, li.line(m.start()))
|
||||
if key in seen_in_file:
|
||||
continue
|
||||
seen_in_file.add(key)
|
||||
# 无 scheme 命中同样走一遍 allowlist:vendored 产物里的注释/元数据字符串
|
||||
# 不该被判成外部依赖,但未登记的一律算 net
|
||||
cat, reason = classify('http://' + h, rel, allow_rules)
|
||||
if cat == 'net':
|
||||
reason = '已知远程域(无 scheme 命中,未登记进允许清单)'
|
||||
known_host_hits.append({
|
||||
'url': h, 'host': h, 'file': rel, 'line': key[1],
|
||||
'cat': cat, 'reason': reason,
|
||||
'ctx': snippet(text, m.start()),
|
||||
})
|
||||
|
||||
if rel.endswith(('.js', '.mjs', '.cjs', '.html')):
|
||||
for rx, kind in ((IMPORT_RE, 'import()'), (WORKER_RE, 'new Worker')):
|
||||
for m in rx.finditer(text):
|
||||
lazy_imports.append({
|
||||
'file': rel, 'line': li.line(m.start()), 'kind': kind,
|
||||
'target': m.group(1),
|
||||
})
|
||||
|
||||
if rel.endswith(('.map', '.md')):
|
||||
pass # 文档/SourceMap 不做资源引用扫描
|
||||
elif rel.endswith(('.js', '.mjs', '.cjs', '.css', '.html', '.json')):
|
||||
for m in ASSET_URL_RE.finditer(text):
|
||||
val = m.group(0)
|
||||
if val.startswith(('data:', 'blob:')):
|
||||
continue
|
||||
if val.startswith('/node_modules/'):
|
||||
continue # 构建期路径,运行时不会请求
|
||||
line = li.line(m.start())
|
||||
ext = val.rsplit('.', 1)[-1].split('?')[0].lower()
|
||||
interesting = ext in MEDIA_FONT_EXT or any(k in val for k in SDK_MARKERS)
|
||||
if not interesting:
|
||||
continue
|
||||
entry = {'file': rel, 'line': line, 'value': val, 'ext': ext,
|
||||
'ctx': snippet(text, m.start(), 60)}
|
||||
if val.startswith('http'):
|
||||
entry['state'] = 'external'
|
||||
elif val.startswith('//'):
|
||||
# 协议相对地址只有「权威段带点」才真的是外域;
|
||||
# //wasm/xxx.wasm 这类是第三方胶水代码里的文件路径
|
||||
auth = val[2:].split('/')[0].split(':')[0]
|
||||
if '.' in auth:
|
||||
entry['state'] = 'external'
|
||||
else:
|
||||
entry['state'] = 'relative'
|
||||
elif val.startswith('/'):
|
||||
key = val.lstrip('/').split('?')[0]
|
||||
entry['state'] = 'local-ok' if key in dist_files else 'local-missing'
|
||||
if entry['state'] == 'local-missing':
|
||||
missing_local.append(entry.copy())
|
||||
else:
|
||||
entry['state'] = 'relative'
|
||||
media_refs.append(entry)
|
||||
|
||||
# manifest.json 里的远程前缀
|
||||
manifest_info = []
|
||||
for root, dirs, files in os.walk(dist):
|
||||
for fn in files:
|
||||
if fn != 'manifest.json':
|
||||
continue
|
||||
p = os.path.join(root, fn)
|
||||
rel = os.path.relpath(p, dist).replace(os.sep, '/')
|
||||
try:
|
||||
data = json.load(open(p, encoding='utf-8'))
|
||||
except Exception as e:
|
||||
manifest_info.append({'file': rel, 'error': str(e)})
|
||||
continue
|
||||
flat = data if isinstance(data, dict) else {}
|
||||
picked = {k: v for k, v in flat.items()
|
||||
if isinstance(v, str) and ('prefix' in k or 'host' in k or 'url' in k)}
|
||||
manifest_info.append({'file': rel, 'keys': picked})
|
||||
|
||||
# ---- 汇总 ----
|
||||
by_cat = Counter(h['cat'] for h in url_hits)
|
||||
ext_refs = ([h for h in url_hits if h['cat'] in ('net', 'lan', 'local')]
|
||||
+ [h for h in known_host_hits if h['cat'] in ('net', 'lan', 'local')])
|
||||
external_refs = len({(h['file'], h['line'], h['url']) for h in ext_refs})
|
||||
|
||||
by_host = defaultdict(lambda: Counter())
|
||||
host_example = {}
|
||||
for h in url_hits:
|
||||
by_host[h['host']][h['cat']] += 1
|
||||
host_example.setdefault(h['host'], '%s:%s' % (h['file'], h['line']))
|
||||
for h in known_host_hits:
|
||||
by_host[h['host']][h['cat']] += 1
|
||||
host_example.setdefault(h['host'], '%s:%s' % (h['file'], h['line']))
|
||||
|
||||
ts = time.strftime('%Y%m%d-%H%M%S')
|
||||
out_md = args.out or os.path.join(REPO, 'data-quality', 'reports', 'site', ts + '-lint-dist.md')
|
||||
out_json = args.json_out or out_md.replace('.md', '.json')
|
||||
|
||||
ext_counter = Counter(r['ext'] for r in media_refs)
|
||||
media_font_refs = [r for r in media_refs if r['ext'] in MEDIA_FONT_EXT]
|
||||
sdk_refs = [r for r in media_refs if any(k in r['value'] for k in SDK_MARKERS)]
|
||||
|
||||
def rows(items, n=None):
|
||||
return items if n is None else items[:n]
|
||||
|
||||
L = []
|
||||
A = L.append
|
||||
A('# UniCut dist 断网可用 lint 报告')
|
||||
A('')
|
||||
A('- 扫描目录:`%s`' % dist)
|
||||
A('- 时间:%s(耗时 %.1fs)' % (time.strftime('%Y-%m-%d %H:%M:%S'), time.time() - t0))
|
||||
A('- 文本文件 %d 个 / 跳过二进制 %d 个' % (text_files, skipped_bin))
|
||||
A('')
|
||||
A('## 结论')
|
||||
A('')
|
||||
A('| 指标 | 数值 |')
|
||||
A('| --- | --- |')
|
||||
A('| **外部网络引用 external_refs(必须为 0)** | **%d** |' % external_refs)
|
||||
A('| URL 出现总次数(含命名空间/文档) | %d |' % (len(url_hits) + len(known_host_hits)))
|
||||
A('| 其中 namespace(w3.org 等命名空间) | %d |' % by_cat.get('namespace', 0))
|
||||
A('| 其中 doc / sourcemap(文档、SourceMap、可视化报告) | %d |' %
|
||||
(by_cat.get('doc', 0) + by_cat.get('sourcemap', 0)))
|
||||
A('| 其中 allowlist(vendored 产物内字符串,见附录) | %d |' % by_cat.get('allow', 0))
|
||||
A('| 其中 local(本机地址残留) | %d |' % by_cat.get('local', 0))
|
||||
A('| 其中 lan(内网地址,仍发请求) | %d |' % by_cat.get('lan', 0))
|
||||
A('| 音视频/字体/SDK 引用(去重后条目) | %d |' % len(media_refs))
|
||||
A('| 其中指向外域 | %d |' % sum(1 for r in media_refs if r['state'] == 'external'))
|
||||
A('| 其中本地缺失 | %d |' % len(missing_local))
|
||||
A('')
|
||||
A('**判定:%s**' % ('✅ 通过:dist 内没有任何会发起外网请求的引用'
|
||||
if external_refs == 0 else '❌ 未通过:存在 %d 处外部网络引用' % external_refs))
|
||||
A('')
|
||||
|
||||
A('## 1. 外部 URL 按 host 聚合')
|
||||
A('')
|
||||
A('| host | 次数 | 分类 | 示例位置 |')
|
||||
A('| --- | --- | --- | --- |')
|
||||
for host, cats in sorted(by_host.items(), key=lambda kv: (-sum(kv[1].values()), kv[0])):
|
||||
A('| %s | %d | %s | `%s` |' % (host or '(空)', sum(cats.values()),
|
||||
', '.join('%s×%d' % (k, v) for k, v in cats.most_common()),
|
||||
host_example.get(host, '')))
|
||||
A('')
|
||||
|
||||
A('## 2. 外部网络引用明细(必须为 0)')
|
||||
A('')
|
||||
if ext_refs:
|
||||
A('| # | file:line | URL | 说明 |')
|
||||
A('| --- | --- | --- | --- |')
|
||||
for i, h in enumerate(rows(ext_refs, args.max_rows), 1):
|
||||
A('| %d | `%s:%s` | `%s` | %s |' % (i, h['file'], h['line'], h['url'], h['reason']))
|
||||
if len(ext_refs) > args.max_rows:
|
||||
A('')
|
||||
A('> 其余 %d 行见 JSON 报告。' % (len(ext_refs) - args.max_rows))
|
||||
else:
|
||||
A('无。')
|
||||
A('')
|
||||
|
||||
A('## 3. 懒加载 chunk import')
|
||||
A('')
|
||||
A('共 %d 处动态 import / Worker 创建。' % len(lazy_imports))
|
||||
A('')
|
||||
external_chunks = [x for x in lazy_imports if x['target'].startswith('http')]
|
||||
if external_chunks:
|
||||
A('⚠️ 指向外域的 chunk:')
|
||||
for x in external_chunks[:50]:
|
||||
A('- `%s:%s` %s → `%s`' % (x['file'], x['line'], x['kind'], x['target']))
|
||||
else:
|
||||
A('全部指向同源相对路径(`/homeAssets/...` 等),无外域 chunk。')
|
||||
A('')
|
||||
A('<details><summary>完整清单(前 200 条)</summary>')
|
||||
A('')
|
||||
for x in rows(lazy_imports, 200):
|
||||
A('- `%s:%s` %s → `%s`' % (x['file'], x['line'], x['kind'], x['target']))
|
||||
A('')
|
||||
A('</details>')
|
||||
A('')
|
||||
|
||||
A('## 4. 音视频 / 字体 / SDK 引用')
|
||||
A('')
|
||||
A('扩展名分布:' + ', '.join('%s×%d' % (k, v) for k, v in ext_counter.most_common()))
|
||||
A('')
|
||||
A('### 4.1 指向外域(必须为 0)')
|
||||
A('')
|
||||
ext_media = [r for r in media_refs if r['state'] == 'external']
|
||||
if ext_media:
|
||||
for r in rows(ext_media, args.max_rows):
|
||||
A('- `%s:%s` → `%s`' % (r['file'], r['line'], r['value']))
|
||||
else:
|
||||
A('无。')
|
||||
A('')
|
||||
A('### 4.2 本地路径但文件缺失(功能降级 / TODO)')
|
||||
A('')
|
||||
if missing_local:
|
||||
for r in rows(missing_local, args.max_rows):
|
||||
A('- `%s:%s` → `%s`' % (r['file'], r['line'], r['value']))
|
||||
else:
|
||||
A('无。')
|
||||
A('')
|
||||
A('### 4.3 字体 / 音视频 / 关键 SDK 取值抽样')
|
||||
A('')
|
||||
A('| file:line | 取值 | 状态 |')
|
||||
A('| --- | --- | --- |')
|
||||
for r in rows(media_font_refs, 80):
|
||||
A('| `%s:%s` | `%s` | %s |' % (r['file'], r['line'], r['value'], r['state']))
|
||||
A('')
|
||||
A('<details><summary>SDK 相关引用(%d 条)</summary>' % len(sdk_refs))
|
||||
A('')
|
||||
for r in rows(sdk_refs, 120):
|
||||
A('- `%s:%s` → `%s`(%s)' % (r['file'], r['line'], r['value'], r['state']))
|
||||
A('')
|
||||
A('</details>')
|
||||
A('')
|
||||
|
||||
A('## 5. assets/manifest.json 远程前缀')
|
||||
A('')
|
||||
if manifest_info:
|
||||
for m in manifest_info:
|
||||
A('- `%s`:' % m['file'])
|
||||
if 'error' in m:
|
||||
A(' - 解析失败:%s' % m['error'])
|
||||
elif m.get('keys'):
|
||||
for k, v in m['keys'].items():
|
||||
A(' - `%s` = `%s`' % (k, v))
|
||||
else:
|
||||
A(' - 无 remote_prefix / preview_prefix 等远程前缀字段')
|
||||
else:
|
||||
A('dist 内没有 `assets/manifest.json`(video-core-sdk 未随包发布远程前缀清单)。')
|
||||
A('')
|
||||
|
||||
A('## 6. TODO 与不可消除项')
|
||||
A('')
|
||||
A('### 6.1 allowlist(vendored 产物内、无法在不改第三方代码的前提下删除的字符串)')
|
||||
A('')
|
||||
allow_by_reason = defaultdict(Counter)
|
||||
for h in url_hits:
|
||||
if h['cat'] == 'allow':
|
||||
allow_by_reason[h['reason']][h['host']] += 1
|
||||
if allow_by_reason:
|
||||
for reason, hosts in allow_by_reason.items():
|
||||
A('- %s:%s' % (reason, ', '.join('%s×%d' % (k, v) for k, v in hosts.most_common())))
|
||||
else:
|
||||
A('无。')
|
||||
A('')
|
||||
A('### 6.2 本地资源缺失 / 功能降级(详见 4.2)')
|
||||
A('')
|
||||
if missing_local:
|
||||
for r in rows(missing_local, 60):
|
||||
A('- [ ] `%s`(`%s:%s`)' % (r['value'], r['file'], r['line']))
|
||||
else:
|
||||
A('- [x] 无缺失的本地音视频/字体/SDK 资源。')
|
||||
A('')
|
||||
A('## 附录:报告文件')
|
||||
A('')
|
||||
A('- JSON:`%s`' % os.path.relpath(out_json, REPO))
|
||||
A('- 允许清单:`%s`' % os.path.relpath(ALLOWLIST, REPO))
|
||||
A('')
|
||||
|
||||
os.makedirs(os.path.dirname(out_md), exist_ok=True)
|
||||
open(out_md, 'w', encoding='utf-8').write('\n'.join(L))
|
||||
json.dump({
|
||||
'dist': dist,
|
||||
'external_refs': external_refs,
|
||||
'by_category': dict(by_cat),
|
||||
'known_host_hits': known_host_hits,
|
||||
'url_hits': url_hits,
|
||||
'lazy_imports': lazy_imports,
|
||||
'media_refs': media_refs,
|
||||
'missing_local': missing_local,
|
||||
'manifest': manifest_info,
|
||||
'files': {'text': text_files, 'binary_skipped': skipped_bin},
|
||||
'report_md': out_md,
|
||||
}, open(out_json, 'w', encoding='utf-8'), ensure_ascii=False, indent=2)
|
||||
|
||||
print('external_refs = %d' % external_refs)
|
||||
print('报告:', out_md)
|
||||
return 0 if (external_refs == 0 or args.no_fail) else 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,56 @@
|
||||
# UniCut dist 外部 URL 允许清单(external_ref_allowlist.txt)
|
||||
#
|
||||
# 每行三列,用 TAB 分隔:正则(对完整 URL 匹配) 类别 原因
|
||||
# 类别固定填 allow —— 表示「这是一段字符串/元数据,运行时不会发起网络请求」。
|
||||
# 凡是能通过改源码、改 public/ 素引或补本地文件解决的,一律不允许进本清单;
|
||||
# 清单里的每一条都必须能回答「为什么删不掉」。
|
||||
#
|
||||
# 维护规则:
|
||||
# 1. 新增一行前先确认:这个 URL 会不会在浏览器里真发起请求?会 → 去改代码/下载资源,别加清单。
|
||||
# 2. 第三方(vendored)压缩产物里的许可证、论文、文档链接属于本清单;本项目自有代码里的不算。
|
||||
# 3. 本清单只覆盖「不可消除项」;doc/sourcemap/namespace 三类由脚本自动判定,不需要登记。
|
||||
#
|
||||
# 说明:unpkg.com / cdn.jsdelivr.net 不在清单里 —— 它们出现在 vendored ffmpeg/tesseract
|
||||
# 的默认参数中,已通过改写 public/ 下的文件指向本地路径,lint 必须能发现回归。
|
||||
|
||||
github\.com allow vendored 依赖(pixi/semi/opencv 等)压缩产物里的项目主页与许可证链接,仅字符串
|
||||
gist\.github\.com allow vendored 依赖 README 片段里的示例链接,仅字符串
|
||||
raw\.githubusercontent\.com allow vendored 依赖 README 片段里的源码链接,仅字符串
|
||||
github\.io allow vendored 依赖文档站链接,仅字符串
|
||||
en\.wikipedia\.org allow 算法出处(Perlin noise / 插值曲线等)注释链接,仅字符串
|
||||
stackoverflow\.com allow 实现来源注释链接,仅字符串
|
||||
www\.apache\.org allow 许可证(Apache-2.0)链接,仅字符串
|
||||
www\.ietf\.org allow RFC 链接(base64/URL 编码实现),仅字符串
|
||||
tools\.ietf\.org allow RFC 链接,仅字符串
|
||||
pubs\.opengroup\.org allow POSIX 规范链接,仅字符串
|
||||
developer\.mozilla\.org allow MDN 文档链接,仅字符串
|
||||
unicode\.org allow Unicode 规范链接,仅字符串
|
||||
www\.khronos\.org allow WebGL/OpenCL 规范链接,仅字符串
|
||||
webkit\.org allow WebKit 实现说明链接,仅字符串
|
||||
www\.wolframalpha\.com allow 数学公式示例链接,仅字符串
|
||||
www\.redblobgames\.com allow 几何算法文章链接,仅字符串
|
||||
www\.shadertoy\.com allow GLSL 特效来源链接,仅字符串
|
||||
easings\.net allow 缓动函数文档链接,仅字符串
|
||||
tympanus\.net allow Codrops 特效文章链接,仅字符串
|
||||
pixijs\.com allow pixi.js 官网链接,仅字符串
|
||||
mths\.be allow escape-string-regexp 作者站点,仅字符串
|
||||
feross\.org allow 各依赖作者/安全说明链接,仅字符串
|
||||
www\.mp3dev\.org allow lame.min.js 作者说明链接,仅字符串
|
||||
www\.linderdaum\.com allow GLSL 库作者链接,仅字符串
|
||||
emscripten\.org allow ffmpeg.wasm(Emscripten)动态链接说明,仅字符串
|
||||
vitejs\.dev allow vite 文档链接(vendored README 片段),仅字符串
|
||||
xxx\.com allow worker 代码里的占位字符串(正则示例),非真实地址
|
||||
opensource\.org allow 许可证链接,仅字符串
|
||||
creativecommons\.org allow CC 许可证链接,仅字符串
|
||||
byteblacksmith\.com allow GLSL 着色器源码里的注释(rand 函数出处),位于 JS 字符串常量中,浏览器不会发起请求
|
||||
bugzil\.la allow Emscripten/MediaPipe wasm 胶水代码里的 Mozilla 缺陷追踪链接,仅字符串
|
||||
mrdoob\.com allow Stats.js(性能面板)作者主页链接,仅字符串
|
||||
reactjs\.org allow React 生产构建的错误说明链接(invariant 文案里拼接),仅字符串
|
||||
prosemirror\.net allow 编辑器依赖的 ProseMirror 文档链接,仅字符串
|
||||
gitee\.com allow 依赖作者仓库镜像链接,仅字符串
|
||||
bit\.ly allow 依赖文档里的短链接(示例),仅字符串
|
||||
tinyurl\.com allow 依赖文档里的短链接(示例),仅字符串
|
||||
fb\.me allow 依赖文档里的社交链接,仅字符串
|
||||
site\.com allow medianinfo 调试日志里的示例地址(正则占位),非真实服务
|
||||
server\.com allow MediaPipe 调试日志里的示例地址(含端口),非真实服务
|
||||
onnxruntime\.ai allow onnxruntime 文档链接,仅字符串
|
||||
@@ -0,0 +1,24 @@
|
||||
services:
|
||||
unicut:
|
||||
build: .
|
||||
container_name: unicut
|
||||
restart: always
|
||||
ports:
|
||||
- "3005:443"
|
||||
- "3006:80"
|
||||
environment:
|
||||
- OMNI_KEY=${OMNI_KEY:-}
|
||||
- CI_KEY=${CI_KEY:-}
|
||||
volumes:
|
||||
- certs:/etc/nginx/certs
|
||||
|
||||
# 本机语音合成(edge-tts),给免登录版提供配音能力;源码在 ../unicut-tts
|
||||
unicut-tts:
|
||||
build: ../unicut-tts
|
||||
container_name: unicut-tts
|
||||
restart: always
|
||||
volumes:
|
||||
- ../unicut-tts/audio:/data/audio
|
||||
|
||||
volumes:
|
||||
certs:
|
||||
@@ -0,0 +1,177 @@
|
||||
# UniCut 免登录改造说明
|
||||
|
||||
目标:去掉所有需要登录/注册的环节,打开即用,全部数据留在本地浏览器。
|
||||
|
||||
## 改动清单
|
||||
|
||||
| 文件 | 改动 |
|
||||
| --- | --- |
|
||||
| `src/utils/guest.ts`(新增) | 定义本地访客身份 `GUEST_USER`(id 0、`vip_status: 1`、`guest: true`),全站默认以该身份运行 |
|
||||
| `src/utils/checkAuth.ts` | `checkAuth()` 恒返回 `false`,路由层不再做登录校验 |
|
||||
| `src/stores/user.ts` | 用户信息默认即访客;退出/失效后仍保留访客身份,只清空 token |
|
||||
| `src/components/login/LoginRegister.tsx` | 登录/注册弹窗整体停用,渲染为空;任何 `showLoginModal` 触发都不再出登录界面 |
|
||||
| `src/layout/index-layout/IndexLayout.tsx` | 去掉“未登录 / 没有访问权限”的整页阻塞 |
|
||||
| `src/layout/workspace-layout/WorkspaceLayout.tsx` | 工作区不再依赖登录状态 |
|
||||
| `src/pages/editor/components/header/Header.tsx` | 保存不再要求登录;本地模式下直接写 IndexedDB;右上角不再出现登录入口 |
|
||||
| `src/pages/editor/components/header/Project.tsx` | 本地模式改用本地保存,不再调服务端 `updateApp` |
|
||||
| `src/pages/editor/components/sources/my/Sources.tsx` / `List.tsx` | 素材面板始终显示,去掉“您还未登录”提示 |
|
||||
| `src/pages/editor/components/sources/ai/AiMain.tsx` | 去掉 token 判断,AI 面板直接可用 |
|
||||
| `src/utils/savePicker.ts`(新增) | 导出兜底:浏览器不支持/未授权文件系统 API 时,改为内存写入 + 自动下载,导出不再静默失败 |
|
||||
| `src/main.tsx` | 启动时安装上面的导出兜底 |
|
||||
| `Dockerfile` | 移除旧的 `patches/0001-nologin.js` 打补丁步骤,直接 `yarn build` |
|
||||
|
||||
## AI 能力(本机自建后端)
|
||||
|
||||
官方 AI 全部走 `video.h5ds.com` 并要账号 token,去登录后必然报
|
||||
`任务创建失败:Header parameter [authorization] cannot be empty`。现在改为直连本机服务:
|
||||
|
||||
| 功能 | 本机后端 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| AI 对话 / agent 模式 | NewAPI `http://192.168.68.19:3099/v1` | OpenAI 兼容,默认 `mimo-v2.6-flash`,失败自动降级 `glm-5.3-flash` → `deepseek-v4-flash`;带图片时改用 `deepseek-v4-flash-vision-exp` |
|
||||
| AI 图片生成 | 本机图像代理 `http://192.168.68.19:8113/v1` | OpenAI 兼容 `/v1/images/generations`,生成后直接回显并可插入时间轴 |
|
||||
| AI 视频生成 | cheaperinference `/civideo/` 直连 | OpenAI 兼容 `/v1/videos/generations`,可选 480p/720p、1~5 秒,生成后可插入时间轴 |
|
||||
| 云合成 / 云导出 | 无 | 已改为提示使用「本地合成」 |
|
||||
| 语音合成(配音) | `unicut-tts` 容器(edge-tts) | nginx 同源反代 `/localtts/` → `unicut-tts:8000`,字节 voice_type 自动映射到 edge 音色,按 text+voice 哈希缓存 mp3 |
|
||||
| 语音识别(AI 字幕) | 无 | 本机未接 ASR,给出明确说明;可手写字幕 |
|
||||
|
||||
配置文件:`public/local-ai.json`(已加入 `.gitignore`,含密钥,勿提交),模板见
|
||||
`public/local-ai.json.example`。运行时也可在站点根目录放同名文件覆盖,不用重新构建。
|
||||
|
||||
### 本机 TTS(配音)
|
||||
|
||||
`../unicut-tts/app.py` 是一个独立的 FastAPI 服务(edge-tts),只暴露给 compose 内网;前端经
|
||||
`/localtts/` 同源反代调用(相对路径,避免 HTTPS 页面加载 HTTP 音频被浏览器拦)。
|
||||
|
||||
```
|
||||
GET /localtts/health → {"ok":true,"cached":N}
|
||||
POST /localtts/tts {text, voice} → {"url":"/localtts/audio/<hash>.mp3", "voice":"zh-CN-XiaoxiaoNeural"}
|
||||
```
|
||||
|
||||
音色映射:前端传字节 `voice_type`(如 `zh_female_xxx_bigtts`),服务按关键词映射到 edge 中文音色,
|
||||
认不出按性别兜底;合成结果按 `text+voice` 哈希缓存,重复文本不重复合成。
|
||||
|
||||
## 模板(官方在线 + 本机备用)
|
||||
|
||||
模板面板原本只从官方接口 `/api/v1/templates/page`(`video.h5ds.com`)拉数据,本机模板无处可放。
|
||||
现在官方模板通过同源 CDN 反代加载(不直连外域,断网可用):
|
||||
|
||||
1. `nginx.conf` 新增 `location /cdn/` → 反代 `https://cdn.h5ds.com/`;
|
||||
2. `src/pages/editor/Editor.tsx` 模板分支:官方工程从 `/cdn/<path>` 取,内部素材路径
|
||||
`/video/…` 与 `/video_business/…` 统一改写成 `/cdn/…`(避开 `"video/mp4"` 这类 MIME 串);
|
||||
3. `src/pages/editor/server.ts`
|
||||
- `getTemplates()`:把官方 `url`/`thumb` 的 `/video*` 路径改成 `/cdn/…`(同源取才不会 404);
|
||||
- 本机模板仍从 `/templates/index.json` 合并(关键词命中时只给本机模板)。
|
||||
|
||||
本机备用模板(**默认不列出**,`public/templates/index.json` 现为空数组):
|
||||
`public/templates/` 下保留 `soft-tpl-01..10.json`(MovieData 工程,纯文字元素,无外部素材依赖)与
|
||||
`soft-tpl-01..10.png` 缩略图。官方模板观感更真实(含 lottie 动效与多帧素材),本机模板仅作为
|
||||
断网兜底;若要恢复列出,把条目写回 `index.json` 即可。
|
||||
生成脚本(可重跑):`/vol1/1000/HD1/APP/hermes/awork/scripts/gen_unicut_templates.py`
|
||||
|
||||
文字元素结构取自 SDK 真实产物(`editor.movie.addElementNoSource`),关键字段:
|
||||
`textStyle.fill.value.colors[0].color` / `fontSize` / `lineHeight` / `align` / `fontFamily`(=aConfused) / `style.x,y` / `trackIndex` / `startTime` / `duration`。
|
||||
|
||||
> 注意:模板点击后会**覆盖当前工程**(原生确认弹窗),属于设计行为;先保存再套用。
|
||||
|
||||
**两个必须注意的坑(已修)**:
|
||||
|
||||
1. TTS 返回的音频地址**必须补成同源绝对地址**。编辑器 `util.reURL()` 会把相对路径拼到
|
||||
`config.resourcesHost`(`https://cdn.h5ds.com`)上,`/localtts/audio/x.mp3` 会变成
|
||||
`https://cdn.h5ds.com/localtts/audio/x.mp3` 而 404,前端拿到的是 `[object Event]` 报错。
|
||||
2. 时间轴为空时 `editor.getGroupElementData()` 返回空数组,「开始朗读」什么都不做;
|
||||
已改为没有元素时直接用输入框文案合成并插入 0 秒处。
|
||||
3. `startRead` 增加了 `try/catch/finally`,异常时也会清掉 `editor.globalLoading`,
|
||||
否则 `tracks-module__spinning` 遮罩会一直盖住面板按钮,表现成「点了没反应」。
|
||||
|
||||
相关代码:`src/utils/localAi.ts`、`src/pages/editor/components/sources/my/TTS.tsx`(新增/改动)、`src/pages/editor/server.ts`(`openAiChat` / `createAiTask` /
|
||||
`getAiTaskList` / `seekAiTaskStatus` / `createTTS` / `createCaption` 本地化)、`src/database/localDB.ts`(新增
|
||||
`aiTasks` 表,DB 版本 6)、`AIChat.tsx`(图片生成直连本机、视频生成给提示)、`Export.tsx`(云合成提示)。
|
||||
|
||||
## 数据存储
|
||||
|
||||
- 首次进入工作区需要选择一个本地文件夹(浏览器 File System Access API 的安全要求,不是登录)。
|
||||
- 项目、素材索引存在 IndexedDB(`H5VideoLocalDB`),素材文件存在所选文件夹。
|
||||
- **工程数据会同步落一份到所选文件夹** `projects/<appid>.json`(`saveProject()` 写入,
|
||||
`getProject()` / `getAppData()` 在 IndexedDB 缺失时从该文件读回)。
|
||||
这样换浏览器、清站点数据、换设备后,只要把项目文件夹指到同一个目录就能恢复工程;
|
||||
也可以直接把 `projects/` 目录打包备份带走。
|
||||
- 不上传服务器,也不依赖账号 token。
|
||||
|
||||
## 构建与发布
|
||||
|
||||
```bash
|
||||
cd /vol1/1000/HD1/docker/unicut-src
|
||||
docker compose build unicut
|
||||
docker compose up -d --no-build
|
||||
```
|
||||
|
||||
访问:https://127.0.0.1:3005/ (HTTP:http://127.0.0.1:3006/)
|
||||
|
||||
## 品牌与站点文案(build21)
|
||||
|
||||
站点原名文案(「云剪|爱趣五视频云剪辑…」与四川爱趣五科技相关信息)已全部替换为 **UniCut**:
|
||||
|
||||
| 文件 | 改动 |
|
||||
| --- | --- |
|
||||
| `index.html` | `<title>` → `UniCut`;description/keywords 重写为 UniCut 在线剪辑;`lang` → `zh-CN`;移除百度统计脚本 |
|
||||
| `src/language/zhCN.ts` | `common_company` → `UniCut`;`home_title` → `UniCut · 创意无限`;`common_copyright` → `UniCut · 本地部署版`(去掉公司名与备案号) |
|
||||
| `src/pages/home/Home.tsx` | FAQ 与首页文案中的「无界云剪辑」→ `UniCut` |
|
||||
| `src/pages/aboutus/AboutUs.tsx` | 中英文「关于我们」整段重写为 UniCut 介绍(本地部署、数据存浏览器、免登录) |
|
||||
|
||||
`cdn.h5ds.com` / `video.h5ds.com` 等域名属于 SDK 资源与接口地址,不是文案,保持原样。
|
||||
|
||||
## 生图 / 生视频:本机 omniroute + cheaperinference
|
||||
|
||||
浏览器侧不留任何密钥,统一走同源反代:
|
||||
|
||||
```
|
||||
浏览器 → https://<unicut>/omniai/* → nginx 注入 Authorization → http://192.168.68.19:20139/v1/*
|
||||
```
|
||||
|
||||
- `nginx.conf` 新增 `location /omniai/`(`proxy_read_timeout 300s`),密钥写成占位符 `__OMNI_KEY__`;
|
||||
- `entrypoint.sh` 启动时用环境变量 `$OMNI_KEY` 替换占位符;
|
||||
- `docker-compose.yml` 通过 `OMNI_KEY=${OMNI_KEY:-}` 注入,真实值放项目根 `.env`(600 权限,已加入 `.gitignore`);
|
||||
- `public/local-ai.json` 的 `image` / `video` 段改为 `baseUrl: /omniai`,**不再包含任何 key**(此前该文件随站点发布、明文带 key)。
|
||||
|
||||
- 模型:生图 `cheaperinference/grok-imagine`(1024×1024,实测约 20 秒,返回 base64 JPEG,代码按 `/9j/` 判 MIME)。
|
||||
- 生视频走 `/civideo/` 同源反代**直连** `https://api.cheaperinference.com/v1`(`nginx.conf` 的 `location /civideo/`,`proxy_read_timeout 600s`、`client_max_body_size 50m`,占位符 `__CI_KEY__` 由 `entrypoint.sh` 用 `$CI_KEY` 注入,真实值同样只在 `.env`)。前端
|
||||
`localGenerateVideo()` 传 `model`+`prompt`+`resolution`+`duration`,实测 480p/720p、1~5 秒可用。
|
||||
|
||||
> 为什么生视频不走 omniroute:omniroute 的 `/v1/videos/generations` 内置视频渠道白名单(`agnes`、`fal-ai`、`kling`、`minimax`、`qwen-cloud`、`veoai`、`adobe-firefly` 等),**不含 `cheaperinference`**,会返回 `Invalid video model`;生图接口无此白名单,故生图仍经 omniroute(`/omniai/`)。生视频改为直连上游绕开白名单。
|
||||
|
||||
## 账号类接口:本地短路(build41/42,修「Header parameter [authorization] cannot be empty」反复弹窗)
|
||||
|
||||
### 问题
|
||||
`nginx.conf` 把 `/api/` 与 `/cgi-bin/` 反代到官方 `video.h5ds.com`,其中
|
||||
**公开目录类接口**(`/api/v1/templates/page`、`/materials/page`、`/common/type-items/page`、`/template/categories/tree`)
|
||||
不带 token 也返回 200,可正常用;但**账号类接口**(`/api/v1/user/*`、`/account/*`)必须登录 token,
|
||||
免登录下必返回 `Header parameter [authorization] cannot be empty`。而保存、作品列表、收藏这类调用是
|
||||
定时/高频触发的(自动保存每 10 秒一次),于是用户被反复弹窗打断。
|
||||
|
||||
### 两处根因
|
||||
1. **`isFSApiSupported()` 用了 `in` 判定**(`'showDirectoryPicker' in window`)。`in` 只要属性名存在于
|
||||
原型链上就为真,某些环境下该方法被禁用/未实现但属性名仍在原型上,判定结果为 true;
|
||||
`FolderGuard` 据此认为「支持 OPFS 但还没选文件夹」,于是**一直停在引导弹窗**,编辑器根本进不去。
|
||||
已改为取值判断 `typeof window.showDirectoryPicker === 'function'`。
|
||||
2. **本地保存的判据用了 OPFS**(`editor.useLocalStorage = isFSApiSupported()`)。OPFS 只在 https / localhost
|
||||
这类**安全上下文**里存在,用 `http://192.168.x.x` 打开时为 false,整条本地链路被判为不可用,
|
||||
保存/作品列表随即退回官方远端接口。已新增 `canUseLocalSave()`(判据改为 **IndexedDB**):
|
||||
工程数据本来就先写 IndexedDB(`saveProject`),文件落盘只是可选增强(没选文件夹时自动跳过),
|
||||
所以只要 IndexedDB 可用本地保存就成立。`Header.tsx` / `my/List.tsx` / `Project.tsx` 的本地分支
|
||||
判据统一放宽为 `editor.useLocalStorage || canUseLocalSave()`。
|
||||
|
||||
### 兜底
|
||||
`BasicService._request()` 对 `/api/v1/user/*`、`/api/v1/account/*` **本地短路**,不发请求,
|
||||
直接返回一个空成功结果(带可用 `id`,列表字段给空数组),调用方自然走空列表 / 本地生成 id 的分支。
|
||||
日志打 `[本地模式] 跳过账号类接口: <url>`,便于排查。
|
||||
封面上传(`saveApp` 里的 `uploadBase64`)同样包了 try/catch,失败只跳过封面,不让整次保存失败。
|
||||
|
||||
### 验收
|
||||
- 模拟无 OPFS(`add_init_script` 把 `showDirectoryPicker` 覆盖为 undefined,等价于 `http://IP` 打开):
|
||||
编辑器**能正常进入**,`官方后端请求 0 条 / 账号类接口 0 条 / Toast 0 条`,
|
||||
且 IndexedDB 里 `projects` 存到了该工程(`{id: 'noopfs_…', name: 'Untitled', hasData: true}`)。
|
||||
- 正常(有 OPFS)环境回归:编辑器能进、`useLocalStorage: true`、账号类接口 0 条、Toast 0 条。
|
||||
|
||||
### 仍需注意
|
||||
用 `http://IP` 打开时 **OPFS 不可用**,因此「把素材文件落到本地文件夹」这一层不工作(工程数据仍存 IndexedDB)。
|
||||
需要完整本地素材能力请用 **https**:`https://192.168.68.19:3005/`(自签证书,首次需点「继续访问」)或本机 `https://127.0.0.1:3005/`。
|
||||
@@ -177,6 +177,45 @@ AI 自动分析视频内容,智能选取精彩片段进行剪辑,适合快
|
||||
### 5.12 AI 抠图
|
||||
一键智能主体抠图,与手动抠图工具互补,应对不同复杂度的抠图需求。
|
||||
|
||||
### 5.13 AI 一键出片
|
||||
**入口**:左侧「AI 创作」面板最上方常驻一张渐变入口卡(带「推荐」角标),不随页签切换而消失,
|
||||
点卡片或点「立即生成」直接进向导;页签里「一键出片」排在第一位并带红点标记,下面才是生视频、生图和生成结果。
|
||||
|
||||
操作上**只给几张图片和一个标题**,向导分四步走完:
|
||||
|
||||
1. **图片与标题** — 上传若干张图片、填一个标题
|
||||
2. **生成文案** — 大模型识别图片内容,按段落生成口播文案(可改、可增删段、可指定每段配哪张图)
|
||||
3. **配置声音** — 13 种中文音色、语速、情绪逐段试听,支持单段重合成或一键全部合成
|
||||
4. **确认生成** — 核对后一键排入时间轴:图片 + 字幕 + 配音按段对齐,直接可导出
|
||||
|
||||
第四步还提供**画面与字幕效果**,生成前就能调好:
|
||||
|
||||
| 项 | 选项 |
|
||||
| --- | --- |
|
||||
| 图片转场 | 自动轮换(推荐)/ 交叉缩放 / 推进穿门 / 水波涟漪 / 左侧擦除 / 立方翻转 / 柔和溶解 / 平滑缩放 / 不加转场 |
|
||||
| 图片动效 | 缓慢推近 / 缓慢拉远 / 左右平移 / 静止 |
|
||||
| 字幕位置 | 底部 / 居中 / 顶部 |
|
||||
| 字幕大小 | 60% ~ 200% 滑块 |
|
||||
| 字幕配色 | 黄字黑边 / 白字黑边 / 橙字白边 |
|
||||
| 字幕入场 | 无 / 放大弹入 / 淡入 / 放大 + 淡入 |
|
||||
|
||||
实现上这几项都落在工程数据里,可继续手动精修:
|
||||
|
||||
- **转场**写 `data.transitions`(`{id, name, duration, startElementId, transitionName, __a}`),
|
||||
转场名取自官方 GL-Transitions 素材库(`/api/v1/materials/page?type=transition`,共 28 个)。
|
||||
SDK 的硬性要求是**同轨道且首尾相接**(`startTime + duration === 下一张的 startTime`),
|
||||
否则 `removeInvalidTransition()` 会静默删掉它 —— 所以向导在收尾阶段把本次的图片统一压到
|
||||
同一条空闲轨道、配音压到另一条,再按相邻关系压转场。
|
||||
- **图片动效**写元素的 `frames` 关键帧(`x/y/width/height` 两帧插值)。运镜时新框始终盖住
|
||||
原框(缩放比 ≥1、位移在 `[(1-k)w, 0]` 内),因此不会在运镜过程中露出画布背景。
|
||||
- **字幕放大**吃的是 `textScale` 而不是 `scale`(渲染时 `new TxtTexture(text, style, textScale)`
|
||||
并重算 `style.width/height`);位置按画布尺寸写绝对坐标,字幕锚点在中心(`x = width/2`),
|
||||
放大后自动重新居中。入场动画同样用 `frames` 关键帧(`textScale` + `alpha`)。
|
||||
|
||||
验收:`scripts/e2e_quickvideo_fx.py` 会真实跑完四步向导,再读回工程数据断言
|
||||
(同轨道、转场条数 = 段数 - 1、`gap = 0`、关键帧/字幕样式逐项比对),并按时间点截帧比对像素,
|
||||
确认擦除转场是逐帧推进的(右侧先变化、颜色渐变混合、随后左侧推进)。
|
||||
|
||||
---
|
||||
|
||||
## 六、时间轴
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
# UniCut 站点断网可用改造与详情页规范(本页日志)
|
||||
|
||||
目标:构建产物里**没有任何会向外网发起请求的引用**,拔掉网线剪辑功能照常;
|
||||
同时把站点内容组织改成「详情页优先」,新增文章只加静态文件、不改前端代码。
|
||||
|
||||
本页只记录本次站点(dist 产物 + public 素引 + 详情页)的改动,不覆盖全站规范。
|
||||
|
||||
## 改动清单
|
||||
|
||||
| 文件 | 改动 |
|
||||
| --- | --- |
|
||||
| `data-quality/scripts/site/00_lint_dist.py`(新增) | dist 产物全量静态 lint:外部 URL 按 host 聚合 + `file:line`、懒加载 chunk import、音视频/字体/SDK 引用取值与本地缺失、manifest 远程前缀扫描 |
|
||||
| `data-quality/scripts/site/external_ref_allowlist.txt`(新增) | 不可消除项允许清单,每条带原因(TAB 三列:正则/类别/原因) |
|
||||
| `scripts/localize-assets.py`(新增) | 下载远程素材到 `public/` 并改写成同源路径,可重复执行;报告写 `data-quality/reports/site/assets-localize.json` |
|
||||
| `scripts/patch-sdk-offline.mjs`(新增) | 构建期改写 `node_modules/video-core-sdk` 里的 CDN 常量,找不到待替换串直接失败 |
|
||||
| `scripts/build.sh`(新增) | 建站流程:构建锁 → 素材刷新 → 构建发布 → 产物 lint → curl 健康检查 |
|
||||
| `package.json` | `build` 脚本前置 `node scripts/patch-sdk-offline.mjs` |
|
||||
| `nginx.conf` | 新增 `location /newapi/` → 本机 NewAPI(3099)同源反代 |
|
||||
| `src/config/index.ts` | `resourcesHost` / `EModuleEffectSourcePath` / `host` / `editorHost` 全部改同源相对路径 |
|
||||
| `src/server/user.service.ts` | `loginFvideo` 不再直连 `fvideo.h5ds.com`,走同源 `/api` |
|
||||
| `src/pages/editor/Editor.tsx` | 演示工程改读 `/assets/demo/test-app.json`;模板 JSON 改同源取 |
|
||||
| `src/pages/editor/components/options/components/ai-btns/VideoRemoveBg.tsx` | 在线抠像改开同源说明页 `/offline-notice.html` |
|
||||
| `src/pages/editor/components/timeline2/toolbar/ai-removebg/AiRemoveBg copy.tsx` | 同上(该文件未被引用,一并清理外链) |
|
||||
| `src/components/login/loginQrcode/LoginQrcode.tsx` | 二维码占位图改本地 `/assets/images/qrcode-loading.png` |
|
||||
| `src/pages/editor/components/ai-chat/AIChat.tsx` | 对话头像改 `/assets/ai-chat/` |
|
||||
| `src/pages/editor/components/options/components/text-style/TextStyle.tsx` | 字体清单优先读本地 `/assets/fontFamily.json`,为空才回退官方接口 |
|
||||
| `src/utils/localAi.ts`、`public/local-ai.json(.example)` | 对话网关地址改同源 `/newapi/v1` |
|
||||
| `src/components/header/Header.tsx` | 页头新增「使用教程」入口,指向 `/article/local-deploy-guide` |
|
||||
| `src/pages/article/*`(新增)、`src/routes.config.ts` | 文章详情页 `/article/:slug` 与路由注册 |
|
||||
| `public/articles/*`(新增) | 索引 `index.json` + 两篇正文(`local-deploy-guide.md`、`offline-ready.md`) |
|
||||
| `public/assets/**`(本地化) | `voices/`(121 音色头像+试听)、`fonts/`(思源黑体 + 兜底)、`ai-chat/`、`demo/test-app.json`、`images/404.png`、`images/qrcode-loading.png`、`effectcanvas/`(占位)、`fontFamily.json` |
|
||||
| `public/offline-notice.html`(新增) | 离线不可用能力的同源说明页 |
|
||||
| `public/assets/ffmpeg/814.ffmpeg.js` | ffmpeg.wasm 内核默认地址 unpkg → `/assets/ffmpeg/ffmpeg-core.js` |
|
||||
| `public/assets/images/logo-black.svg` | 去掉内含外链的设计工具注释 |
|
||||
| `public/assets/ai/tesseract/**`(删除) | 4.7MB 死代码:源码与产物都没有引用,且内含 jsdelivr 默认地址 |
|
||||
| `index.html` | 删除被注释掉的腾讯地图脚本(连带一个明文 key) |
|
||||
|
||||
## 三类外部依赖的处理
|
||||
|
||||
### 1. `grep -rEn "https?://dist"` 能搜出的引用
|
||||
|
||||
- **能改的直接改**:源码里的 `cdn.h5ds.com` / `video.h5ds.com` / `fvideo.h5ds.com` /
|
||||
`water.i.h5ds.com` / `lf3-static.bytednsdoc.com` 全部改成本地路径或同源反代(见改动清单)。
|
||||
- **缺资源就下载**:`scripts/localize-assets.py` 把音色试听/头像、字体、演示工程、占位图
|
||||
下到 `public/` 并改写 JSON 里的地址,共 248 个文件。
|
||||
- **下载不了的做本地兜底**:`/assets/effectcanvas/`(官方目录已下线)放占位清单 +
|
||||
README 说明,TODO 记在本页与 lint 报告里。
|
||||
- **删不掉的列进允许清单**:第三方压缩产物里的许可证/论文/文档链接,见
|
||||
`external_ref_allowlist.txt`,每条都写了为什么删不掉。
|
||||
|
||||
### 2. video-core-sdk 的远程 CDN 前缀
|
||||
|
||||
`video-core-sdk@1.0.70` 把 4 处远程地址写死在压缩产物里,构建期由
|
||||
`scripts/patch-sdk-offline.mjs` 改写:
|
||||
|
||||
| 原值 | 新值 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `cdnHost:"https://cdn.h5ds.com"` | `cdnHost:""` | 字体/素材基址改同源根 |
|
||||
| `img404:"https://cdn.h5ds.com/assets/images/404.png"` | `/assets/images/404.png` | SDK 初始化会 `fetchBlob(img404)`,属于真实请求 |
|
||||
| `window.EModuleEffectSourcePath=…` 与默认参数 | `/assets/effectcanvas/` | 特效画布模块目录 |
|
||||
| 注册 ID 报错文案里的 `https://video.h5ds.com` | 去掉域名 | 文案 |
|
||||
|
||||
> 说明:当前版本 SDK 里**没有** `assets/manifest.json`、也没有 `remote_prefix` /
|
||||
> `preview_prefix` / `esm.video.h5ds.com` / `esm-debug.video.h5ds.com`;
|
||||
> lint 仍会对这些已知远程域做无 scheme 全文扫描,命中即判失败。
|
||||
|
||||
### 3. 音频远程域 `audio01.h5ds.com` / `qkgzjp.h5ds.com`
|
||||
|
||||
产物里同样没有出现这两个域(配音走本机 `unicut-tts`,经 `/localtts/` 同源反代)。
|
||||
lint 把它们列入已知远程域清单,一旦回归立刻失败。
|
||||
|
||||
## 详情页与 slug 规范
|
||||
|
||||
**路由**:`/article/:slug`(`src/pages/article/index.ts`,注册在 `routes.config.ts` 的
|
||||
`/article` 分组里,排在 `/article/about` 之后,互不遮挡)。
|
||||
|
||||
**内容组织**(全部是同源静态文件,断网可读):
|
||||
|
||||
```
|
||||
public/articles/
|
||||
├── index.json # 索引:[{ id, title, description, date, tags }]
|
||||
├── <slug>.md # 正文,Markdown,文件名必须等于 slug
|
||||
└── assets/<slug>/ # 可选配图,正文里写绝对路径 /articles/assets/<slug>/xxx.png
|
||||
```
|
||||
|
||||
**slug 规则**:
|
||||
|
||||
1. 只允许小写字母、数字、连字符:`^[a-z0-9]+(?:-[a-z0-9]+)*$`;
|
||||
2. 长度 ≤ 64 字符,不允许以下划线/中文/大写字母开头结尾,不能有连续连字符;
|
||||
3. `index.json` 里的 `id` **必须**与文件名(去掉 `.md`)完全一致,详情页靠它取正文;
|
||||
4. 建议用「主题词-主题词」的 kebab-case(如 `local-deploy-guide`),
|
||||
不要把日期塞进 slug(日期放 `date` 字段,改期不用改链接);
|
||||
5. 新增文章**只加文件 + 索引项**,不改前端代码;删除文章要同时删正文与索引项;
|
||||
6. slug 一旦发布就不改(链接会被收藏/引用),要换名就新增一篇并保留旧链接的说明。
|
||||
|
||||
**校验**:详情页组件用同一个正则校验 slug,非法直接显示「链接无效」,
|
||||
不会发出任何请求;lint 不校验 slug(那是内容规范,不是产物问题)。
|
||||
|
||||
**页面结构**:`SubHeader`(标题 + 摘要)→ Markdown 正文 → 「更多教程」串联 → `Footer`;
|
||||
未命中索引显示「没有找到这篇文章」并给回首页入口。
|
||||
|
||||
## 断网 lint
|
||||
|
||||
```bash
|
||||
python3 data-quality/scripts/site/00_lint_dist.py --dist dist # 本地构建产物
|
||||
bash scripts/build.sh # 构建后自动对容器内产物跑
|
||||
```
|
||||
|
||||
判定:`external_refs = 0`(退出码 0)。分类口径:
|
||||
|
||||
| 分类 | 是否计入 external_refs | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `net` | ✅ 计入 | 未登记的外部 URL、已知远程域命中 |
|
||||
| `lan` | ✅ 计入 | 内网绝对地址(仍会发起请求,应改同源反代) |
|
||||
| `local` | ✅ 计入 | 残留的 localhost 开发地址 |
|
||||
| `namespace` | ❌ 不计 | `www.w3.org` 等 XML/SVG 命名空间 URI |
|
||||
| `doc` / `sourcemap` | ❌ 不计 | `.md` / `.map` / `stats.html` 里的链接 |
|
||||
| `allow` | ❌ 不计 | 允许清单里登记的不可消除项,逐条带原因 |
|
||||
|
||||
## 构建与发布
|
||||
|
||||
```bash
|
||||
bash scripts/build.sh # 推荐:带锁 + lint 门禁 + 健康检查
|
||||
# 或手动:
|
||||
docker compose build unicut && docker compose up -d --no-build unicut
|
||||
```
|
||||
|
||||
`scripts/build.sh` 会拿 `/tmp/unicut_build.lock`(等待上限 10 分钟,避免并发构建互相覆盖),
|
||||
日志写 `/tmp/unicut_build_site.log`,并在最后 `curl -sk` 检查
|
||||
`/`、`/article/local-deploy-guide`、`/article/offline-ready`、`/offline-notice.html` 是否 200。
|
||||
|
||||
## 本次结果(2026-10-26,最后一次构建 11:23)
|
||||
|
||||
**构建**:`bash scripts/build.sh`(拿到 `/tmp/unicut_build.lock` → 素材刷新 → 构建发布 →
|
||||
导出产物 lint → curl 健康检查),退出码 0,日志 `/tmp/unicut_build_site.log`。
|
||||
|
||||
**lint**(脚本 `data-quality/scripts/site/00_lint_dist.py`):
|
||||
|
||||
| 指标 | 改造前(原线上产物) | 改造后(本次产物) |
|
||||
| --- | --- | --- |
|
||||
| **external_refs(必须为 0)** | **524** | **0** |
|
||||
| URL 出现总次数(含命名空间/文档/允许清单) | 717 | 197 |
|
||||
| namespace(w3.org 等) | 18 | 18 |
|
||||
| doc / sourcemap | 44 | 46 |
|
||||
| allowlist(不可消除项,逐条带原因) | 117 | 132 |
|
||||
| lan / local(内网、localhost 残留) | 4 | 0 |
|
||||
| 音视频/字体/SDK 引用条目 | 1398 | 1308 |
|
||||
| 其中指向外域 | 0 | **0** |
|
||||
| 其中本地缺失(TODO) | 161 | 27 |
|
||||
|
||||
- 最终报告:`data-quality/reports/site/20261026-112622-lint-dist.md`(同名 `.json` 为机器可读版)
|
||||
- 基线报告:改造前对当时容器内产物的扫描,`external_refs = 524`
|
||||
(其中 484 处来自 `assets/zijieVoices.json` 的字节 CDN 音色地址)
|
||||
|
||||
**健康检查(全部 200)**:
|
||||
`/`、`/article/local-deploy-guide`、`/article/offline-ready`、`/offline-notice.html`、
|
||||
`/articles/index.json`、`/articles/offline-ready.md`、`/assets/images/colormap.png`、
|
||||
`/assets/fonts/siYuanHeiTi/font.woff`、`/assets/voices/audio/000-灿灿_Shiny.mp3`、
|
||||
`/cdn/assets/images/404.png`(同源反代)、`/localtts/health`;
|
||||
`/newapi/v1/models` 返回 401(反代已打通,仅缺鉴权头,属正常)。
|
||||
|
||||
**编辑器启动自检**(浏览器实测 `/editor/test`):
|
||||
左侧菜单正常渲染 `模板 / AI创作 / 我的 / 字幕 / 图片 / 视频 / 音频 / 文字 / 贴纸 / 滤镜 / 特效 / 转场 / 更多`,
|
||||
`movieCreateSuccess = true`(侧栏只在该标志为真时挂载),控制台 0 报错,不再出现 `loading 0.0%`。
|
||||
|
||||
**关键回归(已修)**:把 `config.resourcesHost` / SDK `cdnHost` 从 `https://cdn.h5ds.com`
|
||||
改成同源后,SDK 启动时用 pixi `Assets.load` 拉的 4 张滤镜贴图
|
||||
(`/assets/images/{colormap,displacement_map,lightmap,overlay}.png`)本地不存在,
|
||||
nginx 把 404 回退成 `index.html` 导致图片解码失败 →
|
||||
`[Loader.load] Failed ... InvalidStateError` → 卡在 `loading 0.0%`、左侧菜单不渲染。
|
||||
4 张图已由 `scripts/localize-assets.py` 下载补齐(外加演示工程的 2 个媒体文件与
|
||||
`抖音美好体.otf` 字体,字体需下一次构建生效)。
|
||||
|
||||
**同源反代补齐**:模板面板/模板工程原本由另一处改动直连 `cdn.h5ds.com`,
|
||||
已改为 nginx `location /cdn/` 同源反代(`src/pages/editor/server.ts` 的 `CDN` 常量、
|
||||
`src/pages/editor/Editor.tsx` 模板分支),浏览器不再直连外域,联网时功能等价。
|
||||
|
||||
**详情页**:
|
||||
|
||||
- `https://192.168.68.19:3005/article/local-deploy-guide`(本机 `https://127.0.0.1:3005/article/local-deploy-guide`)
|
||||
- `https://192.168.68.19:3005/article/offline-ready`
|
||||
- 正文 `public/articles/<slug>.md`、索引 `public/articles/index.json`,页头「使用教程」入口直达
|
||||
|
||||
## TODO
|
||||
|
||||
- [ ] `public/assets/effectcanvas/`:官方目录已下线,特效画布(EModule)暂不可用;
|
||||
拿到真实模块后按原目录结构放进该目录即可,不需要改代码。
|
||||
- [ ] `public/assets/fonts/aConfused/`:上游 `aConfused/font.woff` 已 404,当前用思源黑体
|
||||
复制兜底(模板里 `fontFamily=aConfused`);拿到原字体后直接替换文件。
|
||||
- [ ] 在线抠像(AI 人像分离)依赖外部服务,离线不可用;要在本机恢复需部署 removebg
|
||||
服务并把地址填回 `VideoRemoveBg.tsx` 的 TODO 处。
|
||||
- [ ] 官方模板工程(`/editor/template?templateId=…` 分支)取的是同源相对路径,
|
||||
离线时该分支无数据;本机模板走 `/templates/index.json`,不受影响。
|
||||
- [ ] 页头 GitHub / Gitee 为用户主动点击的导航外链(不参与资源加载),已登记进允许清单;
|
||||
如需彻底零外链,可在离线部署版里隐藏这两个入口。
|
||||
- [x] `public/assets/fonts/抖音美好体.otf` 已下载(演示工程文字字体,2.0MB),
|
||||
**需下一次构建**才会进镜像;在那之前 lint 报告 4.2 会一直列出这一条缺失。
|
||||
- [ ] `public/assets/huoshan/`:`TTS.tsx` 用 `location.origin + '/assets/huoshan/' + voice`
|
||||
播放音色试听,该目录站点上从来没有 → 试听 404(不阻塞启动,属既有问题)。
|
||||
- [ ] `src/pages/editor/Custom.tsx`(经 `Sides.tsx` 引入)里有 3 个外部预览素材地址
|
||||
(`cdn.jme-aigc.com`、`h5ds-cdn.oss-cn-beijing.aliyuncs.com`、`static-jiemo-dev.wanjiedata.com`),
|
||||
当前未进产物(被 tree-shake),一旦被真正引用,lint 会立刻判失败,需先本地化。
|
||||
- [ ] 已删除 `public/assets/ai/tesseract/`(4.7MB,源码与产物都无引用,且默认走 jsdelivr);
|
||||
如需离线 OCR,重新接入时必须把 worker/core/lang 路径改成同源。
|
||||
- [ ] 报告 4.2 里其余「本地缺失」多为第三方默认参数碎片(`/ffmpeg-core.js`、`/font.woff`、
|
||||
`/worker/web-demuxer.wasm` 等),调用方都传了本地地址,实际不会请求这些路径。
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
CERT_DIR=/etc/nginx/certs
|
||||
|
||||
# 首次启动生成自签证书(File System Access API 需要 HTTPS 安全上下文)
|
||||
if [ ! -f "$CERT_DIR/server.crt" ]; then
|
||||
mkdir -p "$CERT_DIR"
|
||||
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
|
||||
-keyout "$CERT_DIR/server.key" \
|
||||
-out "$CERT_DIR/server.crt" \
|
||||
-subj "/CN=unicut" \
|
||||
-addext "subjectAltName=IP:192.168.68.19,IP:127.0.0.1,DNS:localhost"
|
||||
echo "已生成自签证书"
|
||||
fi
|
||||
|
||||
# 注入本机 AI 网关密钥(compose environment / .env 提供)
|
||||
if [ -n "$CI_KEY" ]; then
|
||||
sed -i "s|__CI_KEY__|$CI_KEY|g" /etc/nginx/conf.d/default.conf
|
||||
else
|
||||
echo "警告:未设置 CI_KEY,/civideo 反代将鉴权失败"
|
||||
fi
|
||||
|
||||
if [ -n "$OMNI_KEY" ]; then
|
||||
sed -i "s|__OMNI_KEY__|$OMNI_KEY|g" /etc/nginx/conf.d/default.conf
|
||||
else
|
||||
echo "警告:未设置 OMNI_KEY,/omniai 反代将鉴权失败"
|
||||
fi
|
||||
|
||||
exec nginx -g 'daemon off;'
|
||||
@@ -1,15 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta
|
||||
name="description"
|
||||
content="云剪是在线使用的视频云剪辑软件,可以对视频进行裁剪、拼接、添加滤镜、贴纸、动画效果,支持定制开发"
|
||||
content="UniCut 是一款在线视频剪辑工具,支持裁剪、拼接、滤镜、贴纸、动画、文字与配音,浏览器打开即可使用"
|
||||
/>
|
||||
<meta
|
||||
name="keywords"
|
||||
content="云剪,爱趣五视频云剪辑,视频剪辑软件,免费在线视频剪辑软件,视频云剪辑私有化部署,视频云剪辑软件源码授权"
|
||||
content="UniCut,在线视频剪辑,视频剪辑软件,免费视频剪辑工具,本地部署视频剪辑,视频剪辑工具"
|
||||
/>
|
||||
<meta name="renderer" content="webkit" />
|
||||
<!-- No Baidu Siteapp-->
|
||||
@@ -20,7 +20,7 @@
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>云剪|爱趣五视频云剪辑|视频剪辑软件|免费在线视频剪辑软件|视频剪辑工具|爱趣五科技有限公司</title>
|
||||
<title>UniCut</title>
|
||||
<script src="/assets/scripts/lame.min.js"></script>
|
||||
<script src="/assets/medianinfo/index.min.js"></script>
|
||||
<script async src="/assets/ffmpeg/ffmpeg.js"></script>
|
||||
@@ -29,14 +29,4 @@
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
<!-- <script src="https://map.qq.com/api/gljs?v=1.exp&key=M7CBZ-VZQKP-RMADM-VS3D3-34WHS-5GFMW"></script> -->
|
||||
<script>
|
||||
var _hmt = _hmt || [];
|
||||
(function () {
|
||||
var hm = document.createElement('script');
|
||||
hm.src = 'https://hm.baidu.com/hm.js?01f99bc11758b79ed21a256e704bee8e';
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
</html>
|
||||
@@ -0,0 +1,135 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
server_name _;
|
||||
|
||||
ssl_certificate /etc/nginx/certs/server.crt;
|
||||
ssl_certificate_key /etc/nginx/certs/server.key;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript image/svg+xml;
|
||||
|
||||
# SPA 路由回退
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# 长缓存带 hash 的构建产物
|
||||
location /homeAssets/ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
|
||||
|
||||
# 生视频:直连 cheaperinference(omniroute 的视频白名单不含该渠道,故绕开)
|
||||
location /civideo/ {
|
||||
proxy_pass https://api.cheaperinference.com/v1/;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host api.cheaperinference.com;
|
||||
proxy_set_header Authorization "Bearer __CI_KEY__";
|
||||
proxy_set_header Content-Type "application/json";
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
client_max_body_size 50m;
|
||||
}
|
||||
|
||||
# 本机 AI 网关(omniroute,OpenAI 兼容):生图/生视频走 cheaperinference 渠道
|
||||
# 密钥由 entrypoint.sh 在容器启动时注入,浏览器侧不出现
|
||||
location /omniai/ {
|
||||
proxy_pass http://192.168.68.19:20139/v1/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host 192.168.68.19;
|
||||
proxy_set_header Authorization "Bearer __OMNI_KEY__";
|
||||
proxy_set_header Content-Type "application/json";
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
client_max_body_size 20m;
|
||||
}
|
||||
|
||||
# 官方素材 CDN(模板工程 JSON、模板缩略图)同源反代:
|
||||
# 浏览器只请求 https://<站点>/cdn/**,不再直连 cdn.h5ds.com;
|
||||
# 断网时该目录自然取不到(模板面板本就是联网能力),本机模板 /templates/** 不受影响。
|
||||
location /cdn/ {
|
||||
proxy_pass https://cdn.h5ds.com/;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_set_header Host cdn.h5ds.com;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_read_timeout 300s;
|
||||
client_max_body_size 2048m;
|
||||
}
|
||||
|
||||
# 兜底:官方素材的同源相对路径(/video/… 与 /video_business/…)直接转发到 CDN。
|
||||
#
|
||||
# 为什么需要它 —— 模板列表接口返回的是相对路径,正常应由前端改写到 /cdn/;
|
||||
# 一旦改写逻辑丢失或被人改坏,这些路径会落到下面的 try_files 兜底,
|
||||
# 返回 200 text/html 的 SPA 首页,<img> 拿到 HTML 当然裂图,而且「200 + 裂图」
|
||||
# 极难排查(看着不像出错)。在这里直接转发到 CDN,既修好这一类问题,
|
||||
# 也让返回内容始终保持为真实图片。
|
||||
location ~ ^/(video|video_business)/ {
|
||||
proxy_pass https://cdn.h5ds.com/$uri;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_set_header Host cdn.h5ds.com;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_read_timeout 300s;
|
||||
client_max_body_size 2048m;
|
||||
}
|
||||
|
||||
# 本机 LLM 网关(NewAPI,OpenAI 兼容 /v1)同源反代:
|
||||
# 浏览器只请求 https://<站点>/newapi/v1/*,既避免 HTTPS 页面直连 HTTP 被拦(混合内容),
|
||||
# 也保证站点在只有本机网络时可用。密钥仍留在服务端,前端不出现。
|
||||
location /newapi/ {
|
||||
proxy_pass http://192.168.68.19:3099/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
client_max_body_size 20m;
|
||||
}
|
||||
|
||||
# 本机语音合成服务(unicut-tts 容器),同源反代,避免 HTTPS 页面加载 HTTP 音频被拦
|
||||
location /localtts/ {
|
||||
proxy_pass http://unicut-tts:8000/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_read_timeout 180s;
|
||||
client_max_body_size 8m;
|
||||
}
|
||||
|
||||
# UNICUT 在线服务反代(账号/素材/AI 等在线能力), 对应官方 dev server 的代理配置
|
||||
location /api/ {
|
||||
proxy_pass https://video.h5ds.com;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_set_header Host video.h5ds.com;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_read_timeout 300s;
|
||||
client_max_body_size 2048m;
|
||||
}
|
||||
|
||||
location /cgi-bin/ {
|
||||
proxy_pass https://video.h5ds.com;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_set_header Host video.h5ds.com;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_read_timeout 300s;
|
||||
client_max_body_size 2048m;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "yarn clean && yarn build:worker && vite build",
|
||||
"build": "yarn clean && node scripts/patch-sdk-offline.mjs && yarn build:worker && vite build",
|
||||
"build:worker": "node worker.config.js",
|
||||
"preview": "vite preview --port 8080",
|
||||
"lint": "eslint src --fix",
|
||||
@@ -106,6 +106,8 @@
|
||||
"typescript": "^5.1.6",
|
||||
"vite": "^4.4.4",
|
||||
"vite-plugin-imp": "^2.4.0",
|
||||
"vite-plugin-mkcert": "^1.17.9"
|
||||
"vite-plugin-mkcert": "^1.17.9",
|
||||
"terser": "^5.31.0",
|
||||
"rimraf": "^5.0.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// 免登录补丁(三处):未登录也能完整使用剪辑工作区
|
||||
// 1. checkAuth 恒 false —— 绕过 /workspace 路由的 meta.auth 守卫(上游未登录时静默弹回首页)
|
||||
// 2. IndexLayout 不再要求 user.info —— 否则未登录进编辑器显示「没有访问权限」
|
||||
// 3. 分类列表首屏抢跑服务器 API(未登录返回 code 1002 弹 "authorization cannot be empty")→ 无 token 时走本地 IndexedDB
|
||||
const fs = require('fs');
|
||||
const p = '/usr/share/nginx/html/homeAssets/js/main-d158b1c0.js';
|
||||
let s = fs.readFileSync(p, 'utf8');
|
||||
const pairs = [
|
||||
['function checkAuth(){const e=matchRoutes(routes,location.pathname);let t=!1;const r=e[e.length-1];return(null==r?void 0:r.route.meta)&&(t=r.route.meta.auth),t}',
|
||||
'function checkAuth(){return!1}'],
|
||||
[':t.info?jsxRuntimeExports.jsxs(FolderGuard,{children:[jsxRuntimeExports.jsx(PageLoading,{}),renderRoutes(e.routes)]}):jsxRuntimeExports.jsx("div",{children:"没有访问权限"})}',
|
||||
':jsxRuntimeExports.jsxs(FolderGuard,{children:[jsxRuntimeExports.jsx(PageLoading,{}),renderRoutes(e.routes)]})}'],
|
||||
['userService.getCategoryList({type:t,page:1,page_size:100}).then(t=>{const[r,n]=t;if(n)return Toast.error(n);a(r.data),e.catesCallback(r.data)})',
|
||||
'Promise.resolve(user$2.token?userService.getCategoryList({type:t,page:1,page_size:100}):getLocalCategoryList(t)).then(t=>{const[r,n]=t;if(n)return Toast.error(n);a(r.data),e.catesCallback(r.data)})'],
|
||||
];
|
||||
let ok = true;
|
||||
for (const [o, n] of pairs) {
|
||||
if (!s.includes(o)) { console.error('PATTERN_MISSING:', o.slice(0, 60)); ok = false; continue; }
|
||||
s = s.split(o).join(n);
|
||||
}
|
||||
if (!ok) process.exit(1);
|
||||
fs.writeFileSync(p, s);
|
||||
console.log('no-login patch applied (3/3)');
|
||||
@@ -0,0 +1,16 @@
|
||||
[
|
||||
{
|
||||
"id": "local-deploy-guide",
|
||||
"title": "UniCut 本机部署指南",
|
||||
"description": "一条命令把在线剪辑工具装进自己的机器,浏览器打开即用",
|
||||
"date": "2026-10-26",
|
||||
"tags": ["部署", "Docker"]
|
||||
},
|
||||
{
|
||||
"id": "offline-ready",
|
||||
"title": "断网也能用:UniCut 离线能力说明",
|
||||
"description": "字体、音色、模板、AI 全部本地化,外网断了也不影响剪辑",
|
||||
"date": "2026-10-26",
|
||||
"tags": ["离线", "原理"]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,60 @@
|
||||
# UniCut 本机部署指南
|
||||
|
||||
UniCut 是一个跑在浏览器里的视频剪辑工具。本机部署版把它做成一个 Docker 站点:
|
||||
装好之后打开网页就能剪辑,工程数据全部存在浏览器本地,不需要注册、不需要登录。
|
||||
|
||||
## 一、准备
|
||||
|
||||
- 一台 Linux 机器(内网 NAS、服务器、虚拟机都可以)
|
||||
- 已安装 Docker 与 Docker Compose
|
||||
- 一台同网段的电脑,用浏览器访问
|
||||
|
||||
## 二、部署
|
||||
|
||||
站点源码在 `docker/unicut-src`,构建与发布只有两条命令:
|
||||
|
||||
```bash
|
||||
cd docker/unicut-src
|
||||
docker compose build unicut
|
||||
docker compose up -d --no-build
|
||||
```
|
||||
|
||||
首次启动会自动生成自签证书(浏览器的 File System Access API 要求 HTTPS 安全上下文),
|
||||
证书保存在 named volume `certs` 里,重建容器不会丢。
|
||||
|
||||
## 三、访问
|
||||
|
||||
| 入口 | 地址 |
|
||||
| --- | --- |
|
||||
| HTTPS(推荐) | `https://<机器IP>:3005/` |
|
||||
| HTTP | `http://<机器IP>:3006/` |
|
||||
|
||||
自签证书第一次打开会有告警,点「高级 → 继续访问」即可。
|
||||
|
||||
## 四、配套服务
|
||||
|
||||
| 服务 | 容器 | 作用 |
|
||||
| --- | --- | --- |
|
||||
| 站点 | `unicut` | nginx:静态产物 + 同源反代 |
|
||||
| 配音 | `unicut-tts` | edge-tts,经 `/localtts/` 同源反代 |
|
||||
| 生图 | `omniroute` | 经 `/omniai/` 同源反代,密钥只在服务端 |
|
||||
| 对话 | NewAPI | 经 `/newapi/` 同源反代 |
|
||||
|
||||
浏览器侧只看到 `https://<站点>/localtts`、`/omniai`、`/newapi` 这些同源路径,
|
||||
既避免 HTTPS 页面直连 HTTP 被浏览器拦截,也不会把任何密钥暴露给前端。
|
||||
|
||||
## 五、构建与发布脚本
|
||||
|
||||
```bash
|
||||
bash scripts/build.sh
|
||||
```
|
||||
|
||||
脚本会:拿构建锁(避免并发构建互相覆盖)→ 构建镜像 → 发布容器 →
|
||||
导出产物跑断网 lint → curl 检查首页与详情页是否 200。
|
||||
|
||||
## 六、常见问题
|
||||
|
||||
- **打不开网页**:确认 3005 端口没有被占用,`docker ps` 里 `unicut` 状态应为 `Up`。
|
||||
- **配音没声音**:`curl -k https://127.0.0.1:3005/localtts/health`,确认 `unicut-tts` 容器在跑。
|
||||
- **AI 生图失败**:确认 `omniroute` 健康,且项目根目录 `.env` 里配置了 `OMNI_KEY`。
|
||||
- **工程数据在哪**:都在浏览器的 IndexedDB 与你选择的本地文件夹里,服务器上没有副本。
|
||||
@@ -0,0 +1,57 @@
|
||||
# 断网也能用:UniCut 离线能力说明
|
||||
|
||||
本机部署版的目标是:**把网线拔掉,剪辑功能照常**。
|
||||
这篇文章说明哪些东西被搬到了本地,以及怎么自己检查。
|
||||
|
||||
## 一、哪些东西本地化了
|
||||
|
||||
| 类别 | 原来的位置 | 现在的位置 |
|
||||
| --- | --- | --- |
|
||||
| 音色试听(121 个音色) | 字节 CDN | `public/assets/voices/`,清单 `assets/zijieVoices.json` |
|
||||
| 字体(思源黑体等) | CDN `/assets/fonts/` | `public/assets/fonts/`,清单 `assets/fontFamily.json` |
|
||||
| AI 对话头像 | 字节 CDN | `public/assets/ai-chat/` |
|
||||
| 编辑器演示工程 | CDN | `public/assets/demo/test-app.json` |
|
||||
| ffmpeg.wasm 内核 | unpkg 默认值 | `public/assets/ffmpeg/` |
|
||||
| SDK 里的 CDN 常量 | `cdn.h5ds.com` | 构建期由 `scripts/patch-sdk-offline.mjs` 改写 |
|
||||
| 生图 / 对话 / 配音 | 外部服务 | nginx 同源反代 `/omniai`、`/newapi`、`/localtts` |
|
||||
|
||||
下载与改写脚本可重复执行:
|
||||
|
||||
```bash
|
||||
python3 scripts/localize-assets.py
|
||||
```
|
||||
|
||||
## 二、怎么检查产物是否干净
|
||||
|
||||
每次构建后跑一次 lint,它会扫全部产物,统计「会真发起外网请求」的引用:
|
||||
|
||||
```bash
|
||||
python3 data-quality/scripts/site/00_lint_dist.py --dist dist
|
||||
```
|
||||
|
||||
判定标准:`external_refs = 0`。报告里还会列出:
|
||||
|
||||
1. 按 host 聚合的外部 URL 与出现位置(`file:line`);
|
||||
2. 懒加载 chunk 的 `import()` 指向,确认没有外域 chunk;
|
||||
3. 音视频 / 字体 / SDK 的引用取值,以及本地文件是否齐全;
|
||||
4. 不可消除项:第三方压缩产物里的许可证、论文、文档链接(见
|
||||
`data-quality/scripts/site/external_ref_allowlist.txt`,每条都写了原因)。
|
||||
|
||||
## 三、已经明确的例外
|
||||
|
||||
- **特效画布(EModule)**:官方 CDN 上的 `/assets/effectcanvas/` 目录已经下线(返回站点首页),
|
||||
下载不到真实模块。本地只放了占位清单,拿到模块后按原目录结构放进
|
||||
`public/assets/effectcanvas/` 即可恢复,不需要改代码。
|
||||
- **在线抠像(AI 人像分离)**:依赖外部站点提供服务,离线不可用。点击后会打开本站的说明页
|
||||
`/offline-notice.html`,不会再向外域发任何请求。
|
||||
- **页头的 GitHub / Gitee 链接**:属于用户主动点击才访问的导航外链,不参与资源加载,
|
||||
保留在允许清单里并注明原因。
|
||||
|
||||
## 四、怎么新增一篇教程
|
||||
|
||||
1. 写 `public/articles/<slug>.md`;
|
||||
2. 在 `public/articles/index.json` 里登记 `id`(必须等于 slug)、标题、日期;
|
||||
3. 详情页地址就是 `https://<站点>/article/<slug>`,不需要改任何前端代码。
|
||||
|
||||
slug 规则:小写字母、数字、连字符,形如 `^[a-z0-9]+(?:-[a-z0-9]+)*$`,长度不超过 64。
|
||||
完整规范见 `docs/断网可用改造.md` 的「详情页与 slug 规范」。
|
||||
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 920 B |
@@ -1,3 +0,0 @@
|
||||
/*! For license information please see tesseract.min.js.LICENSE.txt */
|
||||
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Tesseract=r():t.Tesseract=r()}(self,(()=>(()=>{var t={670:t=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}t.exports=function(){return"undefined"!=typeof window&&"object"===r(window.process)&&"renderer"===window.process.type||!("undefined"==typeof process||"object"!==r(process.versions)||!process.versions.electron)||"object"===("undefined"==typeof navigator?"undefined":r(navigator))&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0}},760:(t,r,e)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}var o=function(t){"use strict";var r,e=Object.prototype,o=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof m?r:m,a=Object.create(o.prototype),c=new N(n||[]);return i(a,"_invoke",{value:P(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p="suspendedStart",y="suspendedYield",v="executing",d="completed",g={};function m(){}function b(){}function w(){}var x={};l(x,c,(function(){return this}));var L=Object.getPrototypeOf,O=L&&L(L(A([])));O&&O!==e&&o.call(O,c)&&(x=O);var E=w.prototype=m.prototype=Object.create(x);function S(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function j(t,r){function e(i,a,c,u){var f=h(t[i],t,a);if("throw"!==f.type){var l=f.arg,s=l.value;return s&&"object"===n(s)&&o.call(s,"__await")?r.resolve(s.__await).then((function(t){e("next",t,c,u)}),(function(t){e("throw",t,c,u)})):r.resolve(s).then((function(t){l.value=t,c(l)}),(function(t){return e("throw",t,c,u)}))}u(f.arg)}var a;i(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return a=a?a.then(o,o):o()}})}function P(t,r,e){var n=p;return function(o,i){if(n===v)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return G()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=k(a,e);if(c){if(c===g)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===p)throw n=d,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=v;var u=h(t,r,e);if("normal"===u.type){if(n=e.done?d:y,u.arg===g)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=d,e.method="throw",e.arg=u.arg)}}}function k(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,k(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,g):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function _(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function T(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function A(t){if(t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=r,e.done=!0,e};return i.next=i}}return{next:G}}function G(){return{value:r,done:!0}}return b.prototype=w,i(E,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:b,configurable:!0}),b.displayName=l(w,f,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===b||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,f,"GeneratorFunction")),t.prototype=Object.create(E),t},t.awrap=function(t){return{__await:t}},S(j.prototype),l(j.prototype,u,(function(){return this})),t.AsyncIterator=j,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new j(s(r,eLine truncated
|
||||
//# sourceMappingURL=tesseract.min.js.map
|
||||
@@ -1,3 +0,0 @@
|
||||
/*! For license information please see worker.min.js.LICENSE.txt */
|
||||
(()=>{var t={919:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=u(t),a=o[0],s=o[1],c=new i(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),f=0,h=s>0?a-4:a;for(r=0;r<h;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],c[f++]=e>>16&255,c[f++]=e>>8&255,c[f++]=255&e;return 2===s&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[f++]=255&e),1===s&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,c[f++]=e>>8&255,c[f++]=255&e),c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=16383,s=0,u=n-i;s<u;s+=a)o.push(c(t,s,s+a>u?u:s+a));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=o.length;a<s;++a)r[a]=o[a],n[o.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,n){for(var i,o,a=[],s=e;s<n;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},86:(t,e,r)=>{var n=r(752),i=r(773);t.exports={encode:n,decode:i}},773:(t,e,r)=>{var n=r(33).lW;function i(t,e){if(this.pos=0,this.buffer=t,this.is_with_alpha=!!e,this.bottom_up=!0,this.flag=this.buffer.toString("utf-8",0,this.pos+=2),"BM"!=this.flag)throw new Error("Invalid BMP File");this.parseHeader(),this.parseRGBA()}i.prototype.parseHeader=function(){if(this.fileSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.reserved=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.offset=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.headerSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.width=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.height=this.buffer.readInt32LE(this.pos),this.pos+=4,this.planes=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.bitPP=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.compress=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.rawSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.hr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.vr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.colors=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.importantColors=this.buffer.readUInt32LE(this.pos),this.pos+=4,16===this.bitPP&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=0===this.colors?1<<this.bitPP:this.colors;this.palette=new Array(t);for(var e=0;e<t;e++){var r=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++),i=this.buffer.readUInt8(this.pos++),o=this.buffer.readUInt8(this.pos++);this.palette[e]={red:i,green:n,blue:r,quad:o}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},i.prototype.parseRGBA=function(){var t="bit"+this.bitPP,e=this.width*this.height*4;this.data=new n(e),this[t]()},i.prototype.bit1=function(){var t=Math.ceil(this.width/8),e=t%4,r=this.height>=0?this.height-1:-this.height;for(r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,i=0;i<t;i++)for(var o=this.buffer.readUInt8(this.pos++),a=n*this.width*4+8*i*4,s=0;s<8&&8*i+s<this.width;s++){var u=this.palette[o>>7-s&1];this.data[a+4*s]=0,this.data[a+4*s+1]=u.blue,this.data[a+4*s+2]=u.green,this.data[a+4*s+3]=u.red}0!=e&&(this.pos+=4-e)}},i.prototype.bit4=function(){if(2==this.compress){var t=function(t){var r=this.palette[t];this.data[e]=0,this.data[e+1]=r.blue,this.data[e+2]=r.green,this.data[e+3]=r.red,e+=4};this.data.fill(255);for(var e=0,r=this.bottom_up?this.height-1:0,n=!1;e<this.data.length;){var i=this.buffer.readUInt8(this.pos++),o=this.buffer.readUInt8(this.pos++);if(0==i){if(0==o){this.bottom_up?r--:r++,e=r*this.width*4,n=!1;continue}if(1==o)break;if(2==o){var a=this.buffer.readUInt8(this.pos++),s=this.buffer.readUInt8(this.pos++);this.bottom_up?r-=s:r+=s,e+=s*this.width*4+4*a}else{for(var u=this.buffer.readUInt8(this.pos++),c=0;c<o;c++)t.call(this,n?15&u:(240&u)>>4),1&c&&c+1<o&&(u=this.buffer.readUInt8(this.pos++)),n=!n;1==(o+1>>1&1)&&this.pos++}}else for(c=0;c<i;c++)t.call(this,n?15&o:(240&o)>>4),n=!n}}else{var f=Math.ceil(this.width/2),h=f%4;for(s=this.height-1;s>=0;s--){var l=this.bottom_up?s:this.height-1-s;for(a=0;a<f;a++){o=this.buffer.readUInt8(this.pos++),e=l*this.width*4+2*a*4;var p=o>>4,d=15&o,y=this.palette[p];if(this.data[e]=0,this.data[e+1]=y.blue,this.data[e+2]=y.green,this.data[e+3]=y.red,2*a+1>=this.width)break;y=this.palette[d],this.data[e+4]=0,this.data[e+4+1]=y.blue,this.data[e+4+2]=y.green,this.data[e+4+3]=y.red}0!=h&&(this.pos+=4-h)}}},i.prototype.bit8=function(){if(1==this.compress){var t=function(t){var r=this.palette[t];this.data[e]=0,this.data[e+1]=r.blue,this.data[e+2]=r.green,this.data[e+3]=r.red,e+=Line truncated
|
||||
//# sourceMappingURL=worker.min.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"title":"每天凌晨3点熬汤,纸包鱼创业者用‘透明厨房’征服回头客","createTime":1774287378187,"updateTime":1774287378187,"poster":"","version":"1.1.0","width":1080,"height":1920,"duration":23.428571428571427,"background":{},"elements":[{"id":"7ml0ky9z","name":"960586379797364736.mp4","_dirty":"1","type":"video","trackIndex":1,"resourceId":"960586379797364736","startTime":0,"matting":{"enabled":false,"color":"#00FF00","filterType":8,"lightLevel":0.2,"gridSize":0.8,"emergence":0},"duration":4.857142857142857,"muted":true,"volume":1,"speed":1,"curveSpeed":false,"clipTime":0,"blendMode":0,"style":{"width":1080,"height":1920,"x":540,"y":960},"flipx":false,"scale":1,"_ratio":0,"filters":[],"templateEnable":true,"sceneIndex":1,"desc":"素材展示厨师凌晨熬汤细节,突出时间与坚持"},{"id":"pdmshnrs","name":"960586379797364736.mp4","_dirty":"1","type":"video","trackIndex":1,"resourceId":"960586379797364736","startTime":4.857142857142857,"matting":{"enabled":false,"color":"#00FF00","filterType":8,"lightLevel":0.2,"gridSize":0.8,"emergence":0},"duration":5.714285714285714,"muted":true,"volume":1,"speed":1,"curveSpeed":false,"clipTime":0,"blendMode":0,"style":{"width":1080,"height":1920,"x":540,"y":960},"flipx":false,"scale":1,"_ratio":0,"filters":[],"templateEnable":true,"sceneIndex":2,"desc":"素材展示后厨环境透明、厨具干净,体现透明厨房理念"},{"id":"cuhalvhs","name":"960586379797364736.mp4","_dirty":"1","type":"video","trackIndex":1,"resourceId":"960586379797364736","startTime":10.571428571428571,"matting":{"enabled":false,"color":"#00FF00","filterType":8,"lightLevel":0.2,"gridSize":0.8,"emergence":0},"duration":4.571428571428571,"muted":true,"volume":1,"speed":1,"curveSpeed":false,"clipTime":0,"blendMode":0,"style":{"width":1080,"height":1920,"x":540,"y":960},"flipx":false,"scale":1,"_ratio":0,"filters":[],"templateEnable":true,"sceneIndex":3,"desc":"素材展示厨师专注烹饪鱼,旁白强调熬汤用心"},{"id":"gw9velsm","name":"960586379797364736.mp4","_dirty":"1","type":"video","trackIndex":1,"resourceId":"960586379797364736","startTime":15.142857142857142,"matting":{"enabled":false,"color":"#00FF00","filterType":8,"lightLevel":0.2,"gridSize":0.8,"emergence":0},"duration":3.428571428571427,"muted":true,"volume":1,"speed":1,"curveSpeed":false,"clipTime":0,"blendMode":0,"style":{"width":1080,"height":1920,"x":540,"y":960},"flipx":false,"scale":1,"_ratio":0,"filters":[],"templateEnable":true,"sceneIndex":4,"desc":"素材展示顾客满意的表情,体现回头客认可"},{"id":"nycs0n1i","name":"960586379797364736.mp4","_dirty":"1","type":"video","trackIndex":1,"resourceId":"960586379797364736","startTime":18.57142857142857,"matting":{"enabled":false,"color":"#00FF00","filterType":8,"lightLevel":0.2,"gridSize":0.8,"emergence":0},"duration":4.857142857142858,"muted":true,"volume":1,"speed":1,"curveSpeed":false,"clipTime":0,"blendMode":0,"style":{"width":1080,"height":1920,"x":540,"y":960},"flipx":false,"scale":1,"_ratio":0,"filters":[],"templateEnable":true,"sceneIndex":5,"desc":"素材展示后厨成品被端出,旁白升华透明经营的意义"},{"id":"y6r2usm8","name":"Zeal.mp3","_dirty":"1","_noControl":true,"type":"audio","trackIndex":3,"resourceId":"958639290817400832","startTime":0,"duration":23.428571428571427,"muted":false,"volume":0.5,"speed":1,"curveSpeed":false,"clipTime":0,"fadeInTime":0,"fadeOutTime":0,"extend":"bgAudio"}],"transitions":[],"cameras":[],"captions":[{"id":"hkbn55y9","name":"每天凌晨3点,后厨只有熬汤的微光。","text":"每天凌晨3点,后厨只有熬汤的微","textStyle":{"radius":[0,0,0,0],"type":"newTextStyle","direction":"horizontal","fillType":"normal","fill":"rgba(248, 231, 28, 1)","padding":[5,5,5,5],"fontSize":200,"letterSpacing":0,"lineHeight":200,"align":"center","fontFamily":"抖音美好体","stroke":{"color":"rgba(51, 51, 51, 1)","lineJoin":"round","lineWidth":18},"fontFamilyURL":"/assets/fonts/抖音美好体.otf"},"style":{"x":540,"y":1480,"alpha":1,"width":392.96000000000004,"height":67.2},"_dirty":"dS1HtIONQ6","type":"caption","trackIndex":0.5,"startTime":0,"duration":2.4285714285714284,"textScale":0.32,"scale":1,"_textStyleDirty":"","templateEnable":true,"sceneIndex":1},{"id":"m5nu3ch2","name":"每天凌晨3点,后厨只有熬汤的微光。","text":"光。","textStyle":{"radius":[0,0,0,0],"type":"newTextStyle","direction":"horizontal","fillType":"normal","fill":"rgba(248, 231, 28, 1)","padding":[5,5,5,5],"fontSize":200,"letterSpacing":0,"lineHeight":200,"align":"center","fontFamily":"抖音美好体","stroke":{"color":"rgba(51, 51, 51, 1)","lineJoin":"round","lineWidth":18},"fontFamilyURL":"/assets/fonts/抖音美好体.otf"},"style":{"x":540,"y":1480,"alpha":1,"width":392.96000000000004,"height":67.2},"_dirty":"dS1HtIONQ6","type":"caption","trackIndex":0.5,"startTime":2.4285714285714284,"duration":2.4285714285714284,"textScale":0.32,"scale":1,"_textStyleDirty":"","templateEnabLine truncated
|
||||
@@ -0,0 +1,7 @@
|
||||
# effectcanvas 本地占位
|
||||
|
||||
官方 `https://cdn.h5ds.com/assets/effectcanvas/` 目前返回站点 index.html(目录已下线),无法下载真实模块。
|
||||
|
||||
- SDK `window.EModuleEffectSourcePath` 已改指向本目录(`/assets/effectcanvas/`);
|
||||
- 这里只放 `manifest.json` 占位,特效画布(EModule)功能在拿到真实模块前不可用(TODO);
|
||||
- 若上游恢复,把模块文件按原目录结构放进来即可,无需改代码。
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"version": "local-stub",
|
||||
"note": "官方 CDN /assets/effectcanvas/ 已失效,特效画布模块暂不可用",
|
||||
"modules": []
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FFmpegWASM=t():e.FFmpegWASM=t()}(self,(()=>(()=>{var e={454:e=>{function t(e){return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}))}t.keys=()=>[],t.resolve=t,t.id=454,e.exports=t}},t={};function r(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,r),s.exports}return r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e;!function(e){e.LOAD="LOAD",e.EXEC="EXEC",e.WRITE_FILE="WRITE_FILE",e.READ_FILE="READ_FILE",e.DELETE_FILE="DELETE_FILE",e.RENAME="RENAME",e.CREATE_DIR="CREATE_DIR",e.LIST_DIR="LIST_DIR",e.DELETE_DIR="DELETE_DIR",e.ERROR="ERROR",e.DOWNLOAD="DOWNLOAD",e.PROGRESS="PROGRESS",e.LOG="LOG"}(e||(e={}));const t=new Error("unknown message type"),a=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),o=(new Error("called FFmpeg.terminate()"),new Error("failed to import ffmpeg-core.js"));let s;self.onmessage=async({data:{id:E,type:n,data:i}})=>{const c=[];let p;try{if(n!==e.LOAD&&!s)throw a;switch(n){case e.LOAD:p=await(async({coreURL:t="https://unpkg.com/@ffmpeg/core@0.12.1/dist/umd/ffmpeg-core.js",wasmURL:a,workerURL:E})=>{const n=!s,i=t,c=a||t.replace(/.js$/g,".wasm"),p=E||t.replace(/.js$/g,".worker.js");try{importScripts(i)}catch{if(self.createFFmpegCore=(await r(454)(i)).default,!self.createFFmpegCore)throw o}return s=await self.createFFmpegCore({mainScriptUrlOrBlob:`${i}#${btoa(JSON.stringify({wasmURL:c,workerURL:p}))}`}),s.setLogger((t=>self.postMessage({type:e.LOG,data:t}))),s.setProgress((t=>self.postMessage({type:e.PROGRESS,data:t}))),n})(i);break;case e.EXEC:p=(({args:e,timeout:t=-1})=>{s.setTimeout(t),s.exec(...e);const r=s.ret;return s.reset(),r})(i);break;case e.WRITE_FILE:p=(({path:e,data:t})=>(s.FS.writeFile(e,t),!0))(i);break;case e.READ_FILE:p=(({path:e,encoding:t})=>s.FS.readFile(e,{encoding:t}))(i);break;case e.DELETE_FILE:p=(({path:e})=>(s.FS.unlink(e),!0))(i);break;case e.RENAME:p=(({oldPath:e,newPath:t})=>(s.FS.rename(e,t),!0))(i);break;case e.CREATE_DIR:p=(({path:e})=>(s.FS.mkdir(e),!0))(i);break;case e.LIST_DIR:p=(({path:e})=>{const t=s.FS.readdir(e),r=[];for(const a of t){const t=s.FS.stat(`${e}/${a}`),o=s.FS.isDir(t.mode);r.push({name:a,isDir:o})}return r})(i);break;case e.DELETE_DIR:p=(({path:e})=>(s.FS.rmdir(e),!0))(i);break;default:throw t}}catch(t){return void self.postMessage({id:E,type:e.ERROR,data:t.toString()})}p instanceof Uint8Array&&c.push(p.buffer),self.postMessage({id:E,type:n,data:p},c)}})(),{}})()));
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FFmpegWASM=t():e.FFmpegWASM=t()}(self,(()=>(()=>{var e={454:e=>{function t(e){return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}))}t.keys=()=>[],t.resolve=t,t.id=454,e.exports=t}},t={};function r(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,r),s.exports}return r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e;!function(e){e.LOAD="LOAD",e.EXEC="EXEC",e.WRITE_FILE="WRITE_FILE",e.READ_FILE="READ_FILE",e.DELETE_FILE="DELETE_FILE",e.RENAME="RENAME",e.CREATE_DIR="CREATE_DIR",e.LIST_DIR="LIST_DIR",e.DELETE_DIR="DELETE_DIR",e.ERROR="ERROR",e.DOWNLOAD="DOWNLOAD",e.PROGRESS="PROGRESS",e.LOG="LOG"}(e||(e={}));const t=new Error("unknown message type"),a=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),o=(new Error("called FFmpeg.terminate()"),new Error("failed to import ffmpeg-core.js"));let s;self.onmessage=async({data:{id:E,type:n,data:i}})=>{const c=[];let p;try{if(n!==e.LOAD&&!s)throw a;switch(n){case e.LOAD:p=await(async({coreURL:t="/assets/ffmpeg/ffmpeg-core.js",wasmURL:a,workerURL:E})=>{const n=!s,i=t,c=a||t.replace(/.js$/g,".wasm"),p=E||t.replace(/.js$/g,".worker.js");try{importScripts(i)}catch{if(self.createFFmpegCore=(await r(454)(i)).default,!self.createFFmpegCore)throw o}return s=await self.createFFmpegCore({mainScriptUrlOrBlob:`${i}#${btoa(JSON.stringify({wasmURL:c,workerURL:p}))}`}),s.setLogger((t=>self.postMessage({type:e.LOG,data:t}))),s.setProgress((t=>self.postMessage({type:e.PROGRESS,data:t}))),n})(i);break;case e.EXEC:p=(({args:e,timeout:t=-1})=>{s.setTimeout(t),s.exec(...e);const r=s.ret;return s.reset(),r})(i);break;case e.WRITE_FILE:p=(({path:e,data:t})=>(s.FS.writeFile(e,t),!0))(i);break;case e.READ_FILE:p=(({path:e,encoding:t})=>s.FS.readFile(e,{encoding:t}))(i);break;case e.DELETE_FILE:p=(({path:e})=>(s.FS.unlink(e),!0))(i);break;case e.RENAME:p=(({oldPath:e,newPath:t})=>(s.FS.rename(e,t),!0))(i);break;case e.CREATE_DIR:p=(({path:e})=>(s.FS.mkdir(e),!0))(i);break;case e.LIST_DIR:p=(({path:e})=>{const t=s.FS.readdir(e),r=[];for(const a of t){const t=s.FS.stat(`${e}/${a}`),o=s.FS.isDir(t.mode);r.push({name:a,isDir:o})}return r})(i);break;case e.DELETE_DIR:p=(({path:e})=>(s.FS.rmdir(e),!0))(i);break;default:throw t}}catch(t){return void self.postMessage({id:E,type:e.ERROR,data:t.toString()})}p instanceof Uint8Array&&c.push(p.buffer),self.postMessage({id:E,type:n,data:p},c)}})(),{}})()));
|
||||
//# sourceMappingURL=814.ffmpeg.js.map
|
||||
@@ -0,0 +1,18 @@
|
||||
[
|
||||
{
|
||||
"name": "siYuanHeiTi",
|
||||
"label": "思源黑体",
|
||||
"urls": {
|
||||
"url": "/assets/fonts/siYuanHeiTi/font.woff",
|
||||
"thumb": "/assets/fonts/siYuanHeiTi/thumb.png"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "aConfused",
|
||||
"label": "杂体(思源黑体兜底)",
|
||||
"urls": {
|
||||
"url": "/assets/fonts/aConfused/font.woff",
|
||||
"thumb": "/assets/fonts/aConfused/thumb.png"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
After Width: | Height: | Size: 923 B |
|
After Width: | Height: | Size: 689 B |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 89 KiB |
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="286px" height="90px" viewBox="0 0 286 90" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 61.2 (89653) - https://sketch.com -->
|
||||
<title>logo-black</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="LOGO" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 2.0 KiB |