From 5d2f803f3c0946057b51594849df50e5e6ff6cc7 Mon Sep 17 00:00:00 2001 From: Brian Bowman Date: Sat, 2 Jul 2022 00:38:50 -0500 Subject: [PATCH] Fix fetching commits from API --- src-tauri/Cargo.lock | 1 - src-tauri/Cargo.toml | 1 - src-tauri/src/main.rs | 7 ------- src/ui/components/news/NewsSection.tsx | 4 +--- 4 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 44b300b..f2d5257 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -742,7 +742,6 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" name = "cultivation" version = "0.1.0" dependencies = [ - "base64", "duct", "futures-util", "http", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 1fbe502..7c90f77 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -37,7 +37,6 @@ duct = "0.13.5" # Serialization. serde_json = "1" -base64 = "0.13.0" # System process elevation. is_elevated = "0.1.2" diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index f163d1c..b65ad7a 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -42,7 +42,6 @@ fn main() { disconnect, req_get, get_bg_file, - base64_decode, is_game_running, get_theme_list, system_helpers::run_command, @@ -233,9 +232,3 @@ async fn get_bg_file(bg_path: String, appdata: String) -> String { } }; } - -#[tauri::command] -fn base64_decode(encoded: String) -> String { - let decoded = base64::decode(&encoded).unwrap(); - return String::from_utf8(decoded).unwrap(); -} \ No newline at end of file diff --git a/src/ui/components/news/NewsSection.tsx b/src/ui/components/news/NewsSection.tsx index 863bded..6dbb1d9 100644 --- a/src/ui/components/news/NewsSection.tsx +++ b/src/ui/components/news/NewsSection.tsx @@ -56,9 +56,7 @@ export default class NewsSection extends React.Component { const commits: string = await invoke('req_get', { url: 'https://api.github.com/repos/Grasscutters/Grasscutter/commits' }) obj = JSON.parse(commits) } else { - const decoded: string = await invoke('base64_decode', { encoded: obj.commits }) - const commitData = JSON.parse(decoded) - obj = commitData.gc_stable + obj = obj.commits.gc_stable } // Probably rate-limited