Images, fixed "data" path
@ -5,7 +5,7 @@ release:
|
|||||||
github:
|
github:
|
||||||
owner: hrfee
|
owner: hrfee
|
||||||
name: jfa-go
|
name: jfa-go
|
||||||
name_template: "v{{.Version}} {{.Env.USER}}"
|
name_template: "v{{.Version}}"
|
||||||
before:
|
before:
|
||||||
hooks:
|
hooks:
|
||||||
# You may remove this if you don't use go modules.
|
# You may remove this if you don't use go modules.
|
||||||
@ -36,7 +36,7 @@ archives:
|
|||||||
checksum:
|
checksum:
|
||||||
name_template: 'checksums.txt'
|
name_template: 'checksums.txt'
|
||||||
snapshot:
|
snapshot:
|
||||||
name_template: "{{ .Tag }}-next"
|
name_template: "{{ .Tag }}-testing"
|
||||||
changelog:
|
changelog:
|
||||||
sort: asc
|
sort: asc
|
||||||
filters:
|
filters:
|
||||||
|
24
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,
|
* `XDG_CONFIG_DIR/jfa-go` (usually ~/.config) on \*nix systems,
|
||||||
* `%AppData%/jfa-go` on Windows,
|
* `%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.*)
|
(*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.
|
||||||
|
6
images/README.md
Normal file
@ -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
|
BIN
images/admin.png
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
images/create.png
Normal file
After Width: | Height: | Size: 106 KiB |
280
images/jfa-go-banner-wide.svg
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
images/jfa-go-icon.png
Executable file
After Width: | Height: | Size: 91 KiB |
22
images/jfa-go-icon.svg
Executable file
After Width: | Height: | Size: 113 KiB |
BIN
images/jfa-go-social.png
Normal file
After Width: | Height: | Size: 56 KiB |
337
images/jfa-go-social.svg
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
images/jfa.gif
Normal file
After Width: | Height: | Size: 3.2 MiB |
9
main.go
@ -93,7 +93,8 @@ func main() {
|
|||||||
userConfigDir, _ := os.UserConfigDir()
|
userConfigDir, _ := os.UserConfigDir()
|
||||||
ctx.data_path = filepath.Join(userConfigDir, "jfa-go")
|
ctx.data_path = filepath.Join(userConfigDir, "jfa-go")
|
||||||
ctx.config_path = filepath.Join(ctx.data_path, "config.ini")
|
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.info = log.New(os.Stdout, "[INFO] ", log.Ltime)
|
||||||
ctx.err = log.New(os.Stdout, "[ERROR] ", log.Ltime|log.Lshortfile)
|
ctx.err = log.New(os.Stdout, "[ERROR] ", log.Ltime|log.Lshortfile)
|
||||||
@ -285,15 +286,15 @@ func main() {
|
|||||||
setGinLogger(router, debugMode)
|
setGinLogger(router, debugMode)
|
||||||
|
|
||||||
router.Use(gin.Recovery())
|
router.Use(gin.Recovery())
|
||||||
router.Use(static.Serve("/", static.LocalFile("data/static", false)))
|
router.Use(static.Serve("/", static.LocalFile(filepath.Join(ctx.local_path, "static"), false)))
|
||||||
router.LoadHTMLGlob("data/templates/*")
|
router.LoadHTMLGlob(filepath.Join(ctx.local_path, "templates", "*"))
|
||||||
router.NoRoute(ctx.NoRouteHandler)
|
router.NoRoute(ctx.NoRouteHandler)
|
||||||
if !firstRun {
|
if !firstRun {
|
||||||
router.GET("/", ctx.AdminPage)
|
router.GET("/", ctx.AdminPage)
|
||||||
router.GET("/getToken", ctx.GetToken)
|
router.GET("/getToken", ctx.GetToken)
|
||||||
router.POST("/newUser", ctx.NewUser)
|
router.POST("/newUser", ctx.NewUser)
|
||||||
router.GET("/invite/:invCode", ctx.InviteProxy)
|
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 := router.Group("/", ctx.webAuth())
|
||||||
api.POST("/generateInvite", ctx.GenerateInvite)
|
api.POST("/generateInvite", ctx.GenerateInvite)
|
||||||
api.GET("/getInvites", ctx.GetInvites)
|
api.GET("/getInvites", ctx.GetInvites)
|
||||||
|