Skip to content

Commit 746b974

Browse files
committed
fix(editor): fix "publish mod may fail" bug
solution add and use handleNetworkRequest api to test 3 times;
1 parent dce74f7 commit 746b974

80 files changed

Lines changed: 144 additions & 34 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

contributes/meta3d-action-mod-career-publish-to-game/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "meta3d-action-mod-career-publish-to-game",
3-
"version": "1.3.61",
3+
"version": "1.3.62",
44
"publisher": "meta3d",
55
"protocol": {
66
"name": "meta3d-action-mod-career-publish-to-game-protocol"

contributes/meta3d-action-mod-career-publish-to-game/src/Main.ts

Lines changed: 56 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,13 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
284284

285285
api.flow.deferExec((meta3dState) => {
286286
return _base64ToUint8Array(assetIconBase64).then(uint8Array => {
287-
let state = api.action.getActionState<state>(meta3dState, actionName)
287+
api.writeState(meta3dState)
288288

289-
return api.backend.publishMod(
290-
` {
289+
return api.backend.handleNetworkRequest(api, meta3dState => {
290+
let state = api.action.getActionState<state>(meta3dState, actionName)
291+
292+
return api.backend.publishMod(
293+
` {
291294
"name": "${_buildUniqueName(state, isChinese)}",
292295
"mod": {
293296
"protocolName": "career-protocol",
@@ -300,25 +303,59 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
300303
]
301304
}
302305
}`,
303-
`${state.readme}`,
304-
_buildDistFileContent(state, characterType_, features, isChinese),
305-
[
306+
`${state.readme}`,
307+
_buildDistFileContent(state, characterType_, features, isChinese),
306308
[
307-
`./${_buildIconId(state, isChinese)}.png`,
308-
uint8Array
309+
[
310+
`./${_buildIconId(state, isChinese)}.png`,
311+
uint8Array
312+
],
309313
],
310-
],
311-
careerIconBase64,
312-
characterType_
313-
)
314-
.then(() => {
315-
meta3dState = api.action.setActionState<infoState>(meta3dState, infoActionName, {
316-
...api.action.getActionState<infoState>(meta3dState, infoActionName),
317-
info: api.nullable.getEmpty()
318-
})
319-
320-
return meta3dState
314+
careerIconBase64,
315+
characterType_
316+
)
317+
}, meta3dState => {
318+
meta3dState = api.action.setActionState<infoState>(meta3dState, infoActionName, {
319+
...api.action.getActionState<infoState>(meta3dState, infoActionName),
320+
info: api.nullable.getEmpty()
321321
})
322+
323+
return meta3dState
324+
}, meta3dState => Promise.resolve(meta3dState), 3)
325+
326+
// return api.backend.publishMod(
327+
// ` {
328+
// "name": "${_buildUniqueName(state, isChinese)}",
329+
// "mod": {
330+
// "protocolName": "career-protocol",
331+
// "author": "${state.author}",
332+
// "displayName_cn": "${state.displayName_cn}",
333+
// "displayName_en": "${state.displayName_en}",
334+
// "repoLink": "${state.repoLink}",
335+
// "isPublic": ${state.isPublic},
336+
// "dependentMods": [
337+
// ]
338+
// }
339+
// }`,
340+
// `${state.readme}`,
341+
// _buildDistFileContent(state, characterType_, features, isChinese),
342+
// [
343+
// [
344+
// `./${_buildIconId(state, isChinese)}.png`,
345+
// uint8Array
346+
// ],
347+
// ],
348+
// careerIconBase64,
349+
// characterType_
350+
// )
351+
// .then(() => {
352+
// meta3dState = api.action.setActionState<infoState>(meta3dState, infoActionName, {
353+
// ...api.action.getActionState<infoState>(meta3dState, infoActionName),
354+
// info: api.nullable.getEmpty()
355+
// })
356+
357+
// return meta3dState
358+
// })
322359
})
323360
.catch(e => {
324361
api.message.error(e)

defaults/meta3d-commonlib/lib/bs/.bsdeps

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ src\log 0x1.a5a64897c2f18p+30
1818
src\copy 0x1.a5a64897c0e59p+30
1919
src\contract 0x1.a5a64897bfdf9p+30
2020
===
21-
D:\Github\Meta3D\node_modules\rescript\win32\rescript.exe 0x1.a6012806cfda2p+30
21+
D:\Github\Meta3D\node_modules\rescript\win32\rescript.exe 0x1.a601b4ad5d0ep+30
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#Start(208782291)
2-
#Done(208783264)
1+
#Start(217783799)
2+
#Done(217784427)
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)