mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-27 04:56:48 +00:00
Bug fixes (#637)
* Fix formatting * Handle case where server does not provide permissions information * Enhanced URL checks * Enhanced check * Fix for error dialog * Bump version information
This commit is contained in:
parent
762d1ae156
commit
52879c0fc2
@ -1,3 +1,7 @@
|
||||
### 0.18.1 - April 2025
|
||||
---
|
||||
- Fix bug associated with handling invalid URLs
|
||||
|
||||
### 0.18.0 - April 2025
|
||||
---
|
||||
- Adds ability to create new companies from the app
|
||||
|
29
lib/api.dart
29
lib/api.dart
@ -336,6 +336,8 @@ class InvenTreeAPI {
|
||||
// Ref: https://github.com/inventree/InvenTree/pull/7420
|
||||
bool get supportsModernAttachments => apiVersion >= 207;
|
||||
|
||||
bool get supportsUserPermissions => apiVersion >= 207;
|
||||
|
||||
// Does the server support the "destination" field on the PurchaseOrder model?
|
||||
// Ref: https://github.com/inventree/InvenTree/pull/8403
|
||||
bool get supportsPurchaseOrderDestination => apiVersion >= 276;
|
||||
@ -725,7 +727,12 @@ class InvenTreeAPI {
|
||||
}
|
||||
|
||||
roles = (data["roles"] ?? {}) as Map<String, dynamic>;
|
||||
|
||||
if (supportsUserPermissions && data.containsKey("permissions")) {
|
||||
permissions = (data["permissions"] ?? {}) as Map<String, dynamic>;
|
||||
} else {
|
||||
permissions = {};
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1194,6 +1201,15 @@ class InvenTreeAPI {
|
||||
|
||||
var _url = makeApiUrl(url);
|
||||
|
||||
if (_url.isEmpty) {
|
||||
showServerError(
|
||||
url,
|
||||
L10().invalidHost,
|
||||
L10().invalidHostDetails
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Add any required query parameters to the URL using ?key=value notation
|
||||
if (urlParams.isNotEmpty) {
|
||||
String query = "?";
|
||||
@ -1210,13 +1226,12 @@ class InvenTreeAPI {
|
||||
|
||||
Uri? _uri = Uri.tryParse(_url);
|
||||
|
||||
if (_uri == null) {
|
||||
showServerError(url, L10().invalidHost, L10().invalidHostDetails);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (_uri.host.isEmpty) {
|
||||
showServerError(url, L10().invalidHost, L10().invalidHostDetails);
|
||||
if (_uri == null || _uri.host.isEmpty) {
|
||||
showServerError(
|
||||
_url,
|
||||
L10().invalidHost,
|
||||
L10().invalidHostDetails
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -228,13 +228,15 @@ Future<void> showServerError(String url, String title, String description) async
|
||||
playAudioFile("sounds/server_error.mp3");
|
||||
}
|
||||
|
||||
description += "\nURL: $url";
|
||||
|
||||
showSnackIcon(
|
||||
title,
|
||||
success: false,
|
||||
actionText: L10().details,
|
||||
onAction: () {
|
||||
showErrorDialog(
|
||||
L10().serverError,
|
||||
title,
|
||||
description: description,
|
||||
icon: TablerIcons.server
|
||||
);
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: inventree
|
||||
description: InvenTree stock management
|
||||
|
||||
version: 0.18.0+97
|
||||
version: 0.18.1+98
|
||||
|
||||
environment:
|
||||
sdk: ">=2.19.5 <3.13.0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user