@@ -101,6 +101,8 @@ pub async fn run() {
101101
102102 #[ cfg( target_arch = "wasm32" ) ]
103103 {
104+ let window = web_sys:: window ( ) . expect ( "Window not available" ) ;
105+ let document = window. document ( ) . expect ( "Document not available" ) ;
104106 let location = web_sys:: window ( ) . expect ( "Window not available" ) . location ( ) ;
105107 let query = location. search ( ) . unwrap_or ( String :: new ( ) ) ;
106108 let query_presplit = format ! ( "--{}" , query[ 1 ..] . replace( "&" , " --" ) . replace( "=" , " " ) ) ;
@@ -110,6 +112,11 @@ pub async fn run() {
110112 . bin_name ( "ornithe-installer-rs" )
111113 . color ( clap:: ColorChoice :: Never )
112114 . try_get_matches_from ( query_cleaned) ;
115+ let loading_text = document. get_element_by_id ( "loading_text" ) . unwrap ( ) ;
116+ let _ = loading_text. insert_adjacent_html (
117+ "afterend" ,
118+ "<i style=\" font-size: 16px;\" id=\" status_notes\" ></i>" ,
119+ ) ;
113120
114121 match res {
115122 Ok ( res) => match parse ( res) . await {
@@ -119,10 +126,7 @@ pub async fn run() {
119126 Ornithe has been successfully installed.
120127 Most mods require that you also download the Ornithe Standard Libraries mod and place it in your mods folder.
121128 You can find it at {}." , crate :: OSL_MODRINTH_URL ) ;
122- let window = web_sys:: window ( ) . expect ( "Window not available" ) ;
123- let document = window. document ( ) . expect ( "Document not available" ) ;
124- if let Some ( element) = document. get_element_by_id ( "loading_text" ) {
125- element. set_inner_html ( & format ! (
129+ loading_text. set_inner_html ( & format ! (
126130 "<h3>Installation complete!</h3>
127131 <p>
128132 Ornithe has been successfully installed.
@@ -132,13 +136,13 @@ pub async fn run() {
132136 You can find it at <a href=\" {}\" >{}</a>
133137 </p>" ,
134138 crate :: OSL_MODRINTH_URL ,
135- crate :: OSL_MODRINTH_URL
136- ) ) ;
137- }
139+ crate :: OSL_MODRINTH_URL ) ) ;
138140 }
139141 }
140142 Err ( e) => {
141143 log:: warn!( "Error while running Ornithe Installer CLI: {}" , & e. 0 ) ;
144+ loading_text
145+ . set_inner_html ( & format ! ( "<h3>Encountered error:</h3><p>{}</p>" , & e. 0 ) ) ;
142146 }
143147 } ,
144148 Err ( error) => {
@@ -188,6 +192,9 @@ async fn parse(matches: ArgMatches) -> Result<InstallationResult, InstallerError
188192 }
189193 if let Some ( matches) = matches. subcommand_matches ( "loader-versions" ) {
190194 let generation = matches. get_one :: < u32 > ( "gen" ) . map ( |u| * u) ;
195+ if let Some ( g) = generation {
196+ print_note_intermediary_generation ( g) ;
197+ }
191198 let versions = crate :: net:: meta:: fetch_loader_versions ( & generation) . await ?;
192199 let loader_type = get_loader_type ( matches) ?;
193200 let betas = matches. get_flag ( "show-betas" ) ;
@@ -307,7 +314,9 @@ async fn parse(matches: ArgMatches) -> Result<InstallationResult, InstallerError
307314 while !fut. is_finished ( ) || !recv. is_empty ( ) {
308315 match recv. try_recv ( ) {
309316 Ok ( ( prog, msg) ) => {
310- pb. println ( msg) ;
317+ if !msg. is_empty ( ) {
318+ pb. println ( msg) ;
319+ }
311320 pb. set_position ( ( prog * 100.0 ) as u64 ) ;
312321 }
313322 Err ( _) => { }
@@ -318,6 +327,35 @@ async fn parse(matches: ArgMatches) -> Result<InstallationResult, InstallerError
318327 }
319328}
320329
330+ fn print_note_intermediary_generation ( generation : u32 ) {
331+ #[ cfg( target_arch = "wasm32" ) ]
332+ {
333+ log:: info!( "Using Intermediary Generation: {generation}" ) ;
334+ let window = web_sys:: window ( ) . expect ( "Window not available" ) ;
335+ let document = window. document ( ) . expect ( "Document not available" ) ;
336+ let status_notes = document. get_element_by_id ( "status_notes" ) . unwrap ( ) ;
337+ let _ = status_notes. insert_adjacent_html (
338+ "beforeend" ,
339+ & format ! ( "Using Intermediary Generation: {generation}<br>" ) ,
340+ ) ;
341+ }
342+ #[ cfg( not( target_arch = "wasm32" ) ) ]
343+ println ! ( "Using Intermediary Generation: {generation}" ) ;
344+ }
345+
346+ fn print_note_excluding_flap ( _sender : & UnboundedSender < ( f32 , String ) > ) {
347+ #[ cfg( target_arch = "wasm32" ) ]
348+ {
349+ log:: info!( "Not installing Flap." ) ;
350+ let window = web_sys:: window ( ) . expect ( "Window not available" ) ;
351+ let document = window. document ( ) . expect ( "Document not available" ) ;
352+ let status_notes = document. get_element_by_id ( "status_notes" ) . unwrap ( ) ;
353+ let _ = status_notes. insert_adjacent_html ( "beforeend" , "Not installing Flap.<br>" ) ;
354+ }
355+ #[ cfg( not( target_arch = "wasm32" ) ) ]
356+ let _ = _sender. send ( ( 0.0 , "Not installing Flap." . to_owned ( ) ) ) ;
357+ }
358+
321359async fn do_install (
322360 send : UnboundedSender < ( f32 , String ) > ,
323361 matches : ArgMatches ,
@@ -332,6 +370,14 @@ async fn do_install(
332370 let loader_version = get_loader_version ( matches, loader_versions) ?;
333371 let location = matches. get_one :: < PathBuf > ( "dir" ) . unwrap ( ) . clone ( ) ;
334372 let create_profile = matches. get_flag ( "generate-profile" ) ;
373+ #[ cfg( not( target_arch = "wasm32" ) ) ]
374+ if !create_profile {
375+ let _ = send. send ( ( 0.0 , "Not generating profile entry." . to_owned ( ) ) ) ;
376+ }
377+ let exclude_flap = matches. get_flag ( "exclude-flap" ) ;
378+ if exclude_flap {
379+ print_note_excluding_flap ( & send) ;
380+ }
335381 crate :: actions:: client:: install (
336382 send,
337383 minecraft_version,
@@ -341,7 +387,7 @@ async fn do_install(
341387 info. calamus_generation ,
342388 location,
343389 create_profile,
344- !matches . get_flag ( "exclude-flap" ) ,
390+ !exclude_flap ,
345391 )
346392 . await ?;
347393 return Ok ( InstallationResult :: Installed ) ;
@@ -357,7 +403,10 @@ async fn do_install(
357403 let loader_versions = all_loader_versions. get ( & loader_type) . unwrap ( ) ;
358404 let loader_version = get_loader_version ( matches, loader_versions) ?;
359405 let location = matches. get_one :: < PathBuf > ( "dir" ) . unwrap ( ) . clone ( ) ;
360- let include_flap = !matches. get_flag ( "exclude-flap" ) ;
406+ let exclude_flap = matches. get_flag ( "exclude-flap" ) ;
407+ if exclude_flap {
408+ print_note_excluding_flap ( & send) ;
409+ }
361410 if let Some ( matches) = matches. subcommand_matches ( "run" ) {
362411 let java = matches. get_one :: < PathBuf > ( "java" ) ;
363412 let run_args = matches. get_one :: < String > ( "args" ) ;
@@ -369,7 +418,7 @@ async fn do_install(
369418 loader_version,
370419 info. calamus_generation ,
371420 location,
372- include_flap ,
421+ !exclude_flap ,
373422 java,
374423 run_args. map ( |s| s. split ( " " ) ) ,
375424 )
@@ -388,7 +437,7 @@ async fn do_install(
388437 info. calamus_generation ,
389438 location,
390439 matches. get_flag ( "download-minecraft" ) ,
391- include_flap ,
440+ !exclude_flap ,
392441 )
393442 . await ?;
394443 return Ok ( InstallationResult :: Installed ) ;
@@ -408,6 +457,10 @@ async fn do_install(
408457 . unwrap ( )
409458 . clone ( ) ;
410459 let generate_zip = matches. get_one :: < bool > ( "generate-zip" ) . unwrap ( ) . clone ( ) ;
460+ let exclude_flap = matches. get_flag ( "exclude-flap" ) ;
461+ if exclude_flap {
462+ print_note_excluding_flap ( & send) ;
463+ }
411464 crate :: actions:: prism_pack:: install (
412465 send,
413466 minecraft_version,
@@ -418,7 +471,7 @@ async fn do_install(
418471 copy_profile_path,
419472 generate_zip,
420473 info. calamus_generation ,
421- !matches . get_flag ( "exclude-flap" ) ,
474+ !exclude_flap ,
422475 )
423476 . await ?;
424477 return Ok ( InstallationResult :: Installed ) ;
@@ -431,6 +484,9 @@ async fn get_minecraft_information(
431484 matches : & ArgMatches ,
432485) -> Result < MinecraftInformation , InstallerError > {
433486 let generation = matches. get_one :: < u32 > ( "gen" ) . map ( |u| * u) ;
487+ if let Some ( g) = generation {
488+ print_note_intermediary_generation ( g) ;
489+ }
434490 let minecraft_versions = crate :: net:: manifest:: fetch_versions ( & generation) . await ?;
435491 let intermediary_versions = crate :: net:: meta:: fetch_intermediary_versions ( & generation) . await ?;
436492
0 commit comments