LR2W4OBXJ2LTOHY6BJM6EO44MFBE7FBJBY25KWN4V3GDLFKF3NEQC
fn create_rewrite_settings() -> RewriteStrSettings<'static, 'static> {
let mut rules = vec![];
let remove_sizings = element!("img", |img| {
["height", "width", "srcset"].map(|attr| img.remove_attribute(&attr));
if let Some(mut unsized_src) = img.get_attribute("src") {
unsized_src = unsized_src.replace("&w", "&_");
unsized_src = unsized_src.replace("&h", "&_");
img.set_attribute("src", &unsized_src)
.expect("attr src is always valid")
}
Ok(())
});
rules.push(remove_sizings);
let append_title = element!("img[title]", |img| {
if let Some(title) = img.get_attribute("title") {
img.after(&format!("<p>{title}</p>"), ContentType::Html)
}
Ok(())
});
rules.push(append_title);
rules.push(element!(r#" img[src*="smbc-comics.com/"] "#, |img| {
if let Some(mut bonus_src) = img.get_attribute("src") {
bonus_src = bonus_src.replace(".png", "after.png");
img.after(&format!("<img src='{bonus_src}' />"), ContentType::Html);
};
Ok(())
}));
RewriteStrSettings {
element_content_handlers: rules,
..Default::default()
}
}
# fly.toml file generated for laker on 2022-09-02T22:55:11+07:00
app = "laker"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[env]
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
http_checks = []
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
FROM docker.io/rust:1.63-slim-bullseye AS build-env
WORKDIR /build
COPY Cargo.toml Cargo.lock /build
RUN mkdir -p /build/src && \
echo "fn main(){}" > /build/src/main.rs && \
cargo build --release
COPY . /build
RUN cargo build --release
FROM gcr.io/distroless/cc-debian11:latest AS runtime
WORKDIR /app
VOLUME /data
CMD ["/app/laker"]
COPY --from=build-env /build/target/release/laker /app/