Skip to content

Commit

Permalink
Merge pull request #147 from root-gg/1.1.1
Browse files Browse the repository at this point in the history
Version 1.1.1
  • Loading branch information
Charles-Antoine Mathieu committed Jan 14, 2016
2 parents 3094de5 + eeedde6 commit 6d365a5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# THE SOFTWARE.
###

RELEASE_VERSION="1.1"
RELEASE_VERSION="1.1.1"
RELEASE_DIR="release/plik-$(RELEASE_VERSION)"
RELEASE_TARGETS=darwin-386 darwin-amd64 freebsd-386 \
freebsd-amd64 linux-386 linux-amd64 linux-arm openbsd-386 \
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ Plik is an simple and powerful file uploading system written in golang.
- Comments : Add custom message (in Markdown format)

### Version
1.1
1.1.1

### Installation

##### From release
To run plik, it's very simple :
```sh
$ wget https://github.com/root-gg/plik/releases/download/1.1/plik-1.1.tar.gz
$ tar xvf plik-1.1.tar.gz
$ cd plik-1.1/server
$ wget https://github.com/root-gg/plik/releases/download/1.1.1/plik-1.1.1.tar.gz
$ tar xvf plik-1.1.1.tar.gz
$ cd plik-1.1.1/server
$ ./plikd
```
Et voilà ! You now have a fully functional instance of plik running on http://127.0.0.1:8080.
Expand Down
22 changes: 15 additions & 7 deletions client/plik.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (
"net/http"
"net/url"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
Expand Down Expand Up @@ -605,13 +604,17 @@ func updateClient(updateFlag bool) (err error) {
return
}

// Download new client
tmpPath := filepath.Dir(path) + "/" + "." + filepath.Base(path) + ".tmp"
tmpFile, err := os.OpenFile(tmpPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0777)
// Create tmp file
tmpFile, err := ioutil.TempFile("", ".plik_update_")
if err != nil {
return
}
defer tmpFile.Close()
defer func() {
tmpFile.Close()
os.Remove(tmpFile.Name())
}()

// Download new client
URL, err = url.Parse(downloadURL)
if err != nil {
err = fmt.Errorf("Unable to download client : %s", err)
Expand All @@ -637,9 +640,14 @@ func updateClient(updateFlag bool) (err error) {
err = fmt.Errorf("Unable to download client : %s", err)
return
}
err = tmpFile.Close()
if err != nil {
err = fmt.Errorf("Unable to download client : %s", err)
return
}

// Check download integrity
downloadMD5, err := utils.FileMd5sum(tmpPath)
downloadMD5, err := utils.FileMd5sum(tmpFile.Name())
if err != nil {
err = fmt.Errorf("Unable to download client : %s", err)
return
Expand All @@ -650,7 +658,7 @@ func updateClient(updateFlag bool) (err error) {
}

// Replace old client
err = os.Rename(tmpPath, path)
err = os.Rename(tmpFile.Name(), path)
if err != nil {
err = fmt.Errorf("Unable to replace client : %s", err)
return
Expand Down
3 changes: 2 additions & 1 deletion server/metadataBackend/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ func (fmb *MetadataBackend) GetUploadsToRemove(ctx *common.PlikContext) (ids []s
// Get upload metadata
upload, err := fmb.Get(ctx, uploadDirectory.Name())
if err != nil {
return ids, err
ctx.EWarningf("Unable to get upload metadata %s : %s", uploadDirectory.Name(), err)
continue
}

// If a TTL is set, test if expired or not
Expand Down
2 changes: 1 addition & 1 deletion server/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<div class="row">
<!-- HEADER LEFT -->
<div class="col-sm-3 text-center">
<h1><a href="/">Plik</a></h1>
<h1><a href="#/_">Plik</a></h1>
</div>
<!-- HEADER RIGHT -->
<div class="col-sm-9 text-right hidden-xs hidden-sm">
Expand Down

0 comments on commit 6d365a5

Please sign in to comment.