mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
commit
608a0015ee
@ -1,3 +1,3 @@
|
||||
*
|
||||
!.docker.json
|
||||
!docker/*
|
||||
!filebrowser
|
58
.github/workflows/main.yaml
vendored
58
.github/workflows/main.yaml
vendored
@ -9,29 +9,63 @@ on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
# linters
|
||||
lint-frontend:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- run: make lint-frontend
|
||||
lint-backend:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
- run: make lint-backend
|
||||
lint-commints:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- run: make lint-commits
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint-frontend, lint-backend, lint-commints]
|
||||
steps:
|
||||
- run: echo "done"
|
||||
|
||||
# tests
|
||||
test-frontend:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- run: npm i -g commitlint
|
||||
- run: make lint
|
||||
test:
|
||||
- run: make test-frontend
|
||||
test-backend:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- run: make test
|
||||
go-version: 1.17
|
||||
- run: make test-backend
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test-frontend, test-backend]
|
||||
steps:
|
||||
- run: echo "done"
|
||||
|
||||
# release
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test]
|
||||
@ -42,7 +76,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16
|
||||
go-version: 1.17
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,11 +1,11 @@
|
||||
*.db
|
||||
*.lock
|
||||
*.bak
|
||||
_old
|
||||
rice-box.go
|
||||
.idea/
|
||||
filebrowser
|
||||
filebrowser.exe
|
||||
/filebrowser
|
||||
/filebrowser.exe
|
||||
/dist
|
||||
|
||||
.DS_Store
|
||||
node_modules
|
||||
|
@ -41,7 +41,7 @@ archives:
|
||||
dockers:
|
||||
-
|
||||
dockerfile: Dockerfile
|
||||
use_buildx: true
|
||||
use: buildx
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
@ -56,10 +56,10 @@ dockers:
|
||||
- "filebrowser/filebrowser:{{ .Tag }}-amd64"
|
||||
- "filebrowser/filebrowser:v{{ .Major }}-amd64"
|
||||
extra_files:
|
||||
- .docker.json
|
||||
- docker/root
|
||||
-
|
||||
dockerfile: Dockerfile
|
||||
use_buildx: true
|
||||
dockerfile: Dockerfile.aarch64
|
||||
use: buildx
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
@ -74,10 +74,10 @@ dockers:
|
||||
- "filebrowser/filebrowser:{{ .Tag }}-arm64"
|
||||
- "filebrowser/filebrowser:v{{ .Major }}-arm64"
|
||||
extra_files:
|
||||
- .docker.json
|
||||
- docker/root
|
||||
-
|
||||
dockerfile: Dockerfile
|
||||
use_buildx: true
|
||||
dockerfile: Dockerfile.armhf
|
||||
use: buildx
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
@ -93,10 +93,10 @@ dockers:
|
||||
- "filebrowser/filebrowser:{{ .Tag }}-armv6"
|
||||
- "filebrowser/filebrowser:v{{ .Major }}-armv6"
|
||||
extra_files:
|
||||
- .docker.json
|
||||
- docker/root
|
||||
-
|
||||
dockerfile: Dockerfile
|
||||
use_buildx: true
|
||||
dockerfile: Dockerfile.armhf
|
||||
use: buildx
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
@ -112,7 +112,7 @@ dockers:
|
||||
- "filebrowser/filebrowser:{{ .Tag }}-armv7"
|
||||
- "filebrowser/filebrowser:v{{ .Major }}-armv7"
|
||||
extra_files:
|
||||
- .docker.json
|
||||
- docker/root
|
||||
docker_manifests:
|
||||
- name_template: "filebrowser/filebrowser:latest"
|
||||
image_templates:
|
||||
|
15
Dockerfile
15
Dockerfile
@ -1,4 +1,5 @@
|
||||
FROM alpine:latest
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine:3.14
|
||||
|
||||
RUN apk --update add ca-certificates \
|
||||
mailcap \
|
||||
curl
|
||||
@ -6,10 +7,10 @@ RUN apk --update add ca-certificates \
|
||||
HEALTHCHECK --start-period=2s --interval=5s --timeout=3s \
|
||||
CMD curl -f http://localhost/health || exit 1
|
||||
|
||||
VOLUME /srv
|
||||
# copy local files
|
||||
COPY docker/root/ /
|
||||
COPY filebrowser /usr/bin/filebrowser
|
||||
|
||||
# ports and volumes
|
||||
VOLUME /srv /config /database
|
||||
EXPOSE 80
|
||||
|
||||
COPY .docker.json /.filebrowser.json
|
||||
COPY filebrowser /filebrowser
|
||||
|
||||
ENTRYPOINT [ "/filebrowser" ]
|
16
Dockerfile.aarch64
Normal file
16
Dockerfile.aarch64
Normal file
@ -0,0 +1,16 @@
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.14
|
||||
|
||||
RUN apk --update add ca-certificates \
|
||||
mailcap \
|
||||
curl
|
||||
|
||||
HEALTHCHECK --start-period=2s --interval=5s --timeout=3s \
|
||||
CMD curl -f http://localhost/health || exit 1
|
||||
|
||||
# copy local files
|
||||
COPY docker/root/ /
|
||||
COPY filebrowser /usr/bin/filebrowser
|
||||
|
||||
# ports and volumes
|
||||
VOLUME /srv /config /database
|
||||
EXPOSE 80
|
16
Dockerfile.armhf
Normal file
16
Dockerfile.armhf
Normal file
@ -0,0 +1,16 @@
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine:arm32v7-3.14
|
||||
|
||||
RUN apk --update add ca-certificates \
|
||||
mailcap \
|
||||
curl
|
||||
|
||||
HEALTHCHECK --start-period=2s --interval=5s --timeout=3s \
|
||||
CMD curl -f http://localhost/health || exit 1
|
||||
|
||||
# copy local files
|
||||
COPY docker/root/ /
|
||||
COPY filebrowser /usr/bin/filebrowser
|
||||
|
||||
# ports and volumes
|
||||
VOLUME /srv /config /database
|
||||
EXPOSE 80
|
102
Makefile
102
Makefile
@ -1,94 +1,68 @@
|
||||
SHELL := /bin/bash
|
||||
BASE_PATH := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
VERSION ?= $(shell git describe --tags --always --match=v* 2> /dev/null || \
|
||||
cat $(CURDIR)/.version 2> /dev/null || echo v0)
|
||||
VERSION_HASH = $(shell git rev-parse HEAD)
|
||||
|
||||
BIN = $(BASE_PATH)/bin
|
||||
PATH := $(BIN):$(PATH)
|
||||
export PATH
|
||||
|
||||
# printing
|
||||
V = 0
|
||||
Q = $(if $(filter 1,$V),,@)
|
||||
M = $(shell printf "\033[34;1m▶\033[0m")
|
||||
|
||||
GO = GOGC=off go
|
||||
# go module
|
||||
MODULE = $(shell env GO111MODULE=on $(GO) list -m)
|
||||
|
||||
DATE ?= $(shell date +%FT%T%z)
|
||||
VERSION ?= $(shell git describe --tags --always --match=v* 2> /dev/null || \
|
||||
cat $(CURDIR)/.version 2> /dev/null || echo v0)
|
||||
VERSION_HASH = $(shell git rev-parse --short HEAD)
|
||||
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
|
||||
include common.mk
|
||||
include tools.mk
|
||||
|
||||
LDFLAGS += -X "$(MODULE)/version.Version=$(VERSION)" -X "$(MODULE)/version.CommitSHA=$(VERSION_HASH)"
|
||||
|
||||
# tools
|
||||
$(BIN):
|
||||
@mkdir -p $@
|
||||
$(BIN)/%: | $(BIN) ; $(info $(M) installing $(PACKAGE)…)
|
||||
$Q env GOBIN=$(BIN) $(GO) install $(PACKAGE)
|
||||
## Build:
|
||||
|
||||
GOLANGCI_LINT = $(BIN)/golangci-lint
|
||||
$(BIN)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint@v1.41.1
|
||||
|
||||
GOIMPORTS = $(BIN)/goimports
|
||||
$(BIN)/goimports: PACKAGE=golang.org/x/tools/cmd/goimports@v0.1.5
|
||||
|
||||
## build: Build
|
||||
.PHONY: build
|
||||
build: | build-frontend build-backend ; $(info $(M) building…)
|
||||
build: | build-frontend build-backend ## Build binary
|
||||
|
||||
## build-frontend: Build frontend
|
||||
.PHONY: build-frontend
|
||||
build-frontend: | ; $(info $(M) building frontend…)
|
||||
build-frontend: ## Build frontend
|
||||
$Q cd frontend && npm ci && npm run build
|
||||
|
||||
## build-backend: Build backend
|
||||
.PHONY: build-backend
|
||||
build-backend: | ; $(info $(M) building backend…)
|
||||
$Q $(GO) build -ldflags '$(LDFLAGS)' -o .
|
||||
build-backend: ## Build backend
|
||||
$Q $(go) build -ldflags '$(LDFLAGS)' -o .
|
||||
|
||||
## test: Run all tests
|
||||
.PHONY: test
|
||||
test: | test-frontend test-backend ; $(info $(M) running tests…)
|
||||
test: | test-frontend test-backend ## Run all tests
|
||||
|
||||
## test-frontend: Run frontend tests
|
||||
.PHONY: test-frontend
|
||||
test-frontend: | ; $(info $(M) running frontend tests…)
|
||||
test-frontend: ## Run frontend tests
|
||||
|
||||
## test-backend: Run backend tests
|
||||
.PHONY: test-backend
|
||||
test-backend: | ; $(info $(M) running backend tests…)
|
||||
$Q $(GO) test -v ./...
|
||||
test-backend: ## Run backend tests
|
||||
$Q $(go) test -v ./...
|
||||
|
||||
## lint: Lint
|
||||
.PHONY: lint
|
||||
lint: lint-frontend lint-backend lint-commits | ; $(info $(M) running all linters…)
|
||||
lint: lint-frontend lint-backend lint-commits ## Run all linters
|
||||
|
||||
## lint-frontend: Lint frontend
|
||||
.PHONY: lint-frontend
|
||||
lint-frontend: | ; $(info $(M) running frontend linters…)
|
||||
lint-frontend: ## Run frontend linters
|
||||
$Q cd frontend && npm ci && npm run lint
|
||||
|
||||
## lint-backend: Lint backend
|
||||
.PHONY: lint-backend
|
||||
lint-backend: | $(GOLANGCI_LINT) ; $(info $(M) running backend linters…)
|
||||
$Q $(GOLANGCI_LINT) run
|
||||
lint-backend: | $(golangci-lint) ## Run backend linters
|
||||
$Q $(golangci-lint) run -v
|
||||
|
||||
## lint-commits: Lint commits
|
||||
.PHONY: lint-commits
|
||||
lint-commits: | ; $(info $(M) running commitlint…)
|
||||
lint-commits: $(commitlint) ## Run commit linters
|
||||
$Q ./scripts/commitlint.sh
|
||||
|
||||
## bump-version: Bump app version
|
||||
fmt: $(goimports) ## Format source files
|
||||
$Q $(goimports) -local $(MODULE) -w $$(find . -type f -name '*.go' -not -path "./vendor/*")
|
||||
|
||||
clean: clean-tools ## Clean
|
||||
|
||||
## Release:
|
||||
|
||||
.PHONY: bump-version
|
||||
bump-version: | ; $(info $(M) creating a new release…)
|
||||
bump-version: $(standard-version) ## Bump app version
|
||||
$Q ./scripts/bump_version.sh
|
||||
|
||||
## help: Show this help
|
||||
.PHONY: help
|
||||
help:
|
||||
@sed -n 's/^## //p' $(MAKEFILE_LIST) | column -t -s ':' | sed -e 's/^/ /' | sort
|
||||
## Help:
|
||||
help: ## Show this help
|
||||
@echo ''
|
||||
@echo 'Usage:'
|
||||
@echo ' ${YELLOW}make${RESET} ${GREEN}<target> [options]${RESET}'
|
||||
@echo ''
|
||||
@echo 'Options:'
|
||||
@$(call global_option, "V [0|1]", "enable verbose mode (default:0)")
|
||||
@echo ''
|
||||
@echo 'Targets:'
|
||||
@awk 'BEGIN {FS = ":.*?## "} { \
|
||||
if (/^[a-zA-Z_-]+:.*?##.*$$/) {printf " ${YELLOW}%-20s${GREEN}%s${RESET}\n", $$1, $$2} \
|
||||
else if (/^## .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \
|
||||
}' $(MAKEFILE_LIST)
|
@ -3,8 +3,8 @@ package cmd
|
||||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"io"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
@ -299,7 +299,7 @@ func setupLog(logMethod string) {
|
||||
case "stderr":
|
||||
log.SetOutput(os.Stderr)
|
||||
case "":
|
||||
log.SetOutput(ioutil.Discard)
|
||||
log.SetOutput(io.Discard)
|
||||
default:
|
||||
log.SetOutput(&lumberjack.Logger{
|
||||
Filename: logMethod,
|
||||
|
28
common.mk
Normal file
28
common.mk
Normal file
@ -0,0 +1,28 @@
|
||||
SHELL := /bin/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 || \
|
||||
cat $(CURDIR)/.version 2> /dev/null || echo v0)
|
||||
VERSION_HASH = $(shell git rev-parse HEAD)
|
||||
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
go = GOGC=off go
|
||||
MODULE = $(shell env GO111MODULE=on go list -m)
|
||||
|
||||
# printing
|
||||
# $Q (quiet) is used in the targets as a replacer for @.
|
||||
# This macro helps to print the command for debugging by setting V to 1. Example `make test-unit V=1`
|
||||
V = 0
|
||||
Q = $(if $(filter 1,$V),,@)
|
||||
# $M is a macro to print a colored ▶ character. Example `$(info $(M) running coverage tests…)` will print "▶ running coverage tests…"
|
||||
M = $(shell printf "\033[34;1m▶\033[0m")
|
||||
|
||||
GREEN := $(shell tput -Txterm setaf 2)
|
||||
YELLOW := $(shell tput -Txterm setaf 3)
|
||||
WHITE := $(shell tput -Txterm setaf 7)
|
||||
CYAN := $(shell tput -Txterm setaf 6)
|
||||
RESET := $(shell tput -Txterm sgr0)
|
||||
|
||||
define global_option
|
||||
printf " ${YELLOW}%-20s${GREEN}%s${RESET}\n" $(1) $(2)
|
||||
endef
|
@ -6,7 +6,7 @@ import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
@ -55,7 +55,7 @@ func (f *FileCache) Load(ctx context.Context, key string) (value []byte, exist b
|
||||
}
|
||||
defer r.Close()
|
||||
|
||||
value, err = ioutil.ReadAll(r)
|
||||
value, err = io.ReadAll(r)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
15
docker/root/etc/cont-init.d/20-config
Normal file
15
docker/root/etc/cont-init.d/20-config
Normal file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# make folders
|
||||
mkdir -p /database
|
||||
|
||||
# copy config
|
||||
if [ ! -f "/config/settings.json" ]; then
|
||||
cp -a /defaults/settings.json /config/settings.json
|
||||
fi
|
||||
|
||||
# permissions
|
||||
chown abc:abc \
|
||||
/config/settings.json \
|
||||
/database \
|
||||
/srv
|
3
docker/root/etc/services.d/filebrowser/run
Normal file
3
docker/root/etc/services.d/filebrowser/run
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
exec s6-setuidgid abc filebrowser -c /config/settings.json -d /database/filebrowser.db;
|
@ -1,3 +1,4 @@
|
||||
//go:build !dev
|
||||
// +build !dev
|
||||
|
||||
package frontend
|
||||
|
@ -1,3 +1,4 @@
|
||||
//go:build dev
|
||||
// +build dev
|
||||
|
||||
package frontend
|
||||
|
@ -5,7 +5,7 @@
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "find ./dist -maxdepth 1 -mindepth 1 ! -name '.gitignore' -exec rm -r {} + && vue-cli-service build --no-clean",
|
||||
"lint": "npx vue-cli-service lint --no-fix",
|
||||
"lint": "npx vue-cli-service lint --no-fix --max-warnings=0",
|
||||
"fix": "npx vue-cli-service lint",
|
||||
"watch": "find ./dist -maxdepth 1 -mindepth 1 ! -name '.gitignore' -exec rm -r {} + && vue-cli-service build --watch --no-clean"
|
||||
},
|
||||
|
@ -137,8 +137,8 @@
|
||||
>
|
||||
<i class="material-icons">chevron_right</i>
|
||||
</button>
|
||||
<link rel="prefetch" :href="previousRaw">
|
||||
<link rel="prefetch" :href="nextRaw">
|
||||
<link rel="prefetch" :href="previousRaw" />
|
||||
<link rel="prefetch" :href="nextRaw" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -320,13 +320,13 @@ export default {
|
||||
return;
|
||||
}
|
||||
},
|
||||
prefetchUrl: function(item) {
|
||||
prefetchUrl: function (item) {
|
||||
const key = Date.parse(item.modified);
|
||||
if (item.type === "image" && !this.fullSize) {
|
||||
return `${baseURL}/api/preview/big${item.path}?k=${key}&inline=true`;
|
||||
} else if (item.type === "image"){
|
||||
} else if (item.type === "image") {
|
||||
return `${baseURL}/api/raw${item.path}?k=${key}&inline=true`;
|
||||
} else{
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
|
@ -143,7 +143,12 @@ export default {
|
||||
singleClick: this.singleClick,
|
||||
dateFormat: this.dateFormat,
|
||||
};
|
||||
await api.update(data, ["locale", "hideDotfiles", "singleClick", "dateFormat"]);
|
||||
await api.update(data, [
|
||||
"locale",
|
||||
"hideDotfiles",
|
||||
"singleClick",
|
||||
"dateFormat",
|
||||
]);
|
||||
this.updateUser(data);
|
||||
this.$showSuccess(this.$t("settings.settingsUpdated"));
|
||||
} catch (e) {
|
||||
|
51
go.mod
51
go.mod
@ -1,42 +1,69 @@
|
||||
module github.com/filebrowser/filebrowser/v2
|
||||
|
||||
go 1.16
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/DataDog/zstd v1.4.0 // indirect
|
||||
github.com/Sereal/Sereal v0.0.0-20190430203904-6faf9605eb56 // indirect
|
||||
github.com/asdine/storm v2.1.2+incompatible
|
||||
github.com/caddyserver/caddy v1.0.3
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/disintegration/imaging v1.6.2
|
||||
github.com/dsnet/compress v0.0.1 // indirect
|
||||
github.com/dsoprea/go-exif/v3 v3.0.0-20201216222538-db167117f483
|
||||
github.com/golang/snappy v0.0.1 // indirect
|
||||
github.com/gorilla/mux v1.7.3
|
||||
github.com/gorilla/websocket v1.4.1
|
||||
github.com/maruel/natural v0.0.0-20180416170133-dbcb3e2e8cf1
|
||||
github.com/marusama/semaphore/v2 v2.4.1
|
||||
github.com/mholt/archiver v3.1.1+incompatible
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/nwaples/rardecode v1.0.0 // indirect
|
||||
github.com/pelletier/go-toml v1.6.0
|
||||
github.com/pierrec/lz4 v0.0.0-20190131084431-473cd7ce01a1 // indirect
|
||||
github.com/spf13/afero v1.2.2
|
||||
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.6.1
|
||||
github.com/stretchr/testify 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
|
||||
go.etcd.io/bbolt v1.3.3
|
||||
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37
|
||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0
|
||||
gopkg.in/yaml.v2 v2.3.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/DataDog/zstd v1.4.0 // indirect
|
||||
github.com/Sereal/Sereal v0.0.0-20190430203904-6faf9605eb56 // indirect
|
||||
github.com/cenkalti/backoff v2.1.1+incompatible // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dsnet/compress v0.0.1 // indirect
|
||||
github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d // indirect
|
||||
github.com/dsoprea/go-utility/v2 v2.0.0-20200717064901-2fccff4aa15e // indirect
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
|
||||
github.com/fsnotify/fsnotify v1.4.7 // indirect
|
||||
github.com/go-acme/lego v2.5.0+incompatible // indirect
|
||||
github.com/go-errors/errors v1.1.1 // indirect
|
||||
github.com/golang/geo v0.0.0-20200319012246-673a6f80352d // indirect
|
||||
github.com/golang/snappy v0.0.1 // indirect
|
||||
github.com/google/uuid v1.1.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/klauspost/cpuid v1.2.0 // indirect
|
||||
github.com/magiconair/properties v1.8.1 // indirect
|
||||
github.com/mholt/certmagic v0.6.2-0.20190624175158-6a42ef9fe8c2 // indirect
|
||||
github.com/miekg/dns v1.1.3 // indirect
|
||||
github.com/mitchellh/mapstructure v1.1.2 // indirect
|
||||
github.com/nwaples/rardecode v1.0.0 // indirect
|
||||
github.com/pierrec/lz4 v0.0.0-20190131084431-473cd7ce01a1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/spf13/cast v1.3.0 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
github.com/ulikunitz/xz v0.5.6 // indirect
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
|
||||
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
|
||||
golang.org/x/net v0.0.0-20200528225125-3c3fba18258b // indirect
|
||||
golang.org/x/sys v0.0.0-20200523222454-059865788121 // indirect
|
||||
golang.org/x/text v0.3.2 // indirect
|
||||
google.golang.org/appengine v1.5.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0
|
||||
gopkg.in/yaml.v2 v2.3.0
|
||||
gopkg.in/ini.v1 v1.51.0 // indirect
|
||||
gopkg.in/square/go-jose.v2 v2.2.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
|
||||
)
|
||||
|
2
go.sum
2
go.sum
@ -101,7 +101,6 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
|
||||
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=
|
||||
@ -302,7 +301,6 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
|
||||
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
|
11
http/data.go
11
http/data.go
@ -64,15 +64,16 @@ func handle(fn handleFunc, prefix string, store *storage.Storage, server *settin
|
||||
server: server,
|
||||
})
|
||||
|
||||
if status != 0 {
|
||||
txt := http.StatusText(status)
|
||||
http.Error(w, strconv.Itoa(status)+" "+txt, status)
|
||||
}
|
||||
|
||||
if status >= 400 || err != nil {
|
||||
clientIP := realip.FromRequest(r)
|
||||
log.Printf("%s: %v %s %v", r.URL.Path, status, clientIP, err)
|
||||
}
|
||||
|
||||
if status != 0 {
|
||||
txt := http.StatusText(status)
|
||||
http.Error(w, strconv.Itoa(status)+" "+txt, status)
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
return stripPrefix(prefix, handler)
|
||||
|
@ -110,7 +110,7 @@ func TestPublicShareHandlerAuthentication(t *testing.T) {
|
||||
|
||||
func newHTTPRequest(t *testing.T, requestModifiers ...func(*http.Request)) *http.Request {
|
||||
t.Helper()
|
||||
r, err := http.NewRequest(http.MethodGet, "h", nil)
|
||||
r, err := http.NewRequest(http.MethodGet, "h", http.NoBody)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to construct request: %v", err)
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@ -50,8 +51,8 @@ func (s *Settings) MakeUserDir(username, userScope, serverRoot string) (string,
|
||||
}
|
||||
|
||||
// Create default user dir
|
||||
userHomeBase := s.Defaults.Scope + string(os.PathSeparator) + "users"
|
||||
userHome := userHomeBase + string(os.PathSeparator) + username
|
||||
userHomeBase := filepath.Join(s.Defaults.Scope, "users")
|
||||
userHome := filepath.Join(userHomeBase, username)
|
||||
err = fs.MkdirAll(userHome, os.ModePerm)
|
||||
if err != nil {
|
||||
log.Printf("create user: failed to mkdir user home dir: [%s]", userHome)
|
||||
|
37
tools.mk
Normal file
37
tools.mk
Normal file
@ -0,0 +1,37 @@
|
||||
include common.mk
|
||||
|
||||
# tools
|
||||
TOOLS_DIR := $(BASE_PATH)/tools
|
||||
TOOLS_GO_DEPS := $(TOOLS_DIR)/go.mod $(TOOLS_DIR)/go.sum
|
||||
TOOLS_BIN := $(TOOLS_DIR)/bin
|
||||
$(eval $(shell mkdir -p $(TOOLS_BIN)))
|
||||
PATH := $(TOOLS_BIN):$(PATH)
|
||||
export PATH
|
||||
|
||||
.PHONY: clean-tools
|
||||
clean-tools:
|
||||
$Q rm -rf $(TOOLS_BIN)
|
||||
|
||||
goimports=$(TOOLS_BIN)/goimports
|
||||
$(goimports): $(TOOLS_GO_DEPS)
|
||||
$Q cd $(TOOLS_DIR) && $(go) build -o $@ golang.org/x/tools/cmd/goimports
|
||||
|
||||
golangci-lint=$(TOOLS_BIN)/golangci-lint
|
||||
$(golangci-lint): $(TOOLS_GO_DEPS)
|
||||
$Q cd $(TOOLS_DIR) && $(go) build -o $@ github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
|
||||
# js tools
|
||||
TOOLS_JS_DEPS=$(TOOLS_DIR)/node_modules/.modified
|
||||
$(TOOLS_JS_DEPS): $(TOOLS_DIR)/package.json $(TOOLS_DIR)/yarn.lock
|
||||
$Q cd ${TOOLS_DIR} && yarn install
|
||||
$Q touch -am $@
|
||||
|
||||
standard-version=$(TOOLS_BIN)/standard-version
|
||||
$(standard-version): $(TOOLS_JS_DEPS)
|
||||
$Q ln -sf $(TOOLS_DIR)/node_modules/.bin/standard-version $@
|
||||
$Q touch -am $@
|
||||
|
||||
commitlint=$(TOOLS_BIN)/commitlint
|
||||
$(commitlint): $(TOOLS_JS_DEPS)
|
||||
$Q ln -sf $(TOOLS_DIR)/node_modules/.bin/commitlint $@
|
||||
$Q touch -am $@
|
152
tools/go.mod
Normal file
152
tools/go.mod
Normal file
@ -0,0 +1,152 @@
|
||||
module github.com/filebrowser/filebrowser/v2/tools
|
||||
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/golangci/golangci-lint v1.43.0
|
||||
golang.org/x/tools v0.1.8
|
||||
)
|
||||
|
||||
require (
|
||||
4d63.com/gochecknoglobals v0.1.0 // indirect
|
||||
github.com/Antonboom/errname v0.1.5 // indirect
|
||||
github.com/Antonboom/nilnil v0.1.0 // indirect
|
||||
github.com/BurntSushi/toml v0.4.1 // indirect
|
||||
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
|
||||
github.com/Masterminds/semver v1.5.0 // indirect
|
||||
github.com/OpenPeeDeeP/depguard v1.0.1 // indirect
|
||||
github.com/alexkohler/prealloc v1.0.0 // indirect
|
||||
github.com/ashanbrown/forbidigo v1.2.0 // indirect
|
||||
github.com/ashanbrown/makezero v0.0.0-20210520155254-b6261585ddde // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bkielbasa/cyclop v1.2.0 // indirect
|
||||
github.com/blizzy78/varnamelen v0.3.0 // indirect
|
||||
github.com/bombsimon/wsl/v3 v3.3.0 // indirect
|
||||
github.com/breml/bidichk v0.1.1 // indirect
|
||||
github.com/butuzov/ireturn v0.1.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.1 // indirect
|
||||
github.com/charithe/durationcheck v0.0.9 // indirect
|
||||
github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af // indirect
|
||||
github.com/daixiang0/gci v0.2.9 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/denis-tingajkin/go-header v0.4.2 // indirect
|
||||
github.com/esimonov/ifshort v1.0.3 // indirect
|
||||
github.com/ettle/strcase v0.1.1 // indirect
|
||||
github.com/fatih/color v1.13.0 // indirect
|
||||
github.com/fatih/structtag v1.2.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.1 // indirect
|
||||
github.com/fzipp/gocyclo v0.3.1 // indirect
|
||||
github.com/go-critic/go-critic v0.6.1 // indirect
|
||||
github.com/go-toolsmith/astcast v1.0.0 // indirect
|
||||
github.com/go-toolsmith/astcopy v1.0.0 // indirect
|
||||
github.com/go-toolsmith/astequal v1.0.1 // indirect
|
||||
github.com/go-toolsmith/astfmt v1.0.0 // indirect
|
||||
github.com/go-toolsmith/astp v1.0.0 // indirect
|
||||
github.com/go-toolsmith/strparse v1.0.0 // indirect
|
||||
github.com/go-toolsmith/typep v1.0.2 // indirect
|
||||
github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b // indirect
|
||||
github.com/gobwas/glob v0.2.3 // indirect
|
||||
github.com/gofrs/flock v0.8.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect
|
||||
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect
|
||||
github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 // indirect
|
||||
github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a // indirect
|
||||
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect
|
||||
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect
|
||||
github.com/golangci/misspell v0.3.5 // indirect
|
||||
github.com/golangci/revgrep v0.0.0-20210930125155-c22e5001d4f2 // indirect
|
||||
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
|
||||
github.com/google/go-cmp v0.5.6 // indirect
|
||||
github.com/gordonklaus/ineffassign v0.0.0-20210225214923-2e10b2664254 // indirect
|
||||
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
|
||||
github.com/gostaticanalysis/comment v1.4.2 // indirect
|
||||
github.com/gostaticanalysis/forcetypeassert v0.0.0-20200621232751-01d4955beaa5 // indirect
|
||||
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/jgautheron/goconst v1.5.1 // indirect
|
||||
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
|
||||
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
|
||||
github.com/julz/importas v0.0.0-20210419104244-841f0c0fe66d // indirect
|
||||
github.com/kisielk/errcheck v1.6.0 // indirect
|
||||
github.com/kisielk/gotool v1.0.0 // indirect
|
||||
github.com/kulti/thelper v0.4.0 // indirect
|
||||
github.com/kunwardeep/paralleltest v1.0.3 // indirect
|
||||
github.com/kyoh86/exportloopref v0.1.8 // indirect
|
||||
github.com/ldez/gomoddirectives v0.2.2 // indirect
|
||||
github.com/ldez/tagliatelle v0.2.0 // indirect
|
||||
github.com/magiconair/properties v1.8.5 // indirect
|
||||
github.com/maratori/testpackage v1.0.1 // indirect
|
||||
github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect
|
||||
github.com/mattn/go-colorable v0.1.11 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/mbilski/exhaustivestruct v1.2.0 // indirect
|
||||
github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 // indirect
|
||||
github.com/mgechev/revive v1.1.2 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.4.2 // indirect
|
||||
github.com/moricho/tparallel v0.2.1 // indirect
|
||||
github.com/nakabonne/nestif v0.3.1 // indirect
|
||||
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect
|
||||
github.com/nishanths/exhaustive v0.2.3 // indirect
|
||||
github.com/nishanths/predeclared v0.2.1 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/pelletier/go-toml v1.9.4 // indirect
|
||||
github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/polyfloyd/go-errorlint v0.0.0-20210722154253-910bb7978349 // indirect
|
||||
github.com/prometheus/client_golang v1.7.1 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.10.0 // indirect
|
||||
github.com/prometheus/procfs v0.6.0 // indirect
|
||||
github.com/quasilyte/go-ruleguard v0.3.13 // indirect
|
||||
github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect
|
||||
github.com/ryancurrah/gomodguard v1.2.3 // indirect
|
||||
github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect
|
||||
github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect
|
||||
github.com/securego/gosec/v2 v2.9.1 // indirect
|
||||
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
|
||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
||||
github.com/sivchari/tenv v1.4.7 // indirect
|
||||
github.com/sonatard/noctx v0.0.1 // indirect
|
||||
github.com/sourcegraph/go-diff v0.6.1 // indirect
|
||||
github.com/spf13/afero v1.6.0 // indirect
|
||||
github.com/spf13/cast v1.4.1 // indirect
|
||||
github.com/spf13/cobra v1.2.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.9.0 // indirect
|
||||
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
|
||||
github.com/stretchr/objx v0.1.1 // indirect
|
||||
github.com/stretchr/testify v1.7.0 // indirect
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
github.com/sylvia7788/contextcheck v1.0.4 // indirect
|
||||
github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b // indirect
|
||||
github.com/tetafro/godot v1.4.11 // indirect
|
||||
github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94 // indirect
|
||||
github.com/tomarrell/wrapcheck/v2 v2.4.0 // indirect
|
||||
github.com/tommy-muehle/go-mnd/v2 v2.4.0 // indirect
|
||||
github.com/ultraware/funlen v0.0.3 // indirect
|
||||
github.com/ultraware/whitespace v0.0.4 // indirect
|
||||
github.com/uudashr/gocognit v1.0.5 // indirect
|
||||
github.com/yeya24/promlinter v0.1.0 // indirect
|
||||
golang.org/x/mod v0.5.1 // indirect
|
||||
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
||||
google.golang.org/protobuf v1.27.1 // indirect
|
||||
gopkg.in/ini.v1 v1.63.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
honnef.co/go/tools v0.2.1 // indirect
|
||||
mvdan.cc/gofumpt v0.1.1 // indirect
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
|
||||
mvdan.cc/unparam v0.0.0-20210104141923-aac4ce9116a7 // indirect
|
||||
)
|
1315
tools/go.sum
Normal file
1315
tools/go.sum
Normal file
File diff suppressed because it is too large
Load Diff
7
tools/package.json
Normal file
7
tools/package.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@commitlint/cli": "^15.0.0",
|
||||
"@commitlint/config-conventional": "^15.0.0",
|
||||
"standard-version": "^9.3.2"
|
||||
}
|
||||
}
|
15
tools/tools.go
Normal file
15
tools/tools.go
Normal file
@ -0,0 +1,15 @@
|
||||
//go:build tools
|
||||
// +build tools
|
||||
|
||||
package tools
|
||||
|
||||
// Manage tool dependencies via go.mod.
|
||||
//
|
||||
// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module
|
||||
// https://github.com/golang/go/issues/25922
|
||||
//
|
||||
// nolint
|
||||
import (
|
||||
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
|
||||
_ "golang.org/x/tools/cmd/goimports"
|
||||
)
|
1707
tools/yarn.lock
Normal file
1707
tools/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user