mirror of
https://github.com/modrinth/code.git
synced 2026-08-28 10:34:53 +00:00
qa: shared instances post release (#6893)
* fix: 20 user cap * qa: invite modal dropdown + other + clamp limits * fix: hide filters if just one type * feat: update req banner * feat: invite management frontend * fix: moderation issues with shared instances * feat: instance icon improvements * fix: better offline handling * fix: lint * feat: show avatar in install to play modal * feat: smaller qa points * fix: fmt * fix: fmt * fix: yeet svg * fix: 50 user limit
This commit is contained in:
@@ -8,7 +8,7 @@ use crate::state::{
|
||||
InstanceInstallStage, LauncherFeatureVersion, ModLoader, ReleaseChannel,
|
||||
State,
|
||||
};
|
||||
use crate::util::fetch::{self, write_cached_icon};
|
||||
use crate::util::fetch;
|
||||
use crate::util::io;
|
||||
use chrono::Utc;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -174,10 +174,8 @@ async fn resolve_icon_path(
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
let (bytes, file_name) = if icon.starts_with("https://")
|
||||
|| icon.starts_with("http://")
|
||||
{
|
||||
let fetched = fetch::fetch(
|
||||
let file = if icon.starts_with("https://") || icon.starts_with("http://") {
|
||||
let bytes = fetch::fetch(
|
||||
icon,
|
||||
None,
|
||||
None,
|
||||
@@ -186,21 +184,15 @@ async fn resolve_icon_path(
|
||||
&state.pool,
|
||||
)
|
||||
.await?;
|
||||
let name = icon.rsplit('/').next().unwrap_or("icon").to_string();
|
||||
(fetched, name)
|
||||
crate::api::instance::cache_icon(bytes, state).await?
|
||||
} else {
|
||||
let data = io::read(state.directories.caches_dir().join(icon)).await?;
|
||||
(bytes::Bytes::from(data), icon.to_string())
|
||||
crate::api::instance::cache_icon_from_path(
|
||||
&state.directories.caches_dir().join(icon),
|
||||
state,
|
||||
)
|
||||
.await?
|
||||
};
|
||||
|
||||
let file = write_cached_icon(
|
||||
&file_name,
|
||||
&state.directories.caches_dir(),
|
||||
bytes,
|
||||
&state.io_semaphore,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(Some(file.to_string_lossy().to_string()))
|
||||
}
|
||||
|
||||
|
||||
@@ -150,6 +150,10 @@ impl State {
|
||||
)
|
||||
.await;
|
||||
|
||||
if let Err(e) = crate::api::instance::migrate_legacy_icons().await {
|
||||
tracing::error!("Error migrating legacy instance icons: {e}");
|
||||
}
|
||||
|
||||
let res = tokio::try_join!(
|
||||
state.discord_rpc.clear_to_default(true),
|
||||
instances::refresh_all_instances(),
|
||||
|
||||
Reference in New Issue
Block a user