Periodic commit
This commit is contained in:
@@ -42,6 +42,14 @@ The portal API key is also a build-time argument: `-DAPI_KEY="..."` (CMake) or
|
|||||||
real value in CI secrets, never in source — rotate by rebuilding with a new
|
real value in CI secrets, never in source — rotate by rebuilding with a new
|
||||||
key.
|
key.
|
||||||
|
|
||||||
|
Version and API key can be baked in together with a single configure:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug \
|
||||||
|
-DAPP_VERSION="1.2.3" \
|
||||||
|
-DAPI_KEY="$API_KEY"
|
||||||
|
```
|
||||||
|
|
||||||
- The app resolves `assets/...` relative to its working directory — launch
|
- The app resolves `assets/...` relative to its working directory — launch
|
||||||
`./build/radiantwave` from the repo root. (The Nix wrapper chdirs to
|
`./build/radiantwave` from the repo root. (The Nix wrapper chdirs to
|
||||||
`$out/share/radiantwave` before exec, which is why the installed app works.)
|
`$out/share/radiantwave` before exec, which is why the installed app works.)
|
||||||
|
|||||||
@@ -153,6 +153,21 @@ Rotate the key by building with a new value and shipping the new binary. The
|
|||||||
Nix package accepts the same value via `callPackage ./nix/package.nix {
|
Nix package accepts the same value via `callPackage ./nix/package.nix {
|
||||||
apiKey = "…"; }`; the flake itself never embeds one.
|
apiKey = "…"; }`; the flake itself never embeds one.
|
||||||
|
|
||||||
|
#### Version + API key in one configure
|
||||||
|
|
||||||
|
`APP_VERSION` and `API_KEY` are independent CMake cache variables, so pass
|
||||||
|
both — plus the build type — in a single configure:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug \
|
||||||
|
-DAPP_VERSION="1.2.3" \
|
||||||
|
-DAPI_KEY="${{ secrets.PORTAL_API_KEY }}"
|
||||||
|
cmake --build build
|
||||||
|
```
|
||||||
|
|
||||||
|
`-D` values always win over the `APP_VERSION` / `API_KEY` environment
|
||||||
|
variables, which `nix develop` seeds from the ambient environment.
|
||||||
|
|
||||||
### Building with Nix
|
### Building with Nix
|
||||||
|
|
||||||
The flake supports `x86_64-linux` and `aarch64-linux` (the deployment
|
The flake supports `x86_64-linux` and `aarch64-linux` (the deployment
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
|
|
||||||
echo "RadiantWave dev shell (APP_VERSION=dev, API_KEY=$([[ -n "$API_KEY" ]] && echo set || echo unset))"
|
echo "RadiantWave dev shell (APP_VERSION=dev, API_KEY=$([[ -n "$API_KEY" ]] && echo set || echo unset))"
|
||||||
echo " Configure: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug"
|
echo " Configure: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug"
|
||||||
|
echo " Bake version+key: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DAPP_VERSION=\"1.2.3\" -DAPI_KEY=\"<key>\""
|
||||||
echo " Build: cmake --build build"
|
echo " Build: cmake --build build"
|
||||||
echo " Run: ./build/radiantwave"
|
echo " Run: ./build/radiantwave"
|
||||||
echo " Tests: ./build/test_assets && ./build/test_<name>"
|
echo " Tests: ./build/test_assets && ./build/test_<name>"
|
||||||
|
|||||||
@@ -83,10 +83,11 @@ struct WifiDevice::Impl {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
std::string err = "D-Bus call failed: ";
|
radiantwave::logger::Logger::instance().warning("WiFi",
|
||||||
err += error.message ? error.message : strerror(-r);
|
std::string("D-Bus call failed: ") +
|
||||||
|
(error.message ? error.message : strerror(-r)));
|
||||||
sd_bus_error_free(&error);
|
sd_bus_error_free(&error);
|
||||||
throw std::runtime_error(err);
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sd_bus_error_free(&error);
|
sd_bus_error_free(&error);
|
||||||
@@ -116,10 +117,16 @@ struct WifiDevice::Impl {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
std::string err = "D-Bus property get failed: ";
|
// Transient D-Bus errors (e.g. a reply raced with a state change
|
||||||
err += error.message ? error.message : strerror(-r);
|
// while NetworkManager churns the device during a failed auth)
|
||||||
|
// must never throw out of here — callers treat a null reply as
|
||||||
|
// "unknown", which keeps the UI and wait loops running.
|
||||||
|
radiantwave::logger::Logger::instance().warning("WiFi",
|
||||||
|
"D-Bus property get failed on " + std::string(path) + "." +
|
||||||
|
std::string(prop) + ": " +
|
||||||
|
(error.message ? error.message : strerror(-r)));
|
||||||
sd_bus_error_free(&error);
|
sd_bus_error_free(&error);
|
||||||
throw std::runtime_error(err);
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sd_bus_error_free(&error);
|
sd_bus_error_free(&error);
|
||||||
@@ -145,7 +152,11 @@ std::string WifiDevice::getInterfaceName() const {
|
|||||||
"Interface",
|
"Interface",
|
||||||
"s"
|
"s"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!msg) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
const char* iface = nullptr;
|
const char* iface = nullptr;
|
||||||
sd_bus_message_read(msg, "s", &iface);
|
sd_bus_message_read(msg, "s", &iface);
|
||||||
std::string result = iface ? iface : "";
|
std::string result = iface ? iface : "";
|
||||||
@@ -162,7 +173,13 @@ uint32_t WifiDevice::getDeviceState() const {
|
|||||||
"State",
|
"State",
|
||||||
"u"
|
"u"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!msg) {
|
||||||
|
// Unknown state keeps callers polling/falling back gracefully instead
|
||||||
|
// of aborting on a transient read failure.
|
||||||
|
return nm_device_state::Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t state = 0;
|
uint32_t state = 0;
|
||||||
sd_bus_message_read(msg, "u", &state);
|
sd_bus_message_read(msg, "u", &state);
|
||||||
sd_bus_message_unref(msg);
|
sd_bus_message_unref(msg);
|
||||||
@@ -328,7 +345,11 @@ AccessPointInfo WifiDevice::getActiveAccessPoint() const {
|
|||||||
"ActiveAccessPoint",
|
"ActiveAccessPoint",
|
||||||
"o"
|
"o"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!msg) {
|
||||||
|
return AccessPointInfo{}; // No active AP
|
||||||
|
}
|
||||||
|
|
||||||
const char* ap_path = nullptr;
|
const char* ap_path = nullptr;
|
||||||
sd_bus_message_read(msg, "o", &ap_path);
|
sd_bus_message_read(msg, "o", &ap_path);
|
||||||
sd_bus_message_unref(msg);
|
sd_bus_message_unref(msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user