Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
Co-Authored-By: somebodywashere <[email protected]>
  • Loading branch information
MHSanaei and somebodywashere committed Mar 12, 2024
1 parent 6fdc07a commit 903db95
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 40 deletions.
2 changes: 0 additions & 2 deletions web/html/xui/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@
this.loading(false);
if (msg.success) {
this.user = {};
window.location.replace;
}
},
async restartPanel() {
Expand Down Expand Up @@ -464,7 +463,6 @@
const msg = await HttpUtil.post("/panel/setting/updateUserSecret", this.user);
if (msg && msg.obj) {
this.user = msg.obj;
window.location.replace;
}
this.loading(false);
await this.updateAllSetting();
Expand Down
47 changes: 9 additions & 38 deletions web/service/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -1069,10 +1069,7 @@ func (s *InboundService) AddClientStat(tx *gorm.DB, inboundId int, client *model
clientTraffic.Reset = client.Reset
result := tx.Create(&clientTraffic)
err := result.Error
if err != nil {
return err
}
return nil
return err
}

func (s *InboundService) UpdateClientStat(tx *gorm.DB, email string, client *model.Client) error {
Expand All @@ -1085,12 +1082,8 @@ func (s *InboundService) UpdateClientStat(tx *gorm.DB, email string, client *mod
"expiry_time": client.ExpiryTime,
"reset": client.Reset,
})

err := result.Error
if err != nil {
return err
}
return nil
return err
}

func (s *InboundService) UpdateClientIPs(tx *gorm.DB, oldEmail string, newEmail string) error {
Expand Down Expand Up @@ -1215,10 +1208,7 @@ func (s *InboundService) SetClientTelegramUserID(trafficId int, tgId string) err
}
inbound.Settings = string(modifiedSettings)
_, err = s.UpdateInboundClient(inbound, clientId)
if err != nil {
return err
}
return nil
return err
}

func (s *InboundService) checkIsEnabledByEmail(clientEmail string) (bool, error) {
Expand Down Expand Up @@ -1365,10 +1355,7 @@ func (s *InboundService) ResetClientIpLimitByEmail(clientEmail string, count int
}
inbound.Settings = string(modifiedSettings)
_, err = s.UpdateInboundClient(inbound, clientId)
if err != nil {
return err
}
return nil
return err
}

func (s *InboundService) ResetClientExpiryTimeByEmail(clientEmail string, expiry_time int64) error {
Expand Down Expand Up @@ -1425,10 +1412,7 @@ func (s *InboundService) ResetClientExpiryTimeByEmail(clientEmail string, expiry
}
inbound.Settings = string(modifiedSettings)
_, err = s.UpdateInboundClient(inbound, clientId)
if err != nil {
return err
}
return nil
return err
}

func (s *InboundService) ResetClientTrafficLimitByEmail(clientEmail string, totalGB int) error {
Expand Down Expand Up @@ -1488,10 +1472,7 @@ func (s *InboundService) ResetClientTrafficLimitByEmail(clientEmail string, tota
}
inbound.Settings = string(modifiedSettings)
_, err = s.UpdateInboundClient(inbound, clientId)
if err != nil {
return err
}
return nil
return err
}

func (s *InboundService) ResetClientTrafficByEmail(clientEmail string) error {
Expand Down Expand Up @@ -1584,10 +1565,7 @@ func (s *InboundService) ResetAllClientTraffics(id int) error {
Updates(map[string]interface{}{"enable": true, "up": 0, "down": 0})

err := result.Error
if err != nil {
return err
}
return nil
return err
}

func (s *InboundService) ResetAllTraffics() error {
Expand All @@ -1598,10 +1576,7 @@ func (s *InboundService) ResetAllTraffics() error {
Updates(map[string]interface{}{"up": 0, "down": 0})

err := result.Error
if err != nil {
return err
}
return nil
return err
}

func (s *InboundService) DelDepletedClients(id int) (err error) {
Expand Down Expand Up @@ -1675,11 +1650,7 @@ func (s *InboundService) DelDepletedClients(id int) (err error) {
}

err = tx.Where(whereText+" and enable = ?", id, false).Delete(xray.ClientTraffic{}).Error
if err != nil {
return err
}

return nil
return err
}

func (s *InboundService) GetClientTrafficTgBot(tgId string) ([]*xray.ClientTraffic, error) {
Expand Down

0 comments on commit 903db95

Please sign in to comment.