Redesign file context menus and download archives using global preference
This commit is contained in:
1 parent
6aca927851
commit
042392f611
22 files changed
+530
-363
No files matched your search
@@ -21,6 +21,7 @@ type AuthMethod string
|
||||
|
||||
// Settings contain the main settings of the application.
|
||||
type Settings struct {
|
||||
DownloadArchiveFormat string `json:"downloadArchiveFormat"`
|
||||
Key []byte `json:"key"`
|
||||
Signup bool `json:"signup"`
|
||||
HideLoginButton bool `json:"hideLoginButton"`
|
||||
@@ -40,6 +41,21 @@ type Settings struct {
|
||||
HideDotfiles bool `json:"hideDotfiles"`
|
||||
}
|
||||
|
||||
func ValidArchiveFormat(format string) bool {
|
||||
switch format {
|
||||
case "", "zip", "tar", "targz", "tarbz2", "tarxz", "tarlz4", "tarsz", "tarbr", "tarzst":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (s *Settings) ArchiveFormat() string {
|
||||
if s.DownloadArchiveFormat == "" || !ValidArchiveFormat(s.DownloadArchiveFormat) {
|
||||
return "zip"
|
||||
}
|
||||
return s.DownloadArchiveFormat
|
||||
}
|
||||
|
||||
// GetRules implements rules.Provider.
|
||||
func (s *Settings) GetRules() []rules.Rule {
|
||||
return s.Rules
|
||||
|
||||
Reference in new issue
Block a user