mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 12:54:53 -05:00
mob-next: how to store port & schema
This commit is contained in:
parent
5b8173f660
commit
cf8a30efac
3 changed files with 16 additions and 3 deletions
|
@ -13,6 +13,8 @@ type FederatedRepo struct {
|
|||
RepoID int64 `xorm:"NOT NULL"`
|
||||
ExternalID string `xorm:"TEXT UNIQUE(federation_repo_mapping) NOT NULL"`
|
||||
FederationHostID int64 `xorm:"UNIQUE(federation_repo_mapping) NOT NULL"`
|
||||
Schema string
|
||||
Port string
|
||||
}
|
||||
|
||||
func NewFederatedRepo(repoID int64, externalID string, federationHostID int64) (FederatedRepo, error) {
|
||||
|
|
|
@ -380,10 +380,13 @@ func repoAssignment(ctx *Context, repo *repo_model.Repository) {
|
|||
ctx.Data["HasAccess"] = true
|
||||
ctx.Data["Permission"] = &ctx.Repo.Permission
|
||||
|
||||
federatedRepo, err := repo_model.FindFederatedReposByRepoID(ctx, repo.ID)
|
||||
federatedRepoList, err := repo_model.FindFederatedReposByRepoID(ctx, repo.ID)
|
||||
if err == nil {
|
||||
// TODO: concat string to semicolon sperated list here
|
||||
ctx.Data["FederatedRepos"] = federatedRepo
|
||||
federatedRepoString := ""
|
||||
for _, federatedRepo := range federatedRepoList {
|
||||
|
||||
}
|
||||
ctx.Data["FederatedRepos"] = federatedRepoString
|
||||
} else if err != repo_model.ErrMirrorNotExist {
|
||||
ctx.ServerError("FindFederatedRepoByRepoID", err)
|
||||
return
|
||||
|
|
|
@ -234,3 +234,11 @@ func StoreFederatedRepoList(ctx context.Context, localRepoId int64, federatedRep
|
|||
|
||||
return 0, "", nil
|
||||
}
|
||||
|
||||
func FederatedRepoUrl(ctx context.Context, federatedRepo repo.FederatedRepo) (string, error) {
|
||||
federationHost, err := forgefed.GetFederationHost(ctx, federatedRepo.FederationHostID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return federationHost.HostFqdn
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue