mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 11:27:17 +08:00
fix: 一些小问题
This commit is contained in:
@@ -260,6 +260,10 @@ func (r *MySQLController) DatabaseList(ctx http.Context) http.Response {
|
||||
}
|
||||
pagedDatabases := databases[startIndex:endIndex]
|
||||
|
||||
if pagedDatabases == nil {
|
||||
pagedDatabases = []database{}
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, http.Json{
|
||||
"total": len(databases),
|
||||
"items": pagedDatabases,
|
||||
@@ -512,6 +516,10 @@ func (r *MySQLController) UserList(ctx http.Context) http.Response {
|
||||
}
|
||||
pagedUserGrants := userGrants[startIndex:endIndex]
|
||||
|
||||
if pagedUserGrants == nil {
|
||||
pagedUserGrants = []user{}
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, http.Json{
|
||||
"total": len(userGrants),
|
||||
"items": pagedUserGrants,
|
||||
|
||||
@@ -200,6 +200,10 @@ func (r *PostgreSQLController) DatabaseList(ctx http.Context) http.Response {
|
||||
}
|
||||
pagedDatabases := databases[startIndex:endIndex]
|
||||
|
||||
if pagedDatabases == nil {
|
||||
pagedDatabases = []database{}
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, http.Json{
|
||||
"total": len(databases),
|
||||
"items": pagedDatabases,
|
||||
@@ -441,6 +445,10 @@ func (r *PostgreSQLController) RoleList(ctx http.Context) http.Response {
|
||||
}
|
||||
pagedRoles := roles[startIndex:endIndex]
|
||||
|
||||
if pagedRoles == nil {
|
||||
pagedRoles = []role{}
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, http.Json{
|
||||
"total": len(roles),
|
||||
"items": pagedRoles,
|
||||
|
||||
@@ -58,6 +58,10 @@ func (r *PureFtpdController) List(ctx http.Context) http.Response {
|
||||
}
|
||||
pagedUsers := users[startIndex:endIndex]
|
||||
|
||||
if pagedUsers == nil {
|
||||
pagedUsers = []types.PureFtpdUser{}
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, http.Json{
|
||||
"total": len(users),
|
||||
"items": pagedUsers,
|
||||
|
||||
@@ -125,6 +125,10 @@ func (r *SafeController) GetFirewallRules(ctx http.Context) http.Response {
|
||||
}
|
||||
pagedRules := rules[startIndex:endIndex]
|
||||
|
||||
if pagedRules == nil {
|
||||
pagedRules = []map[string]string{}
|
||||
}
|
||||
|
||||
return Success(ctx, http.Json{
|
||||
"total": len(rules),
|
||||
"items": pagedRules,
|
||||
|
||||
@@ -80,4 +80,4 @@ systemctl unmask fail2ban
|
||||
systemctl enable fail2ban
|
||||
systemctl start fail2ban
|
||||
|
||||
panel writePlugin fail2ban 1.0.0
|
||||
panel writePlugin fail2ban 1.0.2
|
||||
|
||||
@@ -38,3 +38,5 @@ if [ "$?" != "0" ]; then
|
||||
fi
|
||||
|
||||
systemctl restart fail2ban
|
||||
|
||||
panel writePlugin fail2ban 1.0.2
|
||||
|
||||
Reference in New Issue
Block a user