update travis and some stuff
parent
b39126fdd9
commit
7b81b0828f
|
@ -5,20 +5,14 @@ root = true
|
||||||
|
|
||||||
# Unix-style newlines with a newline ending every file
|
# Unix-style newlines with a newline ending every file
|
||||||
[*]
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
# Matches multiple files with brace expansion notation
|
|
||||||
# Set default charset
|
|
||||||
[*.{js,go}]
|
|
||||||
charset = utf-8
|
|
||||||
|
|
||||||
# 4 space indentation
|
# 4 space indentation
|
||||||
[*.go]
|
[*.go]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
indent_size = 2
|
indent_size = 4
|
||||||
|
|
||||||
# Indentation override for all JS under lib directory
|
|
||||||
[*.js]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
|
|
21
.travis.yml
21
.travis.yml
|
@ -1,13 +1,18 @@
|
||||||
language: go
|
language: go
|
||||||
|
|
||||||
go:
|
go:
|
||||||
- tip
|
- tip
|
||||||
sudo: false
|
|
||||||
install:
|
install:
|
||||||
- go generate
|
- go generate
|
||||||
- go get -u -v $(go list -f '{{join .Imports "\n"}}' ./... | sort | uniq | grep -v caddy-filemanager)
|
- go get -u -v $(go list -f '{{join .Imports "\n"}}' ./... | sort | uniq | grep -v caddy-filemanager)
|
||||||
- go get -u -v github.com/mholt/caddy/caddyhttp
|
- go get -u -v github.com/mholt/caddy/caddyhttp
|
||||||
- go get -u -v github.com/caddyserver/caddydev
|
- go get -u -v github.com/caddyserver/caddydev
|
||||||
- go install github.com/caddyserver/caddydev
|
- go install github.com/caddyserver/caddydev
|
||||||
|
- go get github.com/gordonklaus/ineffassign
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- sed -i 's/\_ \"github.com\/mholt\/caddy\/caddyhttp\"/\_ \"github.com\/mholt\/caddy\/caddyhttp\"\n\_ \"github.com\/hacdias\/caddy-filemanager\"/g' $GOPATH/src/github.com/mholt/caddy/caddy/caddymain/run.go
|
- sed -i 's/\_ \"github.com\/mholt\/caddy\/caddyhttp\"/\_ \"github.com\/mholt\/caddy\/caddyhttp\"\n\_ \"github.com\/hacdias\/caddy-filemanager\"/g' $GOPATH/src/github.com/mholt/caddy/caddy/caddymain/run.go
|
||||||
- go build github.com/mholt/caddy/caddy
|
- go build github.com/mholt/caddy/caddy
|
||||||
|
- diff <(echo -n) <(gofmt -s -d .)
|
||||||
|
- ineffassign .
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
"end_with_newline": false, // End output with newline
|
"end_with_newline": false, // End output with newline
|
||||||
"indent_char": " ", // Indentation character
|
"indent_char": " ", // Indentation character
|
||||||
"indent_level": 0, // Initial indentation level
|
"indent_level": 0, // Initial indentation level
|
||||||
"indent_size": 4, // Indentation size
|
"indent_size": 2, // Indentation size
|
||||||
"indent_with_tabs": false, // Indent with tabs, overrides `indent_size` and `indent_char`
|
"indent_with_tabs": false, // Indent with tabs, overrides `indent_size` and `indent_char`
|
||||||
"jslint_happy": false, // If true, then jslint-stricter mode is enforced
|
"jslint_happy": false, // If true, then jslint-stricter mode is enforced
|
||||||
"keep_array_indentation": false, // Preserve array indentation
|
"keep_array_indentation": false, // Preserve array indentation
|
||||||
|
|
|
@ -121,7 +121,6 @@ function getCSSRule(rules) {
|
||||||
* * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * */
|
||||||
// TODO: here, we should create an abstraction layer from the webdav.
|
// TODO: here, we should create an abstraction layer from the webdav.
|
||||||
// We must create functions that do the requests to the webdav backend.
|
// We must create functions that do the requests to the webdav backend.
|
||||||
// this functions will contain a 'callback' to be used withing the other function.
|
|
||||||
|
|
||||||
webdav.move = function(oldLink, newLink) {
|
webdav.move = function(oldLink, newLink) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -140,6 +139,22 @@ webdav.move = function(oldLink, newLink) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
webdav.put = function(link, body) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let request = new XMLHttpRequest();
|
||||||
|
request.open('PUT', toWebDavURL(link), true);
|
||||||
|
request.onload = () => {
|
||||||
|
if (request.status == 201) {
|
||||||
|
resolve(request.response);
|
||||||
|
} else {
|
||||||
|
reject(request.statusText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
request.onerror = () => reject(request.statusText);
|
||||||
|
request.send(body);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * *
|
||||||
* *
|
* *
|
||||||
|
|
|
@ -67,20 +67,12 @@ listing.itemDrop = function(e) {
|
||||||
|
|
||||||
if (el.id === id) return;
|
if (el.id === id) return;
|
||||||
|
|
||||||
let oldLink = toWebDavURL(document.getElementById(id).dataset.url),
|
let oldLink = document.getElementById(id).dataset.url,
|
||||||
newLink = toWebDavURL(el.dataset.url + name),
|
newLink = el.dataset.url + name;
|
||||||
request = new XMLHttpRequest();
|
|
||||||
|
|
||||||
request.open('MOVE', oldLink);
|
webdav.move(oldLink, newLink)
|
||||||
request.setRequestHeader('Destination', newLink);
|
.then(() => listing.reload())
|
||||||
request.send();
|
.catch(e => console.log(e));
|
||||||
request.onreadystatechange = function() {
|
|
||||||
if (request.readyState == 4) {
|
|
||||||
if (request.status == 201 || request.status == 204) {
|
|
||||||
listing.reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listing.documentDrop = function(event) {
|
listing.documentDrop = function(event) {
|
||||||
|
@ -122,7 +114,8 @@ listing.rename = function(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let link = item.dataset.url,
|
let link = item.dataset.url,
|
||||||
name = item.querySelector('.name').innerHTML;
|
field = item.querySelector('.name'),
|
||||||
|
name = field.innerHTML;
|
||||||
|
|
||||||
let submit = (event) => {
|
let submit = (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -132,8 +125,7 @@ listing.rename = function(event) {
|
||||||
html = buttons.rename.querySelector('i').changeToLoading();
|
html = buttons.rename.querySelector('i').changeToLoading();
|
||||||
closePrompt(event);
|
closePrompt(event);
|
||||||
|
|
||||||
webdav.move(link, newLink)
|
webdav.move(link, newLink).then(() => {
|
||||||
.then(data => {
|
|
||||||
listing.reload(() => {
|
listing.reload(() => {
|
||||||
newName = btoa(newName);
|
newName = btoa(newName);
|
||||||
selectedItems = [newName];
|
selectedItems = [newName];
|
||||||
|
@ -142,10 +134,11 @@ listing.rename = function(event) {
|
||||||
});
|
});
|
||||||
|
|
||||||
buttons.rename.querySelector('i').changeToDone(false, html);
|
buttons.rename.querySelector('i').changeToDone(false, html);
|
||||||
})
|
}).catch(error => {
|
||||||
.catch(error => {
|
field.innerHTML = name;
|
||||||
item.querySelector('.name').innerHTML = name;
|
|
||||||
buttons.rename.querySelector('i').changeToDone(true, html);
|
buttons.rename.querySelector('i').changeToDone(true, html);
|
||||||
|
|
||||||
|
console.log(error);
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -165,24 +158,22 @@ listing.rename = function(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
listing.handleFiles = function(files, base) {
|
listing.handleFiles = function(files, base) {
|
||||||
let button = document.getElementById("upload"),
|
let html = buttons.upload.querySelector('i').changeToLoading(),
|
||||||
html = button.querySelector('i').changeToLoading();
|
promises = [];
|
||||||
|
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let file of files) {
|
||||||
let request = new XMLHttpRequest();
|
promises.push(webdav.put(window.location.pathname + base + file.name, file));
|
||||||
request.open('PUT', toWebDavURL(window.location.pathname + base + files[i].name));
|
}
|
||||||
|
|
||||||
request.send(files[i]);
|
Promise.all(promises)
|
||||||
request.onreadystatechange = function() {
|
.then(() => {
|
||||||
if (request.readyState == 4) {
|
|
||||||
if (request.status == 201) {
|
|
||||||
listing.reload();
|
listing.reload();
|
||||||
}
|
buttons.upload.querySelector('i').changeToDone(false, html);
|
||||||
|
})
|
||||||
button.querySelector('i').changeToDone((request.status != 201), html);
|
.catch(e => {
|
||||||
}
|
console.log(e);
|
||||||
}
|
buttons.upload.querySelector('i').changeToDone(true, html);
|
||||||
}
|
})
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -320,7 +311,6 @@ listing.addDoubleTapEvent = function() {
|
||||||
|
|
||||||
Array.from(items).forEach(file => {
|
Array.from(items).forEach(file => {
|
||||||
file.addEventListener('touchstart', event => {
|
file.addEventListener('touchstart', event => {
|
||||||
console.log("hey")
|
|
||||||
if (touches.id != file.id) {
|
if (touches.id != file.id) {
|
||||||
touches.id = file.id;
|
touches.id = file.id;
|
||||||
touches.count = 1;
|
touches.count = 1;
|
||||||
|
|
Loading…
Reference in New Issue