@@ -14,9 +14,10 @@ export function requestLabelVersion(url: string, channel: string): Promise<Label
1414 return new Promise ( ( resolve , reject ) => {
1515 const request = proto . get ( url , { timeout :120 } , response => {
1616 if ( response . statusCode === 302 || response . statusCode === 200 ) {
17- const regex = / _ ( ( [ 0 - 9 ] { 2 } ) ( \. ( x ) | R ( [ 0 - 9 ] ) * ) ? | m a i n ) _ ( [ 0 - 9 ] { 6 } ) / ;
17+ const regex = / _ ( ( [ 0 - 9 ] { 2 } ) ( \. ( x ) | R ( [ 0 - 9 ] + ) * ) ? | m a i n ) _ ( [ 0 - 9 ] { 6 } ) / ;
1818 const version = new LabeledVersion ( 0 , 0 , 0 , 0 , false , channel , false ) ;
1919 const resultRegex = regex . exec ( response . headers . location ) ;
20+
2021 if ( resultRegex ) {
2122 if ( resultRegex [ 1 ] && resultRegex [ 1 ] === "main" ) {
2223 version . isRRelease = true ;
@@ -80,10 +81,25 @@ export class APIManager {
8081 return labelVersion . version - 1 ;
8182 }
8283
84+ public async HasRReleaseVersionAvailable ( inStartMajorVersion : number , inChannel : string ) : Promise < boolean > {
85+ const labelVersion = new LabeledVersion ( inStartMajorVersion , 0 , 0 , 0 , true , inChannel , false ) ;
86+ let hasRRelease = true ;
87+ const url = this . getURLTool4D ( labelVersion ) ;
88+
89+ try {
90+ await requestLabelVersion ( url , labelVersion . channel ) ;
91+ }
92+ catch ( error ) {
93+ hasRRelease = false ;
94+ }
95+ return hasRRelease ;
96+ }
97+
8398 //https://resources-download.4d.com/release/20%20Rx/20%20R3/latest/mac/tool4d_v20R3_mac_x86.tar.xz
8499 //https://resources-download.4d.com/release/20%20Rx/latest/latest/win/tool4d_win.tar.xz => Last Rx released
85100 //https://resources-download.4d.com/release/20%20Rx/latest/latest/win/tool4d_win.tar.xz => Last Rx beta
86101 //https://resources-download.4d.com/release/20%20Rx/20%20R3/latest/win/tool4d_win.tar.xz => Last 20R3 release
102+ //https://resources-download.4d.com/release/21.x/latest/latest/win/tool4d_win.tar.xz => Last 21.x stable
87103 /*
88104 Starting from 20R5
89105 Linux has tar.xz and .deb
0 commit comments