58 Commits
v2.0.0 ... main

Author SHA1 Message Date
db368bbfd4 Update actions/checkout action to v6
All checks were successful
Main workflow / Run unit tests (push) Successful in 2m27s
Main workflow / build (push) Successful in 47s
2025-12-01 00:02:03 +00:00
79c0529823 Update actions/setup-go action to v6
All checks were successful
Main workflow / Run unit tests (push) Successful in 32s
Main workflow / build (push) Successful in 41s
2025-11-29 12:31:49 +00:00
e1b2d99b23 Update all non-major dependencies
All checks were successful
Main workflow / Run unit tests (push) Successful in 2m6s
Main workflow / build (push) Successful in 1m16s
2025-11-05 20:01:38 +00:00
6175a9857c Update all non-major dependencies
All checks were successful
Main workflow / Run unit tests (push) Successful in 3m23s
Main workflow / build (push) Successful in 42s
2025-08-24 17:01:17 +00:00
7441ce0a83 Update all non-major dependencies
All checks were successful
Main workflow / Run unit tests (push) Successful in 43s
Main workflow / build (push) Successful in 42s
2025-05-01 00:01:57 +00:00
1dc5a2b56b Update dependency ubuntu to v24
All checks were successful
Main workflow / Run unit tests (push) Successful in 3m26s
Main workflow / build (push) Successful in 42s
2025-04-01 00:01:08 +00:00
2eaa0ada05 Update all non-major dependencies
All checks were successful
Main workflow / Run unit tests (push) Successful in 41s
Main workflow / build (push) Successful in 50s
2025-03-31 14:18:47 +00:00
1e67af6bba Use metadata-action
All checks were successful
Main workflow / Run unit tests (push) Successful in 30s
Main workflow / build (push) Successful in 31s
2025-03-31 16:17:05 +02:00
db8529e560 Update renovate config
All checks were successful
Main workflow / Run unit tests (push) Successful in 3m5s
Main workflow / build (push) Successful in 25s
2025-03-31 15:18:28 +02:00
114edffa0a Improve CI
All checks were successful
Main workflow / Run unit tests (push) Successful in 26s
Main workflow / build (push) Successful in 24s
2025-03-31 15:14:34 +02:00
5732fb7aa0 Update renovate settings
All checks were successful
Main workflow / Run unit tests (push) Successful in 1m55s
Main workflow / Build docker image (push) Successful in 2m6s
2024-12-19 15:47:49 +01:00
45c80c1686 Update workflows
All checks were successful
Main workflow / Run unit tests (push) Successful in 1m52s
Main workflow / Build docker image (push) Successful in 1m54s
2024-10-13 11:43:17 +02:00
40e13b716c Update Dockerfile
Some checks failed
Main workflow / Run unit tests (push) Failing after 52s
Main workflow / Build docker image (push) Has been skipped
2024-10-13 11:21:33 +02:00
3079f15783 Update deps 2024-10-13 11:21:28 +02:00
fd26ac21af Go mod tidy 2024-10-03 15:24:23 +02:00
3a90641e40 Update golang:1.22-alpine Docker digest to 89c315d
All checks were successful
Main workflow / Run unit tests (push) Successful in 47s
Main workflow / Build docker image (push) Successful in 1m15s
2024-03-25 10:40:23 +00:00
757e38bc32 Update golang Docker tag to v1.22
All checks were successful
Main workflow / Run unit tests (push) Successful in 46s
Main workflow / Build docker image (push) Successful in 1m8s
2024-03-05 20:40:23 +00:00
3d821b7844 Update module github.com/minio/minio-go/v7 to v7.0.68
All checks were successful
Main workflow / Run unit tests (push) Successful in 43s
Main workflow / Build docker image (push) Successful in 1m10s
2024-03-03 00:40:04 +00:00
31bf2fb3f6 Update module github.com/stretchr/testify to v1.9.0
All checks were successful
Main workflow / Run unit tests (push) Successful in 42s
Main workflow / Build docker image (push) Successful in 1m5s
2024-03-01 12:40:30 +00:00
008cceed07 Update module github.com/minio/minio-go/v7 to v7.0.67
All checks were successful
Main workflow / Run unit tests (push) Successful in 52s
Main workflow / Build docker image (push) Successful in 1m9s
2024-02-11 00:40:10 +00:00
8a9eb0f5ea Update module github.com/rs/zerolog to v1.32.0
All checks were successful
Main workflow / Run unit tests (push) Successful in 44s
Main workflow / Build docker image (push) Successful in 1m7s
2024-02-04 15:40:07 +00:00
be7c5a3164 Update alpine:3.19 Docker digest to c5b1261
All checks were successful
Main workflow / Run unit tests (push) Successful in 48s
Main workflow / Build docker image (push) Successful in 2m21s
2024-01-28 11:11:01 +00:00
e15ae6070f Update golang:1.21-alpine Docker digest to bb943c4
Some checks failed
Main workflow / Build docker image (push) Blocked by required conditions
Main workflow / Run unit tests (push) Has been cancelled
2024-01-27 02:22:46 +00:00
d5330dcfbc Update golang:1.21-alpine Docker digest to 0f7e0b1
All checks were successful
Main workflow / Run unit tests (push) Successful in 45s
Main workflow / Build docker image (push) Successful in 1m13s
2024-01-23 20:22:43 +00:00
fad4b5fd34 Update golang:1.21-alpine Docker digest to 2523a6f
All checks were successful
Main workflow / Run unit tests (push) Successful in 50s
Main workflow / Build docker image (push) Successful in 1m8s
2024-01-09 23:22:35 +00:00
fc0e2d8fdd Update module github.com/minio/minio-go/v7 to v7.0.66
All checks were successful
Main workflow / Run unit tests (push) Successful in 44s
Main workflow / Build docker image (push) Successful in 1m10s
2023-12-14 09:23:13 +00:00
6794b64658 Update alpine Docker tag to v3.19
All checks were successful
Main workflow / Run unit tests (push) Successful in 46s
Main workflow / Build docker image (push) Successful in 1m9s
2023-12-09 09:01:53 +00:00
c6358b3b6c Update golang:1.21-alpine Docker digest to 55f7162
All checks were successful
Main workflow / Run unit tests (push) Successful in 48s
Main workflow / Build docker image (push) Successful in 1m8s
2023-12-09 06:23:21 +00:00
5f8b6c5ba4 Update module github.com/minio/minio-go/v7 to v7.0.65
All checks were successful
Main workflow / Run unit tests (push) Successful in 44s
Main workflow / Build docker image (push) Successful in 1m9s
2023-12-02 17:21:26 +00:00
3dec173a40 Update alpine:3.18 Docker digest to 34871e7
All checks were successful
Main workflow / Run unit tests (push) Successful in 44s
Main workflow / Build docker image (push) Successful in 1m12s
2023-12-01 07:53:33 +00:00
9d1eb48368 Update golang:1.21-alpine Docker digest to 4e09ca4
Some checks failed
Main workflow / Build docker image (push) Blocked by required conditions
Main workflow / Run unit tests (push) Has been cancelled
2023-12-01 04:51:08 +00:00
321c3515f3 Update module github.com/minio/minio-go/v7 to v7.0.64
All checks were successful
Main workflow / Run unit tests (push) Successful in 51s
Main workflow / Build docker image (push) Successful in 1m13s
2023-11-20 23:51:36 +00:00
7870d7b3f2 Update golang:1.21-alpine Docker digest to f475434
All checks were successful
Main workflow / Run unit tests (push) Successful in 40s
Main workflow / Build docker image (push) Successful in 1m7s
2023-11-07 21:02:58 +00:00
c18f91270e Update golang:1.21-alpine Docker digest to 4f95f6b
All checks were successful
Main workflow / Run unit tests (push) Successful in 39s
Main workflow / Build docker image (push) Successful in 1m9s
2023-11-01 19:03:24 +00:00
19efe356ba Update golang:1.21-alpine Docker digest to 27c76dc
All checks were successful
Main workflow / Run unit tests (push) Successful in 36s
Main workflow / Build docker image (push) Successful in 1m10s
2023-10-10 19:55:35 +00:00
dc4bd52fac Update golang:1.21-alpine Docker digest to ae2875f
All checks were successful
Main workflow / Run unit tests (push) Successful in 35s
Main workflow / Build docker image (push) Successful in 1m6s
2023-10-05 21:54:26 +00:00
bce638e2bc Update alpine:3.18 Docker digest to eece025
All checks were successful
Main workflow / Run unit tests (push) Successful in 35s
Main workflow / Build docker image (push) Successful in 1m6s
2023-09-29 06:54:32 +00:00
6146fd6b1b Update golang:1.21-alpine Docker digest to 3380a7e
All checks were successful
Main workflow / Run unit tests (push) Successful in 35s
Main workflow / Build docker image (push) Successful in 1m5s
2023-09-28 23:54:27 +00:00
d206f845b1 Update golang:1.21-alpine Docker digest to 6799466
All checks were successful
Main workflow / Run unit tests (push) Successful in 35s
Main workflow / Build docker image (push) Successful in 1m9s
2023-09-27 02:54:29 +00:00
17e4a4e1f1 Update module github.com/minio/minio-go/v7 to v7.0.63
All checks were successful
Main workflow / Run unit tests (push) Successful in 35s
Main workflow / Build docker image (push) Successful in 1m11s
2023-09-25 11:54:26 +00:00
f8dfc345f0 Update module github.com/rs/zerolog to v1.31.0
All checks were successful
Main workflow / Run unit tests (push) Successful in 35s
Main workflow / Build docker image (push) Successful in 1m7s
2023-09-25 10:54:41 +00:00
87e5dbbc81 Update golang:1.21-alpine Docker digest to 0c860c7
All checks were successful
Main workflow / Run unit tests (push) Successful in 38s
Main workflow / Build docker image (push) Successful in 1m14s
2023-09-06 19:13:48 +00:00
605b81b307 Update golang Docker tag to v1.21
All checks were successful
Main workflow / Run unit tests (push) Successful in 36s
Main workflow / Build docker image (push) Successful in 1m9s
2023-08-09 07:17:07 +00:00
dc6258e386 Update alpine:3.18 Docker digest to 7144f7b
All checks were successful
Main workflow / Run unit tests (push) Successful in 36s
Main workflow / Build docker image (push) Successful in 1m12s
2023-08-07 22:17:08 +00:00
79651834b4 Update golang:1.20-alpine Docker digest to 29a2b23
All checks were successful
Main workflow / Run unit tests (push) Successful in 35s
Main workflow / Build docker image (push) Successful in 1m9s
2023-08-01 22:17:03 +00:00
a81fce0eb9 Update module github.com/rs/zerolog to v1.30.0
All checks were successful
Main workflow / Run unit tests (push) Successful in 37s
Main workflow / Build docker image (push) Successful in 1m17s
2023-07-30 00:17:34 +00:00
85ca8771c3 Update module github.com/minio/minio-go/v7 to v7.0.61
All checks were successful
Main workflow / Run unit tests (push) Successful in 35s
Main workflow / Build docker image (push) Successful in 1m12s
2023-07-17 17:06:14 +00:00
7e2f59de50 Fix pipeline
All checks were successful
Main workflow / Run unit tests (push) Successful in 36s
Main workflow / Build docker image (push) Successful in 1m11s
2023-07-14 13:50:31 +02:00
ad184314d7 Update golang:1.20-alpine Docker digest to 6f592e0
Some checks failed
Main workflow / Run unit tests (push) Successful in 43s
Main workflow / Build docker image (push) Failing after 51s
2023-07-13 21:05:59 +00:00
33848cbbd2 Update golang:1.20-alpine Docker digest to 5bb5c69
All checks were successful
Main workflow / Run unit tests (push) Successful in 37s
Main workflow / Build docker image (push) Successful in 57s
2023-07-12 07:07:47 +00:00
4dfa67af5d Update module github.com/minio/minio-go/v7 to v7.0.60
All checks were successful
Main workflow / Run unit tests (push) Successful in 35s
Main workflow / Build docker image (push) Successful in 59s
2023-07-11 21:06:06 +00:00
6d744ada2a Remove old workaround
All checks were successful
Main workflow / Run unit tests (push) Successful in 37s
Main workflow / Build docker image (push) Successful in 59s
2023-07-02 11:33:07 +02:00
e88fbf2aa9 Fix CI tag generation 2023-07-02 11:32:56 +02:00
e0c1df7043 Update module github.com/minio/minio-go/v7 to v7.0.59
Some checks failed
Main workflow / Run unit tests (push) Successful in 38s
Main workflow / Build docker image (push) Failing after 21s
2023-07-02 09:20:10 +00:00
ce9ce97837 Update README
All checks were successful
Main workflow / Run unit tests (push) Successful in 38s
Main workflow / Build docker image (push) Successful in 58s
2023-07-02 11:12:48 +02:00
ac0313cee3 Add example config.toml 2023-07-02 11:08:19 +02:00
1ada753fcb Add renovate config 2023-07-02 11:08:03 +02:00
3ddfebcd24 Allow empty upload prefix
All checks were successful
Main workflow / Run unit tests (push) Successful in 38s
Main workflow / Build docker image (push) Successful in 56s
2023-06-17 13:54:59 +02:00
17 changed files with 285 additions and 235 deletions

