5 Commits

Author SHA1 Message Date
Thomas Leister
07d0882c65 Introduces version string in log message
Adds a version string to enable the user to distinguish between
multiple Prosody-Filer versions. The version information is "baked in"
via the linker in build.sh
2020-04-20 21:20:39 +02:00
Thomas Leister
016ffd9fa4 Merge branch 'weiss-return-201' into develop 2020-01-12 10:47:18 +01:00
Holger Weiß
95c3ac899f Return status code 201 on PUT success
XEP-0363 (version 0.9.0) says:

| An HTTP status code of 201 means that the server is now ready to serve
| the file via the provided GET URL.

Some clients assume the upload failed when receiving a status code of
200, so we now return 201 instead.
2020-01-11 18:08:28 +01:00
Thomas Leister
3bc8446a6d Updates README: Fixes tidy up command 2020-01-08 20:19:08 +01:00
Thomas Leister
aabe581148 Fix directory listing issue also in alternative Nginx config 2020-01-08 20:11:14 +01:00
4 changed files with 13 additions and 7 deletions

View File

@@ -245,6 +245,7 @@ server {
}
root /home/prosody-filer;
autoindex off;
client_max_body_size 51m;
client_body_buffer_size 51m;
try_files $uri $uri/ @prosodyfiler;
@@ -308,7 +309,7 @@ server {
Prosody Filer has no immediate knowlegde over all the stored files and the time they were uploaded, since no database exists for that. Also Prosody is not capable to do auto deletion if *mod_http_upload_external* is used. Therefore the suggested way of purging the uploads directory is to execute a purge command via a cron job:
@daily find /home/prosody-filer/upload/* -maxdepth 0 -type d -mtime +28 | xargs rm -rf
@daily find /home/prosody-filer/upload/ -type d -mtime +28 | xargs rm -rf
This will delete uploads older than 28 days.

View File

@@ -1,7 +1,10 @@
#!/bin/sh
#!/bin/bash
##
## Builds static prosody-filer binary
##
### get VERSIONSTRING
VERSIONSTRING="$(git describe --tags --exact-match || git rev-parse --short HEAD)"
echo "Building version ${VERSIONSTRING} of Prosody-Filer ..."
### Compile and link statically
CGO_ENABLED=0 GOOS=linux go build -a -ldflags "-extldflags '-static' -w -s -X main.versionString=${VERSIONSTRING}" prosody-filer.go
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' .

View File

@@ -36,6 +36,7 @@ type Config struct {
}
var conf Config
var versionString string = "0.0.0"
/*
* Sets CORS headers
@@ -113,6 +114,7 @@ func handleRequest(w http.ResponseWriter, r *http.Request) {
}
log.Println("Successfully written", n, "bytes to file", fileStorePath)
w.WriteHeader(http.StatusCreated)
} else {
log.Println("Invalid MAC.")
http.Error(w, "403 Forbidden", 403)
@@ -191,7 +193,7 @@ func main() {
/*
* Start HTTP server
*/
log.Println("Starting up XMPP HTTP upload server ...")
log.Println("Starting Prosody-Filer", versionString, "...")
http.HandleFunc("/"+conf.UploadSubDir, handleRequest)
log.Printf("Server started on port %s. Waiting for requests.\n", conf.Listenport)
http.ListenAndServe(conf.Listenport, nil)