Compare commits
No commits in common. "main" and "v1.3.0" have entirely different histories.
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -215,7 +215,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chela"
|
||||
version = "1.4.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"chrono",
|
||||
|
@ -1,8 +1,7 @@
|
||||
[package]
|
||||
name = "chela"
|
||||
version = "1.4.0"
|
||||
version = "1.3.0"
|
||||
edition = "2021"
|
||||
license = "BSL-1.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
23
LICENSE
23
LICENSE
@ -1,23 +0,0 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
10
README.md
10
README.md
@ -71,9 +71,6 @@ If you would like Chela to listen for HTTP requests over a Unix socket, set this
|
||||
##### `CHELA_ALPHABET`
|
||||
If this variable is set, Chela will use the characters in `CHELA_ALPHABET` to create IDs for URLs. The default alphabet is `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`. See [here](https://sqids.org/faq#unique) for more information on Sqids alphabets.
|
||||
|
||||
##### `CHELA_USES_HTTPS`
|
||||
If this variable is set, Chela will refer to itself as `https://$CHELA_HOST` instead of the default `http://$CHELA_HOST`.
|
||||
|
||||
### Manually
|
||||
#### Build
|
||||
```bash
|
||||
@ -97,10 +94,10 @@ If you would prefer to be the only one able to access these pages, then you can
|
||||
|
||||
```nginx
|
||||
server {
|
||||
server_name a.com;
|
||||
server_name example.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:3000;
|
||||
proxy_pass http://localhost:3000/;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
limit_except GET HEAD {
|
||||
@ -110,7 +107,8 @@ server {
|
||||
}
|
||||
|
||||
location /tracking {
|
||||
proxy_pass http://localhost:3000$request_uri;
|
||||
proxy_pass http://localhost:3000/;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
auth_basic 'Restricted';
|
||||
auth_basic_user_file /path/to/your/.htpasswd;
|
||||
|
@ -29,7 +29,6 @@ pub struct ServerState {
|
||||
pub sqids: Sqids,
|
||||
pub main_page_redirect: Option<Url>,
|
||||
pub behind_proxy: bool,
|
||||
pub uses_https: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, sqlx::FromRow, PartialEq, Eq)]
|
||||
@ -88,14 +87,12 @@ async fn main() -> eyre::Result<()> {
|
||||
.build()?;
|
||||
let main_page_redirect = env::var("CHELA_MAIN_PAGE_REDIRECT").unwrap_or_default();
|
||||
let behind_proxy = env::var("CHELA_BEHIND_PROXY").is_ok();
|
||||
let uses_https = env::var("CHELA_USES_HTTPS").is_ok();
|
||||
let server_state = ServerState {
|
||||
db_pool,
|
||||
host,
|
||||
sqids,
|
||||
main_page_redirect: Url::parse(&main_page_redirect).ok(),
|
||||
behind_proxy,
|
||||
uses_https
|
||||
};
|
||||
|
||||
serve(server_state).await?;
|
||||
|
@ -32,8 +32,7 @@ pub async fn create_link(
|
||||
if id.exists {
|
||||
log!("Serving cached id {} -> {}", id.id, form.url.as_str());
|
||||
return Html(format!(
|
||||
r#"<pre>http{}://{}/{} -> <a href="{}"">{}</a></pre>"#,
|
||||
if state.uses_https { "s" } else { "" },
|
||||
r#"<pre>http://{}/{} -> <a href="{}"">{}</a></pre>"#,
|
||||
state.host,
|
||||
id.id,
|
||||
form.url.as_str(),
|
||||
@ -73,8 +72,7 @@ VALUES ($1,$2,true)
|
||||
return (
|
||||
StatusCode::OK,
|
||||
Html(format!(
|
||||
r#"<pre>http{}://{}/{} -> <a href="{}"">{}</a></pre>"#,
|
||||
if state.uses_https { "s" } else { "" },
|
||||
r#"<pre>http://{}/{} -> <a href="{}"">{}</a></pre>"#,
|
||||
state.host,
|
||||
id.id,
|
||||
form.url.as_str(),
|
||||
|
Loading…
Reference in New Issue
Block a user