Skip to content

Commit 5b6528a

Browse files
committedFeb 26, 2025·
chore: bump deps, goreleaser, gha, linting
1 parent e607476 commit 5b6528a

17 files changed

+398
-760
lines changed
 

‎.drone.yml

-150
This file was deleted.

‎.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
server/assets/* linguist-vendored
1+
server/utils/assets/* linguist-vendored

‎.github/renovate.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["config:best-practices", ":automergeMinor", ":automergeDigest"]
4+
}

‎.github/workflows/docker.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: docker
2+
on:
3+
push:
4+
branches: ["main"]
5+
tags:
6+
- "*"
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-and-push-image:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
22+
23+
- name: Log in to the Container registry
24+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Extract metadata (tags, labels) for Docker
31+
id: meta
32+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5
33+
with:
34+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
35+
tags: |
36+
type=semver,pattern={{version}}
37+
type=semver,pattern={{major}}.{{minor}}
38+
type=ref,event=branch
39+
type=sha
40+
41+
- name: Build and push Docker image
42+
uses: docker/build-push-action@0adf9959216b96bec444f325f1e493d4aa344497 # v6
43+
with:
44+
context: .
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}

‎.github/workflows/golang.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: golang
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
13+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
14+
with:
15+
go-version-file: "go.mod"
16+
- name: build
17+
run: make
18+
19+
test:
20+
needs: build
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
issues: write
25+
pull-requests: write
26+
steps:
27+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
28+
with:
29+
fetch-depth: 10
30+
- uses: gwatts/go-coverage-action@2845595538a59d63d1bf55f109c14e104c6f7cb3 # v2
31+
with:
32+
fail-coverage: never
33+
cover-pkg: ./...
34+
35+
goreleaser:
36+
needs: build
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
41+
with:
42+
fetch-depth: 0
43+
- name: Set up Go
44+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
45+
with:
46+
go-version: stable
47+
- name: Run GoReleaser
48+
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6
49+
with:
50+
distribution: goreleaser
51+
version: "~> v2"
52+
args: release --snapshot --clean
53+
54+
# TODO: Fix various errcheck errors
55+
#
56+
# golangci:
57+
# needs: build
58+
# runs-on: ubuntu-latest
59+
# permissions:
60+
# contents: read
61+
# pull-requests: read
62+
# checks: write
63+
# steps:
64+
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
65+
# - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
66+
# with:
67+
# go-version-file: "go.mod"
68+
# - name: golangci-lint
69+
# uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6
70+
# with:
71+
# version: latest
72+
# args: --timeout=3m

‎.github/workflows/goreleaser.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
17+
with:
18+
fetch-depth: 0
19+
- name: Set up Go
20+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
21+
with:
22+
go-version: stable
23+
- name: Run GoReleaser
24+
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6
25+
with:
26+
distribution: goreleaser
27+
version: "~> v2"
28+
args: release --clean
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ vendor/
1717
docs/env/
1818
docs/site/
1919
.vscode/
20+
21+
dist/

‎.goreleaser.yaml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- id: server
9+
main: ./server/
10+
binary: goploader-server
11+
env:
12+
- CGO_ENABLED=0
13+
goos:
14+
- linux
15+
- windows
16+
- darwin
17+
ldflags:
18+
- -s -w
19+
20+
- id: client
21+
main: ./client/
22+
binary: gpldr
23+
env:
24+
- CGO_ENABLED=0
25+
goos:
26+
- linux
27+
- windows
28+
- darwin
29+
ldflags:
30+
- -s -w
31+
32+
archives:
33+
- id: server_archive
34+
builds: [server]
35+
formats: tar.gz
36+
# this name template makes the OS and Arch compatible with the results of `uname`.
37+
name_template: >-
38+
{{ .ProjectName }}_server_
39+
{{- title .Os }}_
40+
{{- if eq .Arch "amd64" }}x86_64
41+
{{- else if eq .Arch "386" }}i386
42+
{{- else }}{{ .Arch }}{{ end }}
43+
{{- if .Arm }}v{{ .Arm }}{{ end }}
44+
# use zip for windows archives
45+
format_overrides:
46+
- goos: windows
47+
formats: zip
48+
49+
- id: client_archive
50+
builds: [client]
51+
formats: tar.gz
52+
# this name template makes the OS and Arch compatible with the results of `uname`.
53+
name_template: >-
54+
{{ .ProjectName }}_client_
55+
{{- title .Os }}_
56+
{{- if eq .Arch "amd64" }}x86_64
57+
{{- else if eq .Arch "386" }}i386
58+
{{- else }}{{ .Arch }}{{ end }}
59+
{{- if .Arm }}v{{ .Arm }}{{ end }}
60+
# use zip for windows archives
61+
format_overrides:
62+
- goos: windows
63+
formats: zip
64+
65+
changelog:
66+
sort: asc
67+
filters:
68+
exclude:
69+
- "^docs:"
70+
- "^test:"
71+
72+
release:
73+
footer: >-
74+
75+
---
76+
77+
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).

‎Makefile

+22-36
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,29 @@
1-
version = 1.0.2
2-
export GO111MODULE=on
3-
export CGO_ENABLED=0
4-
export VERSION=$(shell git describe --abbrev=0 --tags 2> /dev/null || echo "0.1.0")
5-
export TAG=$VERSION
6-
export BUILD=$(shell git rev-parse HEAD 2> /dev/null || echo "undefined")
7-
8-
.PHONY: all clients servers release clean
9-
10-
all:
11-
go build -o client/client github.com/Depado/goploader/client
12-
go build -o server/server github.com/Depado/goploader/server
13-
14-
clients:
15-
-mkdir -p releases/clients
16-
-mkdir -p releases/servers
17-
-rm releases/clients/*
18-
gox -output="releases/clients/client_{{.OS}}_{{.Arch}}" github.com/Depado/goploader/client
19-
tar czf releases/servers/clients.tar.gz releases/clients
20-
21-
servers:
22-
-mkdir -p releases/servers
23-
-mkdir goploader-server
24-
go build -o goploader-server/server github.com/Depado/goploader/server
25-
tar czf releases/servers/server_amd64.tar.gz goploader-server/
26-
rm -r goploader-server/*
27-
GOARCH=arm go build -o goploader-server/server github.com/Depado/goploader/server
28-
tar czf releases/servers/server_arm.tar.gz goploader-server/
29-
-rm -r goploader-server
30-
31-
release: clients servers
32-
tar czf servers.tar.gz releases/servers/
33-
mv servers.tar.gz releases/servers/
34-
35-
docker:
1+
.DEFAULT_GOAL := all
2+
CGO_ENABLED=0
3+
VERSION=$(shell git describe --abbrev=0 --tags 2> /dev/null || echo "0.1.0")
4+
BUILD=$(shell git rev-parse HEAD 2> /dev/null || echo "undefined")
5+
BUILDDATE=$(shell LANG=en_us_88591 date)
6+
7+
.PHONY: help
8+
help:
9+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
10+
11+
.PHONY: all
12+
all: ## Build both the client and the server in their respective directories
13+
go build -o ./client/client ./client
14+
go build -o ./server/server ./server
15+
16+
.PHONY: docker
17+
docker: ## Build the docker image
3618
docker build -t gpldr:latest -t gpldr:$(BUILD) -f Dockerfile .
3719

20+
.PHONY: release
21+
release: ## Create a new release
22+
goreleaser release --clean
23+
3824
.PHONY: snapshot
3925
snapshot: ## Create a new snapshot release
40-
goreleaser --snapshot --skip-publish --rm-dist
26+
goreleaser release --snapshot --clean
4127

4228
clean:
4329
-rm -r releases/

‎client/conf/conf.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package conf
22

33
import (
4-
"io/ioutil"
4+
"fmt"
55
"log"
66
"os"
77

@@ -34,22 +34,24 @@ func Load() error {
3434

3535
if _, err = os.Stat(cdir); os.IsNotExist(err) {
3636
log.Printf("Creating %v directory.\n", cdir)
37-
os.Mkdir(cdir, 0700)
37+
if err := os.Mkdir(cdir, 0700); err != nil {
38+
return fmt.Errorf("unable to create %v directory: %w", cdir, err)
39+
}
3840
} else if err != nil {
3941
return err
4042
}
4143
if _, err = os.Stat(cf); os.IsNotExist(err) {
4244
log.Printf("Configuration file %v not found. Writing default configuration.\n", cf)
43-
C.Service = "https://gpldr.in/"
45+
C.Service = "http://127.0.0.1:8080"
4446
if conf, err = yaml.Marshal(C); err != nil {
4547
return err
4648
}
47-
return ioutil.WriteFile(cf, conf, 0644)
49+
return os.WriteFile(cf, conf, 0644)
4850
} else if err != nil {
4951
return err
5052
}
5153

52-
if conf, err = ioutil.ReadFile(cf); err != nil {
54+
if conf, err = os.ReadFile(cf); err != nil {
5355
return err
5456
}
5557
return yaml.Unmarshal(conf, &C)

‎client/main.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package main
33
import (
44
"fmt"
55
"io"
6-
"io/ioutil"
76
"log"
87
"mime/multipart"
98
"net/http"
@@ -23,7 +22,6 @@ var (
2322
bar *pb.ProgressBar
2423
name string
2524
verbose bool
26-
service = "https://gpldr.in/"
2725
)
2826

2927
func debugf(a ...interface{}) {
@@ -181,7 +179,7 @@ func main() {
181179
check(err)
182180
defer resp.Body.Close()
183181
debugf("Multipart post is done, reading data")
184-
ret, err := ioutil.ReadAll(resp.Body)
182+
ret, err := io.ReadAll(resp.Body)
185183
check(err)
186184
if clip {
187185
debugf("Copying to clipboard")

‎client/screenshot/screenshot.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@ func Do(fp string, window bool) error {
6161
}
6262
}
6363

64-
return fmt.Errorf("No screenshot program found")
64+
return fmt.Errorf("no screenshot program found")
6565
}

‎go.mod

+38-34
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
module github.com/Depado/goploader
22

3-
go 1.18
3+
go 1.23.0
4+
5+
toolchain go1.24.0
46

57
require (
8+
dario.cat/mergo v1.0.1
69
github.com/asdine/storm v2.1.2+incompatible
710
github.com/atotto/clipboard v0.1.4
8-
github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5
9-
github.com/fatih/color v1.13.0
10-
github.com/gin-gonic/gin v1.9.1
11-
github.com/imdario/mergo v0.3.12
11+
github.com/dchest/uniuri v1.2.0
12+
github.com/fatih/color v1.18.0
13+
github.com/gin-gonic/gin v1.10.0
1214
github.com/mitchellh/go-homedir v1.1.0
1315
github.com/ogier/pflag v0.0.1
14-
github.com/prometheus/client_golang v1.12.1
15-
go.etcd.io/bbolt v1.3.6
16+
github.com/prometheus/client_golang v1.21.0
17+
go.etcd.io/bbolt v1.4.0
1618
gopkg.in/cheggaaa/pb.v1 v1.0.28
1719
gopkg.in/yaml.v2 v2.4.0
1820
)
@@ -21,41 +23,43 @@ require (
2123
github.com/DataDog/zstd v1.5.2 // indirect
2224
github.com/Sereal/Sereal v0.0.0-20220220040404-e0d1e550e879 // indirect
2325
github.com/beorn7/perks v1.0.1 // indirect
24-
github.com/bytedance/sonic v1.9.1 // indirect
25-
github.com/cespare/xxhash/v2 v2.1.2 // indirect
26-
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
27-
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
28-
github.com/gin-contrib/sse v0.1.0 // indirect
26+
github.com/bytedance/sonic v1.12.9 // indirect
27+
github.com/bytedance/sonic/loader v0.2.3 // indirect
28+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
29+
github.com/cloudwego/base64x v0.1.5 // indirect
30+
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
31+
github.com/gin-contrib/sse v1.0.0 // indirect
2932
github.com/go-playground/locales v0.14.1 // indirect
3033
github.com/go-playground/universal-translator v0.18.1 // indirect
31-
github.com/go-playground/validator/v10 v10.14.0 // indirect
32-
github.com/goccy/go-json v0.10.2 // indirect
33-
github.com/golang/protobuf v1.5.2 // indirect
34+
github.com/go-playground/validator/v10 v10.25.0 // indirect
35+
github.com/goccy/go-json v0.10.5 // indirect
36+
github.com/golang/protobuf v1.5.4 // indirect
3437
github.com/golang/snappy v0.0.4 // indirect
35-
github.com/google/go-cmp v0.5.8 // indirect
3638
github.com/json-iterator/go v1.1.12 // indirect
37-
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
38-
github.com/leodido/go-urn v1.2.4 // indirect
39-
github.com/mattn/go-colorable v0.1.12 // indirect
40-
github.com/mattn/go-isatty v0.0.19 // indirect
41-
github.com/mattn/go-runewidth v0.0.13 // indirect
42-
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
39+
github.com/klauspost/compress v1.18.0 // indirect
40+
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
41+
github.com/kr/text v0.2.0 // indirect
42+
github.com/leodido/go-urn v1.4.0 // indirect
43+
github.com/mattn/go-colorable v0.1.14 // indirect
44+
github.com/mattn/go-isatty v0.0.20 // indirect
45+
github.com/mattn/go-runewidth v0.0.16 // indirect
4346
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4447
github.com/modern-go/reflect2 v1.0.2 // indirect
45-
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
46-
github.com/prometheus/client_model v0.2.0 // indirect
47-
github.com/prometheus/common v0.34.0 // indirect
48-
github.com/prometheus/procfs v0.7.3 // indirect
49-
github.com/rivo/uniseg v0.2.0 // indirect
48+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
49+
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
50+
github.com/prometheus/client_model v0.6.1 // indirect
51+
github.com/prometheus/common v0.62.0 // indirect
52+
github.com/prometheus/procfs v0.15.1 // indirect
53+
github.com/rivo/uniseg v0.4.7 // indirect
5054
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
51-
github.com/ugorji/go/codec v1.2.11 // indirect
55+
github.com/ugorji/go/codec v1.2.12 // indirect
5256
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
53-
golang.org/x/arch v0.3.0 // indirect
54-
golang.org/x/crypto v0.31.0 // indirect
55-
golang.org/x/net v0.23.0 // indirect
56-
golang.org/x/sys v0.28.0 // indirect
57-
golang.org/x/text v0.21.0 // indirect
57+
golang.org/x/arch v0.14.0 // indirect
58+
golang.org/x/crypto v0.35.0 // indirect
59+
golang.org/x/net v0.35.0 // indirect
60+
golang.org/x/sys v0.30.0 // indirect
61+
golang.org/x/text v0.22.0 // indirect
5862
google.golang.org/appengine v1.6.7 // indirect
59-
google.golang.org/protobuf v1.33.0 // indirect
63+
google.golang.org/protobuf v1.36.5 // indirect
6064
gopkg.in/yaml.v3 v3.0.1 // indirect
6165
)

‎go.sum

+92-517
Large diffs are not rendered by default.

‎server/conf/conf.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package conf
22

33
import (
4-
"io/ioutil"
54
"os"
65

7-
"github.com/imdario/mergo"
6+
"dario.cat/mergo"
87
"gopkg.in/yaml.v2"
98
)
109

@@ -116,7 +115,7 @@ func (c *Conf) FillDefaults() error {
116115
func Load(fp string, verbose bool) error {
117116
var err error
118117
var conf []byte
119-
if conf, err = ioutil.ReadFile(fp); err != nil {
118+
if conf, err = os.ReadFile(fp); err != nil {
120119
return err
121120
}
122121
if err = yaml.Unmarshal(conf, &C); err != nil {

‎server/curl/data.go

-8
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,3 @@ var header = `
1212
Because file sharing is meant to be easy
1313
~ Server-side encrypted file sharing ~
1414
`
15-
16-
var intro = `
17-
One of the main goal of goploader is the ease of use.
18-
That's also why the goploader server doesn't use a JSON API, to guarantee that
19-
any user can upload files painlessly.
20-
21-
You can use this service without a client, simply by issuing curl commands.
22-
`

‎server/setup/setup.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package setup
22

33
import (
44
"fmt"
5-
"io/ioutil"
65
"log"
76
"net/http"
7+
"os"
88

99
"gopkg.in/yaml.v2"
1010

@@ -39,7 +39,7 @@ func configure(c *gin.Context) {
3939
c.AbortWithError(http.StatusInternalServerError, err)
4040
return
4141
}
42-
if err = ioutil.WriteFile("conf.yml", dat, 0644); err != nil {
42+
if err = os.WriteFile("conf.yml", dat, 0644); err != nil {
4343
fmt.Println("An error occured while writing the conf.yml file :", err)
4444
c.AbortWithError(http.StatusInternalServerError, err)
4545
return

0 commit comments

Comments
 (0)
Please sign in to comment.