cleanup
This commit is contained in:
+4
-4
@@ -1,5 +1,5 @@
|
||||
import { Menu, MenuItem, PredefinedMenuItem, Submenu } from '@tauri-apps/api/menu'
|
||||
import { ask, confirm, message, open } from '@tauri-apps/plugin-dialog'
|
||||
import { ask, message, open } from '@tauri-apps/plugin-dialog'
|
||||
import { isPermissionGranted, requestPermission } from '@tauri-apps/plugin-notification'
|
||||
import { sendNotification } from '@tauri-apps/plugin-notification'
|
||||
import { revealItemInDir } from '@tauri-apps/plugin-opener'
|
||||
@@ -55,7 +55,7 @@ export async function buildMenu() {
|
||||
delete storeState.mountedRemotes[remote]
|
||||
await rebuildTrayMenu()
|
||||
await message(`Successfully unmounted ${remote} from ${mountPoint}`, {
|
||||
title: 'Unmount Success',
|
||||
title: 'Success',
|
||||
})
|
||||
} catch (err) {
|
||||
console.error('Unmount operation failed:', err)
|
||||
@@ -227,12 +227,12 @@ export async function buildMenu() {
|
||||
id: `remove-${remote}`,
|
||||
text: 'Remove',
|
||||
action: async () => {
|
||||
const confirmation = await confirm(
|
||||
const answer = await ask(
|
||||
`Are you sure you want to remove ${remote}? This action cannot be reverted.`,
|
||||
{ title: `Removing ${remote}`, kind: 'warning' }
|
||||
)
|
||||
|
||||
if (!confirmation) {
|
||||
if (!answer) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ export async function getRemote(remote: string) {
|
||||
// throw e;
|
||||
// });
|
||||
|
||||
console.log(JSON.stringify(r, null, 2))
|
||||
// console.log(JSON.stringify(r, null, 2))
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
+6
-4
@@ -1,5 +1,5 @@
|
||||
import { downloadDir } from '@tauri-apps/api/path'
|
||||
import { ask, confirm } from '@tauri-apps/plugin-dialog'
|
||||
import { ask } from '@tauri-apps/plugin-dialog'
|
||||
import { exists, writeFile } from '@tauri-apps/plugin-fs'
|
||||
import { fetch } from '@tauri-apps/plugin-http'
|
||||
import { revealItemInDir } from '@tauri-apps/plugin-opener'
|
||||
@@ -32,7 +32,7 @@ export async function dialogGetMountPlugin() {
|
||||
const currentPlatform = platform()
|
||||
if (currentPlatform === 'macos') {
|
||||
// download fuse-t or osxfuse
|
||||
const wantsDownload = await confirm(
|
||||
const wantsDownload = await ask(
|
||||
"Fuse-t is required on macOS to mount remotes. You can open rclone UI again once you're done with the installation.",
|
||||
{
|
||||
title: 'Mount plugin not installed',
|
||||
@@ -53,7 +53,7 @@ export async function dialogGetMountPlugin() {
|
||||
}
|
||||
if (currentPlatform === 'windows') {
|
||||
// download winfsp
|
||||
const wantsDownload = await confirm(
|
||||
const wantsDownload = await ask(
|
||||
"WinFsp is required on Windows to mount remotes. You can open rclone UI again once you're done with the installation.",
|
||||
{
|
||||
title: 'Mount plugin not installed',
|
||||
@@ -84,9 +84,11 @@ export async function unmountRemote(mountPoint: string, force = false) {
|
||||
|
||||
if (output.code !== 0) {
|
||||
if (output.stderr.toLowerCase().includes('busy')) {
|
||||
const answer = await ask('This resource is busy, do you want to force unmount?', {
|
||||
const answer = await ask('This resource is busy, do you wish to force unmount?', {
|
||||
title: 'Could not unmount',
|
||||
kind: 'warning',
|
||||
okLabel: 'Force Unmount',
|
||||
cancelLabel: 'Cancel',
|
||||
})
|
||||
if (answer) {
|
||||
return await unmountRemote(mountPoint, true)
|
||||
|
||||
+2
-6
@@ -23,13 +23,11 @@ export interface RemoteConfig {
|
||||
}
|
||||
|
||||
interface State {
|
||||
count: number
|
||||
anotherCount: number
|
||||
increment: () => void
|
||||
|
||||
rcloneLoaded: boolean
|
||||
rcloneAuth: string
|
||||
rcloneAuthHeader: string
|
||||
|
||||
mountedRemotes: Record<string, string>
|
||||
|
||||
serveList: { pid: number; protocol: string; remote: string }[]
|
||||
@@ -70,13 +68,11 @@ const getStorage = (store: LazyStore): StateStorage => ({
|
||||
export const useStore = create<State>()(
|
||||
shared(
|
||||
(set) => ({
|
||||
count: 0,
|
||||
anotherCount: 0,
|
||||
increment: () => set((state) => ({ count: state.count + 1 })),
|
||||
|
||||
rcloneLoaded: false,
|
||||
rcloneAuth: '',
|
||||
rcloneAuthHeader: '',
|
||||
|
||||
mountedRemotes: {},
|
||||
|
||||
serveList: [],
|
||||
|
||||
@@ -33,8 +33,6 @@ export async function openFullWindow({
|
||||
url: url,
|
||||
})
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000))
|
||||
|
||||
const size = await currentMonitor().then((m) => m?.size)
|
||||
|
||||
if (!size) return
|
||||
|
||||
Reference in New Issue
Block a user