Skip to content

Commit

Permalink
Merge pull request #20 from carlossclaro/dev
Browse files Browse the repository at this point in the history
Code Enhancements and Improvements for pre-release of v1.0.3:
  • Loading branch information
CarrotRub authored Oct 10, 2024
2 parents 479cabf + 1a185c7 commit 479c21b
Show file tree
Hide file tree
Showing 12 changed files with 1,028 additions and 687 deletions.
15 changes: 10 additions & 5 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ struct GameImages {
my_all_images: Vec<String>,
}



fn extract_hrefs_from_body(body: &str) -> Result<Vec<String>> {
let document = kuchiki::parse_html().one(body);
let mut hrefs = Vec::new();
Expand Down Expand Up @@ -525,6 +527,8 @@ fn main() -> Result<(), Box<dyn Error>> {

let app_handle = app.handle().clone();

let scraping_failed_event = app_handle.clone();

// Delete JSON files missing the 'tag' field or corrupted and log the process
if let Err(e) = delete_invalid_json_files(&current_app_handle) {
eprintln!(
Expand Down Expand Up @@ -561,7 +565,7 @@ fn main() -> Result<(), Box<dyn Error>> {
);
//TODO: This will be used to emit a signal to the frontend that the scraping is complete
// when the main reload window code is removed
// first_app_handle_clone.emit_all("new-games-ready", {}).unwrap();
first_app_handle_clone.emit_all("new-games-ready", {}).unwrap();
}

// Clone before emitting to avoid moving the handle
Expand All @@ -580,7 +584,7 @@ fn main() -> Result<(), Box<dyn Error>> {
);
//TODO: This will be used to emit a signal to the frontend that the scraping is complete
// when the main reload window code is removed
// second_app_handle_clone.emit_all("popular-games-ready", {}).unwrap();
second_app_handle_clone.emit_all("popular-games-ready", {}).unwrap();
}

// Clone before emitting to avoid moving the handle
Expand All @@ -599,7 +603,7 @@ fn main() -> Result<(), Box<dyn Error>> {
);
//TODO: This will be used to emit a signal to the frontend that the scraping is complete
// when the main reload window code is removed
// third_app_handle_clone.emit_all("recent-updated-games-ready", {}).unwrap();
third_app_handle_clone.emit_all("recent-updated-games-ready", {}).unwrap();
}

// Clone before emitting to avoid moving the handle
Expand All @@ -618,14 +622,15 @@ fn main() -> Result<(), Box<dyn Error>> {
);
//TODO: This will be used to emit a signal to the frontend that the scraping is complete
// when the main reload window code is removed
//fourth_app_handle_clone.emit_all("sitemaps-ready", {}).unwrap();
fourth_app_handle_clone.emit_all("sitemaps-ready", {}).unwrap();
}
});

// Await the completion of the tasks
if let Err(e) = mandatory_tasks_online.await {
eprintln!("An error occurred during scraping tasks: {:?}", e);
tracing::info!("An error occurred during scraping tasks: {:?}", e);
scraping_failed_event.emit_all("scraping_failed_event", "Test"); //TODO:
// Do not exit, continue running
} else {
tracing::info!(
Expand All @@ -643,7 +648,7 @@ fn main() -> Result<(), Box<dyn Error>> {
current_app_handle
.get_window("main")
.unwrap()
.eval("window.location.reload();")
.eval("window.location.reload();") //TODO : we need to remove this as it causes a reload of the page and the emits dont get sent properly
.unwrap();
println!("Scraping signal has been sent.");
});
Expand Down
142 changes: 80 additions & 62 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,72 +1,90 @@
{
"package": {
"productName": "Fit Launcher",
"version": "1.0.2"
"productName": "Fit Launcher",
"version": "1.0.2"
},
"build": {
"distDir": "../dist",
"devPath": "http://localhost:1420/",
"beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build"
"distDir": "../dist",
"devPath": "http://localhost:1420/",
"beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build"
},
"tauri": {
"bundle": {
"active": true,
"targets": "msi",
"windows": {
"webviewInstallMode": {
"type": "downloadBootstrapper"
}
"bundle": {
"active": true,
"targets": "msi",
"windows": {
"webviewInstallMode": {
"type": "downloadBootstrapper"
}
},
"identifier": "com.fitlauncher.carrotrub",
"icon": [
"./icons/32x32.png",
"./icons/128x128.png",
"./icons/[email protected]",
"./icons/icon.icns",
"./icons/icon.ico"
]
},
"identifier": "com.fitlauncher.carrotrub",
"icon": [
"./icons/32x32.png",
"./icons/128x128.png",
"./icons/[email protected]",
"./icons/icon.icns",
"./icons/icon.ico"
]
},
"allowlist": {
"all": true,
"path": {
"all": true
"allowlist": {
"all": true,
"path": {
"all": true
},
"fs": {
"all": true,
"scope": [
"$APPDATA/**",
"$APPCACHE/**",
"$APPCONFIG/**",
"$CONFIG/**",
"$APP/**",
"$APPCONFIG/tempGames/**",
"$APPCONFIG/data/**",
"$APPCONFIG/sitemaps/**",
"$RESOURCE/**",
"$RESOURCE/images/**",
"$RESOURCE/public/**",
"./**"
]
},
"protocol": {
"asset": true,
"assetScope": [
"$APPCONFIG/sitemaps/**",
"$APPDATA/sitemaps/**",
"$APPCACHE/**",
"$APPCACHE/.persistence/**"
]
}
},
"fs": {
"all":true,
"scope": ["$APPDATA/**", "$APPCACHE/**", "$APPCACHE/.persistence/**", "$APPCONFIG/**", "$CONFIG/**", "$APP/**", "$APPCONFIG/tempGames/**", "$APPCONFIG/data/**","$APPCONFIG/sitemaps/**", "$RESOURCE/*"]
},
"protocol": {
"asset": true,
"assetScope": ["$APPCONFIG/sitemaps/**", "$APPDATA/sitemaps/**","$APPCACHE/**", "$APPCACHE/.persistence/**"]
}
},
"windows": [
{
"label": "main",
"title": "Fit Launcher",
"width": 1280,
"height": 720,
"resizable": true,
"transparent": true,
"fullscreen": false,
"decorations": false,
"visible": false
},
{
"label": "splashscreen",
"url": "splashscreen.html",
"width": 400,
"height": 400,
"decorations": false,
"transparent": true,
"alwaysOnTop": true,
"center": true,
"title": "Splashscreen"
"windows": [
{
"label": "main",
"title": "Fit Launcher",
"width": 1280,
"height": 720,
"resizable": true,
"transparent": true,
"fullscreen": false,
"decorations": false,
"visible": false
},
{
"label": "splashscreen",
"url": "splashscreen.html",
"width": 400,
"height": 400,
"decorations": false,
"transparent": true,
"alwaysOnTop": true,
"center": true,
"title": "Splashscreen"
}
],
"security": {
"csp": "script-src 'wasm-unsafe-eval'"
}
],
"security": {
"csp": "script-src 'wasm-unsafe-eval'"
}
}
}
}
3 changes: 2 additions & 1 deletion src/App.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
html, body {
height: 100%; /* Ensure the body and html stretch fully */
height: 100%;
margin: 0;
padding: 0;
font-family: 'IBMPlexSans', sans-serif;
overflow: hidden;
}

@font-face {
Expand Down
Loading

0 comments on commit 479c21b

Please sign in to comment.