You've already forked AstralRinth
forked from didirus/AstralRinth
@@ -543,23 +543,6 @@ pub async fn remove_project(
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets whether project is a managed modrinth pack
|
||||
#[tracing::instrument]
|
||||
pub async fn is_managed_modrinth_pack(
|
||||
profile: &ProfilePathId,
|
||||
) -> crate::Result<bool> {
|
||||
if let Some(profile) = get(profile, None).await? {
|
||||
if let Some(linked_data) = profile.metadata.linked_data {
|
||||
return Ok(linked_data.project_id.is_some()
|
||||
&& linked_data.version_id.is_some());
|
||||
}
|
||||
Ok(false)
|
||||
} else {
|
||||
Err(crate::ErrorKind::UnmanagedProfileError(profile.to_string())
|
||||
.as_error())
|
||||
}
|
||||
}
|
||||
|
||||
/// Exports the profile to a Modrinth-formatted .mrpack file
|
||||
// Version ID of uploaded version (ie 1.1.5), not the unique identifying ID of the version (nvrqJg44)
|
||||
#[tracing::instrument(skip_all)]
|
||||
|
||||
@@ -24,7 +24,6 @@ pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
|
||||
profile_remove_project,
|
||||
profile_update_managed_modrinth,
|
||||
profile_repair_managed_modrinth,
|
||||
profile_is_managed_modrinth,
|
||||
profile_run,
|
||||
profile_run_wait,
|
||||
profile_run_credentials,
|
||||
@@ -190,12 +189,6 @@ pub async fn profile_repair_managed_modrinth(
|
||||
Ok(profile::update::repair_managed_modrinth(&path).await?)
|
||||
}
|
||||
|
||||
// Gets if a profile is managed by Modrinth
|
||||
#[tauri::command]
|
||||
pub async fn profile_is_managed_modrinth(path: ProfilePathId) -> Result<bool> {
|
||||
Ok(profile::is_managed_modrinth_pack(&path).await?)
|
||||
}
|
||||
|
||||
// Exports a profile to a .mrpack file (export_location should end in .mrpack)
|
||||
// invoke('profile_export_mrpack')
|
||||
#[tauri::command]
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
}
|
||||
},
|
||||
"security": {
|
||||
"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"
|
||||
"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 'self'; frame-src https://*.cloudflare.com 'self'; style-src unsafe-inline 'self'"
|
||||
},
|
||||
"updater": {
|
||||
"active": true,
|
||||
|
||||
@@ -110,11 +110,6 @@ export async function update_repair_modrinth(path) {
|
||||
return await invoke('plugin:profile|profile_repair_managed_modrinth', { path })
|
||||
}
|
||||
|
||||
// Gets whether a profile is managed by Modrinth
|
||||
export async function is_managed_modrinth(path) {
|
||||
return await invoke('plugin:profile|profile_is_managed_modrinth', { path })
|
||||
}
|
||||
|
||||
// Export a profile to .mrpack
|
||||
/// included_overrides is an array of paths to override folders to include (ie: 'mods', 'resource_packs')
|
||||
// Version id is optional (ie: 1.1.5)
|
||||
|
||||
@@ -247,7 +247,7 @@ async function refreshSearch() {
|
||||
}
|
||||
}
|
||||
if (instanceContext.value) {
|
||||
for (let val of results.value) {
|
||||
for (let val of results.value.hits) {
|
||||
val.installed = await check_installed(instanceContext.value.path, val.project_id).then(
|
||||
(x) => (val.installed = x)
|
||||
)
|
||||
|
||||
@@ -10,9 +10,14 @@
|
||||
v-model="selectedProjectType"
|
||||
:items="Object.keys(selectableProjectTypes)"
|
||||
/>
|
||||
<Button v-if="canUpdatePack" color="secondary" @click="updateModpack">
|
||||
<Button
|
||||
v-if="canUpdatePack"
|
||||
:disabled="updatingModpack"
|
||||
color="secondary"
|
||||
@click="updateModpack"
|
||||
>
|
||||
<UpdatedIcon />
|
||||
Update modpack
|
||||
{{ updatingModpack ? 'Updating' : 'Update modpack' }}
|
||||
</Button>
|
||||
</div>
|
||||
<div class="card-row">
|
||||
@@ -362,7 +367,6 @@ import { useRouter } from 'vue-router'
|
||||
import {
|
||||
add_project_from_path,
|
||||
get,
|
||||
is_managed_modrinth,
|
||||
remove_project,
|
||||
toggle_disable_project,
|
||||
update_all,
|
||||
@@ -403,8 +407,14 @@ const props = defineProps({
|
||||
const projects = ref([])
|
||||
const selectionMap = ref(new Map())
|
||||
const showingOptions = ref(false)
|
||||
const canUpdatePack = ref(await is_managed_modrinth(props.instance.path))
|
||||
const canUpdatePack = computed(() => {
|
||||
return (
|
||||
props.instance.metadata.linked_data &&
|
||||
props.instance.metadata.linked_data.version_id !== props.instance.modrinth_update_version
|
||||
)
|
||||
})
|
||||
|
||||
console.log(props.instance)
|
||||
const initProjects = (initInstance) => {
|
||||
projects.value = []
|
||||
if (!initInstance || !initInstance.projects) return
|
||||
@@ -800,8 +810,11 @@ const handleContentOptionClick = async (args) => {
|
||||
}
|
||||
}
|
||||
|
||||
const updatingModpack = ref(false)
|
||||
const updateModpack = async () => {
|
||||
updatingModpack.value = true
|
||||
await update_managed_modrinth(props.instance.path).catch(handleError)
|
||||
updatingModpack.value = false
|
||||
}
|
||||
|
||||
watch(selectAll, () => {
|
||||
|
||||
@@ -508,7 +508,7 @@ watch(
|
||||
async () => {
|
||||
const editProfile = {
|
||||
metadata: {
|
||||
name: title.value.trim().substring(0, 16) ?? 'Instance',
|
||||
name: title.value.trim().substring(0, 32) ?? 'Instance',
|
||||
groups: groups.value.map((x) => x.trim().substring(0, 32)).filter((x) => x.length > 0),
|
||||
loader_version: props.instance.metadata.loader_version,
|
||||
linked_data: props.instance.metadata.linked_data,
|
||||
|
||||
Reference in New Issue
Block a user