2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-10-14 21:22:20 +00:00

allow mobile check ignore (#10529)

* allow mobile check ignore

* add docs
This commit is contained in:
Lukas
2025-10-09 00:44:40 +02:00
committed by GitHub
parent 7ca72ff262
commit cb0b0bcd0d
4 changed files with 36 additions and 5 deletions

View File

@@ -414,7 +414,7 @@ The login-experience can be altered with the following settings:
Custom authentication backends can be used by specifying them here. These can for example be used to add [LDAP / AD login](https://django-auth-ldap.readthedocs.io/en/latest/) to InvenTree
### Sentry Integration
## Sentry Integration
The InvenTree server can be integrated with the [sentry.io](https://sentry.io) monitoring service, for error logging and performance tracking.
@@ -427,7 +427,7 @@ The InvenTree server can be integrated with the [sentry.io](https://sentry.io) m
!!! info "Default DSN"
If enabled with the default DSN, server errors will be logged to a sentry.io account monitored by the InvenTree developers.
### Customization Options
## Customization Options
The logo and custom messages can be changed/set:
@@ -456,6 +456,28 @@ If you want to remove the InvenTree branding as far as possible from your end-us
!!! info "Custom Logo Path"
The provided *custom logo* path must be specified *relative* to the location of the `/static/` directory.
## Frontend Options
Set the `INVENTREE_FRONTEND_SETTINGS` Environment variable to a JSON object or use `frontend_settings` in the configuration file with the following options:
| Option | Description | Default |
| --- | --- | --- |
| `base_url` | Set the base URL for the user interface. This is the UI path e.g. '/web/' | `web` |
| `api_host` | If provided, specify the API host | *None* |
| `server_list` | Set the server list. `{}` | `[]` |
| `debug` | Set the debug mode | *Server debug mode* |
| `environment` | `development` or `production` | *development if Server is in debug mode* |
| `show_server_selector` | In debug mode, show server selector by default. If no servers are specified, show server selector. | |
| `url_compatibility` | Support compatibility with "legacy" URLs? | `true` |
| `sentry_dsn` | Set a Sentry DSN url | *Not specified* |
| `mobile_mode` | Controls if InvenTree web UI can be used by mobile devices. There are 3 options: `default` - does not allow mobile devices; `allow-ignore` - shows a mobile device detected banner with a button to ignore this warning AT THE USERS OWN RISK; `allow-always` - skips the mobile check and allows mobile devices always (of course at the server admins OWN RISK) | `default` |
E.g. to allow mobile devices to ignore the mobile check, use the following Environment variable:
```env
INVENTREE_FRONTEND_SETTINGS='{"mobile_mode": "allow-ignore"}'
```
## Plugin Options
The following [plugin](../plugins/index.md) configuration options are available:

View File

@@ -35,6 +35,7 @@ declare global {
api_host?: string;
sentry_dsn?: string;
environment?: string;
mobile_mode?: 'default' | 'allow-ignore' | 'allow-always';
};
react: typeof React;
React: typeof React;

View File

@@ -40,7 +40,11 @@ export default function MainView() {
}, []);
// Check if mobile
if (!allowMobile && checkMobile()) {
if (
!allowMobile &&
window.INVENTREE_SETTINGS.mobile_mode !== 'allow-always' &&
checkMobile()
) {
return <MobileAppView />;
}

View File

@@ -33,8 +33,12 @@ export default function MobileAppView() {
<Anchor href={docLinks.app}>
<Trans>Read the docs</Trans>
</Anchor>
{IS_DEV && (
<Text onClick={ignore}>
{(IS_DEV ||
window.INVENTREE_SETTINGS.mobile_mode === 'allow-ignore') && (
<Text
onClick={ignore}
style={{ cursor: 'pointer', textDecoration: 'underline' }}
>
<Trans>Ignore and continue to Desktop view</Trans>
</Text>
)}