# RPC - NAS Folder Opener A local HTTP server that opens NAS folder paths in the system file explorer. Designed to work with the PRISM web application hosted at `prism.ccllc.pro`. ## Purpose Browsers cannot directly open network file shares (NAS folders) due to security restrictions. This tool bridges that gap by: 1. Running a local HTTP server on `localhost:8080` 2. Accepting requests from the PRISM web application 3. Opening NAS folder paths in the user's file explorer ## How It Works 1. **User visits PRISM** at `prism.ccllc.pro` and views job information 2. **User clicks a folder link** from the `Job_Folder_Link` field 3. **PRISM makes a request** to `http://localhost:8080/open?path=` 4. **RPC tool opens the path** in the system file explorer ## Installation ### Prerequisites - Rust toolchain installed ([rustup.rs](https://rustup.rs/)) ### Build ```bash cargo build --release ``` The binary will be in `target/release/rpc` (or `target/release/rpc.exe` on Windows). ### Run ```bash cargo run ``` Or run the release binary: ```bash ./target/release/rpc ``` The server will start on `http://127.0.0.1:8080`. ## API Endpoints ### `GET /open?path=` Opens a NAS folder path in the file explorer. **Query Parameters:** - `path` (required): The NAS folder path to open. Supports: - UNC paths: `\\server\share\folder` - SMB paths: `smb://server/share/folder` - Unix-style: `//server/share/folder` **Response:** ```json { "success": true, "message": "Opening path: \\\\server\\share\\folder" } ``` **Error Response:** ```json { "success": false, "message": "Error description" } ``` ### `GET /health` Health check endpoint. **Response:** ```json { "status": "ok", "service": "NAS Folder Opener", "version": "0.1.0" } ``` ## Security - The server only accepts requests from `https://prism.ccllc.pro` (CORS) - Paths are validated to ensure they are network shares - Server only binds to `127.0.0.1` (localhost), not exposed to network ## Integration with PRISM In your Svelte component, add a function to open NAS folders: ```typescript async function openNasFolder(nasPath: string) { try { const response = await fetch( `http://localhost:8080/open?path=${encodeURIComponent(nasPath)}` ); const result = await response.json(); if (!result.success) { alert(`Failed to open folder: ${result.message}`); } } catch (error) { alert('Please ensure the NAS opener tool is running on your computer'); console.error('Error opening NAS folder:', error); } } ``` Then use it when displaying job folder links: ```svelte ``` ## Cross-Platform Support - **Windows**: Uses `explorer.exe` - **macOS**: Uses `open` command - **Linux**: Uses `xdg-open` command ## License Apache-2.0