#216: Added backend components for Org settings

This commit is contained in:
frikky
2020-12-13 12:43:48 +01:00
parent 82d42cf782
commit a5b818772f
6 changed files with 36 additions and 18 deletions
+16 -1
View File
@@ -116,6 +116,14 @@ type Org struct {
SyncFeatures SyncFeatures `json:"sync_features" datastore:"sync_features"`
Created int64 `json:"created" datastore:"created"`
Edited int64 `json:"edited" datastore:"edited"`
Defaults Defaults `json:"defaults" datastore:"defaults"`
}
type Defaults struct {
AppDownloadRepo string `json:"app_download_repo" datastore:"app_download_repo"`
AppDownloadBranch string `json:"app_download_branch" datastore:"app_download_branch"`
WorkflowDownloadRepo string `json:"workflow_download_repo" datastore:"workflow_download_repo"`
WorkflowDownloadBranch string `json:"workflow_download_branch" datastore:"workflow_download_branch"`
}
type AppAuthenticationStorage struct {
@@ -5134,9 +5142,12 @@ func loadSpecificApps(resp http.ResponseWriter, request *http.Request) {
return
}
// Field1 & 2 can be a lot of things..
// Field1 & 2 can be a lot of things.
// Field1 = Username
// Field2 = Password
type tmpStruct struct {
URL string `json:"url"`
Branch string `json:"branch"`
Field1 string `json:"field_1"`
Field2 string `json:"field_2"`
ForceUpdate bool `json:"force_update"`
@@ -5159,6 +5170,10 @@ func loadSpecificApps(resp http.ResponseWriter, request *http.Request) {
URL: tmpBody.URL,
}
if len(tmpBody.Branch) > 0 && tmpBody.Branch != "master" && tmpBody.Branch != "main" {
cloneOptions.ReferenceName = plumbing.ReferenceName(tmpBody.Branch)
}
// FIXME: Better auth.
if len(tmpBody.Field1) > 0 && len(tmpBody.Field2) > 0 {
cloneOptions.Auth = &http2.BasicAuth{