mirror of
1
Fork 0

WIP Implement proper saving of federated repo urls

Added ToDos where relevant
This commit is contained in:
erik 2024-03-19 15:25:52 +01:00
parent 9337274334
commit 884e38bdab
3 changed files with 19 additions and 4 deletions

View File

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

View File

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

View File

@ -113,6 +113,8 @@ type RepoSettingForm struct {
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