Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9112859
feat(ui): whole-app UI refresh (espresso shell, home list, motion ret…
oocsng Nov 21, 2026
6348c86
feat(core): username setting and wire name helpers
oocsng Nov 21, 2026
442f920
feat(capture): avatar JPEG normalise/validate
oocsng Nov 21, 2026
b599aaa
fix(capture): validate avatar JPEG dimensions from the header before …
oocsng Nov 21, 2026
f829e54
feat(net): send username with the computer name
oocsng Nov 21, 2026
dc2c8a2
feat(net): exchange profile pictures over the encrypted session
oocsng Nov 21, 2026
5930b67
test(net): wait for the host to store the viewer picture in test 126
oocsng Nov 21, 2026
189e092
feat(ui): show peer pictures and usernames
oocsng Nov 21, 2026
49daaf3
fix(ui): show usernames in host card, pairing, notifications and tray
oocsng Nov 21, 2026
8798125
feat(ui): profile settings for username and picture
oocsng Nov 21, 2026
f519e18
test(ui): cover the own-avatar crossfade and reduce motion; press fee…
oocsng Nov 21, 2026
356a88d
feat(ui): update button on Home
oocsng Nov 21, 2026
7cd2c8f
chore: set the app version to 1.0.1
oocsng Nov 21, 2026
ab2273d
fix(ui): whole UTF-8 avatar initial, View release label off Windows, …
oocsng Nov 22, 2026
0c43a1c
feat(files): persist the received-files folder and apply it at startup
oocsng Nov 22, 2026
5302c5f
feat(ui): choose the received-files folder in Settings
oocsng Nov 22, 2026
2ac7ae2
feat(files): save an offered file into a given drop folder, falling b…
oocsng Nov 22, 2026
215b122
feat(files): drops on a Windows host land in the folder under the cursor
oocsng Nov 22, 2026
d9925a1
fix(files): skip an unwritable drop folder and pick the active Explor…
oocsng Nov 22, 2026
fa92be4
fix(files): wide-API default received folder and Explorer open, UTF-8…
oocsng Nov 22, 2026
0f74607
fix: open the incoming .part by path (non-ASCII folders), blur the de…
oocsng Nov 22, 2026
d076d79
ci: expect 61 UI snapshots (the refresh added screens)
oocsng Nov 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
run: |
cmake --build build --target CppDesk -j 4
build/CppDesk.app/Contents/MacOS/CppDesk --ui-snapshot "$RUNNER_TEMP/snap"
test "$(ls "$RUNNER_TEMP"/snap/*.png | wc -l)" -eq 36
test "$(ls "$RUNNER_TEMP"/snap/*.png | wc -l)" -eq 61
cp -R "$RUNNER_TEMP/snap" macos-ui-snapshots
- uses: actions/upload-artifact@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ jobs:
- name: Smoke test the AppImage
run: |
./out/CppDesk-x86_64.AppImage --appimage-extract-and-run --ui-snapshot /tmp/ai
test "$(ls /tmp/ai/*.png | wc -l)" -eq 36
test "$(ls /tmp/ai/*.png | wc -l)" -eq 61
- name: Smoke test the .deb
run: |
sudo apt-get install -y "./out/cppdesk_${VERSION}_amd64.deb"
cppdesk --ui-snapshot /tmp/deb
test "$(ls /tmp/deb/*.png | wc -l)" -eq 36
test "$(ls /tmp/deb/*.png | wc -l)" -eq 61
- uses: actions/upload-artifact@v4
with:
name: linux-packages
Expand All @@ -73,12 +73,12 @@ jobs:
run: |
chmod +x out/CppDesk-x86_64.AppImage
out/CppDesk-x86_64.AppImage --appimage-extract-and-run --ui-snapshot /tmp/clean
test "$(ls /tmp/clean/*.png | wc -l)" -eq 36
test "$(ls /tmp/clean/*.png | wc -l)" -eq 61
- name: Install and run the .deb
run: |
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ./out/cppdesk_*_amd64.deb
cppdesk --ui-snapshot /tmp/deb
test "$(ls /tmp/deb/*.png | wc -l)" -eq 36
test "$(ls /tmp/deb/*.png | wc -l)" -eq 61

upload:
needs: [build, packages-on-clean-system]
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20)
# ScreenCaptureKit (macOS host capture) needs 12.3; must be set before project().
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.3" CACHE STRING "")
project(CppDesk VERSION 1.0.0 LANGUAGES C CXX)
project(CppDesk VERSION 1.0.1 LANGUAGES C CXX)
if(NOT MSVC)
enable_language(ASM)
endif()
Expand All @@ -13,12 +13,14 @@ set(CMAKE_CXX_EXTENSIONS OFF)
# Common core sources
set(CORE_SOURCES
src/core/crypto_identity.cpp
src/core/profile.cpp
src/core/totp_manager.cpp
src/core/qr_matrix.cpp
src/net/network_engine.cpp
src/net/fleet_manager.cpp
src/net/updater.cpp
src/capture/screen_capture.cpp
src/capture/avatar_image.cpp
src/capture/display_manager.cpp
src/capture/virtual_display_manager.cpp
src/capture/screen_blank_manager.cpp
Expand Down
2 changes: 2 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ if (-not (Test-Path $Gpp)) {
$CoreSources = @(
"src/simd/simd_kernels.S",
"src/core/crypto_identity.cpp",
"src/core/profile.cpp",
"src/capture/screen_capture.cpp",
"src/capture/avatar_image.cpp",
"src/control/input_injector.cpp",
"src/control/shell_clipboard.cpp",
"src/control/clipboard_file_manager.cpp",
Expand Down
75 changes: 75 additions & 0 deletions src/capture/avatar_image.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include "avatar_image.hpp"

#include "screen_capture.hpp"

#include <algorithm>
#include <cmath>

namespace cppdesk::avatar {

std::optional<std::vector<uint8_t>> normaliseJpeg(const std::vector<uint8_t>& fileBytes) {
if (fileBytes.empty() || fileBytes.size() > kMaxInputBytes) return std::nullopt;
std::vector<uint8_t> src;
int w = 0, h = 0;
if (!TileCodec::decodeJpeg(fileBytes.data(), fileBytes.size(), src, w, h) || w <= 0 || h <= 0) return std::nullopt;

const int side = std::min(w, h);
const int x0 = (w - side) / 2, y0 = (h - side) / 2;
// Area average: output pixel i covers source span [i*side, (i+1)*side) in 1/kSize-pixel units, so it also upscales.
std::vector<uint8_t> out(static_cast<size_t>(kSize) * kSize * 4);
auto overlap = [&](int i, int p) {
return std::max(0, std::min((i + 1) * side, (p + 1) * kSize) - std::max(i * side, p * kSize));
};
for (int oy = 0; oy < kSize; ++oy) {
const int pyLo = oy * side / kSize, pyHi = std::min(side - 1, ((oy + 1) * side - 1) / kSize);
for (int ox = 0; ox < kSize; ++ox) {
const int pxLo = ox * side / kSize, pxHi = std::min(side - 1, ((ox + 1) * side - 1) / kSize);
uint64_t acc[3] = {0, 0, 0}, total = 0;
for (int py = pyLo; py <= pyHi; ++py) {
const uint64_t wy = overlap(oy, py);
for (int px = pxLo; px <= pxHi; ++px) {
const uint64_t wt = wy * overlap(ox, px);
const uint8_t* p = &src[(static_cast<size_t>(y0 + py) * w + (x0 + px)) * 4];
for (int c = 0; c < 3; ++c) acc[c] += wt * p[c];
total += wt;
}
}
uint8_t* d = &out[(static_cast<size_t>(oy) * kSize + ox) * 4];
for (int c = 0; c < 3; ++c) d[c] = static_cast<uint8_t>((acc[c] + total / 2) / total);
d[3] = 255;
}
}
auto jpeg = TileCodec::encodeJpeg(out.data(), kSize, kSize, 85);
if (jpeg.empty() || jpeg.size() > kMaxWireBytes) return std::nullopt;
return jpeg;
}

bool validateWireJpeg(const std::vector<uint8_t>& jpeg) {
if (jpeg.empty() || jpeg.size() > kMaxWireBytes) return false;
int w = 0, h = 0;
// Header first: decodeJpeg would allocate whatever the peer claims (up to 64M pixels) before we could refuse it.
if (!TileCodec::jpegDimensions(jpeg.data(), jpeg.size(), w, h) || w > 256 || h > 256) return false;
std::vector<uint8_t> px;
return TileCodec::decodeJpeg(jpeg.data(), jpeg.size(), px, w, h) && w >= 1 && w <= 256 && h >= 1 && h <= 256;
}

bool decodeCircleBgra(const std::vector<uint8_t>& jpeg, std::vector<uint8_t>& outBgra, int& outW, int& outH) {
std::vector<uint8_t> px;
int w = 0, h = 0;
if (jpeg.empty() || !TileCodec::decodeJpeg(jpeg.data(), jpeg.size(), px, w, h) || w <= 0 || h <= 0) return false;
const float cx = w * 0.5f, cy = h * 0.5f, r = std::min(w, h) * 0.5f;
for (int y = 0; y < h; ++y)
for (int x = 0; x < w; ++x) {
const float d = std::hypot(x + 0.5f - cx, y + 0.5f - cy);
const float cov = std::clamp(r - d + 0.5f, 0.0f, 1.0f);
uint8_t* p = &px[(static_cast<size_t>(y) * w + x) * 4];
for (int c = 0; c < 3; ++c) p[c] = static_cast<uint8_t>(p[c] * cov + 0.5f);
p[3] = static_cast<uint8_t>(255.0f * cov + 0.5f);
}
outBgra = std::move(px);
outW = w;
outH = h;
return true;
}

} // namespace cppdesk::avatar
24 changes: 24 additions & 0 deletions src/capture/avatar_image.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once

#include <cstddef>
#include <cstdint>
#include <optional>
#include <vector>

namespace cppdesk::avatar {

constexpr int kSize = 96; // stored/wire pictures are kSize x kSize
constexpr size_t kMaxWireBytes = 16 * 1024; // largest picture accepted from a peer
constexpr uint64_t kMaxInputBytes = 10ull << 20; // largest file the picker will read

// Decodes a JPEG file, centre-crops to a square, scales to kSize and re-encodes at quality 85.
// nullopt on any failure or when the result exceeds kMaxWireBytes.
std::optional<std::vector<uint8_t>> normaliseJpeg(const std::vector<uint8_t>& fileBytes);

// Trust-boundary check for a picture received from a peer: 1..kMaxWireBytes bytes, decodes, 1..256 px each side.
bool validateWireJpeg(const std::vector<uint8_t>& jpeg);

// Decodes to premultiplied BGRA with alpha 0 outside the inscribed circle and a 1px antialiased edge.
bool decodeCircleBgra(const std::vector<uint8_t>& jpeg, std::vector<uint8_t>& outBgra, int& outW, int& outH);

} // namespace cppdesk::avatar
4 changes: 4 additions & 0 deletions src/capture/screen_capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,10 @@ bool TileCodec::decodeJpegIntoCanvas(const uint8_t*, size_t, uint8_t*, int, int,

#endif

bool TileCodec::jpegDimensions(const uint8_t* jpegData, size_t jpegLen, int& outW, int& outH) {
return parseJpegDimensions(jpegData, jpegLen, outW, outH);
}

EncodedTile TileCodec::encodeRect(
uint16_t x,
uint16_t y,
Expand Down
2 changes: 2 additions & 0 deletions src/capture/screen_capture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class TileCodec {
static bool decompressZstd(const void* src, size_t srcLen, void* dst, size_t dstCapacity);
static std::vector<uint8_t> encodeJpeg(const uint8_t* bgra, int width, int height, int quality);
static bool decodeJpeg(const uint8_t* jpegData, size_t jpegLen, std::vector<uint8_t>& outBgra, int& outW, int& outH);
// Reads the SOF dimensions from the header only, so untrusted size claims can be refused before decodeJpeg allocates.
static bool jpegDimensions(const uint8_t* jpegData, size_t jpegLen, int& outW, int& outH);
static bool decodeJpegIntoCanvas(
const uint8_t* jpegData, size_t jpegLen,
uint8_t* canvasBgra, int canvasW, int canvasH,
Expand Down
Loading
Loading