From 37b769491028a86d697e8d18be09b6e0c1046046 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 18 Apr 2023 19:37:51 +0200 Subject: WIP templates --- main.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 31d5ac3..6842fdf 100644 --- a/main.go +++ b/main.go @@ -129,6 +129,11 @@ func main() { r.HandleFunc("/directory/search", handleDirectorySearch) r.HandleFunc("/directory", handleDirectory) + r.HandleFunc("/garage/key", handleGarageKey) + r.HandleFunc("/garage/website", handleGarageWebsiteList) + r.HandleFunc("/garage/website/new", handleGarageWebsiteNew) + r.HandleFunc("/garage/website/b/{bucket}", handleGarageWebsiteInspect) + r.HandleFunc("/invite/new_account", handleInviteNewAccount) r.HandleFunc("/invite/send_code", handleInviteSendCode) r.HandleFunc("/invitation/{code}", handleInvitationCode) -- cgit v1.2.3 From 24600c8787f949d0de2596a9c6b54a38474e461a Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 18 Apr 2023 22:45:04 +0200 Subject: add dependency to garage --- main.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 6842fdf..89051f5 100644 --- a/main.go +++ b/main.go @@ -48,6 +48,9 @@ type ConfigFile struct { GroupCanInvite string `json:"group_can_invite"` GroupCanAdmin string `json:"group_can_admin"` + S3AdminEndpoint string `json:"s3_admin_endpoint"` + S3AdminToken string `json:"s3_admin_token"` + S3Endpoint string `json:"s3_endpoint"` S3AccessKey string `json:"s3_access_key"` S3SecretKey string `json:"s3_secret_key"` -- cgit v1.2.3 From bdb9af5a26f49799cb1feec866d289513eb09e7b Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 19 Apr 2023 11:36:13 +0200 Subject: Garage key page info --- main.go | 1 + 1 file changed, 1 insertion(+) (limited to 'main.go') diff --git a/main.go b/main.go index 89051f5..0e47e73 100644 --- a/main.go +++ b/main.go @@ -255,6 +255,7 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus { "mail", "memberof", "description", + "garage_s3_access_key", FIELD_NAME_DIRECTORY_VISIBILITY, FIELD_NAME_PROFILE_PICTURE, }, -- cgit v1.2.3 From ddb1ca205abb6349b59bc5ea7764a68484e72338 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 19 Apr 2023 12:17:27 +0200 Subject: bind website page --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index 0e47e73..ca33795 100644 --- a/main.go +++ b/main.go @@ -105,7 +105,12 @@ func readConfig() ConfigFile { } func getTemplate(name string) *template.Template { - return template.Must(template.ParseFiles(templatePath+"/layout.html", templatePath+"/"+name)) + return template.Must(template.New("layout.html").Funcs(template.FuncMap { + "contains": strings.Contains, + }).ParseFiles( + templatePath+"/layout.html", + templatePath+"/"+name, + )) } func main() { -- cgit v1.2.3 From 83ed187dbc6d1ef5f08d74aa57a7d17e907581c9 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 19 Apr 2023 15:07:46 +0200 Subject: reformat code --- main.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index ca33795..ae8fe06 100644 --- a/main.go +++ b/main.go @@ -48,8 +48,8 @@ type ConfigFile struct { GroupCanInvite string `json:"group_can_invite"` GroupCanAdmin string `json:"group_can_admin"` - S3AdminEndpoint string `json:"s3_admin_endpoint"` - S3AdminToken string `json:"s3_admin_token"` + S3AdminEndpoint string `json:"s3_admin_endpoint"` + S3AdminToken string `json:"s3_admin_token"` S3Endpoint string `json:"s3_endpoint"` S3AccessKey string `json:"s3_access_key"` @@ -105,12 +105,12 @@ func readConfig() ConfigFile { } func getTemplate(name string) *template.Template { - return template.Must(template.New("layout.html").Funcs(template.FuncMap { - "contains": strings.Contains, - }).ParseFiles( - templatePath+"/layout.html", - templatePath+"/"+name, - )) + return template.Must(template.New("layout.html").Funcs(template.FuncMap{ + "contains": strings.Contains, + }).ParseFiles( + templatePath+"/layout.html", + templatePath+"/"+name, + )) } func main() { @@ -137,10 +137,10 @@ func main() { r.HandleFunc("/directory/search", handleDirectorySearch) r.HandleFunc("/directory", handleDirectory) - r.HandleFunc("/garage/key", handleGarageKey) - r.HandleFunc("/garage/website", handleGarageWebsiteList) - r.HandleFunc("/garage/website/new", handleGarageWebsiteNew) - r.HandleFunc("/garage/website/b/{bucket}", handleGarageWebsiteInspect) + r.HandleFunc("/garage/key", handleGarageKey) + r.HandleFunc("/garage/website", handleGarageWebsiteList) + r.HandleFunc("/garage/website/new", handleGarageWebsiteNew) + r.HandleFunc("/garage/website/b/{bucket}", handleGarageWebsiteInspect) r.HandleFunc("/invite/new_account", handleInviteNewAccount) r.HandleFunc("/invite/send_code", handleInviteSendCode) @@ -260,7 +260,7 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus { "mail", "memberof", "description", - "garage_s3_access_key", + "garage_s3_access_key", FIELD_NAME_DIRECTORY_VISIBILITY, FIELD_NAME_PROFILE_PICTURE, }, -- cgit v1.2.3