aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorcyqsimon <28627918+cyqsimon@users.noreply.github.com>2022-09-01 13:10:30 +0000
committercyqsimon <28627918+cyqsimon@users.noreply.github.com>2022-09-01 13:10:30 +0000
commit044f30c550888429cf8a9d39ef1a282ff3385e09 (patch)
tree94bd46d6e3de21f6705a3d11592f551ae8a6bcea /src
parentSwitch to `fast_qr` crate (diff)
downloadminiserve-044f30c550888429cf8a9d39ef1a282ff3385e09.tar.gz
miniserve-044f30c550888429cf8a9d39ef1a282ff3385e09.zip
Move QR margin size into `consts`
Diffstat (limited to 'src')
-rw-r--r--src/consts.rs3
-rw-r--r--src/renderer.rs2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/consts.rs b/src/consts.rs
index 1a105f7..d864683 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -2,3 +2,6 @@ use fast_qr::ECL;
/// The error correction level to use for all QR code generation.
pub const QR_EC_LEVEL: ECL = ECL::L;
+
+/// The margin size for the SVG QR code on the webpage.
+pub const SVG_QR_MARGIN: usize = 1;
diff --git a/src/renderer.rs b/src/renderer.rs
index 77b9eed..562f215 100644
--- a/src/renderer.rs
+++ b/src/renderer.rs
@@ -322,7 +322,7 @@ fn qr_spoiler(show_qrcode: bool, content: impl AsRef<str>) -> Markup {
"QR code"
}
div.qrcode #qrcode {
- @match qr_code_svg(content, 1) {
+ @match qr_code_svg(content, consts::SVG_QR_MARGIN) {
Ok(svg) => (PreEscaped(svg)),
Err(err) => (format!("QR generation error: {:?}", err)),
}