Skip to content

Commit 99ea06e

Browse files
Bump to 0.7.0 + Add sign-in error (#1133)
1 parent 49cecf8 commit 99ea06e

File tree

10 files changed

+282
-170
lines changed

10 files changed

+282
-170
lines changed

Cargo.lock

Lines changed: 161 additions & 159 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

theseus/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "theseus"
3-
version = "0.6.3"
3+
version = "0.7.0"
44
authors = ["Jai A <jaiagr+gpg@pm.me>"]
55
edition = "2018"
66

theseus_gui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "theseus_gui",
33
"private": true,
4-
"version": "0.6.3",
4+
"version": "0.7.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

theseus_gui/src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "theseus_gui"
3-
version = "0.6.3"
3+
version = "0.7.0"
44
description = "A Tauri App"
55
authors = ["you"]
66
license = ""

theseus_gui/src-tauri/src/api/auth.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::api::Result;
22
use chrono::{Duration, Utc};
33
use tauri::plugin::TauriPlugin;
4-
use tauri::Manager;
4+
use tauri::{Manager, UserAttentionType};
55
use theseus::prelude::*;
66

77
pub fn init<R: tauri::Runtime>() -> TauriPlugin<R> {
@@ -41,9 +41,18 @@ pub async fn auth_login(app: tauri::AppHandle) -> Result<Option<Credentials>> {
4141
)?),
4242
)
4343
.title("Sign into Modrinth")
44+
.always_on_top(true)
45+
.center()
4446
.build()?;
4547

48+
window.request_user_attention(Some(UserAttentionType::Critical))?;
49+
4650
while (Utc::now() - start) < Duration::minutes(10) {
51+
if window.title().is_err() {
52+
// user closed window, cancelling flow
53+
return Ok(None);
54+
}
55+
4756
if window
4857
.url()
4958
.as_str()

theseus_gui/src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"package": {
1010
"productName": "Modrinth App",
11-
"version": "0.6.3"
11+
"version": "0.7.0"
1212
},
1313
"tauri": {
1414
"allowlist": {

theseus_gui/src/components/RowDisplay.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { useFetch } from '@/helpers/fetch.js'
3232
import { install as pack_install } from '@/helpers/pack.js'
3333
import { useTheming } from '@/store/state.js'
3434
import { mixpanel_track } from '@/helpers/mixpanel'
35+
import { handleSevereError } from '@/store/error.js'
3536
3637
const router = useRouter()
3738
@@ -129,7 +130,7 @@ const handleProjectClick = (event, passedInstance) => {
129130
const handleOptionsClick = async (args) => {
130131
switch (args.option) {
131132
case 'play':
132-
await run(args.item.path).catch(handleError)
133+
await run(args.item.path).catch(handleSevereError)
133134
mixpanel_track('InstanceStart', {
134135
loader: args.item.metadata.loader,
135136
game_version: args.item.metadata.game_version,

theseus_gui/src/components/ui/ErrorModal.vue

Lines changed: 101 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<script setup>
2-
import { Modal, XIcon } from 'omorphia'
2+
import { Modal, XIcon, IssuesIcon, LogInIcon } from 'omorphia'
33
import { ChatIcon } from '@/assets/icons'
44
import { ref } from 'vue'
5+
import { login as login_flow, set_default_user } from '@/helpers/auth.js'
6+
import { handleError } from '@/store/notifications.js'
7+
import mixpanel from 'mixpanel-browser'
8+
import { handleSevereError } from '@/store/error.js'
59
610
const errorModal = ref()
711
const error = ref()
@@ -25,6 +29,10 @@ defineExpose({
2529
if (errorVal.message.includes('because the target machine actively refused it')) {
2630
metadata.value.hostsFile = true
2731
}
32+
} else if (errorVal.message && errorVal.message.includes('User is not logged in')) {
33+
title.value = 'Sign in to Minecraft'
34+
errorType.value = 'minecraft_sign_in'
35+
supportLink.value = 'https://support.modrinth.com'
2836
} else {
2937
title.value = 'An error occurred'
3038
errorType.value = 'unknown'
@@ -36,6 +44,25 @@ defineExpose({
3644
errorModal.value.show()
3745
},
3846
})
47+
48+
const loadingMinecraft = ref(false)
49+
async function loginMinecraft() {
50+
try {
51+
loadingMinecraft.value = true
52+
const loggedIn = await login_flow()
53+
54+
if (loggedIn) {
55+
await set_default_user(loggedIn.id).catch(handleError)
56+
}
57+
58+
await mixpanel.track('AccountLogIn')
59+
loadingMinecraft.value = false
60+
errorModal.value.hide()
61+
} catch (err) {
62+
loadingMinecraft.value = false
63+
handleSevereError(err)
64+
}
65+
}
3966
</script>
4067

4168
<template>
@@ -90,7 +117,11 @@ defineExpose({
90117
Once you're done, come back here and sign in!
91118
</p>
92119
</template>
93-
120+
<div class="cta-button">
121+
<button class="btn btn-primary" :disabled="loadingMinecraft" @click="loginMinecraft">
122+
<LogInIcon /> Sign in to Minecraft
123+
</button>
124+
</div>
94125
<hr />
95126
<p>
96127
If nothing is working and you need help, visit
@@ -103,19 +134,86 @@ defineExpose({
103134
{{ error.message ?? error }}
104135
</details>
105136
</template>
137+
<div v-else-if="errorType === 'minecraft_sign_in'">
138+
<div class="warning-banner">
139+
<div class="warning-banner__title">
140+
<IssuesIcon />
141+
<span>Installed the app before April 23rd, 2024?</span>
142+
</div>
143+
<div class="warning-banner__description">
144+
Modrinth has updated our sign-in workflow to allow for better stability, security, and
145+
performance. You must sign in again so your credentials can be upgraded to this new
146+
flow.
147+
</div>
148+
</div>
149+
<p>
150+
To play this instance, you must sign in through Microsoft below. If you don't have a
151+
Minecraft account, you can purchase the game on the
152+
<a href="https://www.minecraft.net/en-us/store/minecraft-java-bedrock-edition-pc"
153+
>Minecraft website</a
154+
>.
155+
</p>
156+
<div class="cta-button">
157+
<button class="btn btn-primary" :disabled="loadingMinecraft" @click="loginMinecraft">
158+
<LogInIcon /> Sign in to Minecraft
159+
</button>
160+
</div>
161+
</div>
106162
<template v-else>
107163
{{ error.message ?? error }}
108164
</template>
109165
</div>
110166
<div class="input-group push-right">
111167
<a :href="supportLink" class="btn" @click="errorModal.hide()"><ChatIcon /> Get support</a>
112-
<button class="btn btn-primary" @click="errorModal.hide()"><XIcon /> Close</button>
168+
<button class="btn" @click="errorModal.hide()"><XIcon /> Close</button>
113169
</div>
114170
</div>
115171
</Modal>
116172
</template>
117173

174+
<style>
175+
.light-mode {
176+
--color-orange-bg: rgba(255, 163, 71, 0.2);
177+
}
178+
179+
.dark-mode,
180+
.oled-mode {
181+
--color-orange-bg: rgba(224, 131, 37, 0.2);
182+
}
183+
</style>
184+
118185
<style scoped lang="scss">
186+
.cta-button {
187+
display: flex;
188+
align-items: center;
189+
justify-content: center;
190+
padding: 0.5rem;
191+
}
192+
193+
.warning-banner {
194+
display: flex;
195+
flex-direction: column;
196+
gap: 0.5rem;
197+
padding: var(--gap-lg);
198+
background-color: var(--color-orange-bg);
199+
border: 2px solid var(--color-orange);
200+
border-radius: var(--radius-md);
201+
margin-bottom: 1rem;
202+
}
203+
204+
.warning-banner__title {
205+
display: flex;
206+
align-items: center;
207+
gap: 0.5rem;
208+
font-weight: 700;
209+
210+
svg {
211+
color: var(--color-orange);
212+
height: 1.5rem;
213+
width: 1.5rem;
214+
}
215+
}
216+
119217
.modal-body {
120218
display: flex;
121219
flex-direction: column;

theseus_gui/src/components/ui/Instance.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { handleError } from '@/store/state.js'
1717
import { showProfileInFolder } from '@/helpers/utils.js'
1818
import ModInstallModal from '@/components/ui/ModInstallModal.vue'
1919
import { mixpanel_track } from '@/helpers/mixpanel'
20+
import { handleSevereError } from '@/store/error.js'
2021
2122
const props = defineProps({
2223
instance: {
@@ -121,7 +122,7 @@ const install = async (e) => {
121122
const play = async (e, context) => {
122123
e?.stopPropagation()
123124
modLoading.value = true
124-
uuid.value = await run(props.instance.path).catch(handleError)
125+
uuid.value = await run(props.instance.path).catch(handleSevereError)
125126
modLoading.value = false
126127
playing.value = true
127128

theseus_gui/src/pages/instance/Index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ import ContextMenu from '@/components/ui/ContextMenu.vue'
153153
import { mixpanel_track } from '@/helpers/mixpanel'
154154
import { convertFileSrc } from '@tauri-apps/api/tauri'
155155
import { useFetch } from '@/helpers/fetch'
156+
import { handleSevereError } from '@/store/error.js'
156157
157158
const route = useRoute()
158159
@@ -185,7 +186,7 @@ const options = ref(null)
185186
186187
const startInstance = async (context) => {
187188
loading.value = true
188-
uuid.value = await run(route.params.id).catch(handleError)
189+
uuid.value = await run(route.params.id).catch(handleSevereError)
189190
loading.value = false
190191
playing.value = true
191192

0 commit comments

Comments
 (0)