mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2025-01-08 18:51:24 +00:00
Update base64
This commit is contained in:
parent
4dff8de985
commit
240e057f19
7 changed files with 769 additions and 436 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -3,3 +3,6 @@
|
|||
/docker/dev/volumes
|
||||
/client-examples/javascript/node_modules
|
||||
/docker/object-storage/storage
|
||||
/.envrc
|
||||
/.direnv
|
||||
/.ash_history
|
||||
|
|
1045
Cargo.lock
generated
1045
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -27,7 +27,7 @@ actix-web = { version = "4.0.0", default-features = false }
|
|||
anyhow = "1.0"
|
||||
async-trait = "0.1.51"
|
||||
awc = { version = "3.0.0", default-features = false, features = ["rustls"] }
|
||||
base64 = "0.13.0"
|
||||
base64 = "0.21.0"
|
||||
config = "0.13.0"
|
||||
console-subscriber = "0.1"
|
||||
dashmap = "5.1.0"
|
||||
|
@ -55,7 +55,7 @@ structopt = "0.3.14"
|
|||
thiserror = "1.0"
|
||||
time = { version = "0.3.0", features = ["serde"] }
|
||||
tokio = { version = "1", features = ["full", "tracing"] }
|
||||
tokio-uring = { version = "0.3", optional = true, features = ["bytes"] }
|
||||
tokio-uring = { version = "0.4", optional = true, features = ["bytes"] }
|
||||
tokio-util = { version = "0.7", default-features = false, features = ["codec"] }
|
||||
tracing = "0.1.15"
|
||||
tracing-error = "0.2.0"
|
||||
|
@ -71,7 +71,7 @@ url = { version = "2.2", features = ["serde"] }
|
|||
uuid = { version = "1.1.2", features = ["v4", "serde"] }
|
||||
|
||||
[dependencies.tracing-actix-web]
|
||||
version = "0.6.0"
|
||||
version = "0.7.0"
|
||||
default-features = false
|
||||
features = ["emit_event_on_error", "opentelemetry_0_17"]
|
||||
|
||||
|
|
61
flake.lock
Normal file
61
flake.lock
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1683408522,
|
||||
"narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
50
flake.nix
Normal file
50
flake.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
description = "pict-rs";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
in
|
||||
{
|
||||
packages = rec {
|
||||
pict-rs = pkgs.callPackage ./pict-rs.nix {
|
||||
inherit (pkgs.darwin.apple_sdk.frameworks) Security;
|
||||
};
|
||||
|
||||
default = pict-rs;
|
||||
};
|
||||
|
||||
apps = rec {
|
||||
dev = flake-utils.lib.mkApp { drv = self.packages.${system}.pict-rs; };
|
||||
default = dev;
|
||||
};
|
||||
|
||||
devShell = with pkgs; mkShell {
|
||||
nativeBuildInputs = [
|
||||
cargo
|
||||
cargo-outdated
|
||||
cargo-zigbuild
|
||||
clippy
|
||||
imagemagick
|
||||
ffmpeg_5-full
|
||||
gcc
|
||||
imagemagick
|
||||
protobuf
|
||||
rust-analyzer
|
||||
rustc
|
||||
rustfmt
|
||||
taplo
|
||||
];
|
||||
|
||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||
};
|
||||
});
|
||||
}
|
37
pict-rs.nix
Normal file
37
pict-rs.nix
Normal file
|
@ -0,0 +1,37 @@
|
|||
{ exiftool
|
||||
, ffmpeg_5-full
|
||||
, imagemagick
|
||||
, lib
|
||||
, makeWrapper
|
||||
, nixosTests
|
||||
, protobuf
|
||||
, rustPlatform
|
||||
, Security
|
||||
, stdenv
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "pict-rs";
|
||||
version = "0.3.2";
|
||||
src = ./.;
|
||||
cargoSha256 = "";
|
||||
|
||||
PROTOC = "${protobuf}/bin/protoc";
|
||||
PROTOC_INCLUDE = "${protobuf}/include";
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildInputs = lib.optionals stdenv.isDarwin [ Security ];
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/pict-rs \
|
||||
--prefix PATH : "${lib.makeBinPath [ imagemagick ffmpeg_5-full exiftool ]}"
|
||||
'';
|
||||
|
||||
passthru.tests = { inherit (nixosTests) pict-rs; };
|
||||
|
||||
meta = with lib; {
|
||||
description = "A simple image hosting service";
|
||||
homepage = "https://git.asonix.dog/asonix/pict-rs";
|
||||
license = with licenses; [ agpl3Plus ];
|
||||
};
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
use crate::error::Error;
|
||||
use actix_web::web;
|
||||
use base64::engine::{Engine, general_purpose::STANDARD};
|
||||
use sha2::{digest::FixedOutputReset, Digest};
|
||||
use std::{
|
||||
pin::Pin,
|
||||
|
@ -79,7 +80,7 @@ where
|
|||
|
||||
impl std::fmt::Debug for Hash {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "{}", base64::encode(&self.inner))
|
||||
write!(f, "{}", STANDARD.encode(&self.inner))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue