@ttmg/cli 0.3.1-unity.9 → 0.3.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/index.js +210 -40
- package/dist/index.js.map +1 -1
- package/dist/package.json +3 -2
- package/dist/public/assets/index-9wLHKdTg.css +1 -0
- package/dist/public/assets/index-9wLHKdTg.css.br +0 -0
- package/dist/public/assets/index-Cuov3ysP.js +67 -0
- package/dist/public/assets/index-Cuov3ysP.js.br +0 -0
- package/dist/public/assets/{index-BLMuzkOF.js → index-D5if59dO.js} +1 -1
- package/dist/public/assets/index-D5if59dO.js.br +0 -0
- package/dist/public/assets/{index-tH12LIuT.js → index-D7VJivFN.js} +18 -18
- package/dist/public/assets/index-D7VJivFN.js.br +0 -0
- package/dist/public/assets/index-D9N96fJ2.js +67 -0
- package/dist/public/assets/index-D9N96fJ2.js.br +0 -0
- package/dist/public/assets/index-DER-DYLd.css +1 -0
- package/dist/public/assets/index-DER-DYLd.css.br +0 -0
- package/dist/public/assets/{index-O0TENe77.js → index-YhxvkywD.js} +1 -1
- package/dist/public/assets/index-YhxvkywD.js.br +0 -0
- package/dist/public/index.html +2 -2
- package/dist/scripts/worker.js +4 -27
- package/package.json +3 -2
- package/dist/public/assets/index-BLMuzkOF.js.br +0 -0
- package/dist/public/assets/index-O0TENe77.js.br +0 -0
- package/dist/public/assets/index-tH12LIuT.js.br +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -174,3 +174,12 @@ feat: 支持文件变更监听,告知浏览器文件变更,提醒开发者
|
|
|
174
174
|
修复启动模式模块,自定义query 参数无法持久化的问题
|
|
175
175
|
修复扫描二维码模块,内容过多,纵向无法滚动问题
|
|
176
176
|
|
|
177
|
+
## 0.3.1
|
|
178
|
+
- 支持 unity 小游戏本地一些列调试功能,如 Wasm 分包、包大小校验、一键上传代码包至平台等 了解如何使用
|
|
179
|
+
- 增加用户登录过期的异常提示,提醒开发者重新登录
|
|
180
|
+
- 优化上传代码包至平台功能,开发者只用添加描述后点击上传便可自动压缩当前目录下的代码包上传至开发者平台
|
|
181
|
+
- 优化 ttmg login 终端网络代理异常导致无法登录的报错引导,提示用户检查网络设置
|
|
182
|
+
|
|
183
|
+
## 0.3.2-beta.1
|
|
184
|
+
支持 cocos 2.0 openDataContext 相关适配
|
|
185
|
+
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ var cheerio = require('cheerio');
|
|
|
13
13
|
var os = require('os');
|
|
14
14
|
var worker_threads = require('worker_threads');
|
|
15
15
|
var axios = require('axios');
|
|
16
|
+
var qs = require('qs');
|
|
16
17
|
var handlebars = require('handlebars');
|
|
17
18
|
var esbuild = require('esbuild');
|
|
18
19
|
var archiver = require('archiver');
|
|
@@ -21,8 +22,9 @@ var WebSocket = require('ws');
|
|
|
21
22
|
var glob = require('glob');
|
|
22
23
|
var got = require('got');
|
|
23
24
|
var FormData$1 = require('form-data');
|
|
24
|
-
var
|
|
25
|
+
var stream = require('stream');
|
|
25
26
|
var ttmgPack = require('ttmg-pack');
|
|
27
|
+
var http = require('http');
|
|
26
28
|
var fs$1 = require('node:fs');
|
|
27
29
|
var path$1 = require('node:path');
|
|
28
30
|
var zlib = require('zlib');
|
|
@@ -276,7 +278,7 @@ const LOGIN_TT4D = 'https://developers.tiktok.com/passport/web/email/login';
|
|
|
276
278
|
const params = {
|
|
277
279
|
aid: '2471',
|
|
278
280
|
account_sdk_source: 'web',
|
|
279
|
-
sdk_version: '2.1.
|
|
281
|
+
sdk_version: '2.1.6-tiktok',
|
|
280
282
|
};
|
|
281
283
|
const prompt = inquirer.createPromptModule();
|
|
282
284
|
async function login() {
|
|
@@ -318,8 +320,11 @@ async function login() {
|
|
|
318
320
|
const url = LOGIN_TT4D + '?' + new URLSearchParams(params);
|
|
319
321
|
const headers = {
|
|
320
322
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
321
|
-
'User-Agent': 'curl/8.5.0',
|
|
322
323
|
Accept: '*/*',
|
|
324
|
+
'Accept-Encoding': 'gzip, deflate, br',
|
|
325
|
+
Origin: 'https://developers.tiktok.com',
|
|
326
|
+
Referer: 'https://developers.tiktok.com/passport/web/email/login',
|
|
327
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0 Safari/537.36',
|
|
323
328
|
};
|
|
324
329
|
const ora = await import('ora');
|
|
325
330
|
spinner$1 = ora.default({
|
|
@@ -327,13 +332,28 @@ async function login() {
|
|
|
327
332
|
spinner: 'dots',
|
|
328
333
|
});
|
|
329
334
|
spinner$1.start();
|
|
335
|
+
const data = qs.stringify({
|
|
336
|
+
email,
|
|
337
|
+
password,
|
|
338
|
+
mix_mode: '1',
|
|
339
|
+
fixed_mix_mode: '1',
|
|
340
|
+
});
|
|
330
341
|
try {
|
|
331
|
-
const response = await axios.post(url, {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
342
|
+
const response = await axios.post(url, data, {
|
|
343
|
+
headers,
|
|
344
|
+
maxRedirects: 20,
|
|
345
|
+
timeout: 30000,
|
|
346
|
+
});
|
|
347
|
+
if (!response?.data?.data?.user_id) {
|
|
348
|
+
const errCode = response.data?.data?.error_code;
|
|
349
|
+
const errMsg = response.data?.data?.description;
|
|
350
|
+
if (errCode || errMsg) {
|
|
351
|
+
spinner$1.fail(chalk.red(`login failed: ${errMsg}${errCode ? `, error_code: ${errCode}` : ''}`));
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
spinner$1.fail(chalk.red(`login failed`));
|
|
355
|
+
console.log(response.data);
|
|
356
|
+
}
|
|
337
357
|
spinner$1.stop();
|
|
338
358
|
process.exit(1);
|
|
339
359
|
}
|
|
@@ -349,8 +369,13 @@ async function login() {
|
|
|
349
369
|
}
|
|
350
370
|
}
|
|
351
371
|
catch (error) {
|
|
352
|
-
|
|
353
|
-
|
|
372
|
+
// 1. Error Title: Red and bold
|
|
373
|
+
spinner$1.fail(chalk.red.bold('Failed to connect to login service'));
|
|
374
|
+
// 2. Description: Normal text with bold keywords
|
|
375
|
+
console.log(" Detected that the current terminal's " +
|
|
376
|
+
chalk.bold('network proxy settings') +
|
|
377
|
+
' are preventing external network access.', chalk.yellow('Please check your local terminal proxy configuration.'));
|
|
378
|
+
console.log(chalk.yellow('You can follow this doc to modify your terminal network settings:'), chalk.underline.yellow('https://bytedance.larkoffice.com/wiki/ZblJwT0ZNil9jJkS8EgcFlcQnFc'));
|
|
354
379
|
process.exit(1);
|
|
355
380
|
}
|
|
356
381
|
}
|
|
@@ -366,8 +391,8 @@ async function request({ url, method, data, headers, params, }) {
|
|
|
366
391
|
data,
|
|
367
392
|
params,
|
|
368
393
|
headers: {
|
|
369
|
-
...(headers || {}),
|
|
370
394
|
Cookie: cookie,
|
|
395
|
+
...(headers || {}),
|
|
371
396
|
},
|
|
372
397
|
});
|
|
373
398
|
// @ts-ignore
|
|
@@ -495,7 +520,7 @@ async function fetchGameInfo(clientKey) {
|
|
|
495
520
|
params: {
|
|
496
521
|
client_key: clientKey,
|
|
497
522
|
// version_type: 1,
|
|
498
|
-
}
|
|
523
|
+
}
|
|
499
524
|
// headers: {
|
|
500
525
|
// 'x-use-ppe': '1',
|
|
501
526
|
// 'x-tt-env': 'ppe_mg_revamp',
|
|
@@ -639,6 +664,17 @@ function ensureDirSync(dirPath) {
|
|
|
639
664
|
}
|
|
640
665
|
}
|
|
641
666
|
|
|
667
|
+
const bareToRelativePlugin = {
|
|
668
|
+
name: 'bare-to-relative',
|
|
669
|
+
setup(build) {
|
|
670
|
+
// 匹配不以 . 或 / 开头的 .js 文件路径
|
|
671
|
+
build.onResolve({ filter: /^[^./].*\.js$/ }, args => {
|
|
672
|
+
return {
|
|
673
|
+
path: path.resolve(args.resolveDir, args.path),
|
|
674
|
+
};
|
|
675
|
+
});
|
|
676
|
+
},
|
|
677
|
+
};
|
|
642
678
|
function buildOpenContext(sourcePath) {
|
|
643
679
|
const result = esbuild.buildSync({
|
|
644
680
|
entryPoints: [sourcePath],
|
|
@@ -655,6 +691,7 @@ function buildOpenContext(sourcePath) {
|
|
|
655
691
|
'.svg': 'dataurl',
|
|
656
692
|
'.webp': 'dataurl',
|
|
657
693
|
},
|
|
694
|
+
plugins: [bareToRelativePlugin],
|
|
658
695
|
});
|
|
659
696
|
const jsCode = result.outputFiles[0].text;
|
|
660
697
|
return jsCode;
|
|
@@ -1795,14 +1832,58 @@ function showTips(context) {
|
|
|
1795
1832
|
console.log(chalk.gray('─────────────────────────────────────────────'));
|
|
1796
1833
|
}
|
|
1797
1834
|
|
|
1798
|
-
|
|
1835
|
+
/**
|
|
1836
|
+
* 辅助函数:将当前工作目录打包为 Buffer
|
|
1837
|
+
* @param customIgnores - 可选的自定义忽略规则数组 (支持 glob 模式,如 ['dist/**', '*.log'])
|
|
1838
|
+
*/
|
|
1839
|
+
const zipCwdToBuffer = (customIgnores = []) => {
|
|
1840
|
+
return new Promise((resolve, reject) => {
|
|
1841
|
+
const chunks = [];
|
|
1842
|
+
const output = new stream.Writable({
|
|
1843
|
+
write(chunk, encoding, next) {
|
|
1844
|
+
chunks.push(chunk);
|
|
1845
|
+
next();
|
|
1846
|
+
},
|
|
1847
|
+
});
|
|
1848
|
+
const archive = archiver('zip', { zlib: { level: 9 } });
|
|
1849
|
+
output.on('finish', () => {
|
|
1850
|
+
resolve(Buffer.concat(chunks));
|
|
1851
|
+
});
|
|
1852
|
+
archive.on('error', err => {
|
|
1853
|
+
reject(err);
|
|
1854
|
+
});
|
|
1855
|
+
archive.pipe(output);
|
|
1856
|
+
const cwd = process.cwd();
|
|
1857
|
+
// 1. 基础忽略列表 (建议保留这些基础规则,防止包过大)
|
|
1858
|
+
const defaultIgnores = [
|
|
1859
|
+
'node_modules/**',
|
|
1860
|
+
'.git/**',
|
|
1861
|
+
'.DS_Store',
|
|
1862
|
+
ttmgPack.TTMG_TEMP_DIR,
|
|
1863
|
+
'*.zip', // 忽略自身生成的 zip
|
|
1864
|
+
];
|
|
1865
|
+
// 2. 合并自定义规则
|
|
1866
|
+
// Set 去重,防止重复添加
|
|
1867
|
+
const finalIgnores = Array.from(new Set([...defaultIgnores, ...customIgnores]));
|
|
1868
|
+
// 3. 执行打包
|
|
1869
|
+
// 注意:ignore 规则必须使用正斜杠 /,即使在 Windows 下
|
|
1870
|
+
archive.glob('**/*', {
|
|
1871
|
+
cwd: cwd,
|
|
1872
|
+
ignore: finalIgnores,
|
|
1873
|
+
dot: true, // 包含 .env 等点文件
|
|
1874
|
+
});
|
|
1875
|
+
archive.finalize();
|
|
1876
|
+
});
|
|
1877
|
+
};
|
|
1878
|
+
|
|
1799
1879
|
const BASE_URL = 'https://developers.tiktok.com';
|
|
1800
1880
|
const DEV_HEADERS = {
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1881
|
+
// 'x-use-ppe': '1',
|
|
1882
|
+
// 'x-tt-env': UNITY_PPE_ENV,
|
|
1883
|
+
// 'x-tt-target-idc': 'sg',
|
|
1804
1884
|
};
|
|
1805
|
-
const
|
|
1885
|
+
const TTMG_TEMP_DIR = '__TTMG_TEMP__';
|
|
1886
|
+
const WASM_SPLIT_CACHE_DIR = `${TTMG_TEMP_DIR}/wasmcode/`;
|
|
1806
1887
|
const WASM_SYMBOL_FILE_NAME = 'webgl.symbols.json';
|
|
1807
1888
|
const UNITY_WASM_SPLIT_CONFIG_FIELD_SCHEME = {
|
|
1808
1889
|
ENABLEWASMCOLLECT: `"$ENABLEWASMCOLLECT"`,
|
|
@@ -1835,13 +1916,14 @@ const WASM_SPLIT_SUBPACKAGE_CONFIG = {
|
|
|
1835
1916
|
root: 'wasmcode1-android/',
|
|
1836
1917
|
},
|
|
1837
1918
|
ios: {
|
|
1838
|
-
name: 'wasmcode-ios',
|
|
1839
1919
|
root: 'wasmcode-ios/',
|
|
1840
1920
|
},
|
|
1841
1921
|
iosMain: {
|
|
1922
|
+
name: 'wasmcode-ios',
|
|
1842
1923
|
root: 'wasmcode-ios/',
|
|
1843
1924
|
},
|
|
1844
1925
|
iosSub: {
|
|
1926
|
+
name: 'wasmcode1-ios',
|
|
1845
1927
|
root: 'wasmcode1-ios/',
|
|
1846
1928
|
},
|
|
1847
1929
|
};
|
|
@@ -1869,7 +1951,34 @@ async function startPrepare(params) {
|
|
|
1869
1951
|
// 部分后端会依赖 content-type;如果不确定就用 application/octet-stream
|
|
1870
1952
|
contentType: 'application/wasm',
|
|
1871
1953
|
});
|
|
1872
|
-
|
|
1954
|
+
/**
|
|
1955
|
+
* 兼容 WASM_SYMBOL_FILE_NAME
|
|
1956
|
+
* case 1:项目根目录有 webgl.symbols.json 文件
|
|
1957
|
+
* case 2:项目根目录没有 webgl.symbols.json 文件,但 TTMG_TEMP_DIR 有
|
|
1958
|
+
* 优先读 2
|
|
1959
|
+
*/
|
|
1960
|
+
let symbolFilePath = path$1.join(process.cwd(), TTMG_TEMP_DIR, WASM_SYMBOL_FILE_NAME);
|
|
1961
|
+
if (!fs$1.existsSync(symbolFilePath)) {
|
|
1962
|
+
symbolFilePath = path$1.join(process.cwd(), WASM_SYMBOL_FILE_NAME);
|
|
1963
|
+
}
|
|
1964
|
+
/**
|
|
1965
|
+
* 判断是否有 symbol 文件,有则上传,没有直接接口报错
|
|
1966
|
+
*/
|
|
1967
|
+
if (!fs$1.existsSync(symbolFilePath)) {
|
|
1968
|
+
return {
|
|
1969
|
+
error: {
|
|
1970
|
+
code: 400,
|
|
1971
|
+
message: `${WASM_SYMBOL_FILE_NAME} not found at ${path$1.join(process.cwd())},use unity plugin to rebuild`,
|
|
1972
|
+
client_key: params.client_key,
|
|
1973
|
+
},
|
|
1974
|
+
data: null,
|
|
1975
|
+
ctx: {
|
|
1976
|
+
logid: '',
|
|
1977
|
+
httpStatusCode: 400,
|
|
1978
|
+
},
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
form.append('wasm_symbol_file', fs$1.createReadStream(symbolFilePath), {
|
|
1873
1982
|
filename: WASM_SYMBOL_FILE_NAME,
|
|
1874
1983
|
contentType: 'application/octet-stream',
|
|
1875
1984
|
});
|
|
@@ -2303,7 +2412,8 @@ function updateSubpackageConfigSync() {
|
|
|
2303
2412
|
*/
|
|
2304
2413
|
filtered.push(WASM_SPLIT_SUBPACKAGE_CONFIG.androidMain);
|
|
2305
2414
|
filtered.push(WASM_SPLIT_SUBPACKAGE_CONFIG.androidSub);
|
|
2306
|
-
filtered.push(WASM_SPLIT_SUBPACKAGE_CONFIG.
|
|
2415
|
+
filtered.push(WASM_SPLIT_SUBPACKAGE_CONFIG.iosMain);
|
|
2416
|
+
filtered.push(WASM_SPLIT_SUBPACKAGE_CONFIG.iosSub);
|
|
2307
2417
|
// 合并去重:存在则更新 root,不存在则新增
|
|
2308
2418
|
const map = new Map(filtered.map(s => [s.name, s]));
|
|
2309
2419
|
gameJson[fieldName] = Array.from(map.values());
|
|
@@ -2311,7 +2421,7 @@ function updateSubpackageConfigSync() {
|
|
|
2311
2421
|
}
|
|
2312
2422
|
|
|
2313
2423
|
async function downloadAndCompress(opts) {
|
|
2314
|
-
const { startDownloadStatus, downloadDoneStatus, startCompressStatus, compressDoneStatus, url, out, } = opts;
|
|
2424
|
+
const { startDownloadStatus, downloadDoneStatus, startCompressStatus, compressDoneStatus, url, out, enableCompress = false, } = opts;
|
|
2315
2425
|
if (!url)
|
|
2316
2426
|
return;
|
|
2317
2427
|
const willDownloadedFileIsBr = url.includes(BR_SUFFIX);
|
|
@@ -2332,7 +2442,7 @@ async function downloadAndCompress(opts) {
|
|
|
2332
2442
|
await promises.rm(wasmBrOutName);
|
|
2333
2443
|
throw e;
|
|
2334
2444
|
}
|
|
2335
|
-
if (
|
|
2445
|
+
if (enableCompress) {
|
|
2336
2446
|
console.log(`compress start: ${path.basename(out)}${BR_SUFFIX}`);
|
|
2337
2447
|
// 压缩
|
|
2338
2448
|
wsServer.sendUnitySplitStatus({ status: startCompressStatus });
|
|
@@ -2401,11 +2511,11 @@ async function downloadSplited(context) {
|
|
|
2401
2511
|
url: context.main_wasm_h5_download_url,
|
|
2402
2512
|
out: mainIosWasmCodeTempPath,
|
|
2403
2513
|
})),
|
|
2404
|
-
// 下载 ios sub
|
|
2514
|
+
// 下载 ios sub js range json
|
|
2405
2515
|
limit(() => downloadAndCompress({
|
|
2406
2516
|
startDownloadStatus: 'start_download_ios_range_json',
|
|
2407
2517
|
downloadDoneStatus: 'download_ios_range_json_done',
|
|
2408
|
-
url: context.
|
|
2518
|
+
url: context.sub_js_range_download_url,
|
|
2409
2519
|
out: path.join(subIosDir, 'func_bytes_range.json'),
|
|
2410
2520
|
})),
|
|
2411
2521
|
// 下载 ios sub js data br
|
|
@@ -2738,22 +2848,57 @@ async function start() {
|
|
|
2738
2848
|
/**
|
|
2739
2849
|
* @description 上传游戏代码到服务器
|
|
2740
2850
|
*/
|
|
2851
|
+
// app.post('/game/upload', async (req, res) => {
|
|
2852
|
+
// /**
|
|
2853
|
+
// * 我要新版本不做开发者选择,直接当前 cwd 作为 entryDir,压缩成 game.zip 进行上传
|
|
2854
|
+
// */
|
|
2855
|
+
// const fileKeys = Object.keys(req.files);
|
|
2856
|
+
// const uploadedFile = req.files[fileKeys[0]];
|
|
2857
|
+
// if (!uploadedFile) {
|
|
2858
|
+
// res.status(400).send({ code: errorCode, data: 'No file uploaded' }); // 使用正确的 HTTP 状态码
|
|
2859
|
+
// return;
|
|
2860
|
+
// }
|
|
2861
|
+
// try {
|
|
2862
|
+
// // 通过 header 获取 desc
|
|
2863
|
+
// const desc = req.headers['ttmg-game-desc'];
|
|
2864
|
+
// // 需要做 decodeURIComponent 处理
|
|
2865
|
+
// const decodedDesc = decodeURIComponent(desc || '--');
|
|
2866
|
+
// // 直接传递需要的信息
|
|
2867
|
+
// const { data, error } = await uploadGameToPlatform({
|
|
2868
|
+
// data: uploadedFile.data, // 这是 Buffer
|
|
2869
|
+
// name: uploadedFile.name, // 这是文件名
|
|
2870
|
+
// clientKey: getClientKey().clientKey,
|
|
2871
|
+
// note: decodedDesc,
|
|
2872
|
+
// appId: store.getState().appId,
|
|
2873
|
+
// sandboxId: store.getState().sandboxId,
|
|
2874
|
+
// });
|
|
2875
|
+
// if (error) {
|
|
2876
|
+
// res.send({ code: errorCode, error });
|
|
2877
|
+
// } else {
|
|
2878
|
+
// res.send({ code: successCode, data });
|
|
2879
|
+
// }
|
|
2880
|
+
// } catch (error) {
|
|
2881
|
+
// // 错误处理可以更具体
|
|
2882
|
+
// let errorMessage = 'An unknown error occurred.';
|
|
2883
|
+
// if (error instanceof Error) {
|
|
2884
|
+
// errorMessage = error.message;
|
|
2885
|
+
// }
|
|
2886
|
+
// // 打印详细错误到服务器日志,方便排查
|
|
2887
|
+
// res.status(500).send({ code: errorCode, data: errorMessage }); // 使用正确的 HTTP 状态码
|
|
2888
|
+
// }
|
|
2889
|
+
// });
|
|
2741
2890
|
app.post('/game/upload', async (req, res) => {
|
|
2742
|
-
const fileKeys = Object.keys(req.files);
|
|
2743
|
-
const uploadedFile = req.files[fileKeys[0]];
|
|
2744
|
-
if (!uploadedFile) {
|
|
2745
|
-
res.status(400).send({ code: errorCode, data: 'No file uploaded' }); // 使用正确的 HTTP 状态码
|
|
2746
|
-
return;
|
|
2747
|
-
}
|
|
2748
2891
|
try {
|
|
2749
|
-
|
|
2892
|
+
console.log(`正在打包当前目录: ${process.cwd()} ...`);
|
|
2893
|
+
const gameZipBuffer = await zipCwdToBuffer();
|
|
2894
|
+
// 变成 MB
|
|
2895
|
+
console.log(`打包完成,大小: ${(gameZipBuffer.length / 1024 / 1024).toFixed(2)} MB`);
|
|
2750
2896
|
const desc = req.headers['ttmg-game-desc'];
|
|
2751
|
-
// 需要做 decodeURIComponent 处理
|
|
2752
2897
|
const decodedDesc = decodeURIComponent(desc || '--');
|
|
2753
|
-
// 直接传递需要的信息
|
|
2754
2898
|
const { data, error } = await uploadGameToPlatform({
|
|
2755
|
-
|
|
2756
|
-
|
|
2899
|
+
// @ts-ignore
|
|
2900
|
+
data: gameZipBuffer,
|
|
2901
|
+
name: 'game.zip',
|
|
2757
2902
|
clientKey: getClientKey().clientKey,
|
|
2758
2903
|
note: decodedDesc,
|
|
2759
2904
|
appId: store.getState().appId,
|
|
@@ -2767,13 +2912,12 @@ async function start() {
|
|
|
2767
2912
|
}
|
|
2768
2913
|
}
|
|
2769
2914
|
catch (error) {
|
|
2770
|
-
// 错误处理可以更具体
|
|
2771
2915
|
let errorMessage = 'An unknown error occurred.';
|
|
2772
2916
|
if (error instanceof Error) {
|
|
2773
2917
|
errorMessage = error.message;
|
|
2774
2918
|
}
|
|
2775
|
-
|
|
2776
|
-
res.status(500).send({ code: errorCode, data: errorMessage });
|
|
2919
|
+
console.error('Upload failed:', errorMessage);
|
|
2920
|
+
res.status(500).send({ code: errorCode, data: errorMessage });
|
|
2777
2921
|
}
|
|
2778
2922
|
});
|
|
2779
2923
|
app.get('/game/wasm-split-config', (req, res) => {
|
|
@@ -2820,6 +2964,7 @@ async function start() {
|
|
|
2820
2964
|
wasm_md5: codeMd5,
|
|
2821
2965
|
wasm_file_path: codePath,
|
|
2822
2966
|
});
|
|
2967
|
+
console.log('wasm-prepare-end', result);
|
|
2823
2968
|
if (result.error) {
|
|
2824
2969
|
res.send({
|
|
2825
2970
|
code: errorCode,
|
|
@@ -3038,6 +3183,31 @@ async function start() {
|
|
|
3038
3183
|
});
|
|
3039
3184
|
}
|
|
3040
3185
|
});
|
|
3186
|
+
/**
|
|
3187
|
+
*
|
|
3188
|
+
高鹏
|
|
3189
|
+
抄一下码下面的话
|
|
3190
|
+
我试试这个咋样看[看]闵行的是好吃的
|
|
3191
|
+
可以
|
|
3192
|
+
下周大哥来 让他别整一群的 就咱们几个吃个串挺好
|
|
3193
|
+
哪个unity筹备群拉你了哈
|
|
3194
|
+
好
|
|
3195
|
+
新知识 30% 等于部分用户
|
|
3196
|
+
0.3.1-unity.6
|
|
3197
|
+
{
|
|
3198
|
+
"code": 0,
|
|
3199
|
+
"data": {
|
|
3200
|
+
"isSuccess": true
|
|
3201
|
+
},
|
|
3202
|
+
"msg": "download success",
|
|
3203
|
+
"ctx":
|
|
3204
|
+
}
|
|
3205
|
+
发现个小问题
|
|
3206
|
+
wasmcode1-ios 下面下载缺了一个func_bytes_range.json 以及subjs.data.br 多了一个 br 后缀
|
|
3207
|
+
|
|
3208
|
+
Shift + Enter 换行
|
|
3209
|
+
|
|
3210
|
+
*/
|
|
3041
3211
|
app.post('/game/wasm-split-download-result', async (req, res) => {
|
|
3042
3212
|
const { clientKey, codeMd5, codePath } = req.body;
|
|
3043
3213
|
console.log('game/wasm-split-download-result-start', req.body);
|
|
@@ -3191,7 +3361,7 @@ async function dev() {
|
|
|
3191
3361
|
watch();
|
|
3192
3362
|
}
|
|
3193
3363
|
|
|
3194
|
-
var version = "0.3.
|
|
3364
|
+
var version = "0.3.2-beta.1";
|
|
3195
3365
|
var pkg = {
|
|
3196
3366
|
version: version};
|
|
3197
3367
|
|