Files
firka/firka/lib/core/dev/mock_backend.dart
zypherift ca9e6c3efa feat: add mock kréta server + login-screen mock mode toggle
Adds a standalone Go mock server (mock_kreta_server/) with an admin
GUI for editing student/grade/timetable/etc data, plus a login-screen
long-press toggle to point the app at it instead of the real e-Kréta
service for local testing. Also pulls in updated translations from
the firka-localization submodule.
2026-08-26 22:07:21 +02:00

23 lines
592 B
Dart

import "package:firka/core/settings/settings_repository.dart";
import "package:firka/core/settings/settings_schema.dart";
class MockBackend {
static String rewrite(String url) {
if (!Settings.mockBackendEnabled.value) return url;
final mockBase = Settings.mockBackendUrl.value;
if (mockBase.isEmpty) return url;
final mockUri = Uri.parse(mockBase);
final uri = Uri.parse(url);
return uri
.replace(
scheme: mockUri.scheme,
host: mockUri.host,
port: mockUri.hasPort ? mockUri.port : null,
)
.toString();
}
}