Skip to content

Commit

Permalink
clash-verge-rev: 2.0.2 -> 2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Bot-wxt1221 committed Jan 18, 2025
1 parent 6ec47fa commit 71d1ee9
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/src/utils/help.rs b/src/utils/help.rs
index 9b0bc6a7..471b2adc 100644
--- a/src/utils/help.rs
+++ b/src/utils/help.rs
@@ -201,16 +201,6 @@ macro_rules! t {
};
}

-/// 将字节数转换为可读的流量字符串
-/// 支持 B/s、KB/s、MB/s、GB/s 的自动转换
-///
-/// # Examples
-/// ```
-/// assert_eq!(format_bytes_speed(1000), "1000B/s");
-/// assert_eq!(format_bytes_speed(1024), "1.0KB/s");
-/// assert_eq!(format_bytes_speed(1024 * 1024), "1.0MB/s");
-/// ```
-#[cfg(target_os = "macos")]
pub fn format_bytes_speed(speed: u64) -> String {
if speed < 1024 {
format!("{}B/s", speed)
@@ -222,6 +212,15 @@ pub fn format_bytes_speed(speed: u64) -> String {
format!("{:.1}GB/s", speed as f64 / 1024.0 / 1024.0 / 1024.0)
}
}
+/// 将字节数转换为可读的流量字符串
+/// 支持 B/s、KB/s、MB/s、GB/s 的自动转换
+///
+/// # Examples
+/// ```
+/// assert_eq!(format_bytes_speed(1000), "1000B/s");
+/// assert_eq!(format_bytes_speed(1024), "1.0KB/s");
+/// assert_eq!(format_bytes_speed(1024 * 1024), "1.0MB/s");
+/// ```

#[test]
fn test_format_bytes_speed() {
--
2.47.0

14 changes: 7 additions & 7 deletions pkgs/by-name/cl/clash-verge-rev/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@
}:
let
pname = "clash-verge-rev";
version = "2.0.2";
version = "2.0.3";

src = fetchFromGitHub {
owner = "clash-verge-rev";
repo = "clash-verge-rev";
tag = "v${version}";
hash = "sha256-QLvJO1JFHPFOsVxNi6SCu2QuJQ9hCsO1+WKOjZL944w=";
hash = "sha256-vHXXFHdKETJBlzbf4sU+gZpDz06My9DCx5nWdMpHmyc=";
};

src-service = fetchFromGitHub {
owner = "clash-verge-rev";
repo = "clash-verge-service";
rev = "8b676086f2770e213cffea08ef31b54b886f8f11"; # no meaningful tags in this repo. The only way is updating manully every time.
hash = "sha256-vF26Bp52y2kNHwwtBjy3Of75qJpTriqvul29KmudHww=";
rev = "7f8ad08c2f716ca50c074ecd37967728e08edf1e"; # no meaningful tags in this repo. The only way is updating manully every time.
hash = "sha256-kZf5O3n0xmNUN0G4hAWQDN9Oj9K7PtLpv6jnhh1C5Hg=";
};

service-cargo-hash = "sha256-pMOCifffUyBkcXC8inZFZeZVHeaOt0LAu2jZUGQ7QdM=";
service-cargo-hash = "sha256-uo/2QBsZzoTdwRiW0Kr7GGiQCpQH4lW4h5XHqWd5sTU=";

service = callPackage ./service.nix {
inherit
Expand All @@ -52,8 +52,8 @@ let
;
};

npm-hash = "sha256-zsgZhLC+XUzlCUKKGAJV5MlSpWsoLmAgMwKkmAkAX9Q=";
vendor-hash = "sha256-fk3OdJ1CKNHkeUjquJtJgM7PDyPpQ7tssDnFZHMbQHI=";
npm-hash = "sha256-vpa8WyOMOH02g2gxibJmav9yWS3QLhaVcFB0e3cZ8ok=";
vendor-hash = "sha256-JAAhcMfRTlkQQ8lBMLMN+whkGQ/4WHjywompirnc/GI=";

unwrapped = callPackage ./unwrapped.nix {
inherit
Expand Down
32 changes: 18 additions & 14 deletions pkgs/by-name/cl/clash-verge-rev/unwrapped.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,27 @@ rustPlatform.buildRustPackage {
OPENSSL_NO_VENDOR = 1;
};

patches = [
# https://github.com/clash-verge-rev/clash-verge-rev/pull/2582
./0001-enable-format_bytes_speed-for-every-platform.patch
];

postPatch = ''
ls $cargoDepsCopy
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
substituteInPlace $cargoDepsCopy/sysproxy-*/src/linux.rs \
--replace-fail '"gsettings"' '"${glib.bin}/bin/gsettings"' \
--replace-fail '"kreadconfig5"' '"${libsForQt5.kconfig}/bin/kreadconfig5"' \
--replace-fail '"kreadconfig6"' '"${kdePackages.kconfig}/bin/kreadconfig6"' \
--replace-fail '"kwriteconfig5"' '"${libsForQt5.kconfig}/bin/kwriteconfig5"' \
--replace-fail '"kwriteconfig6"' '"${kdePackages.kconfig}/bin/kwriteconfig6"'
substituteInPlace $cargoDepsCopy/sysproxy-*/src/linux.rs \
--replace-fail '"gsettings"' '"${glib.bin}/bin/gsettings"' \
--replace-fail '"kreadconfig5"' '"${libsForQt5.kconfig}/bin/kreadconfig5"' \
--replace-fail '"kreadconfig6"' '"${kdePackages.kconfig}/bin/kreadconfig6"' \
--replace-fail '"kwriteconfig5"' '"${libsForQt5.kconfig}/bin/kwriteconfig5"' \
--replace-fail '"kwriteconfig6"' '"${kdePackages.kconfig}/bin/kwriteconfig6"'
substituteInPlace ./tauri.conf.json \
--replace-fail '"frontendDist": "../dist",' '"frontendDist": "${webui}",' \
--replace-fail '"beforeBuildCommand": "pnpm run web:build"' '"beforeBuildCommand": ""'
sed -i -e '/externalBin/d' -e '/resources/d' tauri.conf.json
sed -i -e '/sidecar/d' -e '/resources/d' tauri.linux.conf.json
substituteInPlace ./tauri.conf.json \
--replace-fail '"frontendDist": "../dist",' '"frontendDist": "${webui}",' \
--replace-fail '"beforeBuildCommand": "pnpm run web:build"' '"beforeBuildCommand": ""'
sed -i -e '/externalBin/d' -e '/resources/d' tauri.conf.json
sed -i -e '/sidecar/d' -e '/resources/d' tauri.linux.conf.json
'';

nativeBuildInputs = [
Expand Down

0 comments on commit 71d1ee9

Please sign in to comment.