mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-07-06 17:13:13 +03:00
Handle paused configs correctly
- Removed unnecessary qr generation
This commit is contained in:
parent
1114ef3214
commit
2adb1c5c80
2 changed files with 11 additions and 10 deletions
|
@ -169,7 +169,7 @@ func (o *JsonDB) Init() error {
|
|||
}
|
||||
for _, cl := range clients {
|
||||
client := cl.Client
|
||||
if len(client.TgUserid) > 3 {
|
||||
if client.Enabled && len(client.TgUserid) > 0 {
|
||||
if userid, err := strconv.ParseInt(client.TgUserid, 10, 64); err == nil {
|
||||
util.UpdateTgToClientID(userid, client.ID)
|
||||
}
|
||||
|
@ -329,10 +329,16 @@ func (o *JsonDB) GetClientByID(clientID string, qrCodeSettings model.QRCodeSetti
|
|||
func (o *JsonDB) SaveClient(client model.Client) error {
|
||||
clientPath := path.Join(path.Join(o.dbPath, "clients"), client.ID+".json")
|
||||
output := o.conn.Write("clients", client.ID, client)
|
||||
if output == nil && len(client.TgUserid) > 3 {
|
||||
if userid, err := strconv.ParseInt(client.TgUserid, 10, 64); err == nil {
|
||||
util.UpdateTgToClientID(userid, client.ID)
|
||||
if output == nil {
|
||||
if client.Enabled && len(client.TgUserid) > 0 {
|
||||
if userid, err := strconv.ParseInt(client.TgUserid, 10, 64); err == nil {
|
||||
util.UpdateTgToClientID(userid, client.ID)
|
||||
}
|
||||
} else {
|
||||
util.RemoveTgToClientID(client.ID)
|
||||
}
|
||||
} else {
|
||||
util.RemoveTgToClientID(client.ID)
|
||||
}
|
||||
err := util.ManagePerms(clientPath)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue