forked from firka/firka
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.
23 lines
592 B
Dart
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();
|
|
}
|
|
}
|