From c63b20551f470d0f06c7c7767a802d1e3f4045a7 Mon Sep 17 00:00:00 2001 From: Evan Buss Date: Sat, 6 Jul 2024 16:06:08 -0400 Subject: [PATCH] refactor: home page / url passing We now allow multiple OPDS feeds to be pre-defined and displayed on the homepage. As a result we need to pass the feed navigation URLs via query parameter rather than a subpath which would only support proxying to a single OPDS feed. The feed is passed via the q= query parameter and any relative links from the OPDS XML are resolved to a complete URL with domain / scheme. We also check the "Content-Type" header in the response received from the OPDS feed to determine whether to parse an OPDS catalog or just proxy the raw response back (images / files). --- .vscode/launch.json | 16 ++++++++ html/feed.html | 9 +++-- html/home.html | 9 +++++ html/html.go | 47 +++++++++++++++++++----- main.go | 89 +++++++++++++++++++++++++++------------------ opds/opds.go | 4 +- 6 files changed, 123 insertions(+), 51 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 html/home.html diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..fc7fb6d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Package", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${workspaceFolder}" + } + + ] +} \ No newline at end of file diff --git a/html/feed.html b/html/feed.html index 3d55daf..1aaedcb 100644 --- a/html/feed.html +++ b/html/feed.html @@ -25,8 +25,9 @@ {{end}} @@ -35,14 +36,14 @@ {{range .Links}}