diff --git a/.goreleaser.yml b/.goreleaser.yml index 066f0fd..dbf66a6 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -5,7 +5,7 @@ release: github: owner: hrfee name: jfa-go - name_template: "v{{.Version}} {{.Env.USER}}" + name_template: "v{{.Version}}" before: hooks: # You may remove this if you don't use go modules. @@ -36,7 +36,7 @@ archives: checksum: name_template: 'checksums.txt' snapshot: - name_template: "{{ .Tag }}-next" + name_template: "{{ .Tag }}-testing" changelog: sort: asc filters: diff --git a/README.md b/README.md index 700696b..15a4e54 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,24 @@ -# jfa-go +# ![jfa-go](images/jfa-go-banner-wide.svg) -A rewrite of [jellyfin-accounts](https://github.com/hrfee/jellyfin-accounts) in Go. Should be fully functional, and functions the same as jf-accounts. To switch, copy your existing `~/.jf-accounts` to: +A rewrite of [jellyfin-accounts](https://github.com/hrfee/jellyfin-accounts) in Go. It has feature parity with the Python version, but should be faster. + +#### Install/usage + +Grab an archive from the release section for your platform, and extract `jfa-go` and `data` to the same directory. +Run the executable to start. +``` +Usage of ./jfa-go: + -config string + alternate path to config file. (default "~/.config/jfa-go/config.ini") + -data string + alternate path to data directory. (default "~/.config/jfa-go") + -host string + alternate address to host web ui on. + -port int + alternate port to host web ui on. +``` + +To switch from jf-accounts, copy your existing `~/.jf-accounts` to: * `XDG_CONFIG_DIR/jfa-go` (usually ~/.config) on \*nix systems, * `%AppData%/jfa-go` on Windows, @@ -8,4 +26,4 @@ A rewrite of [jellyfin-accounts](https://github.com/hrfee/jellyfin-accounts) in (*or specify config/data path with `-config/-data` respectively.*) -Suggestions and help welcome. +This is the first time i've even touched Go, and the code is a mess, so help is very welcome. diff --git a/images/README.md b/images/README.md new file mode 100644 index 0000000..248eb80 --- /dev/null +++ b/images/README.md @@ -0,0 +1,6 @@ +# Images + +This holds any images on the main README, and the base files for the icons and banner. The font used, like Jellyfin, is [Quicksand](https://fonts.google.com/specimen/Quicksand) by Andrew Paglinawan. + +"Go" text logo and Gopher image: Copyright 2018 The Go Authors. All rights reserved. +https://creativecommons.org/licenses/by/3.0/legalcode diff --git a/images/admin.png b/images/admin.png new file mode 100644 index 0000000..7943821 Binary files /dev/null and b/images/admin.png differ diff --git a/images/create.png b/images/create.png new file mode 100644 index 0000000..325b8de Binary files /dev/null and b/images/create.png differ diff --git a/images/jfa-go-banner-wide.svg b/images/jfa-go-banner-wide.svg new file mode 100644 index 0000000..f39cfe0 --- /dev/null +++ b/images/jfa-go-banner-wide.svg @@ -0,0 +1,280 @@ + +image/svg+xml + + + + + + + + + + + + + + + + + + + + ( ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/images/jfa-go-icon.png b/images/jfa-go-icon.png new file mode 100755 index 0000000..c87f4e4 Binary files /dev/null and b/images/jfa-go-icon.png differ diff --git a/images/jfa-go-icon.svg b/images/jfa-go-icon.svg new file mode 100755 index 0000000..45a5038 --- /dev/null +++ b/images/jfa-go-icon.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/images/jfa-go-social.png b/images/jfa-go-social.png new file mode 100644 index 0000000..a1c8f56 Binary files /dev/null and b/images/jfa-go-social.png differ diff --git a/images/jfa-go-social.svg b/images/jfa-go-social.svg new file mode 100644 index 0000000..c69d10d --- /dev/null +++ b/images/jfa-go-social.svg @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ( ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/images/jfa.gif b/images/jfa.gif new file mode 100644 index 0000000..e9a9739 Binary files /dev/null and b/images/jfa.gif differ diff --git a/main.go b/main.go index 1d0ab1f..a29ae3d 100644 --- a/main.go +++ b/main.go @@ -93,7 +93,8 @@ func main() { userConfigDir, _ := os.UserConfigDir() ctx.data_path = filepath.Join(userConfigDir, "jfa-go") ctx.config_path = filepath.Join(ctx.data_path, "config.ini") - ctx.local_path = "data" + executable, _ := os.Executable() + ctx.local_path = filepath.Join(filepath.Dir(executable), "data") ctx.info = log.New(os.Stdout, "[INFO] ", log.Ltime) ctx.err = log.New(os.Stdout, "[ERROR] ", log.Ltime|log.Lshortfile) @@ -285,15 +286,15 @@ func main() { setGinLogger(router, debugMode) router.Use(gin.Recovery()) - router.Use(static.Serve("/", static.LocalFile("data/static", false))) - router.LoadHTMLGlob("data/templates/*") + router.Use(static.Serve("/", static.LocalFile(filepath.Join(ctx.local_path, "static"), false))) + router.LoadHTMLGlob(filepath.Join(ctx.local_path, "templates", "*")) router.NoRoute(ctx.NoRouteHandler) if !firstRun { router.GET("/", ctx.AdminPage) router.GET("/getToken", ctx.GetToken) router.POST("/newUser", ctx.NewUser) router.GET("/invite/:invCode", ctx.InviteProxy) - router.Use(static.Serve("/invite/", static.LocalFile("data/static", false))) + router.Use(static.Serve("/invite/", static.LocalFile(filepath.Join(ctx.local_path, "static"), false))) api := router.Group("/", ctx.webAuth()) api.POST("/generateInvite", ctx.GenerateInvite) api.GET("/getInvites", ctx.GetInvites)