Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: New release. Major rewrite #70

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,715 changes: 1,076 additions & 639 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
[package]
name = "er-save-editor"
version = "0.0.22"
version = "0.1.0"
edition = "2021"

[dependencies]
aes = "0.8.4"
binary-reader = "0.4.5"
bitflags = "2.4.2"
cbc = "0.1.2"
eframe = "0.26.2"
egui-phosphor = { version = "0.4.0", features = ["regular", "fill"] }
egui_extras = "0.26.2"
encoding_rs = "0.8.33"
env_logger = "0.11.2"
image = "0.25.0"
md5 = "0.7.0"
once_cell = "1.19.0"
regex = "1.10.4"
reqwest = { version = "0.12.3", features = ["json", "blocking"] }
rfd = "0.13.0"
rust-embed = "8.3.0"
serde = { version = "1.0.198", features = ["derive"] }
serde_json = "1.0.116"
strsim = "0.11.0"
zstd = "0.13.1"
er-save-lib = {git = "https://github.com/ClayAmore/ER-Save-Lib.git"}
chrono = "0.4.38"

[build-dependencies]
winres = "0.1.12"
20 changes: 20 additions & 0 deletions src/api/github.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use reqwest::blocking::Client;
use super::models::releases::Release;


pub struct GithubApi;

impl GithubApi {
/// Fetch latest release data using github api
pub fn fetch_latest_release(user: &str, repo: &str) -> Result<Release, reqwest::Error> {
let url = &format!("https://api.github.com/repos/{user}/{repo}/releases/latest");
let client = Client::new();
let release = client
.get(url)
.header("User-Agent", "request")
.send()?
.json::<Release>()?;

Ok(release)
}
}
2 changes: 2 additions & 0 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod github;
pub mod models;
1 change: 1 addition & 0 deletions src/api/models/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod releases;
154 changes: 154 additions & 0 deletions src/api/models/releases.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
use serde::{Deserialize, Serialize};
use serde_json::Value;

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Release {
pub url: String,
#[serde(rename = "assets_url")]
pub assets_url: String,
#[serde(rename = "upload_url")]
pub upload_url: String,
#[serde(rename = "html_url")]
pub html_url: String,
pub id: i64,
pub author: Author,
#[serde(rename = "node_id")]
pub node_id: String,
#[serde(rename = "tag_name")]
pub tag_name: String,
#[serde(rename = "target_commitish")]
pub target_commitish: String,
pub name: String,
pub draft: bool,
pub prerelease: bool,
#[serde(rename = "created_at")]
pub created_at: String,
#[serde(rename = "published_at")]
pub published_at: String,
pub assets: Vec<Asset>,
#[serde(rename = "tarball_url")]
pub tarball_url: String,
#[serde(rename = "zipball_url")]
pub zipball_url: String,
pub body: String,
pub reactions: Reactions,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Author {
pub login: String,
pub id: i64,
#[serde(rename = "node_id")]
pub node_id: String,
#[serde(rename = "avatar_url")]
pub avatar_url: String,
#[serde(rename = "gravatar_id")]
pub gravatar_id: String,
pub url: String,
#[serde(rename = "html_url")]
pub html_url: String,
#[serde(rename = "followers_url")]
pub followers_url: String,
#[serde(rename = "following_url")]
pub following_url: String,
#[serde(rename = "gists_url")]
pub gists_url: String,
#[serde(rename = "starred_url")]
pub starred_url: String,
#[serde(rename = "subscriptions_url")]
pub subscriptions_url: String,
#[serde(rename = "organizations_url")]
pub organizations_url: String,
#[serde(rename = "repos_url")]
pub repos_url: String,
#[serde(rename = "events_url")]
pub events_url: String,
#[serde(rename = "received_events_url")]
pub received_events_url: String,
#[serde(rename = "type")]
pub type_field: String,
#[serde(rename = "site_admin")]
pub site_admin: bool,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Asset {
pub url: String,
pub id: i64,
#[serde(rename = "node_id")]
pub node_id: String,
pub name: String,
pub label: Value,
pub uploader: Uploader,
#[serde(rename = "content_type")]
pub content_type: String,
pub state: String,
pub size: i64,
#[serde(rename = "download_count")]
pub download_count: i64,
#[serde(rename = "created_at")]
pub created_at: String,
#[serde(rename = "updated_at")]
pub updated_at: String,
#[serde(rename = "browser_download_url")]
pub browser_download_url: String,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Uploader {
pub login: String,
pub id: i64,
#[serde(rename = "node_id")]
pub node_id: String,
#[serde(rename = "avatar_url")]
pub avatar_url: String,
#[serde(rename = "gravatar_id")]
pub gravatar_id: String,
pub url: String,
#[serde(rename = "html_url")]
pub html_url: String,
#[serde(rename = "followers_url")]
pub followers_url: String,
#[serde(rename = "following_url")]
pub following_url: String,
#[serde(rename = "gists_url")]
pub gists_url: String,
#[serde(rename = "starred_url")]
pub starred_url: String,
#[serde(rename = "subscriptions_url")]
pub subscriptions_url: String,
#[serde(rename = "organizations_url")]
pub organizations_url: String,
#[serde(rename = "repos_url")]
pub repos_url: String,
#[serde(rename = "events_url")]
pub events_url: String,
#[serde(rename = "received_events_url")]
pub received_events_url: String,
#[serde(rename = "type")]
pub type_field: String,
#[serde(rename = "site_admin")]
pub site_admin: bool,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Reactions {
pub url: String,
#[serde(rename = "total_count")]
pub total_count: i64,
#[serde(rename = "+1")]
pub n1: i64,
#[serde(rename = "-1")]
pub n12: i64,
pub laugh: i64,
pub hooray: i64,
pub confused: i64,
pub heart: i64,
pub rocket: i64,
pub eyes: i64,
}
Loading