View File

@@ -1,11 +1,2 @@
.git/
.gitignore
.dockerignore
Dockerfile
LICENSE
Makefile
*.md
*.jpg
docker-compose.yaml
prosody-filer-s3
!cmd/prosody-filer-s3
*
!bin/

View File

@@ -1,77 +0,0 @@
---
name: Main workflow
on:
push:
branches:
- '**'
tags-ignore:
- '**'
jobs:
test:
name: Run unit tests
runs-on: ubuntu-22.04
timeout-minutes: 5
container:
image: alpine:edge
steps:
- name: Install dependencies
run: |
apk add -U \
curl \
git \
go \
minio \
nodejs
- name: Checkout repository
uses: actions/checkout@v3
- name: Start minio
run: |
minio server /data &
while ! curl -s -f http://localhost:9000/minio/health/live; do
sleep 1
done
- name: Run unit tests
run: go test -v ./...
build:
name: Build docker image
needs: test
runs-on: ubuntu-22.04
timeout-minutes: 5
container:
image: alpine:edge
steps:
- name: Install dependencies
run: |
apk add -U \
docker-cli \
docker-cli-buildx \
git \
nodejs
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to registry
uses: actions/docker-login@v2
with:
registry: git.mug.lv
username: galen
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Setup buildx
uses: actions/docker-setup-buildx@v2
- name: Build image
uses: actions/docker-build-push@v4
# TODO: remove once fixed in upstream
env:
ACTIONS_RUNTIME_TOKEN: ""
with:
push: ${{ gitea.ref_name == 'main' }}
tags: git.mug.lv/galen/prosody-filer-s3:${{ gitea.ref_name == 'main' && 'latest' || gitea.ref_name }}

