mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 12:54:53 -05:00
WIP Implement proper saving of federated repo urls
Added ToDos where relevant
This commit is contained in:
parent
9337274334
commit
884e38bdab
3 changed files with 19 additions and 4 deletions
|
@ -137,7 +137,7 @@ type Repository struct {
|
|||
DefaultBranch string
|
||||
WikiBranch string
|
||||
// TODO: Create own table out of this field
|
||||
FederationRepos string
|
||||
FederationRepos string `xorm:"TEXT"`
|
||||
|
||||
NumWatches int
|
||||
NumStars int
|
||||
|
|
|
@ -188,7 +188,20 @@ func SettingsPost(ctx *context.Context) {
|
|||
case "federation":
|
||||
if !setting.Federation.Enabled {
|
||||
ctx.NotFound("", nil)
|
||||
ctx.Flash.Info("Federation Not enabled")
|
||||
return
|
||||
} else {
|
||||
// ToDo: Proper string handling
|
||||
log.Info("web/repo/setting.go:Federation was detected as enabled.")
|
||||
// ToDo: Ability to delete repos
|
||||
repo.FederationRepos = repo.FederationRepos + form.FederationRepos
|
||||
if err := repo_service.UpdateRepository(ctx, repo, false); err != nil {
|
||||
ctx.ServerError("UpdateRepository", err)
|
||||
return
|
||||
}
|
||||
log.Info("Repos are: %v", repo.FederationRepos)
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success"))
|
||||
ctx.Redirect(repo.Link() + "/settings")
|
||||
}
|
||||
|
||||
// TODO: Validate semicolon separation
|
||||
|
|
|
@ -110,9 +110,11 @@ func ParseRemoteAddr(remoteAddr, authUsername, authPassword string) (string, err
|
|||
|
||||
// RepoSettingForm form for changing repository settings
|
||||
type RepoSettingForm struct {
|
||||
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
|
||||
Description string `binding:"MaxSize(2048)"`
|
||||
Website string `binding:"ValidUrl;MaxSize(1024)"`
|
||||
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
|
||||
Description string `binding:"MaxSize(2048)"`
|
||||
Website string `binding:"ValidUrl;MaxSize(1024)"`
|
||||
// ToDo: Do we need validation at this point?
|
||||
FederationRepos string
|
||||
Interval string
|
||||
MirrorAddress string
|
||||
MirrorUsername string
|
||||
|
|
Loading…
Reference in a new issue