mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-16 00:01:02 +00:00
feat(sub): expose last subscription fetch time (#6217)
* feat(sub): expose last subscription fetch time Record successful GET subscription fetches per client and surface the timestamp in the client API and UI. * fix(frontend): include last subscription fetch in client traffic * Update sub_fetch_test.go --------- Co-authored-by: Hermes Agent <hermes-agent@localhost>
This commit is contained in:
@@ -86,7 +86,18 @@ func allModels() []any {
|
||||
}
|
||||
}
|
||||
|
||||
func migrateClientTrafficLastSubFetchColumn() error {
|
||||
migrator := db.Migrator()
|
||||
if !migrator.HasTable(&xray.ClientTraffic{}) || migrator.HasColumn(&xray.ClientTraffic{}, "last_sub_fetch") {
|
||||
return nil
|
||||
}
|
||||
return migrator.AddColumn(&xray.ClientTraffic{}, "LastSubFetch")
|
||||
}
|
||||
|
||||
func initModels() error {
|
||||
if err := migrateClientTrafficLastSubFetchColumn(); err != nil {
|
||||
return err
|
||||
}
|
||||
models := allModels()
|
||||
for _, mdl := range models {
|
||||
if IsPostgres() && postgresModelSettled(mdl) {
|
||||
|
||||
Reference in New Issue
Block a user