View File

@@ -1,47 +0,0 @@
---
name: Main workflow
on:
push:
branches-ignore:
- '**'
tags:
- '**'
jobs:
build:
name: Build docker image
runs-on: ubuntu-22.04
timeout-minutes: 5
container:
image: alpine:edge
steps:
- name: Install dependencies
run: |
apk add -U \
docker-cli \
docker-cli-buildx \
git \
nodejs
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to registry
uses: actions/docker-login@v2
with:
registry: git.mug.lv
username: galen
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Setup buildx
uses: actions/docker-setup-buildx@v2
- name: Build image
uses: actions/docker-build-push@v4
# TODO: remove once fixed in upstream
env:
ACTIONS_RUNTIME_TOKEN: ""
with:
push: true
tags: git.mug.lv/galen/prosody-filer-s3:${{ gitea.ref_name }}

60
.github/workflows/build.yaml vendored Normal file
View File

@@ -0,0 +1,60 @@
---
name: Build image
on:
workflow_call:
inputs:
push:
description: Whether to push the image
type: boolean
required: true
jobs:
build:
name: Build docker image
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Login to registry
if: ${{ inputs.push }}
uses: docker/login-action@v3
with:
registry: git.mug.lv
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Setup buildx
uses: docker/setup-buildx-action@v3
- name: Setup go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Build binary
run: make build
env:
CGO_ENABLED: 0
- name: Tag image
uses: docker/metadata-action@v5
id: meta
with:
images: |
git.mug.lv/${{ github.repository }}
flavor: |
latest=false
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
- name: Build image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ inputs.push }}
tags: ${{ steps.meta.outputs.tags }}

46
.github/workflows/main.yaml vendored Normal file
View File

@@ -0,0 +1,46 @@
---
name: Main workflow
on:
push:
branches:
- '**'
tags-ignore:
- '**'
jobs:
test:
name: Run unit tests
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Run minio
run: |
wget -q https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
./minio server /data &
while ! curl -s -f http://localhost:9000/minio/health/live; do
sleep 1
done
- name: Run unit tests
run: go test -v ./...
- name: Stop minio
if: always()
run: pkill -f minio
build:
needs: test
uses: ./.github/workflows/build.yaml
with:
push: ${{ github.ref_name == 'main' }}
secrets: inherit

16
.github/workflows/tag.yaml vendored Normal file
View File

@@ -0,0 +1,16 @@
---
name: Main workflow
on:
push:
branches-ignore:
- '**'
tags:
- '**'
jobs:
build:
uses: ./.github/workflows/build.yaml
with:
push: true
secrets: inherit

3
.gitignore vendored
View File

@@ -1,2 +1 @@
prosody-filer-s3
!cmd/prosody-filer-s3
bin/

11
.renovaterc.json5 Normal file
View File

@@ -0,0 +1,11 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"dependencyDashboard": true,
"extends": [
"group:allNonMajor",
"schedule:monthly",
],
"enabledManagers": ["github-actions", "gomod"],
"osvVulnerabilityAlerts": true,
"postUpdateOptions": ["gomodTidy"]
}

