mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 16:14:48 +01:00
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"
|
name = "cultivation"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
|
||||||
"duct",
|
"duct",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http",
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user