Removing embedded pict-rs. (#5023)

Some reasons for removing this:

- Even as an optional dependency, it locks us to many specific versions
  of rust deps.
- Pict-rs is a large app that can and should be run in on its own.
- Violates the philosophy of separation of concerns.
This commit is contained in:
Dessalines 2024-09-16 11:08:18 -04:00 committed by GitHub
parent 987e3f8026
commit ff939e04fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 46 additions and 1088 deletions

1103
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -36,7 +36,6 @@ opt-level = "z" # Optimize for size.
debug = 0 debug = 0
[features] [features]
embed-pictrs = ["pict-rs"]
json-log = ["tracing-subscriber/json"] json-log = ["tracing-subscriber/json"]
default = [] default = []
@ -182,7 +181,6 @@ reqwest-middleware = { workspace = true }
reqwest-tracing = { workspace = true } reqwest-tracing = { workspace = true }
clokwerk = { workspace = true } clokwerk = { workspace = true }
serde_json = { workspace = true } serde_json = { workspace = true }
pict-rs = { version = "0.5.16", optional = true }
rustls = { workspace = true } rustls = { workspace = true }
tokio.workspace = true tokio.workspace = true
actix-cors = "0.7.0" actix-cors = "0.7.0"

View file

@ -19,35 +19,6 @@ pub async fn main() -> LemmyResult<()> {
.install_default() .install_default()
.expect("Failed to install rustls crypto provider"); .expect("Failed to install rustls crypto provider");
#[cfg(not(feature = "embed-pictrs"))]
start_lemmy_server(args).await?; start_lemmy_server(args).await?;
#[cfg(feature = "embed-pictrs")]
{
let pictrs_port = &SETTINGS
.pictrs_config()
.unwrap_or_default()
.url
.port()
.unwrap_or(8080);
let pictrs_address = ["127.0.0.1", &pictrs_port.to_string()].join(":");
let pictrs_config = pict_rs::ConfigSource::memory(serde_json::json!({
"server": {
"address": pictrs_address
},
"repo": {
"type": "sled",
"path": "./pictrs/sled-repo"
},
"store": {
"type": "filesystem",
"path": "./pictrs/files"
}
}))
.init::<&str>(None)
.expect("initialize pictrs config");
let (lemmy, pictrs) = tokio::join!(start_lemmy_server(args), pictrs_config.run_on_localset());
lemmy?;
pictrs.expect("run pictrs");
}
Ok(()) Ok(())
} }