diff --git a/docs/docs/start/config.md b/docs/docs/start/config.md index 87660787ef..b3163a9a4a 100644 --- a/docs/docs/start/config.md +++ b/docs/docs/start/config.md @@ -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: diff --git a/src/frontend/src/main.tsx b/src/frontend/src/main.tsx index ab95bd9fc7..6dcea1de6a 100644 --- a/src/frontend/src/main.tsx +++ b/src/frontend/src/main.tsx @@ -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; diff --git a/src/frontend/src/views/MainView.tsx b/src/frontend/src/views/MainView.tsx index 434c404280..c72ce59521 100644 --- a/src/frontend/src/views/MainView.tsx +++ b/src/frontend/src/views/MainView.tsx @@ -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 ; } diff --git a/src/frontend/src/views/MobileAppView.tsx b/src/frontend/src/views/MobileAppView.tsx index fa2c81f74e..ffdb0c297d 100644 --- a/src/frontend/src/views/MobileAppView.tsx +++ b/src/frontend/src/views/MobileAppView.tsx @@ -33,8 +33,12 @@ export default function MobileAppView() { Read the docs - {IS_DEV && ( - + {(IS_DEV || + window.INVENTREE_SETTINGS.mobile_mode === 'allow-ignore') && ( + Ignore and continue to Desktop view )}