diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index e5c3165f..42ae7c60 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
- go-version: 1.18.3
+ go-version: 1.20.1
- run: make lint-backend
lint-commits:
runs-on: ubuntu-latest
@@ -57,7 +57,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
- go-version: 1.18.3
+ go-version: 1.20.1
- run: make test-backend
test:
runs-on: ubuntu-latest
@@ -76,7 +76,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
- go-version: 1.18.3
+ go-version: 1.20.1
- uses: actions/setup-node@v2
with:
node-version: '16'
diff --git a/cmd/config.go b/cmd/config.go
index c94b1ba9..4287f3c2 100644
--- a/cmd/config.go
+++ b/cmd/config.go
@@ -45,6 +45,7 @@ func addConfigFlags(flags *pflag.FlagSet) {
flags.String("branding.color", "", "set the theme color")
flags.String("branding.files", "", "path to directory with images and custom styles")
flags.Bool("branding.disableExternal", false, "disable external links such as GitHub links")
+ flags.Bool("branding.disableUsedPercentage", false, "disable used disk percentage graph")
}
//nolint:gocyclo
@@ -147,6 +148,7 @@ func printSettings(ser *settings.Server, set *settings.Settings, auther auth.Aut
fmt.Fprintf(w, "\tName:\t%s\n", set.Branding.Name)
fmt.Fprintf(w, "\tFiles override:\t%s\n", set.Branding.Files)
fmt.Fprintf(w, "\tDisable external links:\t%t\n", set.Branding.DisableExternal)
+ fmt.Fprintf(w, "\tDisable used disk percentage graph:\t%t\n", set.Branding.DisableUsedPercentage)
fmt.Fprintf(w, "\tColor:\t%s\n", set.Branding.Color)
fmt.Fprintln(w, "\nServer:")
fmt.Fprintf(w, "\tLog:\t%s\n", ser.Log)
diff --git a/cmd/config_init.go b/cmd/config_init.go
index 12b11688..7848e706 100644
--- a/cmd/config_init.go
+++ b/cmd/config_init.go
@@ -35,9 +35,10 @@ override the options.`,
AuthMethod: authMethod,
Defaults: defaults,
Branding: settings.Branding{
- Name: mustGetString(flags, "branding.name"),
- DisableExternal: mustGetBool(flags, "branding.disableExternal"),
- Files: mustGetString(flags, "branding.files"),
+ Name: mustGetString(flags, "branding.name"),
+ DisableExternal: mustGetBool(flags, "branding.disableExternal"),
+ DisableUsedPercentage: mustGetBool(flags, "branding.DisableUsedPercentage"),
+ Files: mustGetString(flags, "branding.files"),
},
}
diff --git a/cmd/config_set.go b/cmd/config_set.go
index 058f0d6b..5a02288f 100644
--- a/cmd/config_set.go
+++ b/cmd/config_set.go
@@ -55,6 +55,8 @@ you want to change. Other options will remain unchanged.`,
set.Branding.Color = mustGetString(flags, flag.Name)
case "branding.disableExternal":
set.Branding.DisableExternal = mustGetBool(flags, flag.Name)
+ case "branding.disableUsedPercentage":
+ set.Branding.DisableUsedPercentage = mustGetBool(flags, flag.Name)
case "branding.files":
set.Branding.Files = mustGetString(flags, flag.Name)
}
diff --git a/cmd/root.go b/cmd/root.go
index 5b314b61..4674d168 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -181,6 +181,7 @@ user created with the credentials from options "username" and "password".`,
defer listener.Close()
log.Println("Listening on", listener.Addr().String())
+ //nolint: gosec
if err := http.Serve(listener, handler); err != nil {
log.Fatal(err)
}
diff --git a/cmd/users.go b/cmd/users.go
index 495c293d..894a162c 100644
--- a/cmd/users.go
+++ b/cmd/users.go
@@ -53,7 +53,7 @@ func printUsers(usrs []*users.User) {
}
func parseUsernameOrID(arg string) (username string, id uint) {
- id64, err := strconv.ParseUint(arg, 10, 64) //nolint:gomnd
+ id64, err := strconv.ParseUint(arg, 10, 64)
if err != nil {
return arg, 0
}
diff --git a/common.mk b/common.mk
index 84c6175b..206fc750 100644
--- a/common.mk
+++ b/common.mk
@@ -1,4 +1,4 @@
-SHELL := /bin/bash
+SHELL := /usr/bin/env bash
DATE ?= $(shell date +%FT%T%z)
BASE_PATH := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
VERSION ?= $(shell git describe --tags --always --match=v* 2> /dev/null || \
@@ -25,4 +25,4 @@ RESET := $(shell tput -Txterm sgr0)
define global_option
printf " ${YELLOW}%-20s${GREEN}%s${RESET}\n" $(1) $(2)
-endef
\ No newline at end of file
+endef
diff --git a/files/file.go b/files/file.go
index 2d96d4c5..1daf384b 100644
--- a/files/file.go
+++ b/files/file.go
@@ -198,8 +198,9 @@ func (i *FileInfo) RealPath() string {
return i.Path
}
+// TODO: use constants
+//
//nolint:goconst
-//TODO: use constants
func (i *FileInfo) detectType(modify, saveContent, readHeader bool) error {
if IsNamedPipe(i.Mode) {
i.Type = "blob"
diff --git a/files/listing.go b/files/listing.go
index 448d7e9c..f35ad8cb 100644
--- a/files/listing.go
+++ b/files/listing.go
@@ -16,6 +16,7 @@ type Listing struct {
}
// ApplySort applies the sort order using .Order and .Sort
+//
//nolint:goconst
func (l Listing) ApplySort() {
// Check '.Order' to know how to sort
diff --git a/frontend/src/components/Sidebar.vue b/frontend/src/components/Sidebar.vue
index a3f4c3ae..4394f55a 100644
--- a/frontend/src/components/Sidebar.vue
+++ b/frontend/src/components/Sidebar.vue
@@ -82,7 +82,9 @@
@@ -116,6 +118,7 @@ import {
version,
signup,
disableExternal,
+ disableUsedPercentage,
noAuth,
loginPage,
} from "@/utils/constants";
@@ -137,6 +140,7 @@ export default {
signup: () => signup,
version: () => version,
disableExternal: () => disableExternal,
+ disableUsedPercentage: () => disableUsedPercentage,
canLogout: () => !noAuth && loginPage,
},
asyncComputed: {
@@ -146,6 +150,9 @@ export default {
? this.$route.path
: this.$route.path + "/";
let usageStats = { used: 0, total: 0, usedPercentage: 0 };
+ if (this.disableUsedPercentage) {
+ return usageStats;
+ }
try {
let usage = await api.usage(path);
usageStats = {
diff --git a/frontend/src/components/prompts/Share.vue b/frontend/src/components/prompts/Share.vue
index 210b2f93..c0c3c083 100644
--- a/frontend/src/components/prompts/Share.vue
+++ b/frontend/src/components/prompts/Share.vue
@@ -32,6 +32,16 @@
content_paste
+
+
+ |
|