🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"
TypeScript
fix: publish website download manifest with desktop releases
Connor8fd0b8ba247c
diff --git a/desktop/scripts/cos-upload.mjs b/desktop/scripts/cos-upload.mjsindex 61526df..654be64 100644--- a/desktop/scripts/cos-upload.mjs+++ b/desktop/scripts/cos-upload.mjs@@ -57,7 +57,7 @@ function authorization(method, uriPathname) {+ `&q-header-list=host&q-url-param-list=&q-signature=${signature}`}-export async function cosPut(localFile, key, { cacheControl } = {}) {+export async function cosPut(localFile, key, { cacheControl, contentType } = {}) {const body = fs.readFileSync(localFile)const uriPathname = `/${key.split('/').map(encodeURIComponent).join('/')}`const headers = {@@ -67,6 +67,7 @@ export async function cosPut(localFile, key, { cacheControl } = {}) {'Content-MD5': crypto.createHash('md5').update(body).digest('base64'),}if (cacheControl) headers['Cache-Control'] = cacheControl+ if (contentType) headers['Content-Type'] = contentTypeconst res = await fetch(`https://${HOST}${uriPathname}`, {method: 'PUT',diff --git a/desktop/scripts/publish-release.mjs b/desktop/scripts/publish-release.mjsindex 61774da..84f8ae2 100644--- a/desktop/scripts/publish-release.mjs+++ b/desktop/scripts/publish-release.mjs@@ -50,8 +50,8 @@ const assets = [// URL/COS key 使用的规范化文件名(空格 → 点号,与 GitHub 服务端一致)const dotName = (f) => f.replace(/ /g, '.')const existing = assets.filter(f => fs.existsSync(path.join(RELEASE, f)))-if (!existing.length) {- console.error(`release/ 下没有版本 ${version} 的产物,请先 npm run dist / dist:win`)+if (existing.length !== assets.length) {+ console.error(`发布需要全部平台产物,缺少: ${assets.filter(f => !existing.includes(f)).join(', ')}`)process.exit(1)}@@ -118,6 +118,23 @@ await cosPut(path.join(RELEASE, 'latest.cos.json'), `${COS_KEY_PREFIX}/latest.js})console.log(` ✓ latest.json (no-cache)`)+// 官网使用脚本清单跨域加载,无需修改 COS 桶级 CORS。安装包全部上传后才更新。+const websiteRelease = {+ version,+ downloads: {+ 'darwin-arm64': `${COS_BASE_URL}/${tag}/HuobaoDrama-${version}-arm64.dmg`,+ 'darwin-x64': `${COS_BASE_URL}/${tag}/HuobaoDrama-${version}.dmg`,+ 'win32-x64': `${COS_BASE_URL}/${tag}/HuobaoDrama.Setup.${version}.exe`,+ },+}+const websiteFeedPath = path.join(RELEASE, 'latest.js')+fs.writeFileSync(websiteFeedPath, `window.huobaoDramaRelease(${JSON.stringify(websiteRelease)});\n`)+await cosPut(websiteFeedPath, `${COS_KEY_PREFIX}/latest.js`, {+ cacheControl: 'no-cache',+ contentType: 'application/javascript; charset=utf-8',+})+console.log(' ✓ latest.js (官网自动下载清单)')+console.log(`发布完成:海外 https://github.com/chatfire-AI/huobao-drama/releases/${tag}