diff --git a/httpd/webadmin.go b/httpd/webadmin.go index 251a37d6..39368996 100644 --- a/httpd/webadmin.go +++ b/httpd/webadmin.go @@ -252,20 +252,23 @@ func loadAdminTemplates(templatesPath string) { filepath.Join(templatesPath, templateAdminDir, templateSetup), } - usersTmpl := utils.LoadTemplate(nil, usersPaths...) - userTmpl := utils.LoadTemplate(nil, userPaths...) - adminsTmpl := utils.LoadTemplate(nil, adminsPaths...) - adminTmpl := utils.LoadTemplate(nil, adminPaths...) - connectionsTmpl := utils.LoadTemplate(nil, connectionsPaths...) - messageTmpl := utils.LoadTemplate(nil, messagePath...) - foldersTmpl := utils.LoadTemplate(nil, foldersPath...) - folderTmpl := utils.LoadTemplate(nil, folderPath...) - statusTmpl := utils.LoadTemplate(nil, statusPath...) - loginTmpl := utils.LoadTemplate(nil, loginPath...) - changePwdTmpl := utils.LoadTemplate(nil, changePwdPaths...) - maintenanceTmpl := utils.LoadTemplate(nil, maintenancePath...) - defenderTmpl := utils.LoadTemplate(nil, defenderPath...) - setupTmpl := utils.LoadTemplate(nil, setupPath...) + rootTpl := template.New("").Funcs(template.FuncMap{ + "ListFSProviders": vfs.ListProviders, + }) + usersTmpl := utils.LoadTemplate(rootTpl, usersPaths...) + userTmpl := utils.LoadTemplate(rootTpl, userPaths...) + adminsTmpl := utils.LoadTemplate(rootTpl, adminsPaths...) + adminTmpl := utils.LoadTemplate(rootTpl, adminPaths...) + connectionsTmpl := utils.LoadTemplate(rootTpl, connectionsPaths...) + messageTmpl := utils.LoadTemplate(rootTpl, messagePath...) + foldersTmpl := utils.LoadTemplate(rootTpl, foldersPath...) + folderTmpl := utils.LoadTemplate(rootTpl, folderPath...) + statusTmpl := utils.LoadTemplate(rootTpl, statusPath...) + loginTmpl := utils.LoadTemplate(rootTpl, loginPath...) + changePwdTmpl := utils.LoadTemplate(rootTpl, changePwdPaths...) + maintenanceTmpl := utils.LoadTemplate(rootTpl, maintenancePath...) + defenderTmpl := utils.LoadTemplate(rootTpl, defenderPath...) + setupTmpl := utils.LoadTemplate(rootTpl, setupPath...) adminTemplates[templateUsers] = usersTmpl adminTemplates[templateUser] = userTmpl diff --git a/templates/webadmin/fsconfig.html b/templates/webadmin/fsconfig.html index 9ae3f916..269df731 100644 --- a/templates/webadmin/fsconfig.html +++ b/templates/webadmin/fsconfig.html @@ -6,12 +6,9 @@
diff --git a/vfs/filesystem.go b/vfs/filesystem.go index ec1ba3c9..5498d61c 100644 --- a/vfs/filesystem.go +++ b/vfs/filesystem.go @@ -68,19 +68,29 @@ func (p FilesystemProvider) ShortInfo() string { case LocalFilesystemProvider: return "Local" case S3FilesystemProvider: - return "S3" + return "AWS S3 (Compatible)" case GCSFilesystemProvider: - return "GCS" + return "Google Cloud Storage" case AzureBlobFilesystemProvider: - return "AzBlob" + return "Azure Blob Storage" case CryptedFilesystemProvider: - return "Encrypted" + return "Local encrypted" case SFTPFilesystemProvider: return "SFTP" } return "" } +// ListProviders returns a list of available FilesystemProviders +func ListProviders() []FilesystemProvider { + // TODO this should ultimately be dynamic (i.e. each provider registers itself) + return []FilesystemProvider{ + LocalFilesystemProvider, S3FilesystemProvider, + GCSFilesystemProvider, AzureBlobFilesystemProvider, + CryptedFilesystemProvider, SFTPFilesystemProvider, + } +} + // ValidatorHelper implements methods we need for Filesystem.ValidateConfig. // It is implemented by vfs.Folder and dataprovider.User type ValidatorHelper interface {