Fix fetching commits from API

This commit is contained in:
Brian Bowman
2022-07-02 00:38:50 -05:00
parent 29716c43b6
commit 5d2f803f3c
4 changed files with 1 additions and 12 deletions

1
src-tauri/Cargo.lock generated
View File

@@ -742,7 +742,6 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
name = "cultivation" name = "cultivation"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"base64",
"duct", "duct",
"futures-util", "futures-util",
"http", "http",

View File

@@ -37,7 +37,6 @@ duct = "0.13.5"
# Serialization. # Serialization.
serde_json = "1" serde_json = "1"
base64 = "0.13.0"
# System process elevation. # System process elevation.
is_elevated = "0.1.2" is_elevated = "0.1.2"

View File

@@ -42,7 +42,6 @@ fn main() {
disconnect, disconnect,
req_get, req_get,
get_bg_file, get_bg_file,
base64_decode,
is_game_running, is_game_running,
get_theme_list, get_theme_list,
system_helpers::run_command, 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();
}

View File

@@ -56,9 +56,7 @@ export default class NewsSection extends React.Component<IProps, IState> {
const commits: string = await invoke('req_get', { url: 'https://api.github.com/repos/Grasscutters/Grasscutter/commits' }) const commits: string = await invoke('req_get', { url: 'https://api.github.com/repos/Grasscutters/Grasscutter/commits' })
obj = JSON.parse(commits) obj = JSON.parse(commits)
} else { } else {
const decoded: string = await invoke('base64_decode', { encoded: obj.commits }) obj = obj.commits.gc_stable
const commitData = JSON.parse(decoded)
obj = commitData.gc_stable
} }
// Probably rate-limited // Probably rate-limited