diff options
| author | Ben Busby <contact@benbusby.com> | 2025-01-27 12:17:20 -0700 |
|---|---|---|
| committer | Ben Busby <contact@benbusby.com> | 2025-01-27 12:17:20 -0700 |
| commit | 6e64a93fd17767bfdb40dda94d354c7e57202ab1 (patch) | |
| tree | 73a2990fe562085a781d6a88d568c129e169574e /server | |
| parent | 3d52cddc669f580b74c66402d1e5cdcbbcfacb9d (diff) | |
| download | farside-6e64a93fd17767bfdb40dda94d354c7e57202ab1.tar.gz | |
Update breezewiki routing behavior, update readme
BreezeWiki requires the subdomain of a fandom link to be preserved when
routing, otherwise the redirect doesn't work correctly.
Cleaned up readme examples
Diffstat (limited to 'server')
| -rw-r--r-- | server/server.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/server/server.go b/server/server.go index 0a0b683..74bfa6c 100644 --- a/server/server.go +++ b/server/server.go @@ -86,7 +86,17 @@ func routing(w http.ResponseWriter, r *http.Request, jsEnabled bool) { return } - instance, err := db.GetInstance(target) + var servicePath string + if target == "breezewiki" { + // Breezewiki requires the subdomain of the instance to be + // preserved for correct routing + splitDomain := strings.Split(path, ".") + if len(splitDomain) > 2 { + servicePath = strings.Split(path, ".")[0] + } + } + + instance, err := db.GetInstance(target, servicePath) if err != nil { log.Printf("Error fetching instance from db: %v\n", err) http.Error( |
