2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 11:27:17 +08:00

fix: 一些小问题

This commit is contained in:
耗子
2024-06-18 03:30:59 +08:00
parent 8a5b46ad7e
commit 46b431de30
6 changed files with 27 additions and 1 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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

View File

@@ -38,3 +38,5 @@ if [ "$?" != "0" ]; then
fi
systemctl restart fail2ban
panel writePlugin fail2ban 1.0.2