Discord and playtime (#462)

* initial

* Fixed java thing

* fixes

* internet check change

* some fix/test commit

* Fix render issues on windows

* bump version

---------

Co-authored-by: Jai A <jaiagr+gpg@pm.me>
Co-authored-by: Jai A <jai@modrinth.com>
This commit is contained in:
Wyatt Verchere
2023-08-05 16:41:08 -07:00
committed by GitHub
parent 5ee64f2705
commit d968ad383c
24 changed files with 277 additions and 89 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "theseus_gui",
"private": true,
"version": "0.4.0",
"version": "0.5.0",
"type": "module",
"scripts": {
"dev": "vite",
@@ -18,7 +18,7 @@
"floating-vue": "^2.0.0-beta.20",
"mixpanel-browser": "^2.47.0",
"ofetch": "^1.0.1",
"omorphia": "^0.4.34",
"omorphia": "^0.4.35",
"pinia": "^2.1.3",
"qrcode.vue": "^3.4.0",
"tauri-plugin-window-state-api": "github:tauri-apps/tauri-plugin-window-state#v1",

View File

@@ -21,8 +21,8 @@ dependencies:
specifier: ^1.0.1
version: 1.0.1
omorphia:
specifier: ^0.4.34
version: 0.4.34
specifier: ^0.4.35
version: 0.4.35
pinia:
specifier: ^2.1.3
version: 2.1.3(vue@3.3.4)
@@ -1348,8 +1348,8 @@ packages:
ufo: 1.1.2
dev: false
/omorphia@0.4.34:
resolution: {integrity: sha512-6uAH1kgzbYYmJDM41Vy4/MhzT9kRj+s1t8IknHKeOQqmVft+wPtv/pbA7pqTMfCzBOarLKKO5s4sNlz8TeMmaQ==}
/omorphia@0.4.35:
resolution: {integrity: sha512-ZxA6sJKWZbiG49l/gTG25cxAvTcIfVSLhuIV2e+LSY0nwkZO4EFvxhzGNz0exR3lVs+OdDCdJyb1U2QYMVbVrA==}
dependencies:
dayjs: 1.11.7
floating-vue: 2.0.0-beta.20(vue@3.3.4)

View File

@@ -1,6 +1,6 @@
[package]
name = "theseus_gui"
version = "0.4.0"
version = "0.5.0"
description = "A Tauri App"
authors = ["you"]
license = ""

View File

@@ -8,7 +8,7 @@
},
"package": {
"productName": "Modrinth App",
"version": "0.4.0"
"version": "0.5.0"
},
"tauri": {
"allowlist": {
@@ -83,7 +83,7 @@
}
},
"security": {
"csp": "default-src 'self'; connect-src https://modrinth.com https://*.modrinth.com https://mixpanel.com https://*.mixpanel.com; font-src https://cdn-raw.modrinth.com/fonts/inter/; img-src tauri: https: data: blob: 'unsafe-inline' asset: https://asset.localhost"
"csp": "default-src 'self'; connect-src https://modrinth.com https://*.modrinth.com https://mixpanel.com https://*.mixpanel.com https://*.cloudflare.com; font-src https://cdn-raw.modrinth.com/fonts/inter/; img-src tauri: https: data: blob: 'unsafe-inline' asset: https://asset.localhost; script-src https://*.cloudflare.com; frame-src https://*.cloudflare.com; style-src unsafe-inline"
},
"updater": {
"active": true,
@@ -96,11 +96,11 @@
"titleBarStyle": "Overlay",
"hiddenTitle": true,
"fullscreen": false,
"height": 650,
"height": 800,
"resizable": true,
"title": "Modrinth App",
"width": 1280,
"minHeight": 630,
"minHeight": 700,
"minWidth": 1100,
"visible": false,
"decorations": false

View File

@@ -5,11 +5,11 @@
"titleBarStyle": "Overlay",
"hiddenTitle": true,
"fullscreen": false,
"height": 650,
"height": 800,
"resizable": true,
"title": "Modrinth App",
"width": 1280,
"minHeight": 630,
"minHeight": 700,
"minWidth": 1100,
"visible": false,
"decorations": true

View File

@@ -1,6 +1,5 @@
<svg
data-v-8c2610d6=""
xmlns="http://www.w3.org/2000/svg"
xml:space="preserve"
viewBox="0 0 100 100"
style="fill-rule: evenodd; clip-rule: evenodd; stroke-linejoin: round; stroke-miterlimit: 2;"><circle cx="50" cy="50" r="50" style="fill:#fff;"

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -211,7 +211,7 @@ onMounted(() => {
<div class="link-row">
<a v-if="loggingIn" class="button-base" @click="loggingIn = false"> Create account </a>
<a v-else class="button-base" @click="loggingIn = true">Sign in</a>
<a class="button-base" href="https://staging.modrinth.com/auth/reset-password">
<a class="button-base" href="https://modrinth.com/auth/reset-password">
Forgot password?
</a>
</div>

View File

@@ -83,15 +83,18 @@ const finishOnboarding = async () => {
async function fetchSettings() {
const fetchSettings = await get().catch(handleError)
if (!fetchSettings.java_globals) {
fetchSettings.java_globals = {}
}
if (!fetchSettings.java_globals.JAVA_17) {
const path = await auto_install_java(17).catch(handleError)
fetchSettings.java_globals.JAVA_17 = await get_jre(path).catch(handleError)
const path1 = await auto_install_java(17).catch(handleError)
fetchSettings.java_globals.JAVA_17 = await get_jre(path1).catch(handleError)
}
if (!fetchSettings.java_globals.JAVA_8) {
const path = await auto_install_java(8).catch(handleError)
fetchSettings.java_globals.JAVA_8 = await get_jre(path).catch(handleError)
const path2 = await auto_install_java(8).catch(handleError)
fetchSettings.java_globals.JAVA_8 = await get_jre(path2).catch(handleError)
}
await set(fetchSettings).catch(handleError)

View File

@@ -2,7 +2,7 @@ import { ofetch } from 'ofetch'
import { handleError } from '@/store/state.js'
import { getVersion } from '@tauri-apps/api/app'
export const useFetch = async (url, item) => {
export const useFetch = async (url, item, isSilent) => {
try {
const version = await getVersion()
@@ -10,7 +10,9 @@ export const useFetch = async (url, item) => {
headers: { 'User-Agent': `modrinth/theseus/${version} (support@modrinth.com)` },
})
} catch (err) {
handleError({ message: `Error fetching ${item}` })
if (!isSilent) {
handleError({ message: `Error fetching ${item}` })
}
console.error(err)
}
}

View File

@@ -237,15 +237,22 @@ async function refreshSearch() {
let val = `${base}${url}`
const rawResults = await useFetch(val, 'search results')
const rawResults = await useFetch(val, 'search results', offline.value)
results.value = rawResults
if (!rawResults) {
results.value = {
hits: [],
total_hits: 0,
limit: 1,
}
}
if (instanceContext.value) {
for (let val of rawResults.hits) {
for (let val of results.value) {
val.installed = await check_installed(instanceContext.value.path, val.project_id).then(
(x) => (val.installed = x)
)
}
}
results.value = rawResults
}
async function onSearchChange(newPageNumber) {
@@ -510,7 +517,7 @@ onUnmounted(() => unlistenOffline())
</script>
<template>
<div v-if="!offline" ref="searchWrapper" class="search-container">
<div ref="searchWrapper" class="search-container">
<aside class="filter-panel">
<Card v-if="instanceContext" class="small-instance">
<router-link :to="`/instance/${encodeURIComponent(instanceContext.path)}`" class="instance">
@@ -704,7 +711,10 @@ onUnmounted(() => unlistenOffline())
class="pagination-before"
@switch-page="onSearchChange"
/>
<SplashScreen v-if="loading || offline" />
<SplashScreen v-if="loading" />
<section v-else-if="offline && results.total_hits == 0" class="offline">
You are currently offline. Connect to the internet to browse Modrinth!
</section>
<section v-else class="project-list display-mode--list instance-results" role="list">
<SearchCard
v-for="result in results.hits"
@@ -890,6 +900,11 @@ onUnmounted(() => unlistenOffline())
margin: 0 1rem 0.5rem 20.5rem;
width: calc(100% - 20.5rem);
.offline {
margin: 1rem;
text-align: center;
}
.loading {
margin: 2rem;
text-align: center;

View File

@@ -41,23 +41,31 @@ const getInstances = async () => {
const getFeaturedModpacks = async () => {
const response = await useFetch(
`https://api.modrinth.com/v2/search?facets=[["project_type:modpack"]]&limit=10&index=follows&filters=${filter.value}`,
'featured modpacks'
'featured modpacks',
offline.value
)
if (response) featuredModpacks.value = response.hits
if (response) {
featuredModpacks.value = response.hits
} else {
featuredModpacks.value = []
}
}
const getFeaturedMods = async () => {
const response = await useFetch(
'https://api.modrinth.com/v2/search?facets=[["project_type:mod"]]&limit=10&index=follows',
'featured mods'
'featured mods',
offline.value
)
if (response) featuredMods.value = response.hits
if (response) {
featuredMods.value = response.hits
} else {
featuredModpacks.value = []
}
}
await getInstances()
if (!offline.value) {
await Promise.all([getFeaturedModpacks(), getFeaturedMods()])
}
await Promise.all([getFeaturedModpacks(), getFeaturedMods()])
const unlistenProfile = await profile_listener(async (e) => {
await getInstances()