Skip to content

Commit

Permalink
Merge pull request #19 from pldubouilh/kb-upload
Browse files Browse the repository at this point in the history
kb upload
  • Loading branch information
pldubouilh authored Mar 31, 2019
2 parents b656951 + 93f3717 commit c049b71
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
run:
build:
make embed
go vet && go fmt
CGO_ENABLED=0 go build gossa.go
rm gossa.go

run:
make build
./gossa fixture

watch:
Expand Down
2 changes: 1 addition & 1 deletion docker/caddy.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN curl -L -o caddy.tar.gz "https://github.com/mholt/caddy/releases/download/v0
RUN tar xvzf caddy.tar.gz && mv caddy /caddy

# download and prepare gossa
RUN curl -L -o /gossa "https://github.com/pldubouilh/gossa/releases/download/v0.0.6/gossa-linux64"
RUN curl -L -o /gossa "https://github.com/pldubouilh/gossa/releases/download/v0.0.7/gossa-linux64"
RUN chmod +x /gossa /caddy

# Caddy config:
Expand Down
2 changes: 1 addition & 1 deletion docker/download.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM alpine
EXPOSE 8001
RUN wget https://github.com/pldubouilh/gossa/releases/download/v0.0.6/gossa-linux64 && mv gossa-linux64 /gossa && chmod +x /gossa
RUN wget https://github.com/pldubouilh/gossa/releases/download/v0.0.7/gossa-linux64 && mv gossa-linux64 /gossa && chmod +x /gossa
ENTRYPOINT [ "/gossa", "-h", "0.0.0.0", "/shared" ]

3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ built blobs are available on the [release page](https://github.com/pldubouilh/go

### run
```sh
# build
# build (or download release from github)
make

# run
Expand All @@ -46,6 +46,7 @@ make
|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|
Expand Down
2 changes: 1 addition & 1 deletion src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func rpc(w http.ResponseWriter, r *http.Request) {
} else if payload.Call == "mv" {
err = os.Rename(payload.Args[0], payload.Args[1])
} else if payload.Call == "rm" {
err = os.Remove(payload.Args[0])
err = os.RemoveAll(payload.Args[0])
}

logVerb("RPC", err, payload)
Expand Down
15 changes: 9 additions & 6 deletions src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ let totalUploads = 0
let totalUploadsSize = 0
let totalUploadedSize = []

const dupe = test => allA.find(a => a.innerText.replace('/', '') === test)
const dupe = test => allA.find(a => a.innerHTML.replace('/', '') === test)
const isDupe = t => dupe(t) ? alert(t + ' already already exists') || true : false

function shouldRefresh () {
Expand Down Expand Up @@ -231,7 +231,7 @@ document.ondragenter = e => {
}
}

document.ondragstart = e => { draggingSrc = e.target.innerText }
document.ondragstart = e => { draggingSrc = e.target.innerHTML }

document.ondragend = e => resetBackgroundLinks()

Expand All @@ -248,7 +248,7 @@ document.ondrop = e => {

// move to a folder
if (draggingSrc && t) {
const dest = t.innerText + draggingSrc
const dest = t.innerHTML + draggingSrc
ensureMove() || mvCall(prependPath(draggingSrc), prependPath(dest), refresh)
// ... or upload
} else if (e.dataTransfer.items.length) {
Expand Down Expand Up @@ -302,7 +302,7 @@ function padOff () {
async function displayPad (a) {
if (a) {
try {
fileEdited = a.innerText
fileEdited = a.innerHTML
const f = await fetch(a.href, {
credentials: 'include',
headers: new Headers({
Expand Down Expand Up @@ -367,7 +367,7 @@ window.rename = (e, commit) => {
return
}

const orig = e.key ? getASelected().innerText : getBtnA(e).innerText
const orig = e.key ? getASelected().innerHTML : getBtnA(e).innerHTML
const chg = prompt('rename to', orig)
if (chg && !isDupe(chg)) {
mvCall(prependPath(orig), prependPath(chg), refresh)
Expand Down Expand Up @@ -488,7 +488,7 @@ function onPaste () {
const root = cuts.pop()
const filename = root.split('/').pop()
const pwd = decodeURIComponent(location.pathname)
const dest = isFolder(a) ? pwd + a.innerText : pwd
const dest = isFolder(a) ? pwd + a.innerHTML : pwd
mvCall(root, dest + filename, onPaste)
}

Expand Down Expand Up @@ -576,6 +576,9 @@ document.body.addEventListener('keydown', e => {

case 'KeyD':
return prevent(e) || window.mkdirBtn()

case 'KeyU':
return prevent(e) || manualUpload.click()
}
}

Expand Down

0 comments on commit c049b71

Please sign in to comment.