mirror of
https://github.com/pldubouilh/gossa
synced 2025-12-06 00:12:36 +01:00
lint js
This commit is contained in:
parent
7b4987d503
commit
97c427fb87
3 changed files with 27 additions and 22 deletions
3
.github/workflows/always.yml
vendored
3
.github/workflows/always.yml
vendored
|
|
@ -12,6 +12,9 @@ jobs:
|
||||||
go-version: 1.19.1
|
go-version: 1.19.1
|
||||||
id: go
|
id: go
|
||||||
|
|
||||||
|
- name: deps
|
||||||
|
run: npm i -g standard
|
||||||
|
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
30
Makefile
30
Makefile
|
|
@ -1,26 +1,29 @@
|
||||||
FLAGS := -ldflags "-s -w" -trimpath
|
FLAGS := -ldflags "-s -w" -trimpath
|
||||||
NOCGO := CGO_ENABLED=0
|
NOCGO := CGO_ENABLED=0
|
||||||
|
|
||||||
build:
|
build::
|
||||||
go vet && go fmt
|
go vet && go fmt
|
||||||
${NOCGO} go build ${FLAGS} -o gossa
|
${NOCGO} go build ${FLAGS} -o gossa
|
||||||
|
|
||||||
install:
|
install::
|
||||||
sudo cp gossa /usr/local/bin
|
sudo cp gossa /usr/local/bin
|
||||||
|
|
||||||
run:
|
run::
|
||||||
./gossa -verb=true test-fixture
|
./gossa -verb=true test-fixture
|
||||||
|
|
||||||
run-ro:
|
run-ro::
|
||||||
./gossa -verb=true -ro=true test-fixture
|
./gossa -verb=true -ro=true test-fixture
|
||||||
|
|
||||||
run-extra:
|
run-extra::
|
||||||
./gossa -verb=true -prefix="/fancy-path/" -k=false -symlinks=true test-fixture
|
./gossa -verb=true -prefix="/fancy-path/" -k=false -symlinks=true test-fixture
|
||||||
|
|
||||||
ci: build-all test
|
lint-js::
|
||||||
|
standard
|
||||||
|
|
||||||
|
ci:: build-all test lint-js
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
test:
|
test::
|
||||||
-@cd test-fixture && ln -s ../support .; true
|
-@cd test-fixture && ln -s ../support .; true
|
||||||
go test -cover -c -tags testrunmain
|
go test -cover -c -tags testrunmain
|
||||||
|
|
||||||
|
|
@ -43,19 +46,19 @@ test:
|
||||||
# go tool cover -html all.out
|
# go tool cover -html all.out
|
||||||
# go tool cover -func=all.out | grep main | grep '9.\..\%'
|
# go tool cover -func=all.out | grep main | grep '9.\..\%'
|
||||||
|
|
||||||
watch:
|
watch::
|
||||||
ls gossa.go gossa_test.go ui/* | entr -rc make build run
|
ls gossa.go gossa_test.go ui/* | entr -rc make build run
|
||||||
|
|
||||||
watch-extra:
|
watch-extra::
|
||||||
ls gossa.go gossa_test.go ui/* | entr -rc make build run-extra
|
ls gossa.go gossa_test.go ui/* | entr -rc make build run-extra
|
||||||
|
|
||||||
watch-ro:
|
watch-ro::
|
||||||
ls gossa.go gossa_test.go ui/* | entr -rc make build run-ro
|
ls gossa.go gossa_test.go ui/* | entr -rc make build run-ro
|
||||||
|
|
||||||
watch-test:
|
watch-test::
|
||||||
ls gossa.go gossa_test.go ui/* | entr -rc make test
|
ls gossa.go gossa_test.go ui/* | entr -rc make test
|
||||||
|
|
||||||
build-all: build
|
build-all:: build
|
||||||
${NOCGO} GOOS=linux GOARCH=amd64 go build ${FLAGS} -o builds/gossa-linux-x64
|
${NOCGO} GOOS=linux GOARCH=amd64 go build ${FLAGS} -o builds/gossa-linux-x64
|
||||||
${NOCGO} GOOS=linux GOARCH=arm go build ${FLAGS} -o builds/gossa-linux-arm
|
${NOCGO} GOOS=linux GOARCH=arm go build ${FLAGS} -o builds/gossa-linux-arm
|
||||||
${NOCGO} GOOS=linux GOARCH=arm64 go build ${FLAGS} -o builds/gossa-linux-arm64
|
${NOCGO} GOOS=linux GOARCH=arm64 go build ${FLAGS} -o builds/gossa-linux-arm64
|
||||||
|
|
@ -64,8 +67,7 @@ build-all: build
|
||||||
${NOCGO} GOOS=windows GOARCH=amd64 go build ${FLAGS} -o builds/gossa-windows.exe
|
${NOCGO} GOOS=windows GOARCH=amd64 go build ${FLAGS} -o builds/gossa-windows.exe
|
||||||
sha256sum builds/*
|
sha256sum builds/*
|
||||||
|
|
||||||
.PHONY: clean
|
clean::
|
||||||
clean:
|
|
||||||
rm -f gossa
|
rm -f gossa
|
||||||
rm -f gossa-linux64
|
rm -f gossa-linux64
|
||||||
rm -f gossa-linux-arm
|
rm -f gossa-linux-arm
|
||||||
|
|
|
||||||
16
ui/script.js
vendored
16
ui/script.js
vendored
|
|
@ -39,9 +39,9 @@ const getArrowSelected = () => document.querySelector('.arrow-selected')
|
||||||
const getASelected = () => !getArrowSelected() ? false : getArrowSelected().parentElement.parentElement.querySelectorAll('a')[0]
|
const getASelected = () => !getArrowSelected() ? false : getArrowSelected().parentElement.parentElement.querySelectorAll('a')[0]
|
||||||
const prependPath = a => a.startsWith('/') ? a : decodeURI(location.pathname) + a
|
const prependPath = a => a.startsWith('/') ? a : decodeURI(location.pathname) + a
|
||||||
const prevent = e => e.preventDefault()
|
const prevent = e => e.preventDefault()
|
||||||
const flicker = w => w.classList.remove('runFade') || void w.offsetWidth || w.classList.add('runFade')
|
const flicker = w => w.classList.remove('runFade') || void w.offsetWidth || w.classList.add('runFade') // eslint-disable-line
|
||||||
|
|
||||||
const encodeURIHash = e => encodeURI(e).replaceAll("#", "%23")
|
const encodeURIHash = e => encodeURI(e).replaceAll('#', '%23')
|
||||||
|
|
||||||
// Manual upload
|
// Manual upload
|
||||||
manualUpload.addEventListener('change', () => Array.from(manualUpload.files).forEach(f => isDupe(f.name) || postFile(f, '/' + f.name)), false)
|
manualUpload.addEventListener('change', () => Array.from(manualUpload.files).forEach(f => isDupe(f.name) || postFile(f, '/' + f.name)), false)
|
||||||
|
|
@ -103,7 +103,7 @@ window.onClickLink = e => {
|
||||||
videoOn(a.href)
|
videoOn(a.href)
|
||||||
return false
|
return false
|
||||||
// let html be displayed naturally
|
// let html be displayed naturally
|
||||||
} else if (a.innerText.endsWith(".html")) {
|
} else if (a.innerText.endsWith('.html')) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -286,7 +286,7 @@ document.ondrop = e => {
|
||||||
|
|
||||||
cancelDefault(e)
|
cancelDefault(e)
|
||||||
upGrid.style.display = 'none'
|
upGrid.style.display = 'none'
|
||||||
let t = getLink().firstChild
|
const t = getLink().firstChild
|
||||||
|
|
||||||
// move to a folder
|
// move to a folder
|
||||||
if (draggingSrc && t) {
|
if (draggingSrc && t) {
|
||||||
|
|
@ -339,7 +339,7 @@ async function padOn (a) {
|
||||||
fileEdited = a.innerHTML
|
fileEdited = a.innerHTML
|
||||||
const f = await fetch(a.href, {
|
const f = await fetch(a.href, {
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
headers: new Headers({ 'pragma': 'no-cache', 'cache-control': 'no-cache' })
|
headers: new Headers({ pragma: 'no-cache', 'cache-control': 'no-cache' })
|
||||||
})
|
})
|
||||||
editor.value = await f.text()
|
editor.value = await f.text()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -605,7 +605,7 @@ function videosOff () {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
window.videodl = function() {
|
window.videodl = function () {
|
||||||
dl(getASelected())
|
dl(getASelected())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -628,7 +628,7 @@ function helpOff () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paste handler
|
// Paste handler
|
||||||
let cuts = []
|
const cuts = []
|
||||||
function onPaste () {
|
function onPaste () {
|
||||||
if (!cuts.length) { return refresh() }
|
if (!cuts.length) { return refresh() }
|
||||||
const a = getASelected()
|
const a = getASelected()
|
||||||
|
|
@ -669,7 +669,7 @@ let typedPath = ''
|
||||||
let typedToken = null
|
let typedToken = null
|
||||||
|
|
||||||
function cpPath () {
|
function cpPath () {
|
||||||
var t = document.createElement('textarea')
|
const t = document.createElement('textarea')
|
||||||
t.value = getASelected().href
|
t.value = getASelected().href
|
||||||
document.body.appendChild(t)
|
document.body.appendChild(t)
|
||||||
t.select()
|
t.select()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue