mirror of
https://github.com/modrinth/code.git
synced 2026-09-05 06:19:11 +00:00
Merge branch 'main' into boris/search-index-fix
This commit is contained in:
@@ -76,6 +76,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Deploy Storybook preview
|
- name: Deploy Storybook preview
|
||||||
uses: cloudflare/wrangler-action@9acf94ace14e7dc412b076f2c5c20b8ce93c79cd # v3.15.0
|
uses: cloudflare/wrangler-action@9acf94ace14e7dc412b076f2c5c20b8ce93c79cd # v3.15.0
|
||||||
|
env:
|
||||||
|
NODE_OPTIONS: --max-old-space-size=6144
|
||||||
with:
|
with:
|
||||||
apiToken: ${{ secrets.CF_API_TOKEN }}
|
apiToken: ${{ secrets.CF_API_TOKEN }}
|
||||||
accountId: ${{ secrets.CF_ACCOUNT_ID }}
|
accountId: ${{ secrets.CF_ACCOUNT_ID }}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use crate::auth::{check_is_moderator_from_headers, get_user_from_headers};
|
use crate::auth::{check_is_moderator_from_headers, get_user_from_headers};
|
||||||
use crate::database::PgPool;
|
use crate::database::PgPool;
|
||||||
use crate::database::models::{
|
use crate::database::models::{
|
||||||
DBFileId, DBOrganization, DBTeamMember, DBVersion,
|
DBFileId, DBOrganization, DBProject, DBTeamMember, DBVersion,
|
||||||
ids::{
|
ids::{
|
||||||
DBAttributionGroupId, DBProjectId, DBVersionId,
|
DBAttributionGroupId, DBProjectId, DBVersionId,
|
||||||
generate_attribution_group_id,
|
generate_attribution_group_id,
|
||||||
@@ -312,16 +312,39 @@ pub async fn list(
|
|||||||
path: web::Path<ProjectId>,
|
path: web::Path<ProjectId>,
|
||||||
) -> Result<web::Json<Vec<AttributionGroupResponse>>, ApiError> {
|
) -> Result<web::Json<Vec<AttributionGroupResponse>>, ApiError> {
|
||||||
let project_id: DBProjectId = path.into_inner().into();
|
let project_id: DBProjectId = path.into_inner().into();
|
||||||
let requester_is_mod = get_user_from_headers(
|
let user = get_user_from_headers(
|
||||||
&req,
|
&req,
|
||||||
&**pool,
|
&**pool,
|
||||||
&redis,
|
&redis,
|
||||||
&session_queue,
|
&session_queue,
|
||||||
Scopes::PROJECT_READ,
|
Scopes::VERSION_READ,
|
||||||
)
|
)
|
||||||
.await
|
.await?
|
||||||
.ok()
|
.1;
|
||||||
.is_some_and(|(_, user)| user.role.is_mod());
|
let requester_is_mod = user.role.is_mod();
|
||||||
|
|
||||||
|
let project = DBProject::get_id(project_id, pool.as_ref(), redis.as_ref())
|
||||||
|
.await?
|
||||||
|
.ok_or(ApiError::NotFound)?;
|
||||||
|
let (team_member, organization_team_member) =
|
||||||
|
DBTeamMember::get_for_project_permissions(
|
||||||
|
&project.inner,
|
||||||
|
user.id.into(),
|
||||||
|
pool.as_ref(),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.wrap_internal_err("failed to fetch project permissions")?;
|
||||||
|
if ProjectPermissions::get_permissions_by_role(
|
||||||
|
&user.role,
|
||||||
|
&team_member,
|
||||||
|
&organization_team_member,
|
||||||
|
)
|
||||||
|
.is_none()
|
||||||
|
{
|
||||||
|
return Err(ApiError::Auth(eyre!(
|
||||||
|
"you do not have permission to read versions for this project"
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
let groups = sqlx::query!(
|
let groups = sqlx::query!(
|
||||||
r#"
|
r#"
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ async fn read_singleplayer_world_maybe_locked(
|
|||||||
.to_string();
|
.to_string();
|
||||||
let last_played = data.get::<_, i64>("LastPlayed").unwrap_or(0);
|
let last_played = data.get::<_, i64>("LastPlayed").unwrap_or(0);
|
||||||
let game_type = data.get::<_, i32>("GameType").unwrap_or(0);
|
let game_type = data.get::<_, i32>("GameType").unwrap_or(0);
|
||||||
let hardcore = data.get::<_, i8>("hardcore").unwrap_or(0) != 0;
|
let hardcore = read_hardcore(data);
|
||||||
|
|
||||||
let icon = if tokio::fs::try_exists(world_path.join("icon.png"))
|
let icon = if tokio::fs::try_exists(world_path.join("icon.png"))
|
||||||
.await
|
.await
|
||||||
@@ -438,6 +438,14 @@ async fn read_singleplayer_world_maybe_locked(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_hardcore(data: &NbtCompound) -> bool {
|
||||||
|
data.get::<_, &NbtCompound>("difficulty_settings")
|
||||||
|
.and_then(|settings| settings.get::<_, i8>("hardcore"))
|
||||||
|
.or_else(|_| data.get::<_, i8>("hardcore"))
|
||||||
|
.unwrap_or(0)
|
||||||
|
!= 0
|
||||||
|
}
|
||||||
|
|
||||||
async fn get_server_worlds_in_instance(
|
async fn get_server_worlds_in_instance(
|
||||||
instance_id: &str,
|
instance_id: &str,
|
||||||
instance_dir: &Path,
|
instance_dir: &Path,
|
||||||
|
|||||||
@@ -711,7 +711,11 @@ pub(crate) async fn remove_project(
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
io::remove_file(base.join(project_path)).await?;
|
match io::remove_file(base.join(project_path)).await {
|
||||||
|
Ok(()) => {}
|
||||||
|
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {}
|
||||||
|
Err(err) => return Err(err.into()),
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(file) = file {
|
if let Some(file) = file {
|
||||||
content_rows::remove_content_entries_for_file(
|
content_rows::remove_content_entries_for_file(
|
||||||
|
|||||||
@@ -10,6 +10,14 @@ export type VersionEntry = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const VERSIONS: VersionEntry[] = [
|
const VERSIONS: VersionEntry[] = [
|
||||||
|
{
|
||||||
|
date: `2026-07-16T19:36:45+00:00`,
|
||||||
|
product: 'app',
|
||||||
|
version: '0.15.12',
|
||||||
|
body: `## Fixed
|
||||||
|
- Fixed issue with some modpacks failing to install due to file mismatches.
|
||||||
|
- Fixed hardcore worlds generated in 26.1+ not being recognised as hardcore in the Jump back in and Worlds tab.`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
date: `2026-07-14T22:14:08+00:00`,
|
date: `2026-07-14T22:14:08+00:00`,
|
||||||
product: 'app',
|
product: 'app',
|
||||||
|
|||||||
Reference in New Issue
Block a user