diff --git a/.gitignore b/.gitignore index 6415d6a..cce83cc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ SingleDownload config/ data/ .idea/ +Gokapi diff --git a/Configuration.go b/Configuration.go index 88761e2..c919c12 100644 --- a/Configuration.go +++ b/Configuration.go @@ -1,5 +1,9 @@ package main +/** +Loading and saving of the persistent configuration +*/ + import ( "encoding/json" "fmt" @@ -9,9 +13,6 @@ import ( "strings" ) -/** -Loading and saving of the persistent configuration -*/ // Name of the config dir that will be created const configDir = "config" @@ -181,4 +182,4 @@ func isValidUrl(url string) bool { return false } return true -} \ No newline at end of file +} diff --git a/Dockerfile.testing b/Dockerfile.testing deleted file mode 100644 index 9525d36..0000000 --- a/Dockerfile.testing +++ /dev/null @@ -1,24 +0,0 @@ -FROM golang:1.16 AS build_base - -## Usage: -## docker build . -t gokapi -## docker run -it -v gokapi-data:/app/data -v gokapi-config:/app/config -p 127.0.0.1:53842:53842 gokapi - -RUN mkdir /compile -COPY go.mod /compile -RUN cd /compile && go mod download - -COPY . /compile - -RUN cd /compile && CGO_ENABLED=0 go build -ldflags="-s -w -X 'main.IS_DOCKER=true' -X 'main.BUILDER=Docker Testing' -X 'main.BUILD_TIME=$(date)'" -o /compile/gokapi - -FROM alpine:3.13 - - -RUN apk add ca-certificates && mkdir /app && touch /app/.isdocker -COPY --from=build_base /compile/gokapi /app/gokapi -WORKDIR /app - -CMD ["/app/gokapi"] - - diff --git a/FileServing.go b/FileServing.go index 2f60912..9b843da 100644 --- a/FileServing.go +++ b/FileServing.go @@ -1,5 +1,9 @@ package main +/** +Serving and processing uploaded files +*/ + import ( "crypto/sha1" "encoding/hex" @@ -11,9 +15,6 @@ import ( "time" ) -/** -Serving and processing uploaded files -*/ // The length for IDs used in URLs. Can be increased to improve security and decreased to increase readability const lengthId = 15 diff --git a/HelperFunctions.go b/HelperFunctions.go index e86e1c2..c455992 100644 --- a/HelperFunctions.go +++ b/HelperFunctions.go @@ -1,5 +1,9 @@ package main +/** +Various functions, mostly for OS access +*/ + import ( "bufio" cryptorand "crypto/rand" @@ -13,9 +17,6 @@ import ( "strings" ) -/** -Various functions, mostly for OS access -*/ // Hashes a password with SHA256 and a salt func hashPassword(password, salt string) string { diff --git a/Main.go b/Main.go index 0b91ee5..b0d21f4 100644 --- a/Main.go +++ b/Main.go @@ -1,5 +1,9 @@ package main +/** +Main routine +*/ + import ( "fmt" "math/rand" @@ -7,9 +11,6 @@ import ( "time" ) -/** -Main routine -*/ // needs to be changed in ./templates/string_constants.tmpl as well const VERSION = "1.1.0" diff --git a/SessionManager.go b/SessionManager.go index 39564be..7b63416 100644 --- a/SessionManager.go +++ b/SessionManager.go @@ -1,13 +1,14 @@ package main +/** +Manages the sessions for the admin user or to access password protected files +*/ + import ( "net/http" "time" ) -/** -Manages the sessions for the admin user or to access password protected files -*/ //If no login occurred during this time, the admin session will be deleted. Default 30 days const COOKIE_LIFE_ADMIN = 30 * 24 * time.Hour diff --git a/Webserver.go b/Webserver.go index 3c3673c..af0677e 100644 --- a/Webserver.go +++ b/Webserver.go @@ -1,5 +1,9 @@ package main +/** +Handling of webserver and requests / uploads +*/ + import ( "embed" "fmt" @@ -15,9 +19,6 @@ import ( "time" ) -/** -Handling of webserver and requests / uploads -*/ // Embedded version of the "static" folder // This contains JS files, CSS, images etc