View File

@@ -1,18 +1,10 @@
FROM golang:1.20-alpine@sha256:e7cc33118f807c67d9f2dfc811cc2cc8b79b3687d0b4ac891dd59bb2a5e4a8d3 AS build
WORKDIR /build
COPY . /build
RUN go build ./...
FROM alpine:3.18@sha256:82d1e9d7ed48a7523bdebc18cf6290bdb97b82302a8a9c27d4fe885949ea94d1
FROM alpine:3.21
RUN apk add -U --no-cache ca-certificates tini && \
addgroup -g 1000 prosody-filer-s3 && \
adduser -h /var/lib/empty -G prosody-filer-s3 -s /sbin/nologin -D -H -u 1000 prosody-filer-s3
COPY --from=build /build/prosody-filer-s3 /usr/local/bin/prosody-filer-s3
COPY bin/prosody-filer-s3 /usr/local/bin/prosody-filer-s3
USER 1000

View File

@@ -1,6 +1,6 @@
.PHONY: build
build:
go build ./...
go build -o bin/ ./cmd/prosody-filer-s3
.PHONY: clean
clean:

View File

@@ -1,7 +1,13 @@
# Prosody Filer S3 fork (fork)
# Prosody Filer S3
Originally forked from https://github.com/Wilm0r/prosody-filer-s3.
Refactored to cleanup code base & fix some issues with the original implementation (e.g. HEAD requests not returning the file size). The `v2` upload API has also been implemented.
See [config.toml](./config.toml) for an example configuration file. It's also now possible to [configure using environment variables](./cmd/prosody-filer-s3/main.go#L255).
# Prosody Filer S3 fork
A simple XMPP upload server (tested with Prosody only so far) that relies on S3 API compatible storage (tested against my own Ceph and [Scaleway (free 75GB)](https://www.scaleway.com/en/object-storage/)) instead of local disk, so that you can run it without local state on Kubernetes/Docker.
Like the original version, it aims to be thin and simple. It streams PUT operations directly to S3, and fetch operations will by default redirect to a signed request to S3, instead of sitting in between as an unnecessary bottleneck. (If you do prefer proxying, it can be enabled using the `ProxyMode` setting.)

View File

@@ -209,12 +209,14 @@ func handlePut(
}
func newHandler(config *Config, client *minio.Client) http.HandlerFunc {
subDir := config.UploadSubDir
if subDir != "" {
subDir = "/" + strings.Trim(subDir, "/") + "/"
var subPath string
if config.UploadSubDir == "" || config.UploadSubDir == "/" {
subPath = "/"
} else {
subPath = "/" + strings.Trim(config.UploadSubDir, "/") + "/"
}
getFilename := func(r *http.Request) string {
return strings.TrimPrefix(r.URL.Path, subDir)
return strings.TrimPrefix(r.URL.Path, subPath)
}
return func(w http.ResponseWriter, r *http.Request) {
@@ -274,13 +276,12 @@ func loadConfig(filename string) (*Config, error) {
}
for name, value := range map[string]string{
"Address": config.Address,
"Secret": config.Secret,
"UploadSubDir": config.UploadSubDir,
"S3Endpoint": config.S3Endpoint,
"S3AccessKey": config.S3AccessKey,
"S3SecretKey": config.S3SecretKey,
"S3Bucket": config.S3Bucket,
"Address": config.Address,
"Secret": config.Secret,
"S3Endpoint": config.S3Endpoint,
"S3AccessKey": config.S3AccessKey,
"S3SecretKey": config.S3SecretKey,
"S3Bucket": config.S3Bucket,
} {
if value == "" {
return nil, fmt.Errorf("missing required config value %s", name)
@@ -326,7 +327,13 @@ func main() {
log.Fatal().Err(err).Msg("failed to initialize s3 client")
}
http.HandleFunc("/"+config.UploadSubDir, newHandler(config, client))
var pattern string
if config.UploadSubDir == "" || config.UploadSubDir == "/" {
pattern = "/"
} else {
pattern = "/" + strings.TrimPrefix(config.UploadSubDir, "/")
}
http.HandleFunc(pattern, newHandler(config, client))
log.Info().Msgf("starting server on %s", config.Address)
if err := http.ListenAndServe(config.Address, nil); err != nil {
log.Fatal().Err(err).Msg("failed to start server")

View File

@@ -166,6 +166,32 @@ func TestUploadValid(t *testing.T) {
}
}
func TestUploadValidNoPrefix(t *testing.T) {
config := testConfig()
config.UploadSubDir = ""
client, err := initS3Client(config)
assert.NoError(t, err)
setupBucket(t, config, client)
defer teardownBucket(t, config, client)
f, err := os.ReadFile("../../catmetal.jpg")
assert.NoError(t, err)
req, err := http.NewRequest("PUT", "/catmetal.jpg", bytes.NewBuffer(f))
assert.NoError(t, err)
req.Header.Set("Content-Type", "image/jpeg")
q := req.URL.Query()
q.Set("v2", "26a2b6e27b451bf695f769c8cbb23f8856e80a1fb5963a831f1c79a19873365d")
req.URL.RawQuery = q.Encode()
rr := httptest.NewRecorder()
handler := http.HandlerFunc(newHandler(config, client))
handler.ServeHTTP(rr, req)
assert.Equal(t, http.StatusCreated, rr.Code)
}
func TestUploadMissingMAC(t *testing.T) {
f, err := os.ReadFile("../../catmetal.jpg")
assert.NoError(t, err)
@@ -296,3 +322,26 @@ func TestDownloadOK(t *testing.T) {
})
}
}
func TestDownloadValidNoPrefix(t *testing.T) {
config := testConfig()
config.ProxyMode = true
config.UploadSubDir = ""
client, err := initS3Client(config)
assert.NoError(t, err)
setupBucket(t, config, client)
defer teardownBucket(t, config, client)
uploadFile(t, config, client)
req, err := http.NewRequest("GET", "/catmetal.jpg", nil)
assert.NoError(t, err)
rr := httptest.NewRecorder()
handler := http.HandlerFunc(newHandler(config, client))
handler.ServeHTTP(rr, req)
assert.Equal(t, http.StatusOK, rr.Code)
assert.Equal(t, "image/jpeg", rr.Header().Get("Content-Type"))
assert.Equal(t, "inline", rr.Header().Get("Content-Disposition"))
}

10
config.toml Normal file
View File

@@ -0,0 +1,10 @@
address = "[::]:5050"
secret = "mysecret"
upload_sub_dir = ""
proxy_mode = true
s3_endpoint = "localhost:9000"
s3_access_key = "minioadmin"
s3_secret_key = "minioadmin"
s3_tls = false
s3_bucket = "bucket"
s3_region = ""

View File

@@ -4,7 +4,7 @@ services:
minio:
image: minio/minio:latest
command:
- server
- /data
- server
- /data
ports:
- "9000:9000"
- "9000:9000"

41
go.mod
View File

@@ -1,34 +1,35 @@
module git.mug.lv/galen/prosody-filer-s3
go 1.20
go 1.23.0
toolchain go1.25.4
require (
github.com/BurntSushi/toml v1.3.2
github.com/minio/minio-go/v7 v7.0.56
github.com/rs/zerolog v1.29.1
github.com/stretchr/testify v1.8.4
github.com/BurntSushi/toml v1.5.0
github.com/minio/minio-go/v7 v7.0.97
github.com/rs/zerolog v1.34.0
github.com/stretchr/testify v1.11.1
)
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.11 // indirect
github.com/klauspost/crc32 v1.3.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/minio/crc64nvme v1.1.0 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/philhofer/fwd v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/sirupsen/logrus v1.9.2 // indirect
golang.org/x/crypto v0.10.0 // indirect
golang.org/x/net v0.11.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
github.com/rs/xid v1.6.0 // indirect
github.com/tinylib/msgp v1.3.0 // indirect
golang.org/x/crypto v0.39.0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sys v0.34.0 // indirect
golang.org/x/text v0.26.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

88
go.sum
View File

@@ -1,73 +1,59 @@
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI=
github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU=
github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/klauspost/crc32 v1.3.0 h1:sSmTt3gUt81RP655XGZPElI0PelVTZ6YwCRnPSupoFM=
github.com/klauspost/crc32 v1.3.0/go.mod h1:D7kQaZhnkX/Y0tstFGf8VUzv2UofNGqCjnC3zdHB0Hw=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/minio/crc64nvme v1.1.0 h1:e/tAguZ+4cw32D+IO/8GSf5UVr9y+3eJcxZI2WOO/7Q=
github.com/minio/crc64nvme v1.1.0/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg=
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
github.com/minio/minio-go/v7 v7.0.56 h1:pkZplIEHu8vinjkmhsexcXpWth2tjVLphrTZx6fBVZY=
github.com/minio/minio-go/v7 v7.0.56/go.mod h1:NUDy4A4oXPq1l2yK6LTSvCEzAMeIcoz9lcj5dbzSrRE=
github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM=
github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/minio/minio-go/v7 v7.0.97 h1:lqhREPyfgHTB/ciX8k2r8k0D93WaFqxbJX36UZq5occ=
github.com/minio/minio-go/v7 v7.0.97/go.mod h1:re5VXuo0pwEtoNLsNuSr0RrLfT/MBtohwdaSmPPSRSk=
github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM=
github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc=
github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU=
github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y=
github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM=
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU=
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/tinylib/msgp v1.3.0 h1:ULuf7GPooDaIlbyvgAxBV/FI7ynli6LZ1/nVUNu+0ww=
github.com/tinylib/msgp v1.3.0/go.mod h1:ykjzy2wzgrlvpDCRc4LA8UXy6D8bzMSuAF3WD57Gok0=
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=