mirror of
https://github.com/gmemstr/sliproad.git
synced 2024-09-20 00:21:15 +01:00
Subdirectory handling in frontend, README
Updated READMe a bit for providers, allowed frontend to better handle linking to subdirectories (previously didn't work at all!).
This commit is contained in:
parent
292e24978d
commit
bb03aa9b8f
20
README.md
20
README.md
|
@ -36,18 +36,16 @@ this project uses go modules and a makefile, so building should be relatively st
|
||||||
- `make` will build the project for your system's architecture.
|
- `make` will build the project for your system's architecture.
|
||||||
- `make pi` will build the project with the `GOOS=linux GOARCH=arm GOARM=5 go` flags set for raspberry pis.
|
- `make pi` will build the project with the `GOOS=linux GOARCH=arm GOARM=5 go` flags set for raspberry pis.
|
||||||
|
|
||||||
## api
|
### providers
|
||||||
|
|
||||||
initially the heavy lifting was done by the server, but the need for a better frontend was clear.
|
there are a few built-in providers, and more can be added by opening a pull request.
|
||||||
|
|
||||||
full documentation coming soon once actual functionality has been nailed down.
|
|name|service|configuration example|
|
||||||
|
|----|-------|---------------------|
|
||||||
|
|disk|local filesystem|disk.yml|
|
||||||
|
|backblaze|backblaze b2|backblaze.yml|
|
||||||
|
|
||||||
## providers
|
#### custom provider
|
||||||
|
|
||||||
// todo
|
custom file providers can be implemented by adding a new go file to the `files` module. it should
|
||||||
|
implement the `FileProviderInterface` interface.
|
||||||
## credits
|
|
||||||
|
|
||||||
svg icons via https://iconsvg.xyz
|
|
||||||
|
|
||||||
raspberry pi svg via https://www.vectorlogo.zone/logos/raspberrypi/index.html
|
|
|
@ -1,9 +1,6 @@
|
||||||
* {
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-lg, .grid-sm {
|
.grid-lg, .grid-sm {
|
||||||
|
@ -46,3 +43,21 @@ body {
|
||||||
background-color: darkgray;
|
background-color: darkgray;
|
||||||
transition: background-color 0.5s;
|
transition: background-color 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
body { background-color: black; color: white; }
|
||||||
|
.grid-lg a, .grid-sm a {
|
||||||
|
background-color: white;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
.grid-lg a:visited, .grid-lg a,
|
||||||
|
.grid-sm a:visited, .grid-sm a {
|
||||||
|
color: black
|
||||||
|
}
|
||||||
|
.grid-lg a:hover,
|
||||||
|
.grid-sm a:hover {
|
||||||
|
color: lightgray;
|
||||||
|
background-color: darkgray;
|
||||||
|
transition: background-color 0.5s;
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,7 +12,7 @@ function getFileListing(provider, path = "") {
|
||||||
html`
|
html`
|
||||||
<div class="grid-sm">
|
<div class="grid-sm">
|
||||||
${files.map(file =>
|
${files.map(file =>
|
||||||
`<a href="${!file.IsDirectory ? `/api/files/${provider}${path}/${file.Name}` : `#${provider + "/" + file.Name}`}">
|
`<a href="${!file.IsDirectory ? `/api/files/${provider}${path}/${file.Name}` : `#${provider}/${path !== "" ? path.replace("/","") + "/" : ""}${file.Name}`}">
|
||||||
${file.Name}${file.IsDirectory ? '/' : ''}
|
${file.Name}${file.IsDirectory ? '/' : ''}
|
||||||
</a>
|
</a>
|
||||||
`
|
`
|
||||||
|
@ -52,7 +52,7 @@ function router(event = null) {
|
||||||
|
|
||||||
let path = hash.split("/")
|
let path = hash.split("/")
|
||||||
let provider = path.shift()
|
let provider = path.shift()
|
||||||
console.log(path, provider)
|
path = path.join("/")
|
||||||
getFileListing(provider, "/" + path)
|
getFileListing(provider, "/" + path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue