diff --git a/.gitignore b/.gitignore
index bf9bbe6..67f4c2a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
badger-db
farside
+deploy.sh
diff --git a/README.md b/README.md
index 303400a..2eb2987 100644
--- a/README.md
+++ b/README.md
@@ -53,40 +53,20 @@ For example:
Page |
Farside Link |
+
+ Scribe |
+ View Medium post |
+ https://farside.link/scribe/@ftrain/big-data-small-effort-b62607a43a8c |
+
Libreddit |
/r/popular |
https://farside.link/libreddit/r/popular |
- Teddit |
- /r/popular |
- https://farside.link/teddit/r/popular |
-
-
- Nitter |
- User Profile |
- https://farside.link/nitter/josevalim |
-
-
- Invidious |
- Home Page |
- https://farside.link/invidious |
-
-
- Piped |
- Video Page |
- https://farside.link/piped/watch?v=eBGIQ7ZuuiU |
-
-
- Whoogle |
- Search "Elixir" |
- https://farside.link/whoogle/search?q=elixir&lang_interface=en |
-
-
- SearX |
- Search "Redis" |
- https://farside.link/searx/search?q=redis |
+ BreezeWiki |
+ Balatro Wiki |
+ https://farside.link/https://balatrogame.fandom.com |
SearXNG |
@@ -108,18 +88,13 @@ For example:
View photo album |
https://farside.link/rimgo/a/H8M4rcp |
-
- Scribe |
- View Medium post |
- https://farside.link/scribe/@ftrain/big-data-small-effort-b62607a43a8c |
-
Note: This table doesn't include all available services. For a complete list of supported frontends, see: https://farside.link
Farside also accepts URLs to "parent" services, and will redirect to an appropriate front end service, for example:
-- https://farside.link/https://www.youtube.com/watch?v=dQw4w9WgXcQ will redirect to a [Piped](https://github.com/TeamPiped/Piped) or [Invidious](https://github.com/iv-org/invidious) instance
+- https://farside.link/https://balatrogame.fandom.com/wiki/Abandoned_Deck will redirect to a [BreezeWiki](https://gitdab.com/cadence/breezewiki) instance
- https://farside.link/reddit.com/r/popular will redirect to a [Libreddit](https://github.com/spikecodes/libreddit) or [Teddit](https://codeberg.org/teddit/teddit) instance
- etc.
diff --git a/db/db.go b/db/db.go
index efdf145..17d1ba3 100644
--- a/db/db.go
+++ b/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
}
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(
diff --git a/services-full.json b/services-full.json
index ad54de6..c03cc22 100644
--- a/services-full.json
+++ b/services-full.json
@@ -483,7 +483,7 @@
},
{
"type": "breezewiki",
- "test_url": "/undertale/wiki/Hot_Dog...%3F",
+ "test_url": "/balatrogame/wiki/Abandoned_Deck",
"fallback": "https://breezewiki.com",
"instances": [
"https://breezewiki.com",
diff --git a/services.json b/services.json
index beb411d..7e990c2 100644
--- a/services.json
+++ b/services.json
@@ -449,7 +449,7 @@
},
{
"type": "breezewiki",
- "test_url": "/undertale/wiki/Hot_Dog...%3F",
+ "test_url": "/balatrogame/wiki/Abandoned_Deck",
"fallback": "https://breezewiki.com",
"instances": [
"https://breezewiki.com",
diff --git a/services/mappings.go b/services/mappings.go
index 53731a6..172e1cd 100644
--- a/services/mappings.go
+++ b/services/mappings.go
@@ -69,7 +69,7 @@ var regexMap = []RegexMapping{
},
{
// Fandom
- Pattern: regexp.MustCompile(`fandom\.com|breezewiki`),
+ Pattern: regexp.MustCompile(`.*fandom\.com|breezewiki`),
Targets: []string{"breezewiki"},
},
{