fix admin.admins call

This commit is contained in:
Umputun
2019-08-01 01:49:09 -05:00
parent da671c005c
commit 17baa0cff6
4 changed files with 3 additions and 18 deletions
@@ -41,7 +41,7 @@ func (m *MemAdmin) Admins(siteID string) (ids []string, err error) {
if !ok {
return nil, errors.Errorf("site %s not found", siteID)
}
log.Printf("[DEBUG] admins for %s, %+v", siteID, resp.IDs)
return resp.IDs, nil
}
+1 -1
View File
@@ -108,7 +108,7 @@ type StoreGroup struct {
Path string `long:"path" env:"PATH" default:"./var" description:"parent dir for bolt files"`
Timeout time.Duration `long:"timeout" env:"TIMEOUT" default:"30s" description:"bolt timeout"`
} `group:"bolt" namespace:"bolt" env-namespace:"BOLT"`
RPC RPCGroup `group:"rpc" namespace:"rpc" env-namespace:"TPC"`
RPC RPCGroup `group:"rpc" namespace:"rpc" env-namespace:"RPC"`
}
// ImageGroup defines options group for store pictures
+1
View File
@@ -469,6 +469,7 @@ func (s *DataStore) ValidateComment(c *store.Comment) error {
func (s *DataStore) IsAdmin(siteID string, userID string) bool {
admins, err := s.AdminStore.Admins(siteID)
if err != nil {
log.Printf("[WARN] can't get admins for %s, %v", siteID, err)
return false
}
for _, a := range admins {
-16
View File
@@ -14,22 +14,6 @@ server {
limit_conn perip 10;
location / {
#CORS
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS';
add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With";
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS';
add_header 'Access-Control-Max-Age' 86400;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
add_header 'Content-Length' 0;
add_header 'Content-Type' 'text/plain; charset=UTF-8';
return 204;
}
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;