mirror of
https://github.com/stashapp/stash.git
synced 2026-03-27 07:31:34 +01:00
* Add reveal in file manager button to file info panel Adds a folder icon button next to the path field in the Scene, Image, and Gallery file info panels. Clicking it calls a new GraphQL mutation that opens the file's enclosing directory in the system file manager (Finder on macOS, Explorer on Windows, xdg-open on Linux). Also fixes the existing revealInFileManager implementations which were constructing exec.Command but never calling Run(), making them no-ops: - darwin: add Run() to open -R - windows: add Run() and fix flag from \select to /select,<path> - linux: implement with xdg-open on the parent directory - desktop.go: use os.Stat instead of FileExists so folders work too * Disallow reveal operation if request not from loopback --------- Co-authored-by: 1509x <1509x@users.noreply.github.com> Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
//go:build darwin
|
|
// +build darwin
|
|
|
|
package desktop
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"os/exec"
|
|
|
|
gosxnotifier "github.com/kermieisinthehouse/gosx-notifier"
|
|
"github.com/stashapp/stash/pkg/logger"
|
|
)
|
|
|
|
func isService() bool {
|
|
// MacOS /does/ support services, using launchd, but there is no straightforward way to check if it was used.
|
|
return false
|
|
}
|
|
|
|
func isServerDockerized() bool {
|
|
return false
|
|
}
|
|
|
|
func sendNotification(notificationTitle string, notificationText string) {
|
|
notification := gosxnotifier.NewNotification(notificationText)
|
|
notification.Title = notificationTitle
|
|
notification.AppIcon = getIconPath()
|
|
notification.Open = getServerURL("")
|
|
notification.Sender = "cc.stashapp.stash"
|
|
err := notification.Push()
|
|
|
|
if err != nil {
|
|
logger.Errorf("Could not send MacOS notification: %s", err.Error())
|
|
}
|
|
}
|
|
|
|
func revealInFileManager(path string, _ os.FileInfo) error {
|
|
if err := exec.Command(`open`, `-R`, path).Run(); err != nil {
|
|
return fmt.Errorf("error revealing path in Finder: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func isDoubleClickLaunched() bool {
|
|
return false
|
|
}
|
|
|
|
func hideConsole() {
|
|
|
|
}
|