Skip to content

Commit

Permalink
Merge pull request #35 from pldubouilh/bump-ui
Browse files Browse the repository at this point in the history
Bump ui
  • Loading branch information
pldubouilh authored Dec 25, 2019
2 parents fe12ed0 + e22ef1b commit b2e0396
Show file tree
Hide file tree
Showing 29 changed files with 160 additions and 189 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Go
name: ci
on: [push, pull_request]
jobs:

Expand All @@ -7,15 +7,15 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.12
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.12
go-version: 1.13
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
with:
submodules: true

- name: Run
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ gossa-windows.exe
.vscode
test-fixture/*
test-fixture/*/*
!test-fixture/.testhidden
!test-fixture/compress
!test-fixture/compress/foo*
!test-fixture/gzip
Expand Down Expand Up @@ -36,3 +37,5 @@ test-fixture/*/*
!test-fixture/hols/scotland-1761292_1920.jpg
!test-fixture/fancy-path
!test-fixture/fancy-path/*
!test-fixture/ext/*
!test-fixture/ext
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

28 changes: 19 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,33 @@ build:
make -C gossa-ui/
go vet && go fmt
CGO_ENABLED=0 go build gossa.go
rm gossa.go
sleep 1 && rm gossa.go

run:
make build
./gossa test-fixture
./gossa -verb=true test-fixture

run-extra:
make build
./gossa -prefix="/fancy-path/" -symlinks=true test-fixture
./gossa -verb=true -prefix="/fancy-path/" -k=false -symlinks=true test-fixture

ci:
-@cd test-fixture && ln -s ../docker .
make build
timeout 10 make run &
sleep 11 && timeout 10 make run-extra &
cp src/gossa_test.go . && go test
test:
timeout 60 make run &
sleep 15 && cp src/gossa_test.go . && go test -run TestNormal
rm gossa_test.go
-killall gossa

test-extra:
timeout 60 make run-extra &
sleep 15 && cp src/gossa_test.go . && go test -run TestExtra
rm gossa_test.go
-killall gossa

ci:
-@cd test-fixture && ln -s ../support .
make test
make test-extra


watch:
ls src/* gossa-ui/* | entr -rc make run
Expand Down
22 changes: 0 additions & 22 deletions docker/caddy.Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions docker/download.Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion gossa-ui
Submodule gossa-ui updated 3 files
+225 −69 script.js
+124 −245 style.css
+29 −9 ui.tmpl
44 changes: 14 additions & 30 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
gossa
=============

![e](https://user-images.githubusercontent.com/760637/52522293-942fa880-2c83-11e9-9f79-0a5b922bcc7f.gif)
![e](https://user-images.githubusercontent.com/760637/71449335-790a4200-274a-11ea-80be-4c536fbad8a1.gif)

[![build status](https://img.shields.io/travis/pldubouilh/gossa.svg?logo=travis)](https://travis-ci.org/pldubouilh/gossa)
[![build status](https://github.com/pldubouilh/gossa/workflows/ci/badge.svg)](https://github.com/pldubouilh/gossa/actions)
[![docker build status](https://img.shields.io/docker/cloud/build/pldubouilh/gossa.svg?logo=docker)](https://hub.docker.com/r/pldubouilh/gossa)
[![docker pulls](https://img.shields.io/docker/pulls/pldubouilh/gossa.svg?logo=docker)](https://hub.docker.com/r/pldubouilh/gossa)
[![github downloads](https://img.shields.io/github/downloads/pldubouilh/gossa/total.svg?logo=github)](https://github.com/pldubouilh/gossa/releases)
Expand All @@ -16,13 +16,14 @@ a [simple UI](https://github.com/pldubouilh/gossa-ui) comes as default, featurin
* 📩 drag-and-drop file/directory uploader
* 🗺️ files handling - move/rename/delete
* 📸 picture browser
* 📽️ video streaming from the browser
* 📽️ video streaming
* ✍️ simple text editor
* ⌨️ keyboard shortcuts
* 🥂 speed - showed rates above 100MB/s
* 🥂 speed - will easily fill available bandwidth
* 🔒 safe - easy/secure multi account setup

### build
built blobs are available on the [release page](https://github.com/pldubouilh/gossa/releases) - or simply `make build` this repo
built blobs are available on the [release page](https://github.com/pldubouilh/gossa/releases) - or simply `make build` this repo.

### usage
```sh
Expand All @@ -31,33 +32,16 @@ built blobs are available on the [release page](https://github.com/pldubouilh/go
% ./gossa -h 192.168.100.33 ~/storage
```

### ui shortcuts
|shortcut | action|
| ------------- |-------------|
|click new folder icon | create new folder|
|click pad icon | open file editor|
|click file icon | rename item|
|double click file icon | delete item|
|drag-and-drop item on UI | move item|
|drag-and-drop external item | upload file/folders|

### keyboard shortcuts
|shortcut | action|
|-------------|-------------|
|Arrows/Enter | browse through files/directories and pictures|
|Ctrl/Meta + C | copy URL to clipboard|
|Ctrl/Meta + E | rename file/folder|
|Ctrl/Meta + Del | delete file/folder|
|Ctrl/Meta + U | upload new file/folder|
|Ctrl/Meta + D | create a new directory|
|Ctrl/Meta + X | cut selected path|
|Ctrl/Meta + V | paste previously selected paths to directory|
|\<any letter\> | search|

### using with docker
a few docker/docker-compose files are provided in the [docker folder](https://github.com/pldubouilh/gossa/tree/master/docker). release images are also pushed to [dockerhub](https://hub.docker.com/r/pldubouilh/gossa), e.g. :
### fancier setups
release images are pushed to [dockerhub](https://hub.docker.com/r/pldubouilh/gossa), e.g. :

```sh
# pull from dockerhub and run
% sudo docker run -v ~/LocalDirToShare:/shared -p 8001:8001 pldubouilh/gossa
```

in a do-one-thing-well mindset, HTTPS and authentication has been left to middlewares and proxies. for instance [caddy](https://caddyserver.com/) handles this very well - have a look at this small [caddy config](https://github.com/pldubouilh/gossa/blob/master/support/Caddyfile) with authentication and option for HTTPS that works along with gossa.

### shortcuts
the default UI is fully usable by through keyboard/UI shortcuts - press `Ctrl/Cmd + h` to see them all.

24 changes: 13 additions & 11 deletions src/gossa.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ var host = flag.String("h", "127.0.0.1", "host to listen to")
var port = flag.String("p", "8001", "port to listen to")
var extraPath = flag.String("prefix", "/", "url prefix at which gossa can be reached, e.g. /gossa/ (slashes of importance)")
var symlinks = flag.Bool("symlinks", false, "follow symlinks \033[4mWARNING\033[0m: symlinks will by nature allow to escape the defined path (default: false)")
var verb = flag.Bool("verb", true, "verbosity")
var skipHidden = flag.Bool("k", true, "skip hidden files")
var verb = flag.Bool("verb", false, "verbosity")
var skipHidden = flag.Bool("k", true, "\nskip hidden files")
var initPath = "."

var fs http.Handler
Expand Down Expand Up @@ -162,35 +162,37 @@ func rpc(w http.ResponseWriter, r *http.Request) {
}

func checkPath(p string) string {
p = filepath.Join(initPath, strings.TrimPrefix(p, *extraPath))
fp, err := filepath.Abs(p)
joined := filepath.Join(initPath, strings.TrimPrefix(p, *extraPath))
fp, err := filepath.Abs(joined)
sl, _ := filepath.EvalSymlinks(fp)

if err != nil || !strings.HasPrefix(fp, initPath) || len(sl) > 0 && !*symlinks && !strings.HasPrefix(sl, initPath) {
if err != nil || !strings.HasPrefix(fp, initPath) || *skipHidden && strings.Contains(p, "/.") || !*symlinks && len(sl) > 0 && !strings.HasPrefix(sl, initPath) {
panic(errors.New("invalid path"))
}

return fp
}

func main() {
var err error
flag.Usage = func() {
fmt.Printf("\nusage: ./gossa ~/directory-to-share\n\n")
flag.PrintDefaults()
}

flag.Parse()
if len(flag.Args()) > 0 {
initPath = flag.Args()[0]
}

var err error
initPath, err = filepath.Abs(initPath)
check(err)

hostString := *host + ":" + *port
fmt.Println("Gossa startig on directory " + initPath)
fmt.Println("Listening on http://" + hostString + *extraPath)

http.HandleFunc(*extraPath+"rpc", rpc)
http.HandleFunc(*extraPath+"post", upload)
http.HandleFunc("/", doContent)
fs = http.StripPrefix(*extraPath, http.FileServer(http.Dir(initPath)))
err = http.ListenAndServe(hostString, nil)
fmt.Printf("Gossa startig on directory %s\nListening on http://%s:%s%s\n", initPath, *host, *port, *extraPath)
err = http.ListenAndServe(*host+":"+*port, nil)
check(err)
}
Loading

0 comments on commit b2e0396

Please sign in to comment.