换源
This commit is contained in:
parent
03b6afade2
commit
355cb36025
@ -102,17 +102,10 @@ pub struct EventCard {
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CurrentVersion {
|
||||
#[serde(rename = "appHash")]
|
||||
pub app_hash: String,
|
||||
#[serde(rename = "systemProfile")]
|
||||
pub system_profile: String,
|
||||
#[serde(rename = "appVersion")]
|
||||
pub app_version: String,
|
||||
#[serde(rename = "assetVersion")]
|
||||
pub asset_version: String,
|
||||
#[serde(rename = "dataVersion")]
|
||||
pub data_version: String,
|
||||
#[serde(rename = "assetHash")]
|
||||
pub asset_hash: String,
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ use anyhow::anyhow;
|
||||
use reqwest::Client;
|
||||
use serde::Deserialize;
|
||||
|
||||
const COMMIT_URL: &str = "https://api.github.com/repos/Team-Haruki/haruki-sekai-master/commits?path=master/events.json&per_page=1";
|
||||
const COMMIT_URL: &str = "https://api.github.com/repos/kotori8823/sekai-master-db/commits?path=events.json&per_page=1";
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct CommitResponse {
|
||||
@ -40,28 +40,28 @@ pub async fn fetch_last_hash() -> anyhow::Result<String> {
|
||||
}
|
||||
|
||||
pub fn raw_url(path: &str) -> String {
|
||||
"https://raw.githubusercontent.com/Team-Haruki/haruki-sekai-master/refs/heads/main/".to_owned()
|
||||
"https://raw.githubusercontent.com/kotori8823/sekai-master-db/refs/heads/master/".to_owned()
|
||||
+ path
|
||||
}
|
||||
|
||||
pub async fn sync_data() -> anyhow::Result<()> {
|
||||
let client = http_client()?;
|
||||
let events_cards = &client
|
||||
.get(raw_url("master/eventCards.json"))
|
||||
.get(raw_url("eventCards.json"))
|
||||
.send()
|
||||
.await?
|
||||
.text()
|
||||
.await?;
|
||||
ending_point!(ok);
|
||||
let event_stories = &client
|
||||
.get(raw_url("master/eventStories.json"))
|
||||
.get(raw_url("eventStories.json"))
|
||||
.send()
|
||||
.await?
|
||||
.text()
|
||||
.await?;
|
||||
ending_point!(ok);
|
||||
let card_episodes = &client
|
||||
.get(raw_url("master/cardEpisodes.json"))
|
||||
.get(raw_url("cardEpisodes.json"))
|
||||
.send()
|
||||
.await?
|
||||
.text()
|
||||
@ -77,7 +77,7 @@ pub async fn sync_data() -> anyhow::Result<()> {
|
||||
pub async fn get_master_data() -> anyhow::Result<CurrentVersion> {
|
||||
let client = http_client()?;
|
||||
let text = client
|
||||
.get(raw_url("versions/current_version.json"))
|
||||
.get(raw_url("versions.json"))
|
||||
.send()
|
||||
.await?
|
||||
.text()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user