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

@@ -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: '',
},
)