mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-25 05:29:20 +00:00
Compare commits
3 Commits
20d86e9ea6
...
88bdefcd90
Author | SHA1 | Date | |
---|---|---|---|
|
88bdefcd90 | ||
|
d29b8f2afa | ||
|
c348593ef4 |
@ -90,6 +90,10 @@ func main() {
|
|||||||
log.SetOutput(os.Stdout)
|
log.SetOutput(os.Stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if open && strings.HasPrefix(addr, "unix:") {
|
||||||
|
log.Fatal("Cannot open ", addr, " in browser")
|
||||||
|
}
|
||||||
|
|
||||||
if db == "" {
|
if db == "" {
|
||||||
configPath, err := os.UserConfigDir()
|
configPath, err := os.UserConfigDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -13,9 +13,9 @@ The latest prebuilt binaries for Linux/MacOS/Windows are available
|
|||||||
[here](https://github.com/nkanaev/yarr/releases/latest).
|
[here](https://github.com/nkanaev/yarr/releases/latest).
|
||||||
The archives follow the naming convention `yarr_{OS}_{ARCH}[_gui].zip`, where:
|
The archives follow the naming convention `yarr_{OS}_{ARCH}[_gui].zip`, where:
|
||||||
|
|
||||||
* `OS` corresponds to the target operating system (darwin/linux/windows for Linux, MacOS, Windows, respectively)
|
* `OS` is the target operating system
|
||||||
* `ARCH` is the CPU architecture (`arm64` for AMD64/Aarch64, `amd64` for X86-64)
|
* `ARCH` is the CPU architecture (`arm64` for AArch64, `amd64` for X86-64)
|
||||||
* `-gui` indicates that the application ships with the GUI (tray icon), and is a command line application if omitted
|
* `-gui` indicates that the binary ships with the GUI (tray icon), and is a command line application if omitted
|
||||||
|
|
||||||
Usage instructions:
|
Usage instructions:
|
||||||
|
|
||||||
|
@ -2,7 +2,10 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/nkanaev/yarr/src/storage"
|
"github.com/nkanaev/yarr/src/storage"
|
||||||
@ -53,14 +56,31 @@ func (s *Server) Start() {
|
|||||||
s.worker.RefreshFeeds()
|
s.worker.RefreshFeeds()
|
||||||
}
|
}
|
||||||
|
|
||||||
httpserver := &http.Server{Addr: s.Addr, Handler: s.handler()}
|
var ln net.Listener
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
if s.CertFile != "" && s.KeyFile != "" {
|
|
||||||
err = httpserver.ListenAndServeTLS(s.CertFile, s.KeyFile)
|
if path, isUnix := strings.CutPrefix(s.Addr, "unix:"); isUnix {
|
||||||
|
err = os.Remove(path)
|
||||||
|
if err != nil {
|
||||||
|
log.Print(err)
|
||||||
|
}
|
||||||
|
ln, err = net.Listen("unix", path)
|
||||||
} else {
|
} else {
|
||||||
err = httpserver.ListenAndServe()
|
ln, err = net.Listen("tcp", s.Addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
httpserver := &http.Server{Handler: s.handler()}
|
||||||
|
if s.CertFile != "" && s.KeyFile != "" {
|
||||||
|
err = httpserver.ServeTLS(ln, s.CertFile, s.KeyFile)
|
||||||
|
ln.Close()
|
||||||
|
} else {
|
||||||
|
err = httpserver.Serve(ln)
|
||||||
|
}
|
||||||
|
|
||||||
if err != http.ErrServerClosed {
|
if err != http.ErrServerClosed {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user