Compare commits

...

10 commits

Author SHA1 Message Date
c7d324b3f4
remove github workflows 2025-11-18 11:11:19 +01:00
8f4acac7b3
use a boxed array insted of a vec (#85)
Use a boxed slice instead of a vec since it won't be resized after
initial creation
2025-09-26 21:34:38 +02:00
8a903cd735
fix failing tests 2025-09-25 14:52:24 +02:00
c547773570
use a boxed array insted of a vec 2025-09-25 14:42:52 +02:00
a8b40e6101
flake: update flake.lock (#84)
Automated changes by the
[update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock)
GitHub Action.

```
Flake lock file updates:

• Updated input 'advisory-db':
    'github:rustsec/advisory-db/d63efe8c21f28b0690df6dc0a9879856bc0ffd88?narHash=sha256-jmfA08xkDtjy9pT6YC5sL4iRtW4TlCSaURSaUnpc4/g%3D' (2025-04-29)
  → 'github:rustsec/advisory-db/fb0d06e8e2cc04c9aa359e51ffa0a09e3bf58822?narHash=sha256-cDl1Qf/bTILEwq6DzMaTsrv6gWYZ47TO4sy7%2BNOA8Ok%3D' (2025-09-22)
• Updated input 'crane':
    'github:ipetkov/crane/efd36682371678e2b6da3f108fdb5c613b3ec598?narHash=sha256-oLvmxOnsEKGtwczxp/CwhrfmQUG2ym24OMWowcoRhH8%3D' (2025-04-24)
  → 'github:ipetkov/crane/95d528a5f54eaba0d12102249ce42f4d01f4e364?narHash=sha256-NU5WaEdfwF6i8faJ2Yh%2BjcK9vVFrofLcwlD/mP65JrI%3D' (2025-09-25)
• Updated input 'fenix':
    'github:nix-community/fenix/6d93c0f68d080e6f5b42d2958708955c8ab8acd9?narHash=sha256-LNElDnQlQXiSGfJiPu4IJJ3PzHnoM31qEWElhz2VyH0%3D' (2025-04-29)
  → 'github:nix-community/fenix/9cdb79384d02234fb2868eba6c7d390253ef6f83?narHash=sha256-rnHjtBRkcwRkrUZxg0RqN1qWTG%2BQC/gj4vn9uzEkBww%3D' (2025-09-24)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/ffa0bb043c25cfc79ff3bc20ba2e44c3724499b1?narHash=sha256-ZGi2gjgPtmPmplCVz7dNufqkBr00g6EeAloX3GrFQls%3D' (2025-04-29)
  → 'github:NixOS/nixpkgs/a1f79a1770d05af18111fbbe2a3ab2c42c0f6cd0?narHash=sha256-5rdAi7CTvM/kSs6fHe1bREIva5W3TbImsto%2BdxG4mBo%3D' (2025-09-21)
```

### Running GitHub Actions on this PR

GitHub Actions will not run workflows on pull requests which are opened
by a GitHub Action.

**To run GitHub Actions workflows on this PR, close and re-open this
pull request.**
2025-09-25 14:42:43 +02:00
github-actions[bot]
9db094a774 [create-pull-request] automated change 2025-09-25 06:15:39 +02:00
github-actions[bot]
453117d0bb flake.lock: Update
Flake lock file updates:

• Updated input 'advisory-db':
    'github:rustsec/advisory-db/d63efe8c21f28b0690df6dc0a9879856bc0ffd88?narHash=sha256-jmfA08xkDtjy9pT6YC5sL4iRtW4TlCSaURSaUnpc4/g%3D' (2025-04-29)
  → 'github:rustsec/advisory-db/fb0d06e8e2cc04c9aa359e51ffa0a09e3bf58822?narHash=sha256-cDl1Qf/bTILEwq6DzMaTsrv6gWYZ47TO4sy7%2BNOA8Ok%3D' (2025-09-22)
• Updated input 'crane':
    'github:ipetkov/crane/efd36682371678e2b6da3f108fdb5c613b3ec598?narHash=sha256-oLvmxOnsEKGtwczxp/CwhrfmQUG2ym24OMWowcoRhH8%3D' (2025-04-24)
  → 'github:ipetkov/crane/95d528a5f54eaba0d12102249ce42f4d01f4e364?narHash=sha256-NU5WaEdfwF6i8faJ2Yh%2BjcK9vVFrofLcwlD/mP65JrI%3D' (2025-09-25)
• Updated input 'fenix':
    'github:nix-community/fenix/6d93c0f68d080e6f5b42d2958708955c8ab8acd9?narHash=sha256-LNElDnQlQXiSGfJiPu4IJJ3PzHnoM31qEWElhz2VyH0%3D' (2025-04-29)
  → 'github:nix-community/fenix/9cdb79384d02234fb2868eba6c7d390253ef6f83?narHash=sha256-rnHjtBRkcwRkrUZxg0RqN1qWTG%2BQC/gj4vn9uzEkBww%3D' (2025-09-24)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/ffa0bb043c25cfc79ff3bc20ba2e44c3724499b1?narHash=sha256-ZGi2gjgPtmPmplCVz7dNufqkBr00g6EeAloX3GrFQls%3D' (2025-04-29)
  → 'github:NixOS/nixpkgs/a1f79a1770d05af18111fbbe2a3ab2c42c0f6cd0?narHash=sha256-5rdAi7CTvM/kSs6fHe1bREIva5W3TbImsto%2BdxG4mBo%3D' (2025-09-21)
2025-09-25 06:15:38 +02:00
132c87b0bf
flake: update flake.lock (#83)
Automated changes by the
[update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock)
GitHub Action.

```
Flake lock file updates:

• Updated input 'advisory-db':
    'github:rustsec/advisory-db/3c6d3186ab06737d1defd2b5ae556d0ecd161603?narHash=sha256-Bcf7iBwrfjYPO7roKCz%2B3yPAFqgNqfKCp51sLKETjxU%3D' (2024-12-28)
  → 'github:rustsec/advisory-db/d63efe8c21f28b0690df6dc0a9879856bc0ffd88?narHash=sha256-jmfA08xkDtjy9pT6YC5sL4iRtW4TlCSaURSaUnpc4/g%3D' (2025-04-29)
• Updated input 'crane':
    'github:ipetkov/crane/72e2d02dbac80c8c86bf6bf3e785536acf8ee926?narHash=sha256-3aH/0Y6ajIlfy7j52FGZ%2Bs4icVX0oHhqBzRdlOeztqg%3D' (2024-12-21)
  → 'github:ipetkov/crane/efd36682371678e2b6da3f108fdb5c613b3ec598?narHash=sha256-oLvmxOnsEKGtwczxp/CwhrfmQUG2ym24OMWowcoRhH8%3D' (2025-04-24)
• Updated input 'fenix':
    'github:nix-community/fenix/3743208cafd7bc3c150f0c77c25ef7430e9c0de2?narHash=sha256-a5EMHpDAxLShxBKUdDVmqZMlfiuOtOUzet2xT/E/RiM%3D' (2024-12-28)
  → 'github:nix-community/fenix/6d93c0f68d080e6f5b42d2958708955c8ab8acd9?narHash=sha256-LNElDnQlQXiSGfJiPu4IJJ3PzHnoM31qEWElhz2VyH0%3D' (2025-04-29)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/7cc0bff31a3a705d3ac4fdceb030a17239412210?narHash=sha256-7QEFnKkzD13SPxs%2BUFR5bUFN2fRw%2BGlL0am72ZjNre4%3D' (2024-12-27)
  → 'github:NixOS/nixpkgs/ffa0bb043c25cfc79ff3bc20ba2e44c3724499b1?narHash=sha256-ZGi2gjgPtmPmplCVz7dNufqkBr00g6EeAloX3GrFQls%3D' (2025-04-29)
• Updated input 'tsunami':
    'github:itepastra/tsunami/d781e154b6632da6719e769ad92f09c42f788911?narHash=sha256-EfLu9OremzI%2BQ052Sd2toX3KMrNMv2QjB0H3KPZ9Wc8%3D' (2024-12-17)
  → 'github:itepastra/tsunami/e47ca589d0c2d2cbe2a1b90d1bdbf1f431547374?narHash=sha256-0c9H2oDQvQ0gPlqidQdBZ7pU7qW0zjsupOkY7IAn0Ik%3D' (2025-03-08)
• Updated input 'tsunami/advisory-db':
    'github:rustsec/advisory-db/ec9ce28714bb38d77a2223e7266df705500a7f11?narHash=sha256-2Ug80Uf/oUujxgh02Iy5vTG0V%2BAb9%2BYUHuRLRY0ayiY%3D' (2024-12-09)
  → 'github:rustsec/advisory-db/74ff50e899726ef85314978f60e9f7858462b21f?narHash=sha256-QsTWsBWXvcrTHMhZK5sTz8Omyxn4tSszg/U5Y1BLzFM%3D' (2025-03-07)
• Updated input 'tsunami/crane':
    'github:ipetkov/crane/60d7623f1320470bf2fdb92fd2dca1e9a27b98ce?narHash=sha256-omYTR59TdH0AumP1cfh49fBnWZ52HjfdNfaLzCMZBx0%3D' (2024-12-16)
  → 'github:ipetkov/crane/aaebfb7ce7e13c691aea178aff7621906f466662?narHash=sha256-js4c6tqxluo4Fysn8gloLnlZ6ZjQkuWMgGjHN8%2BWssE%3D' (2025-03-08)
• Updated input 'tsunami/fenix':
    'github:nix-community/fenix/a18d41b26e998e95a598858fdb86ba22fb5da47d?narHash=sha256-32x1Z%2BPz3Jv0cK9EG56cFTKXy/mZ/c%2BIkxw%2BaVfKHp4%3D' (2024-12-17)
  → 'github:nix-community/fenix/37e933dde18c77a219e0d6d48e16f2e2a22d3976?narHash=sha256-FUhq3GLsUw/5Go3zsrvXWrU1QJ/0Y4YHuw%2BsUpBfUh0%3D' (2025-03-08)
• Updated input 'tsunami/nixpkgs':
    'github:NixOS/nixpkgs/71a6392e367b08525ee710a93af2e80083b5b3e2?narHash=sha256-0XovF7BYP50rTD2v4r55tR5MuBLet7q4xIz6Rgh3BBU%3D' (2024-12-13)
  → 'github:NixOS/nixpkgs/de0fe301211c267807afd11b12613f5511ff7433?narHash=sha256-aizILFrPgq/W53Jw8i0a1h1GZAAKtlYOrG/A5r46gVM%3D' (2025-03-07)
```

### Running GitHub Actions on this PR

GitHub Actions will not run workflows on pull requests which are opened
by a GitHub Action.

**To run GitHub Actions workflows on this PR, close and re-open this
pull request.**
2025-04-30 23:13:11 +02:00
ff458116b7
fix check errors 2025-04-30 21:53:23 +02:00
github-actions[bot]
dd5ccf5502 [create-pull-request] automated change 2025-04-30 06:15:45 +02:00
10 changed files with 521 additions and 555 deletions

View file

@ -1,23 +0,0 @@
name: "build nix"
on:
pull_request:
push:
jobs:
check_flurry_package:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: nix flake check -L --all-systems
build_flurry_package:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: nix build -L
build_flurry_shell:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: nix shell -L --command echo 'it works'

View file

@ -1,45 +0,0 @@
name: rust build
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
check:
name: cargo check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
- run: cargo check
test:
name: cargo test
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
- run: cargo test --features all
clippy:
name: Clippy
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
components: clippy
- run: cargo clippy --features all --tests -- -Dclippy::all

View file

@ -1,26 +0,0 @@
name: update dependencies
on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 4 * * *' # at 04:00 every day
jobs:
update:
name: Update dependencies
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: nix shell -L nixpkgs#cargo --command cargo update
- run: nix shell -L nixpkgs#git --command git add Cargo.lock
- name: Check flake
uses: DeterminateSystems/flake-checker-action@main
- run: nix build -L
- name: Update Nix Flake Lock
uses: DeterminateSystems/update-flake-lock@main
with:
pr-title: "flake: update flake.lock"
pr-labels: |
dependencies
automated
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}

917
Cargo.lock generated

File diff suppressed because it is too large Load diff

24
flake.lock generated
View file

@ -3,11 +3,11 @@
"advisory-db": {
"flake": false,
"locked": {
"lastModified": 1745915470,
"narHash": "sha256-jmfA08xkDtjy9pT6YC5sL4iRtW4TlCSaURSaUnpc4/g=",
"lastModified": 1758521157,
"narHash": "sha256-cDl1Qf/bTILEwq6DzMaTsrv6gWYZ47TO4sy7+NOA8Ok=",
"owner": "rustsec",
"repo": "advisory-db",
"rev": "d63efe8c21f28b0690df6dc0a9879856bc0ffd88",
"rev": "fb0d06e8e2cc04c9aa359e51ffa0a09e3bf58822",
"type": "github"
},
"original": {
@ -34,11 +34,11 @@
},
"crane": {
"locked": {
"lastModified": 1745454774,
"narHash": "sha256-oLvmxOnsEKGtwczxp/CwhrfmQUG2ym24OMWowcoRhH8=",
"lastModified": 1758758545,
"narHash": "sha256-NU5WaEdfwF6i8faJ2Yh+jcK9vVFrofLcwlD/mP65JrI=",
"owner": "ipetkov",
"repo": "crane",
"rev": "efd36682371678e2b6da3f108fdb5c613b3ec598",
"rev": "95d528a5f54eaba0d12102249ce42f4d01f4e364",
"type": "github"
},
"original": {
@ -70,11 +70,11 @@
"rust-analyzer-src": []
},
"locked": {
"lastModified": 1745908826,
"narHash": "sha256-LNElDnQlQXiSGfJiPu4IJJ3PzHnoM31qEWElhz2VyH0=",
"lastModified": 1758695884,
"narHash": "sha256-rnHjtBRkcwRkrUZxg0RqN1qWTG+QC/gj4vn9uzEkBww=",
"owner": "nix-community",
"repo": "fenix",
"rev": "6d93c0f68d080e6f5b42d2958708955c8ab8acd9",
"rev": "9cdb79384d02234fb2868eba6c7d390253ef6f83",
"type": "github"
},
"original": {
@ -145,11 +145,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1745900683,
"narHash": "sha256-ZGi2gjgPtmPmplCVz7dNufqkBr00g6EeAloX3GrFQls=",
"lastModified": 1758446476,
"narHash": "sha256-5rdAi7CTvM/kSs6fHe1bREIva5W3TbImsto+dxG4mBo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ffa0bb043c25cfc79ff3bc20ba2e44c3724499b1",
"rev": "a1f79a1770d05af18111fbbe2a3ab2c42c0f6cd0",
"type": "github"
},
"original": {

View file

@ -12,9 +12,9 @@ pub enum Color {
impl Display for Color {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Color::RGB24(r, g, b) => write!(f, "#{:02X}{:02X}{:02X}FF", r, g, b),
Color::RGBA32(r, g, b, a) => write!(f, "#{:02X}{:02X}{:02X}{:02X}", r, g, b, a),
Color::W8(w) => write!(f, "#{:02X}{:02X}{:02X}FF", w, w, w),
Color::RGB24(r, g, b) => write!(f, "#{r:02X}{g:02X}{b:02X}FF"),
Color::RGBA32(r, g, b, a) => write!(f, "#{r:02X}{g:02X}{b:02X}{a:02X}"),
Color::W8(w) => write!(f, "#{w:02X}{w:02X}{w:02X}FF"),
}
}
}

View file

@ -18,7 +18,7 @@ pub trait Grid<I, V> {
pub struct Flut<T> {
size_x: usize,
size_y: usize,
cells: SyncUnsafeCell<Vec<T>>,
cells: SyncUnsafeCell<Box<[T]>>,
last_hash: SyncUnsafeCell<u64>,
jpgbuf: RwLock<Vec<u8>>,
}
@ -32,7 +32,7 @@ impl<T: Clone> Flut<T> {
Flut {
size_x,
size_y,
cells: vec.into(),
cells: vec.into_boxed_slice().into(),
last_hash: 0.into(),
jpgbuf: RwLock::new(Vec::new()),
}
@ -60,19 +60,19 @@ impl<T> Flut<T> {
impl<T> Grid<Coordinate, T> for Flut<T> {
fn get(&self, x: Coordinate, y: Coordinate) -> Option<&T> {
self.index(x, y)
.map(|idx| unsafe { &(*self.cells.get())[idx] })
.map(|idx| unsafe { &(&(*self.cells.get()))[idx] })
}
fn set(&self, x: Coordinate, y: Coordinate, value: T) {
match self.index(x, y) {
None => (),
Some(idx) => unsafe { (*self.cells.get())[idx] = value },
Some(idx) => unsafe { (&mut (*self.cells.get()))[idx] = value },
}
}
fn get_unchecked(&self, x: Coordinate, y: Coordinate) -> &T {
let idx = y as usize * self.size_x + x as usize;
unsafe { &(*self.cells.get())[idx] }
unsafe { &(&(*self.cells.get()))[idx] }
}
}
@ -128,7 +128,10 @@ mod tests {
async fn test_grid_init_values() {
let grid = Flut::init(3, 3, 0);
assert_eq!(grid.cells.into_inner(), vec![0, 0, 0, 0, 0, 0, 0, 0, 0]);
assert_eq!(
grid.cells.into_inner(),
vec![0, 0, 0, 0, 0, 0, 0, 0, 0].into()
);
}
#[tokio::test]
@ -144,7 +147,10 @@ mod tests {
let grid = Flut::init(3, 3, 0);
grid.set(1, 1, 255);
grid.set(2, 1, 256);
assert_eq!(grid.cells.into_inner(), vec![0, 0, 0, 0, 255, 256, 0, 0, 0]);
assert_eq!(
grid.cells.into_inner(),
vec![0, 0, 0, 0, 255, 256, 0, 0, 0].into()
);
}
#[tokio::test]
@ -152,7 +158,10 @@ mod tests {
let grid = Flut::init(3, 3, 0);
grid.set(1, 1, 255);
grid.set(3, 1, 256);
assert_eq!(grid.cells.into_inner(), vec![0, 0, 0, 0, 255, 0, 0, 0, 0]);
assert_eq!(
grid.cells.into_inner(),
vec![0, 0, 0, 0, 255, 0, 0, 0, 0].into()
);
}
#[tokio::test]

View file

@ -113,12 +113,12 @@ To set a pixel using RGB, use ({SET_PX_RGB_BIN:02X}) (u8 canvas) (x as u16_le) (
match protocol {
crate::ProtocolStatus::Enabled(proto) => {
writer
.write_all(format!("Enabled: {}\n", proto).as_bytes())
.write_all(format!("Enabled: {proto}\n").as_bytes())
.await?;
}
crate::ProtocolStatus::Disabled(proto) => {
writer
.write_all(format!("Disabled: {}\n", proto).as_bytes())
.write_all(format!("Disabled: {proto}\n").as_bytes())
.await?;
}
}

View file

@ -153,12 +153,12 @@ impl<W: AsyncWriteExt + std::marker::Unpin> Responder<W> for TextParser {
match protocol {
crate::ProtocolStatus::Enabled(proto) => {
writer
.write_all(format!("Enabled: {}\n", proto).as_bytes())
.write_all(format!("Enabled: {proto}\n").as_bytes())
.await?;
}
crate::ProtocolStatus::Disabled(proto) => {
writer
.write_all(format!("Disabled: {}\n", proto).as_bytes())
.write_all(format!("Disabled: {proto}\n").as_bytes())
.await?;
}
}

View file

@ -89,7 +89,7 @@ fn make_image_stream(
fn make_stats() -> Message {
let pixels: u64 = COUNTER.load(std::sync::atomic::Ordering::Relaxed);
let clients: u64 = CLIENTS.load(std::sync::atomic::Ordering::Relaxed);
format!("{{\"c\":{}, \"p\":{}}}", clients, pixels).into()
format!("{{\"c\":{clients}, \"p\":{pixels}}}").into()
}
async fn stats_stream(ws: WebSocketUpgrade) -> Response {