mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-12 23:24:35 +01:00
Merge pull request #9 from Seeker14491/fix-news
Fix fetching commits from API
This commit is contained in:
1
src-tauri/Cargo.lock
generated
1
src-tauri/Cargo.lock
generated
@@ -742,7 +742,6 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
|
||||
name = "cultivation"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"duct",
|
||||
"futures-util",
|
||||
"http",
|
||||
|
||||
@@ -37,7 +37,6 @@ duct = "0.13.5"
|
||||
|
||||
# Serialization.
|
||||
serde_json = "1"
|
||||
base64 = "0.13.0"
|
||||
|
||||
# System process elevation.
|
||||
is_elevated = "0.1.2"
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user