Skip to content

Commit

Permalink
Merge branch 'modrinth:main' into he3als/content-page-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ferothefox authored Dec 28, 2024
2 parents 1fec577 + 24765db commit a0c4923
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 21 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/theseus-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ jobs:
!target/release/bundle/*/*.app.tar.gz
!target/release/bundle/*/*.app.tar.gz.sig
!target/release/bundle/*/*.AppImage
!target/release/bundle/*/*.AppImage.tar.gz
!target/release/bundle/*/*.AppImage.tar.gz.sig
!target/release/bundle/*/*.deb
!target/release/bundle/*/*.rpm
!target/release/bundle/appimage/*.AppImage
!target/release/bundle/appimage/*.AppImage.tar.gz
!target/release/bundle/appimage/*.AppImage.tar.gz.sig
!target/release/bundle/deb/*.deb
!target/release/bundle/rpm/*.rpm
!target/release/bundle/msi/*.msi
!target/release/bundle/msi/*.msi.zip
Expand Down
26 changes: 20 additions & 6 deletions apps/frontend/src/pages/search/[searchProjectType].vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@
Install content to server
</h1>
</template>
<NavTabs v-if="!server" :links="selectableProjectTypes" class="hidden md:flex" />
<NavTabs
v-if="!server && !flags.projectTypesPrimaryNav"
:links="selectableProjectTypes"
class="hidden md:flex"
/>
</section>
<aside
:class="{
Expand Down Expand Up @@ -338,11 +342,21 @@ const tags = useTags();
const flags = useFeatureFlags();
const auth = await useAuth();
const projectType = computed(() =>
tags.value.projectTypes.find(
const projectType = ref();
function setProjectType() {
const projType = tags.value.projectTypes.find(
(x) => x.id === route.path.replaceAll(/^\/|s\/?$/g, ""), // Removes prefix `/` and suffixes `s` and `s/`
),
);
);
if (projType) {
projectType.value = projType;
}
}
setProjectType();
router.afterEach(() => {
setProjectType();
});
const projectTypes = computed(() => [projectType.value.id]);
const server = ref();
Expand Down Expand Up @@ -516,7 +530,7 @@ const {
const config = useRuntimeConfig();
const base = import.meta.server ? config.apiBaseUrl : config.public.apiBaseUrl;
return `${base}/search${requestParams.value}`;
return `${base}search${requestParams.value}`;
},
{
transform: (hits) => {
Expand Down
25 changes: 20 additions & 5 deletions apps/labrinth/src/database/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,12 @@ impl RedisPool {

fetch_ids.iter().for_each(|key| {
pipe.atomic().set_options(
format!("{}_{namespace}:{}/lock", self.meta_namespace, key),
// We store locks in lowercase because they are case insensitive
format!(
"{}_{namespace}:{}/lock",
self.meta_namespace,
key.to_lowercase()
),
100,
SetOptions::default()
.get(true)
Expand Down Expand Up @@ -395,7 +400,9 @@ impl RedisPool {

pipe.atomic().del(format!(
"{}_{namespace}:{}/lock",
self.meta_namespace, actual_slug
// Locks are stored in lowercase
self.meta_namespace,
actual_slug.to_lowercase()
));
}
}
Expand All @@ -408,8 +415,10 @@ impl RedisPool {
ids.remove(&base62);

pipe.atomic().del(format!(
"{}_{namespace}:{base62}/lock",
self.meta_namespace
"{}_{namespace}:{}/lock",
self.meta_namespace,
// Locks are stored in lowercase
base62.to_lowercase()
));
}

Expand All @@ -423,6 +432,11 @@ impl RedisPool {
}

for (key, _) in ids {
pipe.atomic().del(format!(
"{}_{namespace}:{}/lock",
self.meta_namespace,
key.to_lowercase()
));
pipe.atomic().del(format!(
"{}_{namespace}:{key}/lock",
self.meta_namespace
Expand Down Expand Up @@ -451,7 +465,8 @@ impl RedisPool {
format!(
"{}_{namespace}:{}/lock",
self.meta_namespace,
x.key()
// We lowercase key because locks are stored in lowercase
x.key().to_lowercase()
)
})
.collect::<Vec<_>>(),
Expand Down
15 changes: 10 additions & 5 deletions packages/ui/src/utils/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export type FilterType = {
}[]
searchable: boolean
allows_custom_options?: 'and' | 'or'
ordering?: number
} & (
| {
display: 'all' | 'scrollable' | 'none'
Expand Down Expand Up @@ -215,6 +216,7 @@ export function useSearch(
query_value: gameVersion.version,
method: 'or',
})),
ordering: projectTypes.value.includes('mod') ? 2 : undefined,
},
{
id: 'mod_loader',
Expand Down Expand Up @@ -243,6 +245,7 @@ export function useSearch(
value: `categories:${loader.name}`,
}
}),
ordering: projectTypes.value.includes('mod') ? 1 : undefined,
},
{
id: 'modpack_loader',
Expand Down Expand Up @@ -375,11 +378,13 @@ export function useSearch(
},
]

return filterTypes.filter((filterType) =>
filterType.supported_project_types.some((projectType) =>
projectTypes.value.includes(projectType),
),
)
return filterTypes
.filter((filterType) =>
filterType.supported_project_types.some((projectType) =>
projectTypes.value.includes(projectType),
),
)
.sort((a, b) => (b.ordering ?? 0) - (a.ordering ?? 0))
})

const facets = computed(() => {
Expand Down

0 comments on commit a0c4923

Please sign in to comment.