mirror of
https://code.rocketnine.space/tslocum/twins.git
synced 2024-11-27 11:28:14 +01:00
Rename HiddenFiles as Hidden
This commit is contained in:
parent
cac10df2f6
commit
58a4ecd958
6 changed files with 29 additions and 28 deletions
|
@ -111,25 +111,11 @@ Cache duration (in seconds). Set to `0` to disable caching entirely. This is an
|
||||||
out-of-spec feature. See [PROPOSALS.md](https://gitlab.com/tslocum/twins/blob/master/PROPOSALS.md)
|
out-of-spec feature. See [PROPOSALS.md](https://gitlab.com/tslocum/twins/blob/master/PROPOSALS.md)
|
||||||
for more information.
|
for more information.
|
||||||
|
|
||||||
##### Log
|
##### Hidden
|
||||||
|
|
||||||
Path to log file. Requests are logged in [Apache format](https://httpd.apache.org/docs/2.2/logs.html#combined),
|
|
||||||
excluding IP address and query.
|
|
||||||
|
|
||||||
##### SymLinks
|
|
||||||
|
|
||||||
When enabled, symbolic links may be accessed. This attribute is disabled by default.
|
|
||||||
|
|
||||||
##### HiddenFiles
|
|
||||||
|
|
||||||
When enabled, hidden files and directories may be accessed. This attribute is
|
When enabled, hidden files and directories may be accessed. This attribute is
|
||||||
disabled by default.
|
disabled by default.
|
||||||
|
|
||||||
##### List
|
|
||||||
|
|
||||||
When enabled, directories without an index file will serve a list of their
|
|
||||||
contents. This attribute is disabled by default.
|
|
||||||
|
|
||||||
##### Input
|
##### Input
|
||||||
|
|
||||||
Request text input from user.
|
Request text input from user.
|
||||||
|
@ -138,6 +124,20 @@ Request text input from user.
|
||||||
|
|
||||||
Request sensitive text input from the user. Text will not be shown as it is entered.
|
Request sensitive text input from the user. Text will not be shown as it is entered.
|
||||||
|
|
||||||
|
##### List
|
||||||
|
|
||||||
|
When enabled, directories without an index file will serve a list of their
|
||||||
|
contents. This attribute is disabled by default.
|
||||||
|
|
||||||
|
##### Log
|
||||||
|
|
||||||
|
Path to log file. Requests are logged in [Apache format](https://httpd.apache.org/docs/2.2/logs.html#combined),
|
||||||
|
excluding IP address and query.
|
||||||
|
|
||||||
|
##### SymLinks
|
||||||
|
|
||||||
|
When enabled, symbolic links may be accessed. This attribute is disabled by default.
|
||||||
|
|
||||||
##### Type
|
##### Type
|
||||||
|
|
||||||
Content type is normally detected automatically. This attribute forces a
|
Content type is normally detected automatically. This attribute forces a
|
||||||
|
|
13
README.md
13
README.md
|
@ -12,6 +12,8 @@ This page is also available at [gemini://twins.rocketnine.space](gemini://twins.
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Serve static files
|
- Serve static files
|
||||||
|
- Detect content type
|
||||||
|
- Specify content type for files with matching extension
|
||||||
- List files and directories (when enabled)
|
- List files and directories (when enabled)
|
||||||
- Reverse proxy requests
|
- Reverse proxy requests
|
||||||
- TCP
|
- TCP
|
||||||
|
@ -25,20 +27,19 @@ twins includes features that are not yet part of the Gemini specification. See [
|
||||||
|
|
||||||
## Download
|
## Download
|
||||||
|
|
||||||
|
twins is written in [Go](https://golang.org). Run the following command to
|
||||||
|
download and build twins from source.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go get gitlab.com/tslocum/twins
|
go get gitlab.com/tslocum/twins
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The resulting binary is available as `~/go/bin/twins`.
|
||||||
|
|
||||||
## Configure
|
## Configure
|
||||||
|
|
||||||
See [CONFIGURATION.md](https://gitlab.com/tslocum/twins/blob/master/CONFIGURATION.md)
|
See [CONFIGURATION.md](https://gitlab.com/tslocum/twins/blob/master/CONFIGURATION.md)
|
||||||
|
|
||||||
## Run
|
|
||||||
|
|
||||||
```bash
|
|
||||||
twins
|
|
||||||
```
|
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
Please share issues and suggestions [here](https://gitlab.com/tslocum/twins/issues).
|
Please share issues and suggestions [here](https://gitlab.com/tslocum/twins/issues).
|
||||||
|
|
|
@ -35,7 +35,7 @@ type pathConfig struct {
|
||||||
SymLinks bool
|
SymLinks bool
|
||||||
|
|
||||||
// Serve hidden files and directories
|
// Serve hidden files and directories
|
||||||
HiddenFiles bool
|
Hidden bool
|
||||||
|
|
||||||
// List directory
|
// List directory
|
||||||
List bool
|
List bool
|
||||||
|
@ -173,8 +173,8 @@ func readconfig(configPath string) error {
|
||||||
if defaultPath.SymLinks {
|
if defaultPath.SymLinks {
|
||||||
serve.SymLinks = defaultPath.SymLinks
|
serve.SymLinks = defaultPath.SymLinks
|
||||||
}
|
}
|
||||||
if defaultPath.HiddenFiles {
|
if defaultPath.Hidden {
|
||||||
serve.HiddenFiles = defaultPath.HiddenFiles
|
serve.Hidden = defaultPath.Hidden
|
||||||
}
|
}
|
||||||
if defaultPath.List {
|
if defaultPath.List {
|
||||||
serve.List = defaultPath.List
|
serve.List = defaultPath.List
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -6,6 +6,6 @@ require (
|
||||||
github.com/h2non/filetype v1.1.0
|
github.com/h2non/filetype v1.1.0
|
||||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||||
github.com/yookoala/gofast v0.4.1-0.20201013050739-975113c54107
|
github.com/yookoala/gofast v0.4.1-0.20201013050739-975113c54107
|
||||||
golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 // indirect
|
golang.org/x/tools v0.0.0-20201117152513-9036a0f9af11 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
|
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
|
||||||
)
|
)
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -34,8 +34,8 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
|
||||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20200908211811-12e1bf57a112/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
golang.org/x/tools v0.0.0-20200908211811-12e1bf57a112/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
||||||
golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg=
|
golang.org/x/tools v0.0.0-20201117152513-9036a0f9af11 h1:gqcmLJzeDSNhSzkyhJ4kxP6CtTimi/5hWFDGp0lFd1w=
|
||||||
golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20201117152513-9036a0f9af11/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
|
|
@ -145,7 +145,7 @@ func servePath(c *tls.Conn, request *url.URL, serve *pathConfig) (int, int64) {
|
||||||
resolvedPath = strings.Join(requestSplit[pathSlashes:], "/")
|
resolvedPath = strings.Join(requestSplit[pathSlashes:], "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !serve.HiddenFiles {
|
if !serve.Hidden {
|
||||||
for _, piece := range requestSplit {
|
for _, piece := range requestSplit {
|
||||||
if len(piece) > 0 && piece[0] == '.' {
|
if len(piece) > 0 && piece[0] == '.' {
|
||||||
return writeStatus(c, statusNotFound), -1
|
return writeStatus(c, statusNotFound), -1
|
||||||
|
|
Loading…
Reference in a new issue