mirror of
https://github.com/benbusby/farside.git
synced 2025-04-25 13:10:02 +00:00
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
This commit is contained in:
parent
3d52cddc66
commit
6e64a93fd1
7 changed files with 33 additions and 39 deletions
10
db/db.go
10
db/db.go
|
@ -3,10 +3,12 @@ package db
|
|||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/benbusby/farside/services"
|
||||
|
@ -55,7 +57,7 @@ func SetInstances(service string, instances []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func GetInstance(service string) (string, error) {
|
||||
func GetInstance(service, path string) (string, error) {
|
||||
instances, err := GetAllInstances(service)
|
||||
if err != nil || len(instances) == 0 {
|
||||
if err != nil {
|
||||
|
@ -80,6 +82,12 @@ func GetInstance(service string) (string, error) {
|
|||
index := rand.Intn(len(instances))
|
||||
value := instances[index]
|
||||
selectionMap[service] = value
|
||||
|
||||
if len(path) > 0 {
|
||||
value = strings.TrimSuffix(value, "/")
|
||||
value = fmt.Sprintf("%s/%s", value, path)
|
||||
}
|
||||
|
||||
return value, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue