Allow .molly files to configure redirects.
This commit is contained in:
parent
d7663ab688
commit
1794ff643b
2 changed files with 10 additions and 5 deletions
|
@ -301,12 +301,12 @@ other settings in `.molly` files will be ignored:
|
|||
* `DirectoryTitles`
|
||||
* `GeminiExt`
|
||||
* `MimeOverrides`
|
||||
* `PermRedirects`
|
||||
* `TempRedirects`
|
||||
|
||||
Future support is planned for `.molly` files to be able to override:
|
||||
|
||||
* `CertificateZones`
|
||||
* `TempRedirects`
|
||||
* `PermRedirects`
|
||||
|
||||
## Trivia
|
||||
|
||||
|
|
11
handler.go
11
handler.go
|
@ -81,7 +81,6 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log
|
|||
if config.ReadMollyFiles {
|
||||
parseMollyFiles(path, &config, errorLogEntries)
|
||||
}
|
||||
|
||||
// Check for redirects
|
||||
for src, dst := range config.TempRedirects {
|
||||
if URL.Path == src {
|
||||
|
@ -304,8 +303,14 @@ func parseMollyFiles(path string, config *Config, errorLogEntries chan string) {
|
|||
config.DirectorySort = mollyFile.DirectorySort
|
||||
config.DirectoryReverse = mollyFile.DirectoryReverse
|
||||
config.DirectoryTitles = mollyFile.DirectoryTitles
|
||||
for pathRegex, newType := range mollyFile.MimeOverrides {
|
||||
config.MimeOverrides[pathRegex] = newType
|
||||
for key, value := range mollyFile.TempRedirects {
|
||||
config.TempRedirects[key] = value
|
||||
}
|
||||
for key, value := range mollyFile.PermRedirects {
|
||||
config.PermRedirects[key] = value
|
||||
}
|
||||
for key, value := range mollyFile.MimeOverrides {
|
||||
config.MimeOverrides[key] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue