mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-15 09:47:39 +08:00
c766140dad
This PR adds a new field `RemoteAddress` to both mirror types which contains the sanitized remote address for easier (database) access to that information. Will be used in the audit PR if merged.
25 lines
736 B
Go
25 lines
736 B
Go
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package convert
|
|
|
|
import (
|
|
repo_model "code.gitea.io/gitea/models/repo"
|
|
api "code.gitea.io/gitea/modules/structs"
|
|
)
|
|
|
|
// ToPushMirror convert from repo_model.PushMirror and remoteAddress to api.TopicResponse
|
|
func ToPushMirror(pm *repo_model.PushMirror) (*api.PushMirror, error) {
|
|
repo := pm.GetRepository()
|
|
return &api.PushMirror{
|
|
RepoName: repo.Name,
|
|
RemoteName: pm.RemoteName,
|
|
RemoteAddress: pm.RemoteAddress,
|
|
CreatedUnix: pm.CreatedUnix.FormatLong(),
|
|
LastUpdateUnix: pm.LastUpdateUnix.FormatLong(),
|
|
LastError: pm.LastError,
|
|
Interval: pm.Interval.String(),
|
|
SyncOnCommit: pm.SyncOnCommit,
|
|
}, nil
|
|
}
|