diff --git a/Cargo.lock b/Cargo.lock index b42a1c007..0994b24f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8453,9 +8453,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.30.8" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6682a07cf5bab0b8a2bd20d0a542917ab928b5edb75ebd4eda6b05cbaab872da" +checksum = "cc6b53216f32e60efc27dfa111268481e4dfba53e553e4cdebcaed9db36c11bb" dependencies = [ "bitflags 2.6.0", "cocoa 0.26.0", @@ -8468,7 +8468,6 @@ dependencies = [ "gdkwayland-sys", "gdkx11-sys", "gtk", - "instant", "jni", "lazy_static", "libc", @@ -8527,8 +8526,7 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tauri" version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e545de0a2dfe296fa67db208266cd397c5a55ae782da77973ef4c4fac90e9f2c" +source = "git+https://github.com/modrinth/tauri?rev=9c36dd3#9c36dd30ad6d19832a5dbd7ac9af0a152bb9323a" dependencies = [ "anyhow", "bytes 1.7.2", @@ -8559,11 +8557,11 @@ dependencies = [ "serde_repr", "serialize-to-javascript", "swift-rs", - "tauri-build", + "tauri-build 2.0.3 (git+https://github.com/modrinth/tauri?rev=9c36dd3)", "tauri-macros", "tauri-runtime", "tauri-runtime-wry", - "tauri-utils", + "tauri-utils 2.1.0 (git+https://github.com/modrinth/tauri?rev=9c36dd3)", "thiserror 2.0.7", "tokio 1.42.0", "tray-icon", @@ -8592,8 +8590,29 @@ dependencies = [ "semver 1.0.23", "serde", "serde_json", - "tauri-codegen", - "tauri-utils", + "tauri-codegen 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tauri-utils 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tauri-winres", + "toml 0.8.19", + "walkdir", +] + +[[package]] +name = "tauri-build" +version = "2.0.3" +source = "git+https://github.com/modrinth/tauri?rev=9c36dd3#9c36dd30ad6d19832a5dbd7ac9af0a152bb9323a" +dependencies = [ + "anyhow", + "cargo_toml", + "dirs 5.0.1", + "glob", + "heck 0.5.0", + "json-patch", + "schemars", + "semver 1.0.23", + "serde", + "serde_json", + "tauri-utils 2.1.0 (git+https://github.com/modrinth/tauri?rev=9c36dd3)", "tauri-winres", "toml 0.8.19", "walkdir", @@ -8604,6 +8623,31 @@ name = "tauri-codegen" version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf79faeecf301d3e969b1fae977039edb77a4c1f25cc0a961be298b54bff97cf" +dependencies = [ + "base64 0.22.1", + "ico", + "json-patch", + "plist", + "png", + "proc-macro2", + "quote", + "semver 1.0.23", + "serde", + "serde_json", + "sha2 0.10.8", + "syn 2.0.90", + "tauri-utils 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 2.0.7", + "time", + "url", + "uuid 1.10.0", + "walkdir", +] + +[[package]] +name = "tauri-codegen" +version = "2.0.3" +source = "git+https://github.com/modrinth/tauri?rev=9c36dd3#9c36dd30ad6d19832a5dbd7ac9af0a152bb9323a" dependencies = [ "base64 0.22.1", "brotli 7.0.0", @@ -8618,7 +8662,7 @@ dependencies = [ "serde_json", "sha2 0.10.8", "syn 2.0.90", - "tauri-utils", + "tauri-utils 2.1.0 (git+https://github.com/modrinth/tauri?rev=9c36dd3)", "thiserror 2.0.7", "time", "url", @@ -8629,15 +8673,14 @@ dependencies = [ [[package]] name = "tauri-macros" version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c52027c8c5afb83166dacddc092ee8fff50772f9646d461d8c33ee887e447a03" +source = "git+https://github.com/modrinth/tauri?rev=9c36dd3#9c36dd30ad6d19832a5dbd7ac9af0a152bb9323a" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.90", - "tauri-codegen", - "tauri-utils", + "tauri-codegen 2.0.3 (git+https://github.com/modrinth/tauri?rev=9c36dd3)", + "tauri-utils 2.1.0 (git+https://github.com/modrinth/tauri?rev=9c36dd3)", ] [[package]] @@ -8652,7 +8695,7 @@ dependencies = [ "schemars", "serde", "serde_json", - "tauri-utils", + "tauri-utils 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.8.19", "walkdir", ] @@ -8669,7 +8712,7 @@ dependencies = [ "serde_json", "tauri", "tauri-plugin", - "tauri-utils", + "tauri-utils 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 2.0.7", "tracing", "url", @@ -8711,7 +8754,7 @@ dependencies = [ "serde_repr", "tauri", "tauri-plugin", - "tauri-utils", + "tauri-utils 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 2.0.7", "toml 0.8.19", "url", @@ -8821,8 +8864,7 @@ dependencies = [ [[package]] name = "tauri-runtime" version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cce18d43f80d4aba3aa8a0c953bbe835f3d0f2370aca75e8dbb14bd4bab27958" +source = "git+https://github.com/modrinth/tauri?rev=9c36dd3#9c36dd30ad6d19832a5dbd7ac9af0a152bb9323a" dependencies = [ "dpi", "gtk", @@ -8831,7 +8873,7 @@ dependencies = [ "raw-window-handle 0.6.2", "serde", "serde_json", - "tauri-utils", + "tauri-utils 2.1.0 (git+https://github.com/modrinth/tauri?rev=9c36dd3)", "thiserror 2.0.7", "url", "windows 0.58.0", @@ -8840,8 +8882,7 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f442a38863e10129ffe2cec7bd09c2dcf8a098a3a27801a476a304d5bb991d2" +source = "git+https://github.com/modrinth/tauri?rev=9c36dd3#9c36dd30ad6d19832a5dbd7ac9af0a152bb9323a" dependencies = [ "gtk", "http 1.1.0", @@ -8855,7 +8896,7 @@ dependencies = [ "softbuffer", "tao", "tauri-runtime", - "tauri-utils", + "tauri-utils 2.1.0 (git+https://github.com/modrinth/tauri?rev=9c36dd3)", "url", "webkit2gtk", "webview2-com", @@ -8868,6 +8909,41 @@ name = "tauri-utils" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9271a88f99b4adea0dc71d0baca4505475a0bbd139fb135f62958721aaa8fe54" +dependencies = [ + "cargo_metadata", + "ctor", + "dunce", + "glob", + "html5ever", + "http 1.1.0", + "infer 0.16.0", + "json-patch", + "kuchikiki", + "log", + "memchr", + "phf 0.11.2", + "proc-macro2", + "quote", + "regex", + "schemars", + "semver 1.0.23", + "serde", + "serde-untagged", + "serde_json", + "serde_with", + "swift-rs", + "thiserror 2.0.7", + "toml 0.8.19", + "url", + "urlpattern", + "uuid 1.10.0", + "walkdir", +] + +[[package]] +name = "tauri-utils" +version = "2.1.0" +source = "git+https://github.com/modrinth/tauri?rev=9c36dd3#9c36dd30ad6d19832a5dbd7ac9af0a152bb9323a" dependencies = [ "brotli 7.0.0", "cargo_metadata", @@ -9026,7 +9102,7 @@ dependencies = [ "serde", "serde_json", "tauri", - "tauri-build", + "tauri-build 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "tauri-plugin-deep-link", "tauri-plugin-dialog", "tauri-plugin-opener", diff --git a/Cargo.toml b/Cargo.toml index 0b2197db8..834e90ffd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,3 +19,6 @@ strip = true # Remove debug symbols [profile.dev.package.sqlx-macros] opt-level = 3 + +[patch.crates-io] +tauri = { git = "https://github.com/modrinth/tauri", rev = "9c36dd3" } \ No newline at end of file diff --git a/apps/app-frontend/src/components/ui/SplashScreen.vue b/apps/app-frontend/src/components/ui/SplashScreen.vue index fa45ff012..14b0a72a4 100644 --- a/apps/app-frontend/src/components/ui/SplashScreen.vue +++ b/apps/app-frontend/src/components/ui/SplashScreen.vue @@ -127,7 +127,6 @@ const os = ref('') getOS().then((x) => (os.value = x)) loading_listener(async (e) => { - console.log(e) if (e.event.type === 'directory_move') { loadingProgress.value = 100 * (e.fraction ?? 1) message.value = 'Updating app directory...' diff --git a/apps/app-frontend/src/helpers/utils.js b/apps/app-frontend/src/helpers/utils.js index 69cd5a8c4..569420101 100644 --- a/apps/app-frontend/src/helpers/utils.js +++ b/apps/app-frontend/src/helpers/utils.js @@ -49,17 +49,3 @@ export const releaseColor = (releaseType) => { return '' } } - -export function debounce(fn, wait) { - let timer - return function (...args) { - if (timer) { - clearTimeout(timer) // clear any pre-existing timer - } - - const context = this // get the current context - timer = setTimeout(() => { - fn.apply(context, args) // call the function if time expires - }, wait) - } -} diff --git a/apps/app-frontend/src/pages/Browse.vue b/apps/app-frontend/src/pages/Browse.vue index 607d7c1d5..c21b6ff11 100644 --- a/apps/app-frontend/src/pages/Browse.vue +++ b/apps/app-frontend/src/pages/Browse.vue @@ -21,7 +21,6 @@ import { useRoute, useRouter } from 'vue-router' import SearchCard from '@/components/ui/SearchCard.vue' import { get as getInstance, get_projects as getInstanceProjects } from '@/helpers/profile.js' import { get_search_results } from '@/helpers/cache.js' -import { debounce } from '@/helpers/utils.js' import NavTabs from '@/components/ui/NavTabs.vue' import type Instance from '@/components/ui/Instance.vue' import InstanceIndicator from '@/components/ui/InstanceIndicator.vue' @@ -190,6 +189,7 @@ const pageCount = computed(() => ) watch(requestParams, () => { + if (!route.params.projectType) return refreshSearch() }) @@ -214,44 +214,39 @@ async function refreshSearch() { } } results.value = rawResults.result -} - -function setPage(newPageNumber: number) { - currentPage.value = newPageNumber - - updateSearchResults() - onSearchChangeToTop() -} -async function updateSearchResults() { - await refreshSearch() + const persistentParams: LocationQuery = {} - if (import.meta.client) { - const persistentParams: LocationQuery = {} - - for (const [key, value] of Object.entries(route.query)) { - if (PERSISTENT_QUERY_PARAMS.includes(key)) { - persistentParams[key] = value - } - } - - if (instanceHideInstalled.value) { - persistentParams.ai = 'true' - } else { - delete persistentParams.ai + for (const [key, value] of Object.entries(route.query)) { + if (PERSISTENT_QUERY_PARAMS.includes(key)) { + persistentParams[key] = value } + } - const params = { - ...persistentParams, - ...createPageParams(), - } + if (instanceHideInstalled.value) { + persistentParams.ai = 'true' + } else { + delete persistentParams.ai + } - await router.replace({ path: route.path, query: params }) - breadcrumbs.setContext({ name: 'Discover content', link: route.path, query: params }) + const params = { + ...persistentParams, + ...createPageParams(), } + + breadcrumbs.setContext({ + name: 'Discover content', + link: `/browse/${projectType.value}`, + query: params, + }) + await router.replace({ path: route.path, query: params }) } -const debouncedSearchChange = debounce(() => updateSearchResults(1), 200) +async function setPage(newPageNumber: number) { + currentPage.value = newPageNumber + + await onSearchChangeToTop() +} const searchWrapper: Ref = ref(null) @@ -261,13 +256,10 @@ async function onSearchChangeToTop() { window.scrollTo({ top: 0, behavior: 'smooth' }) } -async function clearSearch() { +function clearSearch() { query.value = '' - await updateSearchResults() } -async function clearFilters() {} - watch( () => route.params.projectType, async (newType) => { @@ -275,14 +267,9 @@ watch( if (!newType || newType === projectType.value) return projectType.value = newType - breadcrumbs.setContext({ name: 'Discover content', link: `/browse/${projectType.value}` }) currentSortType.value = { display: 'Relevance', name: 'relevance' } query.value = '' - - loading.value = true - await clearFilters() - loading.value = false }, ) @@ -418,7 +405,6 @@ await refreshSearch() spellcheck="false" type="text" :placeholder="`Search ${projectType}s...`" - @input="debouncedSearchChange()" />