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

Trying to fix issues#300 #354

Merged
merged 1 commit into from
Aug 3, 2024
Merged
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
4 changes: 2 additions & 2 deletions phira/src/client/model/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ impl Roles {
}
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
#[serde(default)]
pub struct User {
pub id: i32,
pub name: String,
Expand All @@ -96,7 +97,6 @@ pub struct User {
pub bio: Option<String>,
pub exp: i64,
pub rks: f32,
#[serde(default)]
pub roles: i32,

pub joined: DateTime<Utc>,
Expand Down
12 changes: 11 additions & 1 deletion phira/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ impl Data {
let entry = entry?;
let filename = entry.file_name();
let filename = filename.to_str().unwrap();
let filename = format!("download/{filename}");
let Ok(id): Result<i32, _> = filename.parse() else { continue };
let filename = format!("download/{filename}");
if occurred.contains(&filename) {
continue;
}
Expand All @@ -139,6 +139,16 @@ impl Data {
});
}
}
let respacks: HashSet<_> = self.respacks.iter().map(|s| s.clone()).collect();
for entry in std::fs::read_dir(dir::respacks()?)? {
let entry = entry?;
let filename = entry.file_name();
let filename = filename.to_str().unwrap().to_string();
if respacks.contains(&filename) {
continue;
}
self.respacks.push(filename);
}
if let Some(res_pack_path) = &mut self.config.res_pack_path {
if res_pack_path.starts_with('/') {
// for compatibility
Expand Down