Merge pull request #9 from Seeker14491/fix-news

Fix fetching commits from API
This commit is contained in:
SpikeHD
2022-07-03 19:23:43 -07:00
committed by GitHub
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"
version = "0.1.0"
dependencies = [
"base64",
"duct",
"futures-util",
"http",

View File

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

View File

@@ -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();
}

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' })
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