diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc33584..a2aae5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: jobs: ci: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 @@ -32,10 +32,10 @@ jobs: run: cargo doc nix: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: /nix key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 189d066..477b48e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,8 +10,8 @@ on: jobs: release: - # Should match the version that Polygott uses. - runs-on: ubuntu-18.04 + # Should match the version reported by /etc/lsb-release on Repls. + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 diff --git a/src/auth.rs b/src/auth.rs index aefdfde..645316f 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -461,7 +461,8 @@ fn validate_token(token: &str, replid: &str, pubkeys: &HashMap>) Some(crate::api::repl_token::Metadata::Id(id)) => id.id.clone(), _ => bail!("token does not contain a replid: {:?}", &repl_token), }; - if token_replid != replid { + let pruned_replid = replid.split_once(":").map(|(replid, _)| replid.to_string()); + if token_replid != replid && Some(&token_replid) != pruned_replid.as_ref() { bail!( "token not issued for replid {:?}: {:?}", &token_replid, @@ -1056,6 +1057,8 @@ mod tests { .expect("Failed to generate PASETO"); validate_token(&token, &replid.to_string(), &pubkeys).expect("Failed to validate token"); + validate_token(&token, &format!("{replid}:01").to_string(), &pubkeys) + .expect("Failed to validate token"); validate_token( &String::from("this is not a token"), &replid.to_string(), diff --git a/src/messages/server.rs b/src/messages/server.rs index 7eba516..de73082 100644 --- a/src/messages/server.rs +++ b/src/messages/server.rs @@ -115,7 +115,7 @@ impl Message { skip(src, 3 * number_of_colors)?; let bpp = if number_of_colors <= 2 { 1 } else { 8 }; - let row_size = (width * bpp + 7) / 8; + let row_size = (width * bpp).div_ceil(8); let uncompressed_size = row_size * height; log::debug!( @@ -150,7 +150,7 @@ impl Message { // Cursor Pseudo-encoding -239 => { skip(src, width * height * bytes_per_pixel)?; - let row_size = (width + 7) / 8; + let row_size = width.div_ceil(8); skip(src, row_size * height) } // QEMU Extended Key Event Pseudo-encoding diff --git a/src/rfb.rs b/src/rfb.rs index 28a4f2a..13de662 100644 --- a/src/rfb.rs +++ b/src/rfb.rs @@ -80,7 +80,7 @@ impl RfbConnection { }) } - pub fn split(&mut self) -> (ReadHalf, WriteHalf) { + pub fn split<'a>(&'a mut self) -> (ReadHalf<'a>, WriteHalf<'a>) { let (rs, ws) = self.stream.split(); ( ReadHalf {