Configuration Options
Relevant source files
The following files were used as context for generating this wiki page:
The Nextcloud CAD Viewer is designed to be a "plug-and-play" application that integrates the @mlightcad/cad-viewer library into the Nextcloud ecosystem. While the application works out-of-the-box with minimal intervention, there are several configuration layers available to administrators and developers, ranging from server-side environment tuning to frontend viewer initialization parameters.
Sources: appinfo/info.xml , README.md:144-146
Frontend Viewer Configuration
The frontend viewer is initialized via the loadCADViewer utility, which accepts a CADViewerOptions object. This allows for the customization of the user experience, including localization, visual themes, and rendering performance settings.
Initialization Options
When the application mounts, it identifies the file to be rendered and applies default or specific settings to the MlCadViewer component.
| Option | Type | Default | Description |
|---|---|---|---|
locale | string | 'en' | Language code for the viewer interface. |
theme | 'light' | 'dark' | 'dark' | Visual theme of the viewer UI. |
background | number | 0x1e1e1e | Hexadecimal color code for the canvas background. |
useMainThreadDraw | boolean | false | Whether to force rendering on the main thread instead of a worker. |
Sources: src/utils/cadLoader.ts:10-18, src/utils/cadLoader.ts:32-40, src/App.vue:64
Data Flow for Viewer Initialization
The following diagram illustrates how the application retrieves configuration and file data to initialize the viewer.
The application primarily uses the dark theme by default during the initViewer process.
Sources: src/App.vue:42-70, src/utils/cadLoader.ts:48-53
Server-Side & Environment Configuration
To support the viewing of large or complex CAD files (DWG/DXF), the host server must be configured with adequate resource limits. These settings are typically managed within the php.ini or Nextcloud config.php files.
PHP Runtime Requirements
| Directive | Recommended Value | Purpose |
|---|---|---|
memory_limit | 1024M | Prevents crashes during the processing of large drawings. |
max_execution_time | 300 | Allows sufficient time for streaming large file contents. |
upload_max_filesize | 500M | Ensures large CAD assets can be uploaded to the instance. |
Sources: wiki/Installation-Guide.md:163-168, wiki/Requirements.md:31-35, wiki/Troubleshooting.md:213-218
Web Server Configuration (MIME Types)
Proper configuration of MIME types is essential for Nextcloud to correctly identify and open CAD files with the viewer.
# Apache Configuration
AddType application/acad .dwg
AddType application/dxf .dxf
AddType image/vnd.dwg .dwg
AddType image/vnd.dxf .dxf
Sources: wiki/Installation-Guide.md:145-152, wiki/Requirements.md:129-139
Hardware & Browser Configuration
Because the viewer relies on WebGL 2.0 for 3D rendering, client-side configuration significantly impacts performance.
Browser Settings
Users may need to adjust browser settings to ensure hardware acceleration is active, which is critical for smooth "Pan" and "Zoom" operations.
- Chrome/Edge: Enable "Use hardware acceleration when available" in System settings.
- Firefox: Uncheck "Use recommended performance settings" and enable "Use hardware acceleration".
Sources: wiki/Requirements.md:110-120, wiki/Troubleshooting.md:162-166
Build-Time Configuration
Developers can modify the build process via package.json and webpack.config.js. The project supports two primary modes:
- Development:
npm run devenables watch mode and source mapping. - Production:
npm run buildoptimizes assets for deployment.
The application targets specific Node.js versions (^20 || ^22) and requires the --legacy-peer-deps flag during installation to handle conflicts within the @mlightcad package ecosystem.
Sources: package.json:11-13, AGENTS.md:21-25
Summary
Configuration for the Nextcloud CAD Viewer is split between frontend initialization (handled in cadLoader.ts), server resource tuning (PHP limits), and client-side hardware enablement. While default settings prioritize a dark-themed, high-performance WebGL experience, administrators must ensure the server's PHP memory and execution limits are scaled to the size of the CAD files being managed.