Skip to content

Commit 27012ec

Browse files
authored
updated settings (#978)
1 parent 9fe1289 commit 27012ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+686
-766
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,22 @@ All notable changes to this project will be documented in this file. For commit
44

55
## v0.7.15-beta
66

7+
**New Features**:
8+
- added userDefault `disableViewingExt`. The new properties apply to all files, not just office.
9+
- code blocks in markdown viewer have line numbers and each line is highlightable
10+
11+
**Notes**:
12+
- replaced `disableOfficePreviewExt` with more generally applicable `disablePreviewExt` to disable preview for any specific file type.
13+
- more tooltip descriptions for settings options
14+
715
**BugFixes**:
816
- fix chinese and other language error (#972, #969)
917
- fix docker dockerfile for `docker run` (#973)
1018
- fix double slash href on single source (#968)
1119
- fix sources named "files" or "share" issue (#949, #574)
20+
- focus input field on popups (#976)
21+
- hopeful fix for size calculation (#982)
22+
- edit button is not working on .md files (#983)
1223

1324
## v0.7.14-beta
1425

backend/cmd/user.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ func validateUserInfo() {
3737
if updateLoginType(user) {
3838
updateUser = true
3939
}
40+
if updateUserDefaults(user) {
41+
updateUser = true
42+
}
4043
adminUser := settings.Config.Auth.AdminUsername
4144
adminPass := settings.Config.Auth.AdminPassword
4245
passwordEnabled := settings.Config.Auth.Methods.PasswordAuth.Enabled
@@ -63,6 +66,14 @@ func validateUserInfo() {
6366
}
6467
}
6568

69+
func updateUserDefaults(user *users.User) bool {
70+
if user.DisableOfficePreviewExt != "" && user.DisablePreviewExt == "" {
71+
user.DisablePreviewExt = user.DisableOfficePreviewExt
72+
return true
73+
}
74+
return false
75+
}
76+
6677
func updateUserScopes(user *users.User) bool {
6778
newScopes := []users.SourceScope{}
6879
seen := make(map[string]bool)

backend/common/settings/config.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -336,16 +336,15 @@ func setDefaults(generate bool) Settings {
336336
Name: "FileBrowser Quantum",
337337
},
338338
UserDefaults: UserDefaults{
339-
DisableOnlyOfficeExt: ".txt .csv .html .pdf",
340-
StickySidebar: true,
341-
LockPassword: false,
342-
ShowHidden: false,
343-
DarkMode: true,
344-
DisableSettings: false,
345-
ViewMode: "normal",
346-
Locale: "en",
347-
GallerySize: 3,
348-
ThemeColor: "var(--blue)",
339+
StickySidebar: true,
340+
LockPassword: false,
341+
ShowHidden: false,
342+
DarkMode: true,
343+
DisableSettings: false,
344+
ViewMode: "normal",
345+
Locale: "en",
346+
GallerySize: 3,
347+
ThemeColor: "var(--blue)",
349348
Permissions: users.Permissions{
350349
Modify: false,
351350
Share: false,

backend/common/settings/settings.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func ApplyUserDefaults(u *users.User) {
4949
u.Preview = Config.UserDefaults.Preview
5050
u.ShowHidden = Config.UserDefaults.ShowHidden
5151
u.DateFormat = Config.UserDefaults.DateFormat
52-
u.DisableOnlyOfficeExt = Config.UserDefaults.DisableOnlyOfficeExt
52+
u.DisableViewingExt = Config.UserDefaults.DisableViewingExt
5353
u.ThemeColor = Config.UserDefaults.ThemeColor
5454
u.GallerySize = Config.UserDefaults.GallerySize
5555
u.QuickDownload = Config.UserDefaults.QuickDownload

backend/common/settings/structs.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ type UserDefaults struct {
135135
GallerySize int `json:"gallerySize"` // 0-9 - the size of the gallery thumbnails
136136
ThemeColor string `json:"themeColor"` // theme color to use: eg. #ff0000, or var(--red), var(--purple), etc
137137
QuickDownload bool `json:"quickDownload"` // show icon to download in one click
138-
DisableOnlyOfficeExt string `json:"disableOnlyOfficeExt"` // comma separated list of file extensions to disable onlyoffice preview for
139-
DisableOfficePreviewExt string `json:"disableOfficePreviewExt"` // comma separated list of file extensions to disable office preview for
138+
DisablePreviewExt string `json:"disablePreviewExt"` // comma separated list of file extensions to disable preview for
139+
DisableViewingExt string `json:"disableViewingExt"` // comma separated list of file extensions to disable viewing for
140140
LockPassword bool `json:"lockPassword"` // disable the user from changing their password
141141
DisableSettings bool `json:"disableSettings,omitempty"` // disable the user from viewing the settings page
142142
Preview users.Preview `json:"preview"`
@@ -146,4 +146,6 @@ type UserDefaults struct {
146146
DisableUpdateNotifications bool `json:"disableUpdateNotifications"` // disable update notifications banner for admin users
147147
DeleteWithoutConfirming bool `json:"deleteWithoutConfirming"` // delete files without confirmation
148148
FileLoading users.FileLoading `json:"fileLoading"` // upload and download settings
149+
DisableOfficePreviewExt string `json:"disableOfficePreviewExt"` // deprecated: use disablePreviewExt instead
150+
DisableOnlyOfficeExt string `json:"disableOnlyOfficeExt"` // list of file extensions to disable onlyoffice editor for
149151
}

backend/database/users/users.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,12 @@ type NonAdminEditable struct {
9595
GallerySize int `json:"gallerySize"` // 0-9 - the size of the gallery thumbnails
9696
ThemeColor string `json:"themeColor"` // theme color to use: eg. #ff0000, or var(--red), var(--purple), etc
9797
QuickDownload bool `json:"quickDownload"` // show icon to download in one click
98-
DisableOnlyOfficeExt string `json:"disableOnlyOfficeExt"` // comma separated list of file extensions to disable onlyoffice preview for
99-
DisableOfficePreviewExt string `json:"disableOfficePreviewExt"` // comma separated list of file extensions to disable office preview for
10098
DisableUpdateNotifications bool `json:"disableUpdateNotifications"` // disable update notifications
10199
FileLoading FileLoading `json:"fileLoading"` // upload and download settings
100+
DisableOfficePreviewExt string `json:"disableOfficePreviewExt"` // deprecated
101+
DisableOnlyOfficeExt string `json:"disableOnlyOfficeExt"` // deprecated
102+
DisablePreviewExt string `json:"disablePreviewExt"` // comma separated list of file extensions to disable preview for
103+
DisableViewingExt string `json:"disableViewingExt"` // comma separated list of file extensions to disable viewing for
102104
}
103105

104106
type FileLoading struct {

backend/indexing/indexingSchedule.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ func (idx *Index) RunIndexing(origin string, quick bool) {
160160
logger.Debugf("Time spent indexing [%v]: %v seconds", idx.Name, idx.QuickScanTime)
161161
} else {
162162
idx.FullScanTime = int(time.Since(startTime).Seconds())
163-
idx.mu.Lock()
164-
idx.DiskUsed = idx.totalSize
165-
idx.mu.Unlock()
166163
// update smart indexing
167164
if idx.FullScanTime < 3 || idx.NumDirs < 10000 {
168165
idx.Assessment = "simple"

backend/swagger/docs/docs.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,11 +2540,15 @@ const docTemplate = `{
25402540
"type": "boolean"
25412541
},
25422542
"disableOfficePreviewExt": {
2543-
"description": "comma separated list of file extensions to disable office preview for",
2543+
"description": "deprecated: use disablePreviewExt instead",
25442544
"type": "string"
25452545
},
25462546
"disableOnlyOfficeExt": {
2547-
"description": "comma separated list of file extensions to disable onlyoffice preview for",
2547+
"description": "list of file extensions to disable onlyoffice editor for",
2548+
"type": "string"
2549+
},
2550+
"disablePreviewExt": {
2551+
"description": "comma separated list of file extensions to disable preview for",
25482552
"type": "string"
25492553
},
25502554
"disableQuickToggles": {
@@ -2563,6 +2567,10 @@ const docTemplate = `{
25632567
"description": "disable update notifications banner for admin users",
25642568
"type": "boolean"
25652569
},
2570+
"disableViewingExt": {
2571+
"description": "comma separated list of file extensions to disable viewing for",
2572+
"type": "string"
2573+
},
25662574
"editorQuickSave": {
25672575
"description": "show quick save button in editor",
25682576
"type": "boolean"
@@ -2802,11 +2810,15 @@ const docTemplate = `{
28022810
"type": "boolean"
28032811
},
28042812
"disableOfficePreviewExt": {
2805-
"description": "comma separated list of file extensions to disable office preview for",
2813+
"description": "deprecated",
28062814
"type": "string"
28072815
},
28082816
"disableOnlyOfficeExt": {
2809-
"description": "comma separated list of file extensions to disable onlyoffice preview for",
2817+
"description": "deprecated",
2818+
"type": "string"
2819+
},
2820+
"disablePreviewExt": {
2821+
"description": "comma separated list of file extensions to disable preview for",
28102822
"type": "string"
28112823
},
28122824
"disableQuickToggles": {
@@ -2824,6 +2836,10 @@ const docTemplate = `{
28242836
"description": "disable update notifications",
28252837
"type": "boolean"
28262838
},
2839+
"disableViewingExt": {
2840+
"description": "comma separated list of file extensions to disable viewing for",
2841+
"type": "string"
2842+
},
28272843
"editorQuickSave": {
28282844
"description": "show quick save button in editor",
28292845
"type": "boolean"

backend/swagger/docs/swagger.json

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2529,11 +2529,15 @@
25292529
"type": "boolean"
25302530
},
25312531
"disableOfficePreviewExt": {
2532-
"description": "comma separated list of file extensions to disable office preview for",
2532+
"description": "deprecated: use disablePreviewExt instead",
25332533
"type": "string"
25342534
},
25352535
"disableOnlyOfficeExt": {
2536-
"description": "comma separated list of file extensions to disable onlyoffice preview for",
2536+
"description": "list of file extensions to disable onlyoffice editor for",
2537+
"type": "string"
2538+
},
2539+
"disablePreviewExt": {
2540+
"description": "comma separated list of file extensions to disable preview for",
25372541
"type": "string"
25382542
},
25392543
"disableQuickToggles": {
@@ -2552,6 +2556,10 @@
25522556
"description": "disable update notifications banner for admin users",
25532557
"type": "boolean"
25542558
},
2559+
"disableViewingExt": {
2560+
"description": "comma separated list of file extensions to disable viewing for",
2561+
"type": "string"
2562+
},
25552563
"editorQuickSave": {
25562564
"description": "show quick save button in editor",
25572565
"type": "boolean"
@@ -2791,11 +2799,15 @@
27912799
"type": "boolean"
27922800
},
27932801
"disableOfficePreviewExt": {
2794-
"description": "comma separated list of file extensions to disable office preview for",
2802+
"description": "deprecated",
27952803
"type": "string"
27962804
},
27972805
"disableOnlyOfficeExt": {
2798-
"description": "comma separated list of file extensions to disable onlyoffice preview for",
2806+
"description": "deprecated",
2807+
"type": "string"
2808+
},
2809+
"disablePreviewExt": {
2810+
"description": "comma separated list of file extensions to disable preview for",
27992811
"type": "string"
28002812
},
28012813
"disableQuickToggles": {
@@ -2813,6 +2825,10 @@
28132825
"description": "disable update notifications",
28142826
"type": "boolean"
28152827
},
2828+
"disableViewingExt": {
2829+
"description": "comma separated list of file extensions to disable viewing for",
2830+
"type": "string"
2831+
},
28162832
"editorQuickSave": {
28172833
"description": "show quick save button in editor",
28182834
"type": "boolean"

backend/swagger/docs/swagger.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,13 @@ definitions:
526526
description: delete files without confirmation
527527
type: boolean
528528
disableOfficePreviewExt:
529-
description: comma separated list of file extensions to disable office preview
530-
for
529+
description: 'deprecated: use disablePreviewExt instead'
531530
type: string
532531
disableOnlyOfficeExt:
533-
description: comma separated list of file extensions to disable onlyoffice
534-
preview for
532+
description: list of file extensions to disable onlyoffice editor for
533+
type: string
534+
disablePreviewExt:
535+
description: comma separated list of file extensions to disable preview for
535536
type: string
536537
disableQuickToggles:
537538
description: disable the quick toggles in the sidebar
@@ -545,6 +546,9 @@ definitions:
545546
disableUpdateNotifications:
546547
description: disable update notifications banner for admin users
547548
type: boolean
549+
disableViewingExt:
550+
description: comma separated list of file extensions to disable viewing for
551+
type: string
548552
editorQuickSave:
549553
description: show quick save button in editor
550554
type: boolean
@@ -717,12 +721,13 @@ definitions:
717721
description: delete files without confirmation
718722
type: boolean
719723
disableOfficePreviewExt:
720-
description: comma separated list of file extensions to disable office preview
721-
for
724+
description: deprecated
722725
type: string
723726
disableOnlyOfficeExt:
724-
description: comma separated list of file extensions to disable onlyoffice
725-
preview for
727+
description: deprecated
728+
type: string
729+
disablePreviewExt:
730+
description: comma separated list of file extensions to disable preview for
726731
type: string
727732
disableQuickToggles:
728733
description: disable the quick toggles in the sidebar
@@ -735,6 +740,9 @@ definitions:
735740
disableUpdateNotifications:
736741
description: disable update notifications
737742
type: boolean
743+
disableViewingExt:
744+
description: comma separated list of file extensions to disable viewing for
745+
type: string
738746
editorQuickSave:
739747
description: show quick save button in editor
740748
type: boolean

0 commit comments

Comments
 (0)