1
0

Finalize 0.8.1 release (#2182)

* Finalize 0.8.1 release

* Remove console.logs

* Fix build

* add default to users

* update release conf

* fix again?

* fix build (again)

* actually fix build

* Update config dir

* Update config dir

* Fix dir again
This commit is contained in:
Geometrically
2024-08-20 17:53:14 -07:00
committed by GitHub
parent 3fca24e6fd
commit a19ce0458a
25 changed files with 504 additions and 117 deletions

View File

@@ -98,7 +98,7 @@ jobs:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
args: --target universal-apple-darwin
args: "--target universal-apple-darwin --config ./apps/app/tauri-release.conf.json"
working-directory: ./apps/app
- name: build app
@@ -110,6 +110,7 @@ jobs:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
args: "--config ./apps/app/tauri-release.conf.json"
working-directory: ./apps/app
- name: upload ${{ matrix.platform }}

273
Cargo.lock generated
View File

@@ -531,6 +531,9 @@ name = "bytes"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
dependencies = [
"serde",
]
[[package]]
name = "bzip2"
@@ -1948,6 +1951,25 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "h2"
version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8"
dependencies = [
"bytes",
"fnv",
"futures-core",
"futures-sink",
"futures-util",
"http 0.2.12",
"indexmap 2.4.0",
"slab",
"tokio",
"tokio-util",
"tracing",
]
[[package]]
name = "h2"
version = "0.4.5"
@@ -2097,6 +2119,17 @@ dependencies = [
"itoa 1.0.11",
]
[[package]]
name = "http-body"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
dependencies = [
"bytes",
"http 0.2.12",
"pin-project-lite",
]
[[package]]
name = "http-body"
version = "1.0.1"
@@ -2116,7 +2149,7 @@ dependencies = [
"bytes",
"futures-util",
"http 1.1.0",
"http-body",
"http-body 1.0.1",
"pin-project-lite",
]
@@ -2132,6 +2165,36 @@ version = "1.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"
[[package]]
name = "httpdate"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "hyper"
version = "0.14.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9"
dependencies = [
"bytes",
"futures-channel",
"futures-core",
"futures-util",
"h2 0.3.26",
"http 0.2.12",
"http-body 0.4.6",
"httparse",
"httpdate",
"itoa 1.0.11",
"pin-project-lite",
"socket2 0.4.10",
"tokio",
"tower-service",
"tracing",
"want",
]
[[package]]
name = "hyper"
version = "1.4.1"
@@ -2141,9 +2204,9 @@ dependencies = [
"bytes",
"futures-channel",
"futures-util",
"h2",
"h2 0.4.5",
"http 1.1.0",
"http-body",
"http-body 1.0.1",
"httparse",
"itoa 1.0.11",
"pin-project-lite",
@@ -2160,7 +2223,7 @@ checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155"
dependencies = [
"futures-util",
"http 1.1.0",
"hyper",
"hyper 1.4.1",
"hyper-util",
"rustls",
"rustls-pki-types",
@@ -2170,6 +2233,19 @@ dependencies = [
"webpki-roots",
]
[[package]]
name = "hyper-tls"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [
"bytes",
"hyper 0.14.30",
"native-tls",
"tokio",
"tokio-native-tls",
]
[[package]]
name = "hyper-util"
version = "0.1.7"
@@ -2180,8 +2256,8 @@ dependencies = [
"futures-channel",
"futures-util",
"http 1.1.0",
"http-body",
"hyper",
"http-body 1.0.1",
"hyper 1.4.1",
"pin-project-lite",
"socket2 0.5.7",
"tokio",
@@ -2698,6 +2774,12 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "minisign-verify"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "933dca44d65cdd53b355d0b73d380a2ff5da71f87f036053188bf1eab6a19881"
[[package]]
name = "miniz_oxide"
version = "0.7.4"
@@ -2732,6 +2814,23 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "native-tls"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466"
dependencies = [
"libc",
"log",
"openssl",
"openssl-probe",
"openssl-sys",
"schannel",
"security-framework",
"security-framework-sys",
"tempfile",
]
[[package]]
name = "ndk"
version = "0.6.0"
@@ -3030,6 +3129,50 @@ dependencies = [
"windows-sys 0.59.0",
]
[[package]]
name = "openssl"
version = "0.10.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1"
dependencies = [
"bitflags 2.6.0",
"cfg-if",
"foreign-types 0.3.2",
"libc",
"once_cell",
"openssl-macros",
"openssl-sys",
]
[[package]]
name = "openssl-macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.74",
]
[[package]]
name = "openssl-probe"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
version = "0.9.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "option-ext"
version = "0.2.0"
@@ -3771,6 +3914,48 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]]
name = "reqwest"
version = "0.11.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62"
dependencies = [
"base64 0.21.7",
"bytes",
"encoding_rs",
"futures-core",
"futures-util",
"h2 0.3.26",
"http 0.2.12",
"http-body 0.4.6",
"hyper 0.14.30",
"hyper-tls",
"ipnet",
"js-sys",
"log",
"mime",
"native-tls",
"once_cell",
"percent-encoding",
"pin-project-lite",
"rustls-pemfile 1.0.4",
"serde",
"serde_json",
"serde_urlencoded",
"sync_wrapper 0.1.2",
"system-configuration",
"tokio",
"tokio-native-tls",
"tokio-util",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-streams",
"web-sys",
"winreg 0.50.0",
]
[[package]]
name = "reqwest"
version = "0.12.5"
@@ -3783,11 +3968,11 @@ dependencies = [
"encoding_rs",
"futures-core",
"futures-util",
"h2",
"h2 0.4.5",
"http 1.1.0",
"http-body",
"http-body 1.0.1",
"http-body-util",
"hyper",
"hyper 1.4.1",
"hyper-rustls",
"hyper-util",
"ipnet",
@@ -3799,12 +3984,12 @@ dependencies = [
"pin-project-lite",
"quinn",
"rustls",
"rustls-pemfile",
"rustls-pemfile 2.1.3",
"rustls-pki-types",
"serde",
"serde_json",
"serde_urlencoded",
"sync_wrapper",
"sync_wrapper 1.0.1",
"system-configuration",
"tokio",
"tokio-rustls",
@@ -3956,6 +4141,15 @@ dependencies = [
"zeroize",
]
[[package]]
name = "rustls-pemfile"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
dependencies = [
"base64 0.21.7",
]
[[package]]
name = "rustls-pemfile"
version = "2.1.3"
@@ -4004,6 +4198,15 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "schannel"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534"
dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "scoped-tls"
version = "1.0.1"
@@ -4030,6 +4233,29 @@ dependencies = [
"zeroize",
]
[[package]]
name = "security-framework"
version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
dependencies = [
"bitflags 2.6.0",
"core-foundation",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "selectors"
version = "0.22.0"
@@ -4644,6 +4870,12 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "sync_wrapper"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
[[package]]
name = "sync_wrapper"
version = "1.0.1"
@@ -4817,6 +5049,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "336bc661a3f3250853fa83c6e5245449ed1c26dce5dcb28bdee7efedf6278806"
dependencies = [
"anyhow",
"base64 0.21.7",
"bytes",
"cocoa 0.24.1",
"dirs-next",
"dunce",
@@ -4831,6 +5065,8 @@ dependencies = [
"heck 0.5.0",
"http 0.2.12",
"ignore",
"indexmap 1.9.3",
"minisign-verify",
"objc",
"once_cell",
"open",
@@ -4839,6 +5075,7 @@ dependencies = [
"rand 0.8.5",
"raw-window-handle",
"regex",
"reqwest 0.11.27",
"rfd",
"semver",
"serde",
@@ -4854,12 +5091,14 @@ dependencies = [
"tauri-utils",
"tempfile",
"thiserror",
"time",
"tokio",
"url",
"uuid 1.10.0",
"webkit2gtk",
"webview2-com",
"windows 0.39.0",
"zip",
]
[[package]]
@@ -5096,7 +5335,7 @@ dependencies = [
"paste",
"rand 0.8.5",
"regex",
"reqwest",
"reqwest 0.12.5",
"serde",
"serde_ini",
"serde_json",
@@ -5294,6 +5533,16 @@ dependencies = [
"syn 2.0.74",
]
[[package]]
name = "tokio-native-tls"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
dependencies = [
"native-tls",
"tokio",
]
[[package]]
name = "tokio-rustls"
version = "0.26.0"

View File

@@ -101,7 +101,17 @@ onUnmounted(() => unlisten())
/>
<div class="project-info">
<p class="title">{{ props.instance.name }}</p>
<p class="description">
<p
v-if="
props.instance.install_stage === 'installing' ||
props.instance.install_stage === 'not_installed' ||
props.instance.install_stage === 'pack_installing'
"
class="description"
>
Installing...
</p>
<p v-else class="description">
{{ props.instance.loader }}
{{ props.instance.game_version }}
</p>

View File

@@ -0,0 +1,23 @@
<script setup lang="ts">
import { ref } from 'vue'
import { Promotion } from '@modrinth/ui'
import { get as getCreds } from '@/helpers/mr_auth.js'
import { handleError } from '@/store/notifications.js'
import { get_user } from '@/helpers/cache.js'
const showAd = ref(true)
const creds = await getCreds().catch(handleError)
if (creds && creds.user_id) {
const user = await get_user(creds.user_id).catch(handleError)
const MIDAS_BITFLAG = 1 << 0
if (user && (user.badges & MIDAS_BITFLAG) === MIDAS_BITFLAG) {
showAd.value = false
}
}
</script>
<template>
<Promotion v-if="showAd" :external="false" query-param="?r=launcher" />
</template>

View File

@@ -6,7 +6,6 @@ import {
Checkbox,
Button,
DropdownSelect,
Promotion,
NavRow,
Card,
SearchFilter,
@@ -23,6 +22,8 @@ import { get as getInstance, get_projects as getInstanceProjects } from '@/helpe
import { convertFileSrc } from '@tauri-apps/api/tauri'
import { get_search_results } from '@/helpers/cache.js'
import { debounce } from '@/helpers/utils.js'
import PromotionWrapper from '@/components/ui/PromotionWrapper.vue'
const router = useRouter()
const route = useRoute()
@@ -674,7 +675,7 @@ const isModProject = computed(() => ['modpack', 'mod'].includes(projectType.valu
</Card>
</aside>
<div class="search">
<Promotion class="promotion" :external="false" query-param="?r=launcher" />
<PromotionWrapper />
<Card class="project-type-container">
<NavRow :links="selectableProjectTypes" />
</Card>

View File

@@ -91,7 +91,6 @@ async function updateJavaVersion(version) {
async function fetchCredentials() {
const creds = await getCreds().catch(handleError)
console.log(creds)
if (creds && creds.user_id) {
creds.user = await get_user(creds.user_id).catch(handleError)
}

View File

@@ -63,7 +63,7 @@
</Card>
</div>
<div class="content">
<Promotion :external="false" query-param="?r=launcher" />
<PromotionWrapper />
<RouterView v-slot="{ Component }">
<template v-if="Component">
<Suspense @pending="loadingBar.startLoading()" @resolve="loadingBar.stopLoading()">
@@ -104,7 +104,7 @@
</ContextMenu>
</template>
<script setup>
import { Button, Avatar, Card, Promotion } from '@modrinth/ui'
import { Button, Avatar, Card } from '@modrinth/ui'
import {
BoxIcon,
SettingsIcon,
@@ -137,6 +137,7 @@ import { useFetch } from '@/helpers/fetch'
import { handleSevereError } from '@/store/error.js'
import { get_project, get_version_many } from '@/helpers/cache.js'
import dayjs from 'dayjs'
import PromotionWrapper from '@/components/ui/PromotionWrapper.vue'
const route = useRoute()

View File

@@ -213,9 +213,9 @@
class="mod-content"
>
<Avatar :src="mod.icon" />
<div v-tooltip="`${mod.name} by ${mod.author}`" class="mod-text">
<div class="mod-text">
<div class="title">{{ mod.name }}</div>
<span class="no-wrap">by {{ mod.author }}</span>
<span v-if="mod.author" class="no-wrap">by {{ mod.author }}</span>
</div>
</router-link>
<div v-else class="mod-content">
@@ -476,41 +476,54 @@ const initProjects = async (cacheBehaviour) => {
if (file.metadata) {
const project = modrinthProjects.find((x) => file.metadata.project_id === x.id)
const version = modrinthVersions.find((x) => file.metadata.version_id === x.id)
const org = project.organization
? modrinthOrganizations.find((x) => x.id === project.organization)
: null
const team = modrinthTeams.find((x) => x[0].team_id === project.team)
if (project && version) {
const org = project.organization
? modrinthOrganizations.find((x) => x.id === project.organization)
: null
let owner = org ? org.name : team.find((x) => x.is_owner).user.username
const team = modrinthTeams.find((x) => x[0].team_id === project.team)
newProjects.push({
path,
name: project.title,
slug: project.slug,
author: owner,
version: version.version_number,
file_name: file.file_name,
icon: project.icon_url,
disabled: file.file_name.endsWith('.disabled'),
updateVersion: file.update_version_id,
outdated: !!file.update_version_id,
project_type: project.project_type,
id: project.id,
})
} else {
newProjects.push({
path,
name: file.file_name.replace('.disabled', ''),
author: '',
version: null,
file_name: file.file_name,
icon: null,
disabled: file.file_name.endsWith('.disabled'),
outdated: false,
project_type: file.project_type,
})
let owner
if (org) {
owner = org.name
} else if (team) {
owner = team.find((x) => x.is_owner).user.username
} else {
owner = null
}
newProjects.push({
path,
name: project.title,
slug: project.slug,
author: owner,
version: version.version_number,
file_name: file.file_name,
icon: project.icon_url,
disabled: file.file_name.endsWith('.disabled'),
updateVersion: file.update_version_id,
outdated: !!file.update_version_id,
project_type: project.project_type,
id: project.id,
})
}
continue
}
newProjects.push({
path,
name: file.file_name.replace('.disabled', ''),
author: '',
version: null,
file_name: file.file_name,
icon: null,
disabled: file.file_name.endsWith('.disabled'),
outdated: false,
project_type: file.project_type,
})
}
projects.value = newProjects

View File

@@ -894,7 +894,8 @@ const isChanged = computed(() => {
return (
loader.value !== props.instance.loader ||
gameVersion.value !== props.instance.game_version ||
selectableLoaderVersions.value[loaderVersionIndex.value].id !== props.instance.loader_version
(loaderVersionIndex.value >= 0 &&
selectableLoaderVersions.value[loaderVersionIndex.value].id !== props.instance.loader_version)
)
})
@@ -910,6 +911,8 @@ async function saveGvLoaderEdits() {
if (loader.value !== 'vanilla') {
editProfile.loader_version = selectableLoaderVersions.value[loaderVersionIndex.value].id
} else {
loaderVersionIndex.value = -1
}
await edit(props.instance.path, editProfile).catch(handleError)
await repairProfile(false)

View File

@@ -163,7 +163,7 @@
</Card>
</div>
<div v-if="data" class="content-container">
<Promotion :external="false" query-param="?r=launcher" />
<PromotionWrapper />
<Card class="tabs">
<NavRow
v-if="data.gallery.length > 0"
@@ -261,6 +261,7 @@ import { convertFileSrc } from '@tauri-apps/api/tauri'
import ContextMenu from '@/components/ui/ContextMenu.vue'
import { install as installVersion } from '@/store/install.js'
import { get_project, get_project_many, get_team, get_version_many } from '@/helpers/cache.js'
import PromotionWrapper from '@/components/ui/PromotionWrapper.vue'
dayjs.extend(relativeTime)

View File

@@ -19,7 +19,7 @@ theseus = { path = "../../packages/app-lib", features = ["tauri"] }
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.7.1", features = ["app-all", "devtools", "dialog", "dialog-confirm", "dialog-open", "macos-private-api", "os-all", "protocol-asset", "shell-open", "window-close", "window-create", "window-hide", "window-maximize", "window-minimize", "window-set-decorations", "window-show", "window-start-dragging", "window-unmaximize", "window-unminimize"] }
tauri = { version = "1.7.1", features = [ "updater", "app-all", "devtools", "dialog", "dialog-confirm", "dialog-open", "macos-private-api", "os-all", "protocol-asset", "shell-open", "window-close", "window-create", "window-hide", "window-maximize", "window-minimize", "window-set-decorations", "window-show", "window-start-dragging", "window-unmaximize", "window-unminimize"] }
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
tauri-plugin-deep-link = "0.1.2"

View File

@@ -3,7 +3,7 @@
windows_subsystem = "windows"
)]
use tauri::Manager;
use tauri::{Manager, PhysicalSize};
use theseus::prelude::*;
mod api;
@@ -33,6 +33,14 @@ fn show_window(app: tauri::AppHandle) {
let win = app.get_window("main").unwrap();
win.show().unwrap();
win.set_focus().unwrap();
// fix issue where window shows as extremely small
if let Ok(size) = win.inner_size() {
let width = if size.width < 1100 { 1280 } else { size.width };
let height = if size.height < 700 { 800 } else { size.height };
win.set_size(PhysicalSize::new(width, height)).unwrap();
}
}
#[tauri::command]

View File

@@ -0,0 +1,10 @@
{
"tauri": {
"updater": {
"active": true,
"endpoints": ["https://launcher-files.modrinth.com/updates.json"],
"dialog": true,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDIwMzM5QkE0M0FCOERBMzkKUldRNTJyZzZwSnN6SUdPRGdZREtUUGxMblZqeG9OVHYxRUlRTzJBc2U3MUNJaDMvZDQ1UytZZmYK"
}
}
}

View File

@@ -8,7 +8,7 @@
},
"package": {
"productName": "Modrinth App",
"version": "0.8.0"
"version": "0.8.1"
},
"tauri": {
"allowlist": {

View File

@@ -73,9 +73,7 @@
<SparklesIcon class="h-8 w-8 text-purple" />
<span class="text-lg font-bold">Remove all ads</span>
<span class="leading-5 text-secondary">
Never see an advertisement again on
<!--the Modrinth app or-->
the website.
Never see an advertisement again on the Modrinth app or the website.
</span>
</div>
<div class="flex flex-col gap-4 rounded-xl bg-bg-raised p-4">

View File

@@ -34,10 +34,7 @@
<span class="font-bold">Benefits</span>
<div class="flex items-center gap-2">
<CheckCircleIcon class="h-5 w-5 text-brand" />
<span>
Ad-free browsing on modrinth.com
<!--and Modrinth App-->
</span>
<span> Ad-free browsing on modrinth.com and Modrinth App </span>
</div>
<div class="flex items-center gap-2">
<CheckCircleIcon class="h-5 w-5 text-brand" />

View File

@@ -369,6 +369,8 @@ pub struct User {
pub bio: Option<String>,
pub created: DateTime<Utc>,
pub role: String,
#[serde(default)]
pub badges: u32,
}
#[derive(Serialize, Deserialize, Clone, Debug)]

View File

@@ -273,6 +273,7 @@ where
bio: x.user.bio,
created: x.user.created,
role: x.user.role,
badges: 0,
};
cached_entries.push(CacheValue::User(

View File

@@ -72,7 +72,11 @@ impl State {
.await?;
tokio::task::spawn(async move {
let res = state.discord_rpc.clear_to_default(true).await;
let res = tokio::try_join!(
state.discord_rpc.clear_to_default(true),
Profile::refresh_all(),
ModrinthCredentials::refresh_all(),
);
if let Err(e) = res {
tracing::error!("Error running discord RPC: {e}");

View File

@@ -1,4 +1,5 @@
use crate::config::MODRINTH_API_URL;
use crate::state::{CacheBehaviour, CachedEntry};
use crate::util::fetch::{fetch_advanced, FetchSemaphore};
use chrono::{DateTime, Duration, TimeZone, Utc};
use dashmap::DashMap;
@@ -172,6 +173,23 @@ impl ModrinthCredentials {
Ok(())
}
pub(crate) async fn refresh_all() -> crate::Result<()> {
let state = crate::State::get().await?;
let all = Self::get_all(&state.pool).await?;
let user_ids = all.into_iter().map(|x| x.0).collect::<Vec<_>>();
CachedEntry::get_user_many(
&user_ids.iter().map(|x| &**x).collect::<Vec<_>>(),
Some(CacheBehaviour::Bypass),
&state.pool,
&state.fetch_semaphore,
)
.await?;
Ok(())
}
}
#[derive(Serialize, Debug)]

View File

@@ -536,6 +536,93 @@ impl Profile {
Ok(())
}
pub(crate) async fn refresh_all() -> crate::Result<()> {
let state = crate::State::get().await?;
let all = Self::get_all(&state.pool).await?;
let mut keys = vec![];
for profile in &all {
let path =
crate::api::profile::get_full_path(&profile.path).await?;
for project_type in ProjectType::iterator() {
let folder = project_type.get_folder();
let path = path.join(folder);
if path.exists() {
for subdirectory in std::fs::read_dir(&path)
.map_err(|e| io::IOError::with_path(e, &path))?
{
let subdirectory =
subdirectory.map_err(io::IOError::from)?.path();
if subdirectory.is_file() {
if let Some(file_name) = subdirectory
.file_name()
.and_then(|x| x.to_str())
{
let file_size = subdirectory
.metadata()
.map_err(io::IOError::from)?
.len();
keys.push(format!(
"{file_size}-{}/{folder}/{file_name}",
profile.path
));
}
}
}
}
}
}
let file_hashes = CachedEntry::get_file_hash_many(
&keys.iter().map(|s| &**s).collect::<Vec<_>>(),
None,
&state.pool,
&state.fetch_semaphore,
)
.await?;
let file_updates = file_hashes
.iter()
.filter_map(|x| {
all.iter().find(|prof| x.path.contains(&prof.path)).map(
|profile| {
format!(
"{}-{}-{}",
x.hash,
profile.loader.as_str(),
profile.game_version
)
},
)
})
.collect::<Vec<_>>();
let file_hashes_ref =
file_hashes.iter().map(|x| &*x.hash).collect::<Vec<_>>();
let file_updates_ref =
file_updates.iter().map(|x| &**x).collect::<Vec<_>>();
tokio::try_join!(
CachedEntry::get_file_many(
&file_hashes_ref,
Some(CacheBehaviour::MustRevalidate),
&state.pool,
&state.fetch_semaphore,
),
CachedEntry::get_file_update_many(
&file_updates_ref,
Some(CacheBehaviour::MustRevalidate),
&state.pool,
&state.fetch_semaphore,
)
)?;
Ok(())
}
pub async fn get_projects(
&self,
cache_behaviour: Option<CacheBehaviour>,

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 75.75 81.21">
<defs>
<style>
.cls-1 {
fill: #fff;
}
.cls-2 {
fill: #03ddff;
}
.cls-3 {
fill: #0d1129;
}
</style>
</defs>
<path class="cls-1" d="m37.05,81.21c-1.46,0-2.92-.36-4.21-1.03l-29.06-15.15C1.46,63.82.02,61.44.02,58.82L0,22.43c0-2.62,1.44-5,3.76-6.21L32.9,1.03c1.3-.68,2.75-1.03,4.21-1.03s2.92.36,4.21,1.03l30.66,15.98c2.32,1.21,3.76,3.59,3.76,6.2v34.73c.01,2.62-1.43,5-3.75,6.21l-30.73,16.02c-1.29.67-2.75,1.03-4.21,1.03Z"/>
<path class="cls-3" d="m37.05,78.21c-.98,0-1.96-.24-2.82-.69l-29.06-15.15c-1.32-.69-2.15-2.06-2.15-3.55l-.02-36.39c0-1.49.83-2.86,2.15-3.55L34.29,3.69c.87-.45,1.85-.69,2.82-.69s1.96.24,2.82.69l30.65,15.98c1.32.69,2.15,2.06,2.15,3.55v34.73c.01,1.49-.81,2.86-2.14,3.55l-30.73,16.02c-.87.45-1.84.69-2.82.69h0Z"/>
<path class="cls-2" d="m68.76,57.28c0,.37-.21.72-.54.89l-7.94,4.14-6.27-2.35v5.62l-10.48,5.46c-4.06,2.12-8.89,2.12-12.95,0l-23.02-12c-.34-.17-.54-.51-.54-.88l-.02-35.18c0-.37.21-.72.54-.89l23.1-12.04c4.06-2.12,8.89-2.12,12.95,0l10.46,5.45v5.62l6.27-2.35,7.88,4.11c.34.17.54.51.54.88l.02,33.52Z"/>
<path class="cls-3" d="m67.36,24.16v32.77l-6.65,3.47v-14.37c0-.29-.25-.52-.54-.5l-7.24.53c-.26.02-.46.24-.46.5v18.15l-8.47,4.41-2.7,1.41s1.45-2.08,1.63-5.9v-15.16h0s.14-5.68-4.52-8.8c4.66-3.11,4.52-8.79,4.52-8.79h0v-14.62c0-4.31-1.65-6.68-1.65-6.68l1.65.86,1.05.55,8.49,4.42v17.12c0,.26.2.48.46.5l7.24.52c.29.02.54-.21.54-.5v-13.34l6.65,3.46Z"/>
<path class="cls-3" d="m31.89,33.27v-7.96c0-.51-.48-.88-.98-.75l-3.94,1.07-3.06.82-8.63,2.33-2.22.6-.9.24v7.17l.9-.11,2.22-.26,8.63-1,3.06-.36,2.04-.23,1.67-.2c.69-.08,1.21-.67,1.21-1.36Zm-1.26-1.32l-1.62.27-2.04.33-3.06.5-8.63,1.41-2.22.36v-3.68l2.22-.53,8.63-2.08,3.06-.73,2.04-.49,1.62-.39v5.03Z"/>
<polygon class="cls-3" points="23.91 29.98 23.91 31.65 15.28 33.21 15.28 31.88 23.91 29.98"/>
<polygon class="cls-3" points="29.01 28.86 29.01 30.73 26.97 31.09 26.97 29.31 29.01 28.86"/>
<path class="cls-3" d="m30.69,46.97l-1.67-.2-2.04-.23-3.06-.36-8.63-1-2.22-.26-.9-.11v7.17l.9.24,2.22.6,8.63,2.33,3.06.82,3.94,1.07c.49.13.98-.24.98-.75v-7.96c0-.7-.52-1.28-1.21-1.36Zm-.05,7.71l-1.62-.39-2.04-.49-3.06-.73-8.63-2.08-2.22-.53v-3.68l2.22.36,8.63,1.41,3.06.5,2.04.33,1.62.27v5.03Z"/>
<polygon class="cls-3" points="23.92 51.62 23.92 49.95 15.29 48.39 15.29 49.72 23.92 51.62"/>
<polygon class="cls-3" points="29.02 52.74 29.02 50.87 26.98 50.51 26.98 52.29 29.02 52.74"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -13,7 +13,6 @@ import _SSOGoogleIcon from './external/sso/google.svg?component'
import _SSOMicrosoftIcon from './external/sso/microsoft.svg?component'
import _SSOSteamIcon from './external/sso/steam.svg?component'
import _AppleIcon from './external/apple.svg?component'
import _BisectIcon from './external/bh.svg?component'
import _BuyMeACoffeeIcon from './external/bmac.svg?component'
import _DiscordIcon from './external/discord.svg?component'
import _KoFiIcon from './external/kofi.svg?component'
@@ -169,7 +168,6 @@ export const SSOGoogleIcon = _SSOGoogleIcon
export const SSOMicrosoftIcon = _SSOMicrosoftIcon
export const SSOSteamIcon = _SSOSteamIcon
export const AppleIcon = _AppleIcon
export const BisectIcon = _BisectIcon
export const BuyMeACoffeeIcon = _BuyMeACoffeeIcon
export const DiscordIcon = _DiscordIcon
export const KoFiIcon = _KoFiIcon

View File

@@ -18,6 +18,11 @@ html {
--color-tooltip-text: var(--color-base);
--color-tooltip-bg: var(--color-button-bg);
--color-ad: rgba(125, 75, 162, 0.2);
--color-ad-raised: rgba(190, 140, 243, 0.5);
--color-ad-contrast: black;
--color-ad-highlight: var(--color-purple);
}
.light-mode,
@@ -56,11 +61,6 @@ html {
hsla(0, 0%, 0%, 0.1) 0px 4px 6px -1px, hsla(0, 0%, 0%, 0.1) 0px 2px 4px -1px;
--shadow-card: rgba(50, 50, 100, 0.1) 0px 2px 4px 0px;
--color-ad: #d6e6f9;
--color-ad-raised: #b1c8e4;
--color-ad-contrast: var(--color-text);
--color-ad-highlight: #088cdb;
}
.dark-mode,
@@ -97,11 +97,6 @@ html {
hsla(0, 0%, 0%, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;
--shadow-card: rgba(0, 0, 0, 0.25) 0px 2px 4px 0px;
--color-ad: #1f324a;
--color-ad-raised: #2e4057;
--color-ad-contrast: var(--color-text);
--color-ad-highlight: #088cdb;
}
.oled-mode {

View File

@@ -1,18 +1,16 @@
<template>
<div class="GBBNWLJVGRHFLYVGSZKSSKNTHFYXHMBD">
<a
:href="`https://bisecthosting.com/modrinth${queryParam}`"
rel="noopener nofollow sponsored"
:target="target"
></a>
<a href="https://modrinth.com/plus" rel="noopener nofollow sponsored" :target="target"></a>
<div class="GBBNWLJVGRHFLYVGSZKSSKNTHFYXHMBD-0">
<div class="GBBNWLJVGRHFLYVGSZKSSKNTHFYXHMBD-1">
<div class="GBBNWLJVGRHFLYVGSZKSSKNTHFYXHMBD-2">
<BisectIcon class="GBBNWLJVGRHFLYVGSZKSSKNTHFYXHMBD-3" />
<ModrinthPlusIcon class="GBBNWLJVGRHFLYVGSZKSSKNTHFYXHMBD-3" />
<span>
<span> Host your Minecraft server on </span>
<strong>BisectHosting</strong>
<span> - get 25% off your first month with code <strong>MODRINTH</strong>. </span>
<span>
90% of ad revenue goes to creators. Go ad-free while supporting creators with
</span>
<strong>Modrinth Plus.</strong>
<span> Subscribe today!</span>
</span>
</div>
</div>
@@ -25,16 +23,14 @@
<script setup lang="ts">
import { computed } from 'vue'
import { BisectIcon } from '@modrinth/assets'
import { ModrinthPlusIcon } from '@modrinth/assets'
const props = withDefaults(
defineProps<{
external: boolean
queryParam: string
}>(),
{
external: true,
queryParam: '',
},
)