@@ -60,26 +60,26 @@ const getRelease = async (firmware: string) => {
60
60
const manifest = await readTextFile ( 'manifest.json' , { dir : BaseDirectory . AppConfig } )
61
61
62
62
const config_json = JSON . parse ( manifest )
63
- console . log ( '[Github Release]: Manifest: ' , config_json )
64
63
65
64
if ( manifest !== '' ) {
66
- const builds = config_json [ 'builds' ] . map ( ( build ) => {
67
- const parts = build [ 'parts' ] . map ( async ( part ) => {
68
- const firmwarePath = await join ( appConfigDirPath , part [ 'path' ] )
65
+ // modify the version property
66
+ config_json [ 'version' ] = firmwareVersion ( )
67
+ // loop through the builds array and the parts array and update the path property
68
+ for ( let i = 0 ; i < config_json [ 'builds' ] . length ; i ++ ) {
69
+ for ( let j = 0 ; j < config_json [ 'builds' ] [ i ] [ 'parts' ] . length ; j ++ ) {
70
+ const firmwarePath = await join (
71
+ appConfigDirPath ,
72
+ config_json [ 'builds' ] [ i ] [ 'parts' ] [ j ] [ 'path' ] ,
73
+ )
69
74
console . log ( '[Github Release]: Firmware Path: ' , firmwarePath )
70
75
const firmwareSrc = convertFileSrc ( firmwarePath )
71
76
console . log ( '[Github Release]: Firmware Src: ' , firmwareSrc )
72
- return { ...part , path : firmwareSrc }
73
- } )
74
- return { ...build , parts }
75
- } )
76
-
77
- const build = await builds
78
- console . log ( '[Github Release]: Firmware Version: ' , firmwareVersion ( ) )
79
- const newConfig = { version : firmwareVersion ( ) , ...config_json , builds : build }
77
+ config_json [ 'builds' ] [ i ] [ 'parts' ] [ j ] [ 'path' ] = firmwareSrc
78
+ }
79
+ }
80
80
81
81
// write the config file
82
- writeTextFile ( 'manifest.json' , JSON . stringify ( newConfig ) , {
82
+ writeTextFile ( 'manifest.json' , JSON . stringify ( config_json ) , {
83
83
dir : BaseDirectory . AppConfig ,
84
84
} )
85
85
. then ( ( ) => {
@@ -92,6 +92,7 @@ const getRelease = async (firmware: string) => {
92
92
console . error ( '[Manifest Update Error]: ' , err )
93
93
} )
94
94
95
+ console . log ( '[Github Release]: Manifest: ' , config_json )
95
96
return
96
97
}
97
98
return response
@@ -207,6 +208,7 @@ export const doGHRequest = () => {
207
208
return
208
209
}
209
210
}
211
+ console . warn ( '[Config Exists]: Most likely rate limited' )
210
212
setGHData ( config_json , false )
211
213
setGHRestStatus ( RESTStatus . COMPLETE )
212
214
} )
0 commit comments