mirror of
https://github.com/Forceu/Gokapi.git
synced 2026-03-13 13:39:02 -05:00
Documentation
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@ SingleDownload
|
||||
config/
|
||||
data/
|
||||
.idea/
|
||||
Gokapi
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"]
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
7
Main.go
7
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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user