mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-05-24 00:24:06 +03:00
secure jsondb user perms (#404)
This commit is contained in:
parent
6bbe230fe8
commit
7488f283c4
2 changed files with 38 additions and 8 deletions
|
@ -3,6 +3,9 @@ package jsondb
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/ngoduykhanh/wireguard-ui/model"
|
||||
)
|
||||
|
||||
|
@ -65,7 +68,11 @@ func (o *JsonDB) SaveWakeOnLanHost(host model.WakeOnLanHost) error {
|
|||
return err
|
||||
}
|
||||
|
||||
return o.conn.Write(model.WakeOnLanHostCollectionName, resourceName, host)
|
||||
wakeOnLanHostPath := path.Join(path.Join(o.dbPath, model.WakeOnLanHostCollectionName), resourceName+".json")
|
||||
output := o.conn.Write(model.WakeOnLanHostCollectionName, resourceName, host)
|
||||
os.Chmod(wakeOnLanHostPath, 0600)
|
||||
return output
|
||||
|
||||
}
|
||||
|
||||
func (o *JsonDB) DeleteWakeOnHost(host model.WakeOnLanHost) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue