1
Fork 0
mirror of https://github.com/Steffo99/patched-porobot.git synced 2024-10-16 09:37:27 +00:00

Fix conditional compilation

This commit is contained in:
Steffo 2023-03-24 01:01:14 +01:00
parent 0d3c1329c4
commit d417be378a
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -1,9 +1,5 @@
//! Module defining [CardArt].
use base64::Engine;
use hmac::Mac;
use std::env;
/// The illustration of a [Card](super::card::Card), also referred to as an *art asset*.
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub struct CardArt {
@ -35,6 +31,8 @@ impl CardArt {
/// Get the URL to convert the image at the given URL into JPG using imgproxy.
#[cfg(feature = "jpg")]
fn imgproxy_convert_to_jpg(url: &str) -> String {
use base64::Engine;
let url = base64::prelude::BASE64_URL_SAFE.encode(url);
let url = format!("/{url}.jpg");
@ -51,6 +49,10 @@ impl CardArt {
///
#[cfg(feature = "jpg")]
fn imgproxy_authenticate_url(url: &str) -> String {
use base64::Engine;
use hmac::Mac;
use std::env;
let key = env::var("POROXY_KEY")
.expect("POROXY_KEY to be set");
let key = hex::decode(key)
@ -84,6 +86,8 @@ impl CardArt {
///
#[cfg(feature = "jpg")]
pub fn card_jpg(&self) -> String {
use std::env;
let host = env::var("POROXY_HOST")
.expect("POROXY_HOST to be set");
@ -107,6 +111,8 @@ impl CardArt {
///
#[cfg(feature = "jpg")]
pub fn full_jpg(&self) -> String {
use std::env;
let host = env::var("POROXY_HOST")
.expect("POROXY_HOST to be set");