mirror of
https://github.com/nkanaev/yarr.git
synced 2025-11-08 10:29:37 +00:00
fever api support
Fever API spec: https://github.com/DigitalDJ/tinytinyrss-fever-plugin/blob/master/fever-api.md
This commit is contained in:
@@ -9,10 +9,10 @@ import (
|
||||
)
|
||||
|
||||
type Middleware struct {
|
||||
Username string
|
||||
Password string
|
||||
BasePath string
|
||||
Public string
|
||||
Username string
|
||||
Password string
|
||||
BasePath string
|
||||
SkipAuthPaths []string
|
||||
}
|
||||
|
||||
func unsafeMethod(method string) bool {
|
||||
@@ -20,9 +20,11 @@ func unsafeMethod(method string) bool {
|
||||
}
|
||||
|
||||
func (m *Middleware) Handler(c *router.Context) {
|
||||
if strings.HasPrefix(c.Req.URL.Path, m.BasePath+m.Public) {
|
||||
c.Next()
|
||||
return
|
||||
for _, path := range m.SkipAuthPaths {
|
||||
if strings.HasPrefix(c.Req.URL.Path, m.BasePath+path) {
|
||||
c.Next()
|
||||
return
|
||||
}
|
||||
}
|
||||
if IsAuthenticated(c.Req, m.Username, m.Password) {
|
||||
c.Next()
|
||||
|
||||
Reference in New Issue
Block a user