Compare commits
3 commits
feature/ht
...
master
Author | SHA1 | Date | |
---|---|---|---|
a416857313 | |||
0957263ad8 | |||
1b43717a31 |
6 changed files with 12 additions and 16 deletions
|
@ -1,3 +1,7 @@
|
|||
# 1.1.2 / 2025-03-04
|
||||
- Remove unused enum member
|
||||
- Bump lucide vendored dependency to `16a18f79`
|
||||
|
||||
# 1.1.1
|
||||
- Remove caching for `/info` (and all non-Bytes responses)
|
||||
- Extract error function to a macro
|
||||
|
|
|
@ -20,8 +20,6 @@ If you are deploying to production, you can provide a directory path in the firs
|
|||
|
||||
Only `.svg` files will be read from that directory. The server's default port is `7878`, although this can be configured with the `PORT` environment variable.
|
||||
|
||||
It is recommended to place a reverse proxy in front of luciders to provide caching support, response compression and other optimisations that are out of scope for this project.
|
||||
|
||||
# Docker
|
||||
You can build and run this project with Docker. The Dockerfile is configured to use the submodule for the icons. To build the image:
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use crate::{
|
||||
error, http::{
|
||||
http::{
|
||||
requests::{Request, RequestStatus, Url},
|
||||
responses::{Body, Response, UnitOrBoxedError},
|
||||
}, threads::ThreadPool
|
||||
},
|
||||
threads::ThreadPool,
|
||||
};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
|
@ -64,7 +65,7 @@ impl Handlers {
|
|||
RequestStatus::Ok(req) => req,
|
||||
RequestStatus::MalformedHTTP(stream) => {
|
||||
stream.shutdown(Shutdown::Both).unwrap_or_else(|_| {
|
||||
error!("Failed to shutdown malformed HTTP stream")
|
||||
eprintln!("Failed to close malformed HTTP stream")
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ use std::{error::Error, io::prelude::*, net::TcpStream};
|
|||
use super::requests::Request;
|
||||
|
||||
pub enum Body {
|
||||
String(String),
|
||||
Static(&'static str),
|
||||
Bytes(Vec<u8>, &'static str),
|
||||
}
|
||||
|
@ -57,7 +56,6 @@ fn send_response(mut stream: TcpStream, status: u16, body: Body) -> UnitOrBoxedE
|
|||
response.push_str(&format!(
|
||||
"Content-Length: {}\r\n",
|
||||
match &body {
|
||||
Body::String(s) => s.len(),
|
||||
Body::Static(s) => s.len(),
|
||||
Body::Bytes(b, _) => b.len(),
|
||||
}
|
||||
|
@ -68,16 +66,11 @@ fn send_response(mut stream: TcpStream, status: u16, body: Body) -> UnitOrBoxedE
|
|||
response.push_str("Cache-Control: immutable, public, max-age=604800\r\n");
|
||||
}
|
||||
Body::Static(_) => response.push_str("Content-Type: text/plain; charset=utf-8\r\n"),
|
||||
_ => {}
|
||||
}
|
||||
response.push_str("\r\n");
|
||||
|
||||
// Body
|
||||
match &body {
|
||||
Body::String(s) => response.push_str(s),
|
||||
Body::Static(s) => response.push_str(s),
|
||||
_ => {}
|
||||
}
|
||||
if let Body::Static(s) = &body { response.push_str(s) }
|
||||
|
||||
match stream.write(response.as_bytes()) {
|
||||
Ok(_) => {}
|
||||
|
|
|
@ -133,7 +133,7 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
if let Some(_) = req.url.query.get("discord_compatibility") {
|
||||
if req.url.query.contains_key("discord_compatibility") {
|
||||
padding = 8;
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ fn main() {
|
|||
icon_string = icon_string.replace("currentColor", svg_stroke);
|
||||
|
||||
let mut backwards_compatibility = false;
|
||||
if let Some(_) = req.url.query.get("backwards_compatibility") {
|
||||
if req.url.query.contains_key("backwards_compatibility") {
|
||||
backwards_compatibility = true;
|
||||
// Icons were 80x80 plus 8px of padding; Icons start at 24x24 now so: 80 - 8 = 72, 72 / 24 = 3 therefore scale is 3x.
|
||||
scale = 3;
|
||||
|
|
2
vendor/lucide
vendored
2
vendor/lucide
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 11b95f883a089f8596f85200298e01558b5db877
|
||||
Subproject commit 16a18f790881adc6f44767edac29bfc2b42b8dc5
|
Loading…
Reference in a new issue