mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
remove open-golang dependency
This commit is contained in:
parent
93eeef0131
commit
5b0b47635d
1
go.mod
1
go.mod
@ -7,7 +7,6 @@ require (
|
|||||||
github.com/getlantern/systray v1.0.4
|
github.com/getlantern/systray v1.0.4
|
||||||
github.com/mattn/go-sqlite3 v1.14.0
|
github.com/mattn/go-sqlite3 v1.14.0
|
||||||
github.com/mmcdole/gofeed v1.0.0
|
github.com/mmcdole/gofeed v1.0.0
|
||||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
|
|
||||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
|
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
|
||||||
)
|
)
|
||||||
|
|
||||||
|
2
go.sum
2
go.sum
@ -40,8 +40,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA=
|
|
||||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
"github.com/nkanaev/yarr/src/platform"
|
"github.com/nkanaev/yarr/src/platform"
|
||||||
"github.com/nkanaev/yarr/src/server"
|
"github.com/nkanaev/yarr/src/server"
|
||||||
"github.com/nkanaev/yarr/src/storage"
|
"github.com/nkanaev/yarr/src/storage"
|
||||||
sdopen "github.com/skratchdot/open-golang/open"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version string = "0.0"
|
var Version string = "0.0"
|
||||||
@ -104,7 +103,7 @@ func main() {
|
|||||||
|
|
||||||
logger.Printf("starting server at %s", srv.GetAddr())
|
logger.Printf("starting server at %s", srv.GetAddr())
|
||||||
if open {
|
if open {
|
||||||
sdopen.Run(srv.GetAddr())
|
platform.Open(srv.GetAddr())
|
||||||
}
|
}
|
||||||
platform.Start(srv)
|
platform.Start(srv)
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ package platform
|
|||||||
import (
|
import (
|
||||||
"github.com/getlantern/systray"
|
"github.com/getlantern/systray"
|
||||||
"github.com/nkanaev/yarr/src/server"
|
"github.com/nkanaev/yarr/src/server"
|
||||||
"github.com/skratchdot/open-golang/open"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Start(s *server.Handler) {
|
func Start(s *server.Handler) {
|
||||||
@ -20,7 +19,7 @@ func Start(s *server.Handler) {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-menuOpen.ClickedCh:
|
case <-menuOpen.ClickedCh:
|
||||||
open.Run(s.GetAddr())
|
Open(s.GetAddr())
|
||||||
case <-menuQuit.ClickedCh:
|
case <-menuQuit.ClickedCh:
|
||||||
systray.Quit()
|
systray.Quit()
|
||||||
}
|
}
|
||||||
|
5
src/platform/open.go
Normal file
5
src/platform/open.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package platform
|
||||||
|
|
||||||
|
func Open(input string) error {
|
||||||
|
return open(input).Run()
|
||||||
|
}
|
9
src/platform/open_etc.go
Normal file
9
src/platform/open_etc.go
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// +build !windows,!darwin
|
||||||
|
|
||||||
|
package platform
|
||||||
|
|
||||||
|
import "os/exec"
|
||||||
|
|
||||||
|
func open(input string) *exec.Cmd {
|
||||||
|
return exec.Command("xdg-open", input)
|
||||||
|
}
|
9
src/platform/open_mac.go
Normal file
9
src/platform/open_mac.go
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// +build darwin
|
||||||
|
|
||||||
|
package platform
|
||||||
|
|
||||||
|
import "os/exec"
|
||||||
|
|
||||||
|
func open(input string) *exec.Cmd {
|
||||||
|
return exec.Command("open", input)
|
||||||
|
}
|
12
src/platform/open_win.go
Normal file
12
src/platform/open_win.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// +build windows
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
)
|
||||||
|
|
||||||
|
func open(input string) *exec.Cmd {
|
||||||
|
rundll32 := filepath.Join(os.Getenv("SYSTEMROOT"), "System32", "rundll32.exe")
|
||||||
|
return exec.Command(rundll32, "url.dll,FileProtocolHandler", input)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user