refactored install dialog

This commit is contained in:
2025-10-07 00:41:21 +02:00
parent 225835e5d1
commit c8c3a5c73f
44 changed files with 1426 additions and 730 deletions

View File

@ -4,6 +4,7 @@ import type {
IHaexHubExtension,
IHaexHubExtensionManifest,
} from '~/types/haexhub'
import type { ExtensionPreview } from '@bindings/ExtensionPreview'
interface ExtensionInfoResponse {
key_hash: string
@ -302,6 +303,14 @@ export const useExtensionsStore = defineStore('extensionsStore', () => {
return true
}
const preview = ref<ExtensionPreview>()
const previewManifestAsync = async (extensionPath: string) => {
preview.value = await invoke<ExtensionPreview>('preview_extension', {
extensionPath,
})
return preview.value
}
/* const readManifestFileAsync = async (
extensionId: string,
version: string,
@ -377,6 +386,7 @@ export const useExtensionsStore = defineStore('extensionsStore', () => {
isActive,
isExtensionInstalledAsync,
loadExtensionsAsync,
previewManifestAsync,
removeExtensionAsync,
}
})

View File

@ -2,7 +2,7 @@ import { and, eq, or, type SQLWrapper } from 'drizzle-orm'
import {
haexNotifications,
type InsertHaexNotifications,
} from '~~/src-tauri/database/schemas/vault'
} from '~~/src-tauri/database/schemas/haex'
import {
isPermissionGranted,
requestPermission,
@ -42,19 +42,18 @@ export const useNotificationStore = defineStore('notificationStore', () => {
console.log('readNotificationsAsync', filter)
if (filter) {
return await currentVault.value.drizzle
return await currentVault.value?.drizzle
.select()
.from(haexNotifications)
.where(and(...filter))
} else {
return await currentVault.value.drizzle.select().from(haexNotifications)
return await currentVault.value?.drizzle.select().from(haexNotifications)
}
}
const syncNotificationsAsync = async () => {
notifications.value = await readNotificationsAsync([
eq(haexNotifications.read, false),
])
notifications.value =
(await readNotificationsAsync([eq(haexNotifications.read, false)])) ?? []
}
const addNotificationAsync = async (
@ -75,7 +74,7 @@ export const useNotificationStore = defineStore('notificationStore', () => {
type: notification.type || 'info',
}
await currentVault.value.drizzle
await currentVault.value?.drizzle
.insert(haexNotifications)
.values(_notification)
@ -102,7 +101,7 @@ export const useNotificationStore = defineStore('notificationStore', () => {
const filter = notificationIds.map((id) => eq(haexNotifications.id, id))
console.log('deleteNotificationsAsync', notificationIds)
return currentVault.value.drizzle
return currentVault.value?.drizzle
.delete(haexNotifications)
.where(or(...filter))
}