diet-guard/app/lib/services/desktop_wrapper.dart
Krzysztof kuhy Rudnicki b3aeb4f4b7
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (push) Waiting to run
Tests / test (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
Re-point paths for the ~ reorganisation (home-tidy)
Also bumps Flutter 3.47.3, flutter_secure_storage 11.1.0, idb_shim 2.9.9,
mcp 2.2.0 and ruff 0.16.7 so the freshness gate lets this through.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AwtowrowDXx6ccmWVPkCaF
2026-09-11 19:53:03 +02:00

30 lines
1.2 KiB
Dart

/// Shared constants between the web app and the desktop wrapper that serves it.
library;
/// The fixed port the desktop wrapper serves on.
///
/// **Do not change this casually.** IndexedDB (the food log, the food bank,
/// the settings) is keyed by origin, so a different port
/// looks like a different app with no history at all. The launcher, the
/// packaging and `bin/diet_guard_desktop.dart` must all use this value, and
/// the Chrome `--user-data-dir` must stay equally fixed for the same reason.
///
/// 8730 is `~/src/todo`'s wrapper and 8731 is `~/src/habit_stack`'s; this is the next
/// free one so all three can run at once.
const desktopWrapperPort = 8732;
/// Origin of the desktop wrapper, e.g. `http://localhost:8732`.
const desktopWrapperOrigin = 'http://localhost:$desktopWrapperPort';
/// URL paths the wrapper serves.
///
/// Kept beside the port so the client and the server cannot drift apart; the
/// server mirrors these constants rather than re-spelling the strings.
abstract final class WrapperPaths {
/// Prefix for document reads/writes: `/documents/<name>`.
static const documents = '/documents/';
/// Prefix for the GitHub proxy (see `wrapper_server.dart`).
static const github = '/github/';
}