Compare commits
7 Commits
3038c29c57
..
v1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
601c9677b7
|
|||
|
4d90e52c36
|
|||
|
55c8fc0a4f
|
|||
|
aa59067bb3
|
|||
|
c05d987ff1
|
|||
|
a5115c0a15
|
|||
|
20cc6e210e
|
@@ -1,69 +0,0 @@
|
||||
name: Metrics Collection
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * 1' # Weekly on Monday at midnight
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main, master]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'Cargo.toml'
|
||||
- '.github/workflows/metrics.yml'
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
collect-metrics:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- uses: ./.github/actions/deps
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
|
||||
|
||||
- name: Generate test coverage
|
||||
run: |
|
||||
cargo install cargo-tarpaulin
|
||||
cargo tarpaulin --out Html --out Lcov --output-dir ./coverage
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: coverage-report
|
||||
path: ./coverage
|
||||
retention-days: 30
|
||||
|
||||
- name: Count lines of code
|
||||
run: |
|
||||
cargo install tokei
|
||||
tokei --output json > loc.json
|
||||
echo "Lines of code:"
|
||||
tokei --type=Rust
|
||||
|
||||
- name: Upload LOC metrics
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: loc-metrics
|
||||
path: loc.json
|
||||
retention-days: 30
|
||||
|
||||
- name: Generate dependency graph
|
||||
run: |
|
||||
cargo install cargo-depgraph
|
||||
cargo depgraph --all-features --dedup-transitive --format dot > deps.dot
|
||||
echo "Dependency graph generated: deps.dot"
|
||||
echo "Total dependencies: $(cargo tree --depth 0 | wc -l)"
|
||||
|
||||
- name: Upload dependency graph
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dependency-graph
|
||||
path: deps.dot
|
||||
retention-days: 30
|
||||
@@ -94,25 +94,20 @@ jobs:
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: List artifacts
|
||||
run: ls -la artifacts/
|
||||
|
||||
- name: Determine tag
|
||||
id: tag
|
||||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: RustLock v${{ steps.tag.outputs.VERSION }}
|
||||
draft: true
|
||||
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') }}
|
||||
files: |
|
||||
artifacts/rustlock-default-ubuntu/rustlock
|
||||
artifacts/rustlock-no-networking-ubuntu/rustlock
|
||||
artifacts/rustlock-default-debian/rustlock
|
||||
artifacts/rustlock-default-fedora/rustlock
|
||||
artifacts/rustlock-default-arch/rustlock
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
artifacts/rustlock-default-ubuntu/rustlock/rustlock:rustlock-default-ubuntu
|
||||
artifacts/rustlock-no-networking-ubuntu/rustlock/rustlock:rustlock-no-networking-ubuntu
|
||||
artifacts/rustlock-default-debian/rustlock/rustlock:rustlock-default-debian
|
||||
artifacts/rustlock-default-fedora/rustlock/rustlock:rustlock-default-fedora
|
||||
artifacts/rustlock-default-arch/rustlock/rustlock:rustlock-default-arch
|
||||
|
||||
Generated
+45
-11
@@ -1571,6 +1571,18 @@ dependencies = [
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"libc",
|
||||
"plain",
|
||||
"redox_syscall",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.3.8"
|
||||
@@ -1861,6 +1873,12 @@ version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
||||
|
||||
[[package]]
|
||||
name = "plain"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.18.1"
|
||||
@@ -2041,6 +2059,15 @@ dependencies = [
|
||||
"getrandom 0.2.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ce70a74e890531977d37e532c34d45e9055d2409ed08ddba14529471ed0be16"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.12.3"
|
||||
@@ -2213,10 +2240,10 @@ dependencies = [
|
||||
"tokio",
|
||||
"toml 1.0.6+spec-1.1.0",
|
||||
"upower_dbus",
|
||||
"users",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-protocols-wlr",
|
||||
"whoami",
|
||||
"xkbcommon",
|
||||
"zbus",
|
||||
"zeroize",
|
||||
@@ -2874,16 +2901,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "users"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf8_iter"
|
||||
version = "1.0.4"
|
||||
@@ -2947,6 +2964,12 @@ dependencies = [
|
||||
"wit-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasite"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.114"
|
||||
@@ -3148,6 +3171,17 @@ version = "0.25.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1"
|
||||
|
||||
[[package]]
|
||||
name = "whoami"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d"
|
||||
dependencies = [
|
||||
"libredox",
|
||||
"wasite",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ zeroize = "1.7"
|
||||
log = "0.4"
|
||||
env_logger = { version = "0.11", default-features = false, features = ["color", "humantime"] }
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
|
||||
users = "0.11"
|
||||
whoami = "1.0"
|
||||
zbus = { version = "3.15", default-features = false, features = ["tokio"] }
|
||||
mpris = "2.0"
|
||||
upower_dbus = "0.3"
|
||||
|
||||
@@ -20,5 +20,6 @@ pkgs.rustPlatform.buildRustPackage {
|
||||
pkgs.pkg-config
|
||||
pkgs.rustPlatform.bindgenHook
|
||||
pkgs.rustfmt
|
||||
pkgs.clippy
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,70 +1,10 @@
|
||||
# Cargo-deny configuration for RustLock
|
||||
# See: https://embarkstudios.github.io/cargo-deny/
|
||||
|
||||
[advisories]
|
||||
# Check for security vulnerabilities
|
||||
vulnerability = "deny"
|
||||
# Check for unmaintained crates
|
||||
unmaintained = "warn"
|
||||
# Check for unsound crates
|
||||
unsound = "deny"
|
||||
# Check for yanked crates
|
||||
yanked = "deny"
|
||||
# Ignore specific advisories
|
||||
ignore = [
|
||||
# Add specific advisory IDs to ignore here if needed
|
||||
]
|
||||
|
||||
# Sources for advisory database
|
||||
[advisories.db]
|
||||
# Use GitHub advisory database
|
||||
github-data = "https://github.com/rustsec/advisory-db"
|
||||
# Update frequency (daily)
|
||||
update-frequency = "daily"
|
||||
ignore = []
|
||||
|
||||
[bans]
|
||||
# Multiple versions of the same crate
|
||||
multiple-versions = "allow"
|
||||
# Wildcard dependencies (e.g., "1.*")
|
||||
wildcards = "deny"
|
||||
|
||||
# Skip specific crates from checks
|
||||
skip = [
|
||||
# Add crate names to skip here if needed
|
||||
]
|
||||
|
||||
[licenses]
|
||||
# Default license policy
|
||||
default = "deny"
|
||||
# Allow these licenses
|
||||
allow = [
|
||||
"MIT",
|
||||
"Apache-2.0",
|
||||
"BSD-2-Clause",
|
||||
"BSD-3-Clause",
|
||||
"ISC",
|
||||
"Zlib",
|
||||
"Unlicense",
|
||||
"CC0-1.0",
|
||||
"MPL-2.0",
|
||||
"AGPL-3.0-or-later", # Our own license
|
||||
]
|
||||
# Copyleft licenses that require special attention
|
||||
copyleft = "warn"
|
||||
# Unknown licenses
|
||||
unlicensed = "deny"
|
||||
|
||||
# Skip specific crates from license checks
|
||||
skip = [
|
||||
# Add crate names to skip here if needed
|
||||
]
|
||||
|
||||
[sources]
|
||||
# Allow only these registries
|
||||
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
|
||||
# Deny git repositories (except for specific cases)
|
||||
allow-git = []
|
||||
|
||||
[metadata]
|
||||
# Minimum severity level to display
|
||||
severity-threshold = "low"
|
||||
+2
-6
@@ -4,7 +4,7 @@ use std::thread;
|
||||
use log::{debug, error};
|
||||
use pam_client::{Context, ErrorCode, Flag};
|
||||
use smithay_client_toolkit::reexports::{calloop::channel, calloop::EventLoop};
|
||||
use users::get_current_username;
|
||||
use whoami::username;
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
const SERVICE_NAME: &str = "rustlock";
|
||||
@@ -37,11 +37,7 @@ impl pam_client::ConversationHandler for LockConversation {
|
||||
|
||||
pub fn create_and_run_auth_loop(
|
||||
) -> Option<(channel::Sender<Zeroizing<String>>, channel::Channel<bool>)> {
|
||||
let username = get_current_username()
|
||||
.expect("Failed to get username")
|
||||
.to_str()
|
||||
.expect("Failed to get non-unicode username")
|
||||
.to_string();
|
||||
let username = username();
|
||||
|
||||
let conversation = LockConversation { password: None };
|
||||
match Context::new(SERVICE_NAME, Some(username.as_str()), conversation) {
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ impl LockedSurface {
|
||||
use wayland_client::Proxy;
|
||||
self.wayland_surface
|
||||
.as_ref()
|
||||
.map_or(false, |ws| ws.id() == surface.id())
|
||||
.is_some_and(|ws| ws.id() == surface.id())
|
||||
}
|
||||
|
||||
/// Update the surface state (called on each frame)
|
||||
|
||||
+3
-2
@@ -160,7 +160,7 @@ impl WaylandLock {
|
||||
if let Some(info) = self.output_state.info(output) {
|
||||
if let Some(mode) = info.modes.first() {
|
||||
let (w, h) = mode.dimensions;
|
||||
return (w as i32, h as i32);
|
||||
return (w, h);
|
||||
}
|
||||
}
|
||||
(1920, 1080)
|
||||
@@ -587,6 +587,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
log::set_logger(&LOGGER).map(|()| log::set_max_level(log::LevelFilter::Debug))?;
|
||||
|
||||
log::info!("Starting rustlock v{}", env!("CARGO_PKG_VERSION"));
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
let lock_manager = Arc::new(Mutex::new(LockManager::new(config.clone())));
|
||||
let ctrlc_exit = Arc::new(std::sync::atomic::AtomicBool::new(false));
|
||||
|
||||
@@ -626,7 +627,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
registry_state: RegistryState::new(&globals),
|
||||
session_lock_state: SessionLockState::new(&globals, &qh),
|
||||
seat_state: SeatState::new(&globals, &qh),
|
||||
shm_state: shm_state,
|
||||
shm_state,
|
||||
pool,
|
||||
session_lock: None,
|
||||
lock_surfaces: Vec::new(),
|
||||
|
||||
+3
-16
@@ -499,8 +499,7 @@ impl Renderer {
|
||||
let art_size = 56.0;
|
||||
let spacing = 80.0;
|
||||
|
||||
if self.config.show_album_art {
|
||||
if self.system_status.media_art_url != self.last_art_url {
|
||||
if self.config.show_album_art && self.system_status.media_art_url != self.last_art_url {
|
||||
self.last_art_url = self.system_status.media_art_url.clone();
|
||||
self.media_art_surface = None;
|
||||
if let Some(ref data) = self.system_status.media_art_data {
|
||||
@@ -526,7 +525,6 @@ impl Renderer {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let has_art = self.config.show_album_art && self.media_art_surface.is_some();
|
||||
let text_x = if has_art {
|
||||
@@ -654,25 +652,14 @@ impl Renderer {
|
||||
self.context.move_to(text_x, y);
|
||||
self.context.show_text(ssid).unwrap();
|
||||
} else {
|
||||
let strength = self.system_status.wifi_strength.unwrap_or(0);
|
||||
let icon = if strength > 75 {
|
||||
"📶"
|
||||
} else if strength > 50 {
|
||||
"📶"
|
||||
} else if strength > 25 {
|
||||
"📶"
|
||||
} else {
|
||||
"📶"
|
||||
};
|
||||
let text = format!("{} {}", icon, ssid);
|
||||
self.context.new_path();
|
||||
self.context.set_source_rgba(1.0, 1.0, 1.0, self.fade_alpha);
|
||||
self.context.set_font_size(16.0);
|
||||
self.context.move_to(x, y);
|
||||
self.context.show_text(&text).unwrap();
|
||||
self.context.show_text(ssid).unwrap();
|
||||
}
|
||||
} else {
|
||||
let text = "📵 No WiFi";
|
||||
let text = "No WiFi";
|
||||
self.context.new_path();
|
||||
self.context
|
||||
.set_source_rgba(1.0, 1.0, 1.0, self.fade_alpha * 0.5);
|
||||
|
||||
+4
-4
@@ -394,24 +394,24 @@ impl ScreenshotManager {
|
||||
flipped[dst_offset..dst_offset + src_stride]
|
||||
.copy_from_slice(&converted_data[src_offset..src_offset + src_stride]);
|
||||
}
|
||||
return Ok(ImageSurface::create_for_data(
|
||||
return ImageSurface::create_for_data(
|
||||
flipped,
|
||||
cairo::Format::ARgb32,
|
||||
info.width as i32,
|
||||
info.height as i32,
|
||||
src_stride as i32,
|
||||
)
|
||||
.context("Failed to create flipped Cairo surface")?);
|
||||
.context("Failed to create flipped Cairo surface");
|
||||
}
|
||||
|
||||
Ok(ImageSurface::create_for_data(
|
||||
ImageSurface::create_for_data(
|
||||
converted_data,
|
||||
cairo::Format::ARgb32,
|
||||
info.width as i32,
|
||||
info.height as i32,
|
||||
pixel_width as i32,
|
||||
)
|
||||
.context("Failed to create Cairo surface")?)
|
||||
.context("Failed to create Cairo surface")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -230,7 +230,7 @@ impl SystemManager {
|
||||
)
|
||||
).await;
|
||||
|
||||
if let Err(_) = result {
|
||||
if result.is_err() {
|
||||
error!("System command {} timed out", method);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user