Compare commits

...

5 Commits

Author SHA1 Message Date
Jai A
c1518c52f3 fix avatar merge 2023-11-21 10:16:36 -07:00
ToBinio
531b38e562 display App version in settings (#801)
Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
2023-11-21 08:38:22 -07:00
chaos
fd299aabe8 Check for write access before change. (#890)
* Check for write access before change. Closes #862

* Formatting.
2023-11-21 08:37:05 -07:00
chaos
4b1a3eb41e Add missing noblur value to modals. Closes #713 (#891) 2023-11-21 08:35:57 -07:00
chaos
a5739fa7e2 Bump version + revert to mc-heads.net (#895) 2023-11-21 08:35:32 -07:00
13 changed files with 83 additions and 24 deletions

6
Cargo.lock generated
View File

@@ -4685,7 +4685,7 @@ dependencies = [
[[package]]
name = "theseus"
version = "0.6.1"
version = "0.6.2"
dependencies = [
"async-recursion",
"async-tungstenite",
@@ -4733,7 +4733,7 @@ dependencies = [
[[package]]
name = "theseus_cli"
version = "0.6.1"
version = "0.6.2"
dependencies = [
"argh",
"color-eyre",
@@ -4760,7 +4760,7 @@ dependencies = [
[[package]]
name = "theseus_gui"
version = "0.6.1"
version = "0.6.2"
dependencies = [
"chrono",
"cocoa",

View File

@@ -1,6 +1,6 @@
[package]
name = "theseus"
version = "0.6.1"
version = "0.6.2"
authors = ["Jai A <jaiagr+gpg@pm.me>"]
edition = "2018"

View File

@@ -1,6 +1,7 @@
//! Theseus profile management interface
use std::path::PathBuf;
use tokio::fs;
use io::IOError;
use tokio::sync::RwLock;
@@ -188,3 +189,17 @@ pub async fn set_config_dir(new_config_dir: PathBuf) -> crate::Result<()> {
Ok(())
}
pub async fn is_dir_writeable(new_config_dir: PathBuf) -> crate::Result<bool> {
let temp_path = new_config_dir.join(".tmp");
match fs::write(temp_path.clone(), "test").await {
Ok(_) => {
fs::remove_file(temp_path).await?;
Ok(true)
}
Err(e) => {
tracing::error!("Error writing to new config dir: {}", e);
Ok(false)
}
}
}

View File

@@ -1,6 +1,6 @@
[package]
name = "theseus_cli"
version = "0.6.1"
version = "0.6.2"
authors = ["Jai A <jaiagr+gpg@pm.me>"]
edition = "2018"

View File

@@ -1,7 +1,7 @@
{
"name": "theseus_gui",
"private": true,
"version": "0.6.1",
"version": "0.6.2",
"type": "module",
"scripts": {
"dev": "vite",

View File

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

View File

@@ -8,7 +8,8 @@ pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
.invoke_handler(tauri::generate_handler![
settings_get,
settings_set,
settings_change_config_dir
settings_change_config_dir,
settings_is_dir_writeable
])
.build()
}
@@ -37,3 +38,11 @@ pub async fn settings_change_config_dir(new_config_dir: PathBuf) -> Result<()> {
settings::set_config_dir(new_config_dir).await?;
Ok(())
}
#[tauri::command]
pub async fn settings_is_dir_writeable(
new_config_dir: PathBuf,
) -> Result<bool> {
let res = settings::is_dir_writeable(new_config_dir).await?;
Ok(res)
}

View File

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

View File

@@ -11,7 +11,7 @@
:size="mode === 'expanded' ? 'xs' : 'sm'"
:src="
selectedAccount
? `https://crafatar.com/avatars/${selectedAccount.id}?size=128&overlay`
? `https://mc-heads.net/avatar/${selectedAccount.id}/128`
: 'https://launcher-files.modrinth.com/assets/steve_head.png'
"
/>
@@ -24,10 +24,7 @@
:class="{ expanded: mode === 'expanded', isolated: mode === 'isolated' }"
>
<div v-if="selectedAccount" class="selected account">
<Avatar
size="xs"
:src="`https://crafatar.com/avatars/${selectedAccount.id}?size=128&overlay`"
/>
<Avatar size="xs" :src="`https://mc-heads.net/avatar/${selectedAccount.id}/128`" />
<div>
<h4>{{ selectedAccount.username }}</h4>
<p>Selected</p>
@@ -45,10 +42,7 @@
<div v-if="displayAccounts.length > 0" class="account-group">
<div v-for="account in displayAccounts" :key="account.id" class="account-row">
<Button class="option account" @click="setAccount(account)">
<Avatar
:src="`https://crafatar.com/avatars/${selectedAccount.id}?size=128&overlay`"
class="icon"
/>
<Avatar :src="`https://mc-heads.net/avatar/${selectedAccount.id}/128`" class="icon" />
<p>{{ account.username }}</p>
</Button>
<Button v-tooltip="'Log out'" icon-only @click="logout(account.id)">
@@ -62,7 +56,7 @@
</Button>
</Card>
</transition>
<Modal ref="loginModal" class="modal" header="Signing in">
<Modal ref="loginModal" class="modal" header="Signing in" :noblur="!themeStore.advancedRendering">
<div class="modal-body">
<QrcodeVue :value="loginUrl" class="qr-code" margin="3" size="160" />
<div class="modal-text">
@@ -120,6 +114,7 @@ import {
} from '@/helpers/auth'
import { get, set } from '@/helpers/settings'
import { handleError } from '@/store/state.js'
import { useTheming } from '@/store/theme.js'
import { mixpanel_track } from '@/helpers/mixpanel'
import QrcodeVue from 'qrcode.vue'
import { process_listener } from '@/helpers/events'
@@ -136,6 +131,7 @@ const emit = defineEmits(['change'])
const loginCode = ref(null)
const themeStore = useTheming()
const settings = ref({})
const accounts = ref([])
const loginUrl = ref('')

View File

@@ -292,9 +292,11 @@ const exportPack = async () => {
.textarea-wrapper {
// margin-top: 1rem;
height: 12rem;
textarea {
max-height: 12rem;
}
.preview {
overflow-y: auto;
}

View File

@@ -2,11 +2,13 @@
import { Button, LogInIcon, Modal, ClipboardCopyIcon, GlobeIcon, Card } from 'omorphia'
import { authenticate_await_completion, authenticate_begin_flow } from '@/helpers/auth.js'
import { handleError } from '@/store/notifications.js'
import { useTheming } from '@/store/theme.js'
import mixpanel from 'mixpanel-browser'
import { get, set } from '@/helpers/settings.js'
import { ref } from 'vue'
import QrcodeVue from 'qrcode.vue'
const themeStore = useTheming()
const loginUrl = ref(null)
const loginModal = ref()
const loginCode = ref(null)
@@ -94,7 +96,7 @@ const clipboardWrite = async (a) => {
</div>
</Card>
</div>
<Modal ref="loginModal" header="Signing in">
<Modal ref="loginModal" header="Signing in" :noblur="!themeStore.advancedRendering">
<div class="modal-body">
<QrcodeVue :value="loginUrl" class="qr-code" margin="3" size="160" />
<div class="modal-text">

View File

@@ -43,3 +43,7 @@ export async function set(settings) {
export async function change_config_dir(newConfigDir) {
return await invoke('plugin:settings|settings_change_config_dir', { newConfigDir })
}
export async function is_dir_writeable(newConfigDir) {
return await invoke('plugin:settings|settings_is_dir_writeable', { newConfigDir })
}

View File

@@ -14,7 +14,7 @@ import {
UpdatedIcon,
} from 'omorphia'
import { handleError, useTheming } from '@/store/state'
import { change_config_dir, get, set } from '@/helpers/settings'
import { is_dir_writeable, change_config_dir, get, set } from '@/helpers/settings'
import { get_max_memory } from '@/helpers/jre'
import { get as getCreds, logout } from '@/helpers/mr_auth.js'
import JavaSelector from '@/components/ui/JavaSelector.vue'
@@ -22,6 +22,7 @@ import ModrinthLoginScreen from '@/components/ui/tutorial/ModrinthLoginScreen.vu
import { mixpanel_opt_out_tracking, mixpanel_opt_in_tracking } from '@/helpers/mixpanel'
import { open } from '@tauri-apps/api/dialog'
import { getOS } from '@/helpers/utils.js'
import { version } from '../../package.json'
const pageOptions = ['Home', 'Library']
@@ -39,6 +40,8 @@ const accessSettings = async () => {
return settings
}
// const launcherVersion = await get_launcher_version().catch(handleError)
const fetchSettings = await accessSettings().catch(handleError)
const settings = ref(fetchSettings)
@@ -116,7 +119,18 @@ async function signInAfter() {
}
async function findLauncherDir() {
const newDir = await open({ multiple: false, directory: true })
const newDir = await open({
multiple: false,
directory: true,
title: 'Select a new app directory',
})
const writeable = await is_dir_writeable(newDir)
if (!writeable) {
handleError('The selected directory does not have proper permissions for write access.')
return
}
if (newDir) {
settingsDir.value = newDir
@@ -154,9 +168,13 @@ async function refreshDir() {
</span>
<span v-else> Sign in to your Modrinth account. </span>
</label>
<button v-if="credentials" class="btn" @click="logOut"><LogOutIcon /> Sign out</button>
<button v-if="credentials" class="btn" @click="logOut">
<LogOutIcon />
Sign out
</button>
<button v-else class="btn" @click="$refs.loginScreenModal.show()">
<LogInIcon /> Sign in
<LogInIcon />
Sign in
</button>
</div>
<label for="theme">
@@ -517,6 +535,19 @@ async function refreshDir() {
/>
</div>
</Card>
<Card>
<div class="label">
<h3>
<span class="label__title size-card-header">About</span>
</h3>
</div>
<div>
<label>
<span class="label__title">App version</span>
<span class="label__description">Theseus v{{ version }} </span>
</label>
</div>
</Card>
</div>
</template>