From bde6135f70f1f711e131777f4be637c6468569a0 Mon Sep 17 00:00:00 2001
From: Paul van Tilburg
Date: Mon, 17 Oct 2022 19:47:29 +0200
Subject: [PATCH] Use public URL instead of URL in configuration
Change the name of the `url` config key to `public_url` to be more clear
about what it is for.
---
README.md | 6 +++---
Rocket.toml.example | 2 +-
src/feed.rs | 2 +-
src/lib.rs | 6 +++---
templates/index.html.tera | 2 +-
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 6032fd4..829e956 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ builds when you don't add `--release`.)
### Configuration
For now, you will need to provide Rocket with configuration to tell it at which
-URL Podbringer is hosted. This needs to be done even if you are not using a
+public URL Podbringer is hosted. This needs to be done even if you are not using a
reverse proxy, in which case you need to provide it with the proxied URL. You
can also use the configuration to configure a different address and/or port.
Just create a `Rocket.toml` file that contains (or copy `Rocket.toml.example`):
@@ -34,7 +34,7 @@ Just create a `Rocket.toml` file that contains (or copy `Rocket.toml.example`):
[default]
address = "0.0.0.0"
port = 7062
-url = "https://my.domain.tld/podbringer"
+public_url = "https://my.domain.tld/podbringer"
```
This will work independent of the type of build. For more about Rocket's
@@ -52,7 +52,7 @@ need to use for Podbringer is comprised of the following parts:
```text
https://my.domain.tld/podbringer/feed/mixcloud/myfavouriteband
|------------------------------| |-------||--------------|
- The Podbringer location URL Service User @ service
+ The Podbringer public URL Service User @ service
```
### Feed item limit
diff --git a/Rocket.toml.example b/Rocket.toml.example
index 5264447..e01db9b 100644
--- a/Rocket.toml.example
+++ b/Rocket.toml.example
@@ -1,4 +1,4 @@
[default]
address = "0.0.0.0"
port = 7062
-url = "https://my.domain.tld/podbringer"
+public_url = "https://my.domain.tld/podbringer"
diff --git a/src/feed.rs b/src/feed.rs
index 869125e..20d46fc 100644
--- a/src/feed.rs
+++ b/src/feed.rs
@@ -92,7 +92,7 @@ fn construct_item(
})
.collect::>();
let url = uri!(
- Absolute::parse(&config.url).expect("valid URL"),
+ Absolute::parse(&config.public_url).expect("valid URL"),
crate::get_download(backend_id = backend_id, file = item.enclosure.file)
);
let enclosure = EnclosureBuilder::default()
diff --git a/src/lib.rs b/src/lib.rs
index 08a4db3..b3b1410 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -69,9 +69,9 @@ pub(crate) type Result = std::result::Result;
#[derive(Debug, Deserialize, Serialize)]
#[serde(crate = "rocket::serde")]
pub(crate) struct Config {
- /// The URL at which the application is hosted or proxied from.
+ /// The public URL at which the application is hosted or proxied from.
#[serde(default)]
- url: String,
+ public_url: String,
}
/// A Rocket responder wrapper type for RSS feeds.
@@ -107,7 +107,7 @@ async fn get_feed(
/// Returns a simple index page that explains the usage.
#[get("/")]
pub(crate) async fn get_index(config: &State) -> Template {
- Template::render("index", context! { url: &config.url })
+ Template::render("index", context! { url: &config.public_url })
}
/// Sets up Rocket.
diff --git a/templates/index.html.tera b/templates/index.html.tera
index 4a156c6..c9a3af7 100644
--- a/templates/index.html.tera
+++ b/templates/index.html.tera
@@ -11,7 +11,7 @@
https://my.domain.tld/podbringer/feed/mixcloud/myfavouriteband
|------------------------------| |-------||--------------|
- The Podbringer location URL Service User @ service
+ The Podbringer public URL Service User @ service