This commit is contained in:
FTCHD
2025-01-31 16:08:24 +02:00
parent 236c664867
commit ce1228ae5a
10 changed files with 13 additions and 98 deletions
-62
View File
@@ -1,62 +0,0 @@
# Issue & Goal
- opening the app in release mode does not show the tray icon or do anything
- tauri looks to be working and sending the `applicationDidFinishLaunching` event but nothing happens
- the goal is to have this run on macOS (no sandboxing needed)
# Notes
### Overall
- you will have to download the `rclone` binary from the [website](https://rclone.org/downloads/) yourself. if you already have rclone installed, it will be used instead of the binary.
- the main window runs the `main.ts` file that's at the project root, it is not related to the vite app. it gets compiled by the `buildExternal.js` script and added to the vite bundle through the `public` directory.
- sometimes `rclone` binary does not start correctly and the loading tray icons is stuck forever, i'd like to solve that too but this is more of a notice to restart the app if that happens.
### Tauri Info
#### Environment
- OS: Mac OS 14.7.2 arm64 (X64)
- Xcode Command Line Tools: installed
- rustc: 1.82.0 (f6e511eec 2024-10-15)
- cargo: 1.82.0 (8f40fc59f 2024-08-21)
- rustup: 1.27.1 (54dd3d00f 2024-04-24)
- Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 20.8.1
- npm: 10.1.0
#### Packages
- tauri 🦀: 2.2.0
- tauri-build 🦀: 2.0.4
- wry 🦀: 0.48.0
- tao 🦀: 0.31.1
- @tauri-apps/api : 2.2.0
- @tauri-apps/cli : 2.2.5
#### Plugins
- tauri-plugin-log 🦀: 2.2.0
- @tauri-apps/plugin-log : 2.2.0
- tauri-plugin-notification 🦀: 2.2.0
- @tauri-apps/plugin-notification : 2.2.1
- tauri-plugin-process 🦀: 2.2.0
- @tauri-apps/plugin-process : 2.2.0
- tauri-plugin-http 🦀: 2.2.0
- @tauri-apps/plugin-http : 2.2.0
- tauri-plugin-store 🦀: 2.2.0
- @tauri-apps/plugin-store : 2.2.0
- tauri-plugin-os 🦀: 2.2.0
- @tauri-apps/plugin-os : 2.2.0
- tauri-plugin-shell 🦀: 2.2.0
- @tauri-apps/plugin-shell : 2.2.0
- tauri-plugin-single-instance 🦀: 2.2.0
- @tauri-apps/plugin-single-instance : not installed!
- tauri-plugin-dialog 🦀: 2.2.0
- @tauri-apps/plugin-dialog : 2.2.0
- tauri-plugin-fs 🦀: 2.2.0
- @tauri-apps/plugin-fs : 2.2.0
- tauri-plugin-opener 🦀: 2.2.3
- @tauri-apps/plugin-opener : 2.2.5
#### App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: React
- bundler: Vite
+4 -4
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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: [],
-2
View File
@@ -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
-3
View File
@@ -248,9 +248,6 @@
{
"url": "http://localhost:5572/**"
},
{
"url": "https://www.google.com"
},
{
"url": "https://downloads.rclone.org/**"
},
-1
View File
@@ -78,7 +78,6 @@
}
},
"hardenedRuntime": true,
"entitlements": "Entitlements.plist",
"minimumSystemVersion": "10.13"
}
}
-15
View File
@@ -1,11 +1,6 @@
import { useStore } from '../../lib/store'
// const store = new LazyStore('store.json')
function Test() {
const count = useStore((state) => state.count)
const increment = useStore((state) => state.increment)
// useEffect(() => {
// console.log('Test')
@@ -34,16 +29,6 @@ function Test() {
<main className="container bg-blue-500">
<div className="flex flex-col">
<h1>Rclone UI</h1>
<button
onClick={() => {
increment()
}}
type="button"
>
Increment Zustand
</button>
<p>{count}</p>
</div>
</main>
)