Fix shit, update deps
This commit is contained in:
		
							parent
							
								
									fe4dac9fd2
								
							
						
					
					
						commit
						b5d71f3418
					
				
							
								
								
									
										1062
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1062
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										62
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										62
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							@ -2,17 +2,17 @@
 | 
				
			|||||||
  "nodes": {
 | 
					  "nodes": {
 | 
				
			||||||
    "devshell": {
 | 
					    "devshell": {
 | 
				
			||||||
      "inputs": {
 | 
					      "inputs": {
 | 
				
			||||||
 | 
					        "flake-utils": "flake-utils",
 | 
				
			||||||
        "nixpkgs": [
 | 
					        "nixpkgs": [
 | 
				
			||||||
          "nixpkgs"
 | 
					          "nixpkgs"
 | 
				
			||||||
        ],
 | 
					        ]
 | 
				
			||||||
        "systems": "systems"
 | 
					 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1688380630,
 | 
					        "lastModified": 1705332421,
 | 
				
			||||||
        "narHash": "sha256-8ilApWVb1mAi4439zS3iFeIT0ODlbrifm/fegWwgHjA=",
 | 
					        "narHash": "sha256-USpGLPme1IuqG78JNqSaRabilwkCyHmVWY0M9vYyqEA=",
 | 
				
			||||||
        "owner": "numtide",
 | 
					        "owner": "numtide",
 | 
				
			||||||
        "repo": "devshell",
 | 
					        "repo": "devshell",
 | 
				
			||||||
        "rev": "f9238ec3d75cefbb2b42a44948c4e8fb1ae9a205",
 | 
					        "rev": "83cb93d6d063ad290beee669f4badf9914cc16ec",
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
@ -22,15 +22,33 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "flake-utils": {
 | 
					    "flake-utils": {
 | 
				
			||||||
 | 
					      "inputs": {
 | 
				
			||||||
 | 
					        "systems": "systems"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "locked": {
 | 
				
			||||||
 | 
					        "lastModified": 1701680307,
 | 
				
			||||||
 | 
					        "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
 | 
				
			||||||
 | 
					        "owner": "numtide",
 | 
				
			||||||
 | 
					        "repo": "flake-utils",
 | 
				
			||||||
 | 
					        "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
 | 
				
			||||||
 | 
					        "type": "github"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "original": {
 | 
				
			||||||
 | 
					        "owner": "numtide",
 | 
				
			||||||
 | 
					        "repo": "flake-utils",
 | 
				
			||||||
 | 
					        "type": "github"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "flake-utils_2": {
 | 
				
			||||||
      "inputs": {
 | 
					      "inputs": {
 | 
				
			||||||
        "systems": "systems_2"
 | 
					        "systems": "systems_2"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1681202837,
 | 
					        "lastModified": 1705309234,
 | 
				
			||||||
        "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
 | 
					        "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
 | 
				
			||||||
        "owner": "numtide",
 | 
					        "owner": "numtide",
 | 
				
			||||||
        "repo": "flake-utils",
 | 
					        "repo": "flake-utils",
 | 
				
			||||||
        "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
 | 
					        "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
@ -46,11 +64,11 @@
 | 
				
			|||||||
        ]
 | 
					        ]
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1688534083,
 | 
					        "lastModified": 1698420672,
 | 
				
			||||||
        "narHash": "sha256-/bI5vsioXscQTsx+Hk9X5HfweeNZz/6kVKsbdqfwW7g=",
 | 
					        "narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=",
 | 
				
			||||||
        "owner": "nix-community",
 | 
					        "owner": "nix-community",
 | 
				
			||||||
        "repo": "naersk",
 | 
					        "repo": "naersk",
 | 
				
			||||||
        "rev": "abca1fb7a6cfdd355231fc220c3d0302dbb4369a",
 | 
					        "rev": "aeb58d5e8faead8980a807c840232697982d47b9",
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
@ -61,10 +79,10 @@
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    "nixpkgs": {
 | 
					    "nixpkgs": {
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1689326639,
 | 
					        "lastModified": 1696323343,
 | 
				
			||||||
        "narHash": "sha256-79zi0t83Dcc2dE0NuYZ+2hqtKXZN1yWVq5mtx8D2d7Y=",
 | 
					        "narHash": "sha256-u7WLUrh5eb+6SBYwtkaGL2ryHpLcHzmLml+a+VqKJWE=",
 | 
				
			||||||
        "path": "/nix/store/fpnvhgjsm9jxw4bjvn2sa4rnd55g20w6-source",
 | 
					        "path": "/nix/store/v4vrwzcjk2aa9nv7l22j157l6v3dd0vn-source",
 | 
				
			||||||
        "rev": "9fdfaeb7b96f05e869f838c73cde8d98c640c649",
 | 
					        "rev": "3b79cc4bcd9c09b5aa68ea1957c25e437dc6bc58",
 | 
				
			||||||
        "type": "path"
 | 
					        "type": "path"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
@ -83,17 +101,17 @@
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    "rust-overlay": {
 | 
					    "rust-overlay": {
 | 
				
			||||||
      "inputs": {
 | 
					      "inputs": {
 | 
				
			||||||
        "flake-utils": "flake-utils",
 | 
					        "flake-utils": "flake-utils_2",
 | 
				
			||||||
        "nixpkgs": [
 | 
					        "nixpkgs": [
 | 
				
			||||||
          "nixpkgs"
 | 
					          "nixpkgs"
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1689388484,
 | 
					        "lastModified": 1707012820,
 | 
				
			||||||
        "narHash": "sha256-cR8W4LZTk1SFGhDUGG4RF7qPZP7d9qFmltk7nFi7WMo=",
 | 
					        "narHash": "sha256-4cxIaHUx6/DSEVHJfK0gx4DZkJ5xHugan27KfuVPnj0=",
 | 
				
			||||||
        "owner": "oxalica",
 | 
					        "owner": "oxalica",
 | 
				
			||||||
        "repo": "rust-overlay",
 | 
					        "repo": "rust-overlay",
 | 
				
			||||||
        "rev": "15027511818ee595ca2ae6ec4b5f8f0e96c0fe47",
 | 
					        "rev": "b83b8c3ef16d15a4ae3843d74f32dfc86caed60f",
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
@ -152,11 +170,11 @@
 | 
				
			|||||||
        "systems": "systems_3"
 | 
					        "systems": "systems_3"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1689068808,
 | 
					        "lastModified": 1705309234,
 | 
				
			||||||
        "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
 | 
					        "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
 | 
				
			||||||
        "owner": "numtide",
 | 
					        "owner": "numtide",
 | 
				
			||||||
        "repo": "flake-utils",
 | 
					        "repo": "flake-utils",
 | 
				
			||||||
        "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
 | 
					        "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								src/svg.rs
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/svg.rs
									
									
									
									
									
								
							@ -1,22 +1,22 @@
 | 
				
			|||||||
use image::{DynamicImage, RgbaImage};
 | 
					use image::{DynamicImage, RgbaImage};
 | 
				
			||||||
use resvg::tiny_skia::{Paint, PathBuilder, Pixmap, PixmapPaint, Stroke};
 | 
					use resvg::tiny_skia::{Paint, PathBuilder, Pixmap, PixmapPaint, Stroke};
 | 
				
			||||||
use resvg::usvg::TreeParsing;
 | 
					use resvg::usvg::{fontdb, Options, PostProcessingSteps, Transform, TreeParsing, TreePostProc};
 | 
				
			||||||
use resvg::usvg::{Options, Transform};
 | 
					 | 
				
			||||||
use resvg::Tree;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::StdError;
 | 
					use crate::StdError;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Render the raw SVG data to an image
 | 
					// Render the raw SVG data to an image
 | 
				
			||||||
pub fn render_svg(data: &[u8], height: u32, with_border: bool) -> StdError<DynamicImage> {
 | 
					pub fn render_svg(data: &[u8], height: u32, with_border: bool) -> StdError<DynamicImage> {
 | 
				
			||||||
    let opt = Options::default();
 | 
					    let opt = Options::default();
 | 
				
			||||||
    let rtree = resvg::usvg::Tree::from_data(data, &opt).expect("couldn't parse");
 | 
					    let mut rtree = resvg::usvg::Tree::from_data(data, &opt).expect("couldn't parse");
 | 
				
			||||||
 | 
					    rtree.postprocess(PostProcessingSteps::default(), &fontdb::Database::new());
 | 
				
			||||||
    let svg_size = rtree.size;
 | 
					    let svg_size = rtree.size;
 | 
				
			||||||
    // Work out how wide the pixmap of height `height` needs to be to entirely fit the SVG.
 | 
					    // Work out how wide the pixmap of height `height` needs to be to entirely fit the SVG.
 | 
				
			||||||
    let scale_factor = height as f32 / svg_size.height();
 | 
					    let scale_factor = height as f32 / svg_size.height();
 | 
				
			||||||
    let pm_width = (scale_factor * svg_size.width()).ceil() as u32;
 | 
					    let pm_width = (scale_factor * svg_size.width()).ceil() as u32;
 | 
				
			||||||
    let mut pixmap = Pixmap::new(pm_width, height).ok_or("Error creating pixmap")?;
 | 
					    let mut pixmap = Pixmap::new(pm_width, height).ok_or("Error creating pixmap")?;
 | 
				
			||||||
    // Render the svg into a pixmap.
 | 
					    // Render the svg into a pixmap.
 | 
				
			||||||
    Tree::from_usvg(&rtree).render(
 | 
					    resvg::render(
 | 
				
			||||||
 | 
					        &rtree,
 | 
				
			||||||
        Transform::from_scale(scale_factor, scale_factor),
 | 
					        Transform::from_scale(scale_factor, scale_factor),
 | 
				
			||||||
        &mut pixmap.as_mut(),
 | 
					        &mut pixmap.as_mut(),
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
				
			|||||||
@ -21,7 +21,7 @@ pub async fn scrape_web() -> StdError<Vec<(String, String)>> {
 | 
				
			|||||||
        scraper::Selector::parse("li.gallerybox").map_err(|e| format!("{:?}", e))?;
 | 
					        scraper::Selector::parse("li.gallerybox").map_err(|e| format!("{:?}", e))?;
 | 
				
			||||||
    let link_sel =
 | 
					    let link_sel =
 | 
				
			||||||
        scraper::Selector::parse("a.mw-file-description").map_err(|e| format!("{:?}", e))?;
 | 
					        scraper::Selector::parse("a.mw-file-description").map_err(|e| format!("{:?}", e))?;
 | 
				
			||||||
    let title_sel = scraper::Selector::parse(".gallerytext p").map_err(|e| format!("{:?}", e))?;
 | 
					    let title_sel = scraper::Selector::parse(".gallerytext").map_err(|e| format!("{:?}", e))?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Fetch stuff!
 | 
					    // Fetch stuff!
 | 
				
			||||||
    let client = get_client(None)?;
 | 
					    let client = get_client(None)?;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user