From 265b81a52b6f27e3280e66de643ad89ad629a94a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2019 11:14:41 +0000 Subject: [PATCH 01/13] chore(deps): bump github.com/spf13/viper from 1.5.0 to 1.6.1 Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.5.0 to 1.6.1. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](https://github.com/spf13/viper/compare/v1.5.0...v1.6.1) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index ef13115d..93c5e75c 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/spf13/cobra v0.0.5 github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.5.0 + github.com/spf13/viper v1.6.1 github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect diff --git a/go.sum b/go.sum index aef332f4..6940aa82 100644 --- a/go.sum +++ b/go.sum @@ -74,6 +74,7 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= @@ -97,6 +98,7 @@ github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGAR github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a/go.mod h1:wK6yTYYcgjHE1Z1QtXACPDjcFJyBskHEdagmnq3vsP8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -168,6 +170,8 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/russross/blackfriday v0.0.0-20170610170232-067529f716f4/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= @@ -192,6 +196,8 @@ github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.5.0 h1:GpsTwfsQ27oS/Aha/6d1oD7tpKIqWnOA6tgOX9HHkt4= github.com/spf13/viper v1.5.0/go.mod h1:AkYRkVJF8TkSG/xet6PzXX+l39KhhXa2pdqVSxnTcn4= +github.com/spf13/viper v1.6.1 h1:VPZzIkznI1YhVMRi6vNFLHSwhnhReBfgTxIPccpfdZk= +github.com/spf13/viper v1.6.1/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= @@ -276,6 +282,7 @@ golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4c= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -287,6 +294,8 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/mcuadros/go-syslog.v2 v2.2.1/go.mod h1:l5LPIyOOyIdQquNg+oU6Z3524YwrcqEm0aKH+5zpt2U= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= From cc7ec4f0c5688b3ee0639c6f702975da49541104 Mon Sep 17 00:00:00 2001 From: Ramires Viana Date: Sun, 5 Jan 2020 18:28:17 +0000 Subject: [PATCH 02/13] Fix multiple selection --- files/listing.go | 4 ++-- frontend/src/components/files/ListingItem.vue | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/listing.go b/files/listing.go index d09f67e1..ad60e51e 100644 --- a/files/listing.go +++ b/files/listing.go @@ -62,11 +62,11 @@ func (l byName) Swap(i, j int) { // Treat upper and lower case equally func (l byName) Less(i, j int) bool { if l.Items[i].IsDir && !l.Items[j].IsDir { - return true + return l.Sorting.Asc } if !l.Items[i].IsDir && l.Items[j].IsDir { - return false + return !l.Sorting.Asc } return natural.Less(strings.ToLower(l.Items[j].Name), strings.ToLower(l.Items[i].Name)) diff --git a/frontend/src/components/files/ListingItem.vue b/frontend/src/components/files/ListingItem.vue index 2cb03b2b..8c70d54d 100644 --- a/frontend/src/components/files/ListingItem.vue +++ b/frontend/src/components/files/ListingItem.vue @@ -129,7 +129,7 @@ export default { return } - if (event.shiftKey && this.selected.length === 1) { + if (event.shiftKey) { let fi = 0 let la = 0 From 55a9d945cc62a0fbd786970d394dcf5f307359fa Mon Sep 17 00:00:00 2001 From: Ramires Viana Date: Thu, 2 Jan 2020 00:48:48 +0000 Subject: [PATCH 03/13] Add dark theme --- frontend/public/index.html | 3 + frontend/public/themes/dark.css | 140 ++++++++++++++++++++ frontend/src/components/files/Editor.vue | 5 + frontend/src/components/settings/Themes.vue | 18 +++ frontend/src/i18n/en.json | 5 + frontend/src/utils/constants.js | 4 +- frontend/src/views/settings/Global.vue | 7 + http/static.go | 1 + settings/branding.go | 1 + 9 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 frontend/public/themes/dark.css create mode 100644 frontend/src/components/settings/Themes.vue diff --git a/frontend/public/index.html b/frontend/public/index.html index f360bc86..4999b7a6 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -133,6 +133,9 @@ + [{[ if .Theme -]}] + + [{[ end ]}] [{[ if .CSS -]}] [{[ end ]}] diff --git a/frontend/public/themes/dark.css b/frontend/public/themes/dark.css new file mode 100644 index 00000000..3fba1f70 --- /dev/null +++ b/frontend/public/themes/dark.css @@ -0,0 +1,140 @@ +:root { + --background: #121212; + --surfacePrimary: #171819; + --surfaceSecondary: #212528; + --divider: rgba(255, 255, 255, 0.12); + --icon: #ffffff; + --textPrimary: rgba(255, 255, 255, 0.87); + --textSecondary: rgba(255, 255, 255, 0.6); +} + +body { + background: var(--background); + color: var(--textPrimary); +} + +#loading { + background: var(--background); +} +#loading .spinner div { + background: var(--icon); +} + +#login { + background: var(--background); +} + +header { + background: var(--surfacePrimary); +} + +#search #input { + background: var(--surfaceSecondary); +} +#search.active #input, +#search.active .boxes { + background: var(--surfacePrimary); +} +#search.active input { + color: var(--textPrimary); +} +#search.active #result { + background: var(--background); + color: var(--textPrimary); +} +#search.active .boxes h3 { + color: var(--textPrimary); +} + +.action { + color: var(--textPrimary) !important; +} +.action i { + color: var(--icon) !important; +} +.action .counter { + border-color: var(--surfacePrimary); +} + +nav > div { + border-color: var(--divider); +} + +#breadcrumbs { + border-color: var(--divider); + color: var(--textPrimary) !important; +} +#breadcrumbs span { + color: var(--textPrimary) !important; +} + +#listing .item { + background: var(--surfacePrimary); + color: var(--textPrimary); + border-color: var(--divider) !important; +} +#listing .item i { + color: var(--icon); +} +#listing .item .modified { + color: var(--textSecondary); +} +#listing h2, +#listing.list .header span { + color: var(--textPrimary) !important; +} +#listing.list .header span { + color: var(--textPrimary); +} +#listing.list .header i { + color: var(--icon); +} +#listing.list .item.header { + background: var(--background); +} + +.card { + background: var(--surfacePrimary); + color: var(--textPrimary); +} +.button--flat:hover { + background: var(--surfaceSecondary); +} + +.card h3, +.dashboard #nav, +.dashboard p label { + color: var(--textPrimary); +} +.input { + background: var(--surfaceSecondary); + color: var(--textPrimary); +} + +.dashboard #nav li, +.collapsible { + border-color: var(--divider); +} +.collapsible > label * { + color: var(--textPrimary); +} + +.shell { + background: var(--surfacePrimary); + color: var(--textPrimary); +} + +@media (max-width: 736px) { + #file-selection { + background: var(--surfaceSecondary) !important; + } + #file-selection span { + color: var(--textPrimary) !important; + } + nav { + background: var(--surfaceSecondary) !important; + } + #dropdown { + background: var(--surfaceSecondary) !important; + } +} diff --git a/frontend/src/components/files/Editor.vue b/frontend/src/components/files/Editor.vue index 6d87a5c8..ce31348e 100644 --- a/frontend/src/components/files/Editor.vue +++ b/frontend/src/components/files/Editor.vue @@ -10,6 +10,7 @@ import buttons from '@/utils/buttons' import ace from 'ace-builds/src-min-noconflict/ace.js' import modelist from 'ace-builds/src-min-noconflict/ext-modelist.js' import 'ace-builds/webpack-resolver' +import { theme } from '@/utils/constants' export default { name: 'editor', @@ -45,6 +46,10 @@ export default { mode: modelist.getModeForPath(this.req.name).mode, wrap: true }) + + if (theme == 'dark') { + this.editor.setTheme("ace/theme/twilight"); + } }, methods: { keyEvent (event) { diff --git a/frontend/src/components/settings/Themes.vue b/frontend/src/components/settings/Themes.vue new file mode 100644 index 00000000..48a663bd --- /dev/null +++ b/frontend/src/components/settings/Themes.vue @@ -0,0 +1,18 @@ + + + \ No newline at end of file diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index f0752511..f42be526 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -119,6 +119,11 @@ "newArchetype": "Create a new post based on an archetype. Your file will be created on content folder." }, "settings": { + "themes": { + "title": "Theme", + "light": "Light", + "dark": "Dark" + }, "instanceName": "Instance name", "brandingDirectoryPath": "Branding directory path", "documentation": "documentation", diff --git a/frontend/src/utils/constants.js b/frontend/src/utils/constants.js index 306f460d..b4a5a5be 100644 --- a/frontend/src/utils/constants.js +++ b/frontend/src/utils/constants.js @@ -9,6 +9,7 @@ const version = window.FileBrowser.Version const logoURL = `/${staticURL}/img/logo.svg` const noAuth = window.FileBrowser.NoAuth const loginPage = window.FileBrowser.LoginPage +const theme = window.FileBrowser.Theme export { name, @@ -20,5 +21,6 @@ export { signup, version, noAuth, - loginPage + loginPage, + theme } diff --git a/frontend/src/views/settings/Global.vue b/frontend/src/views/settings/Global.vue index bd642359..a0fbfa8a 100644 --- a/frontend/src/views/settings/Global.vue +++ b/frontend/src/views/settings/Global.vue @@ -29,6 +29,11 @@ {{ $t('settings.disableExternalLinks') }}

+

+ + +

+

@@ -98,10 +103,12 @@ import { mapState } from 'vuex' import { settings as api } from '@/api' import UserForm from '@/components/settings/UserForm' import Rules from '@/components/settings/Rules' +import Themes from '@/components/settings/Themes' export default { name: 'settings', components: { + Themes, UserForm, Rules }, diff --git a/http/static.go b/http/static.go index 29239a5f..104f2d09 100644 --- a/http/static.go +++ b/http/static.go @@ -37,6 +37,7 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *data, box * "LoginPage": auther.LoginPage(), "CSS": false, "ReCaptcha": false, + "Theme": d.settings.Branding.Theme, } if d.settings.Branding.Files != "" { diff --git a/settings/branding.go b/settings/branding.go index 8a835b1d..68404bbb 100644 --- a/settings/branding.go +++ b/settings/branding.go @@ -5,4 +5,5 @@ type Branding struct { Name string `json:"name"` DisableExternal bool `json:"disableExternal"` Files string `json:"files"` + Theme string `json:"theme"` } From cb98c913d4a9e60482bd616af252212220bc05a8 Mon Sep 17 00:00:00 2001 From: Alexey Larkov Date: Thu, 2 Jan 2020 17:18:36 +0200 Subject: [PATCH 04/13] Allow request manifest through reverse proxy with authentication --- frontend/public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/public/index.html b/frontend/public/index.html index 4999b7a6..ba18daa2 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -14,7 +14,7 @@ - + From cec551c3de0d333dbdf6fc19e2b03e63e701de8e Mon Sep 17 00:00:00 2001 From: Hadrien Dorio Date: Tue, 3 Dec 2019 05:59:37 +0000 Subject: [PATCH 05/13] fix(docker): Add mime.types file Uses the package mailcap from alpine as a source for /etc/mime.types which is required by golang.org/pkg/mime on unix systems. --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 93fe7e50..549bd136 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ -FROM alpine:latest as certs +FROM alpine:latest as alpine RUN apk --update add ca-certificates +RUN apk --update add mailcap FROM scratch -COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=alpine /etc/mime.types /etc/mime.types VOLUME /srv EXPOSE 80 From 897ac7528137dc395357db52c103498d995fbf05 Mon Sep 17 00:00:00 2001 From: freedomlang Date: Thu, 5 Dec 2019 17:14:44 +0800 Subject: [PATCH 06/13] refactor: Use v-for for language option --- .../src/components/settings/Languages.vue | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/frontend/src/components/settings/Languages.vue b/frontend/src/components/settings/Languages.vue index f07d4f85..ad11a60a 100644 --- a/frontend/src/components/settings/Languages.vue +++ b/frontend/src/components/settings/Languages.vue @@ -1,30 +1,38 @@