{"id":31375932,"url":"https://github.com/kristupasjon/localserverdrop","last_synced_at":"2025-12-30T19:12:03.999Z","repository":{"id":316897390,"uuid":"1063982152","full_name":"KristupasJon/LocalServerDrop","owner":"KristupasJon","description":"A crossplatform Electron desktop application for local file server using Express. Share files across your local network with authentication and speed.","archived":false,"fork":false,"pushed_at":"2025-09-27T12:33:02.000Z","size":243,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-27T13:18:33.101Z","etag":null,"topics":["chromium","css3","electronjs","expressjs","file-sharing","html5","javascript","linux","localhost","localhost-related","macos","modern-ui","multer-storage","nodejs","offline-first","restful-api","server","tailwindcss","token-based-authentication","windows"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KristupasJon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-25T11:31:24.000Z","updated_at":"2025-09-27T12:33:05.000Z","dependencies_parsed_at":"2025-09-27T13:18:36.974Z","dependency_job_id":"d04e999f-feed-4898-b458-e07504c53f5c","html_url":"https://github.com/KristupasJon/LocalServerDrop","commit_stats":null,"previous_names":["kristupasjon/localserverdrop"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/KristupasJon/LocalServerDrop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KristupasJon%2FLocalServerDrop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KristupasJon%2FLocalServerDrop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KristupasJon%2FLocalServerDrop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KristupasJon%2FLocalServerDrop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KristupasJon","download_url":"https://codeload.github.com/KristupasJon/LocalServerDrop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KristupasJon%2FLocalServerDrop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277318707,"owners_count":25798184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-28T02:00:08.834Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chromium","css3","electronjs","expressjs","file-sharing","html5","javascript","linux","localhost","localhost-related","macos","modern-ui","multer-storage","nodejs","offline-first","restful-api","server","tailwindcss","token-based-authentication","windows"],"created_at":"2025-09-28T02:51:55.626Z","updated_at":"2025-09-28T02:51:56.601Z","avatar_url":"https://github.com/KristupasJon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LocalServerDrop\n\nA cross-platform Electron desktop application that will act as a local file sharing server using Express web server, with Multer storage. Share files fast across your local network.\n\n## What is LocalServerDrop?\n\nLocalServerDrop combines the convenience of a desktop application with the accessibility of a web server to create a seamless filesharing solution. Upload files through the desktop app or web interface, and share them instantly across your local network. Perfect for quick file transfers between devices without cloud dependencies or complex setup.\n\n\u003cimg width=\"1191\" height=\"666\" alt=\"image\" src=\"https://github.com/user-attachments/assets/2f74e96c-e5cc-4bc7-bc0e-6cf34bcf22af\" /\u003e\n\u003cimg width=\"1489\" height=\"510\" alt=\"image\" src=\"https://github.com/user-attachments/assets/827b7e99-1b10-4e1e-bb6b-ab558c6769ea\" /\u003e\n\n## Why LocalServerDrop?\n\n- **Privacy First**: No cloud services, everything stays on your private network.\n- **Simple Setup**: No configuration required, install and use.\n- **Cross-Device Compatible**: Access from any device with a web browser or run the application which is also multiplatform (Electron).\n- **Fast**: Local network speeds should be blazing fast, much MUCH faster than any online provider.\n- **Secure**: Only users with the admin token can delete files, ensuring unauthorized users cannot remove shared content. IPC handlers and correct filepath resolution make it much safer than most other available solutions that usually offer little to no security.\n- **Developer Friendly**: Clean codebase for easy modification.\n\nPerfect for developers, designers, content creators, or anyone who needs to quickly share files across devices without the hassle of cloud services or complex network setup.\n\n## Key Features\n\n- **Drag \u0026 Drop Upload**: Simple file uploading with visual feedback\n- **Cross-Platform**: Works on Windows, macOS, and Linux\n- **Local Network Sharing**: Access files via web browser at `localhost:8080` (Or use your device IPv4 shown in the app for LAN access)\n- **Real-time File Management**: View, download, and delete files instantly\n- **Modern UI**: Beautiful dark theme with gradient effects and smooth animations\n- **File Type Recognition**: Visual icons and color coding for different file types\n- **Security**: Admin-only file deletion with token authentication\n- **No External Dependencies**: Everything runs locally on your machine\n\n## Technology Stack\n\n### Frontend\n- **Electron**: Cross-platform desktop app framework\n- **HTML5/CSS3**: Modern web standards\n- **Tailwind CSS**: Utility-first CSS framework for rapid styling\n- **Vanilla JavaScript**: Lightweight, no heavy frameworks\n\n### Backend\n- **Node.js**: JavaScript runtime for server-side logic\n- **Express.js**: Web framework for handling HTTP requests\n- **Multer**: Middleware for handling file uploads\n- **File System API**: Native file operations\n\n### Development Tools\n- **Electron Builder**: Package and distribute the app\n- **Nodemon**: Auto-restart development server\n- **Tailwind CLI**: CSS compilation and optimization\n\n## Getting Started\n\n### Prerequisites\n\n- **Node.js**\n- **npm**\n\n### Installation\n1. Download the installer\n2. Run as administrator (for proper installation)\n3. Follow the setup wizard\n4. Launch from Start Menu or desktop shortcut\n\n\u003e [!TIP]\n\u003e Run the installer as administrator to ensure proper installation and avoid permission issues.\n\n### Running with Node.js runtime (No installation)\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/KristupasJon/LocalServerDrop.git\n   cd LocalServerDrop\n   ```\n\n2. **Install dependencies**\n   ```bash\n   npm install\n   ```\n\n3. **Build CSS (required - output.css is not tracked in git)**\n   ```bash\n   npm run buildcss\n   ```\n\n\u003e [!NOTE]\n\u003e The CSS build step is required because `output.css` is not tracked in git. You must run this command before starting the application.\n\n4. **Start the application**\n   ```bash\n   npm start\n   ```\n\n### Development Mode\n\nFor development with auto-reload:\n```bash\nnpm run dev\n```\n\nThis watches for changes in `main`, `renderer`, `preload`, and `backend` directories.\n\n## Building for Distribution\n\nBuild for your current platform:\n```bash\nnpm run build\n```\n\nBuild for specific platforms:\n```bash\nnpm run build:win    # Windows\nnpm run build:mac    # macOS\nnpm run build:linux  # Linux\n```\n\nBuilt applications will be available in the `dist/` directory.\n\n## Usage\n\n### Desktop App\n1. Launch LocalServerDrop\n2. Drag and drop files onto the upload zone, or click to browse\n3. Files are automatically uploaded to the local server\n4. Use the \"File Vault\" section to manage uploaded files\n5. Click the server button to open the web interface — the button shows your device IPv4 (for example, `192.168.1.50:8080`) inside Electron; on the same machine it may show `localhost:8080`\n\n### Web Interface\n1. Open any web browser\n2. Navigate to `http://localhost:8080` on the same machine, or `http://\u003cyour-device-ip\u003e:8080` from other devices on the same network\n3. Upload and download files through the web interface\n4. Perfect for sharing with other devices on your network\n\n### Network Sharing\n- The Electron UI shows your device IPv4 so others can connect (for example, `http://192.168.1.50:8080`)\n- Other devices on your network can access files by visiting `http://[YOUR-IP]:8080`\n- Find your IP address using `ipconfig` (Windows) or `ifconfig` (Mac/Linux)\n\n\u003e [!IMPORTANT]\n\u003e Windows Firewall may block inbound connections the first time the server runs. Approve the prompt when Windows asks to allow access. If needed, you can add a rule to allow TCP 8080.\n\n\u003cimg width=\"554\" height=\"517\" alt=\"image\" src=\"https://github.com/user-attachments/assets/ab4372dd-e65a-47bf-8d71-becde517d125\" /\u003e\n\nWindows PowerShell (run as Administrator):\n\n```powershell\nNew-NetFirewallRule -DisplayName \"LocalServerDrop 8080\" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 8080\n```\n\nTo remove later:\n\n```powershell\nRemove-NetFirewallRule -DisplayName \"LocalServerDrop 8080\"\n```\n\n\u003e [!TIP]\n\u003e To share files across your network, replace `[YOUR-IP]` with your actual IP address. Use `ipconfig` on Windows or `ifconfig` on Mac/Linux to find your IP.\n\n## Security Features\n\n- **Local Network Ready**: Server binds to `0.0.0.0` by default (listens on all interfaces). Use a trusted network or change binding to `127.0.0.1` to restrict to the local machine only.\n- **Admin Token Authentication**: File deletion requires admin token\n- **Path Traversal Protection**: Prevents unauthorized file access\n- **Sandboxed Frontend**: Electron security best practices implemented\n\n\u003e [!NOTE]\n\u003e **Security Notes:**\n\u003e - **Per-session admin token**: A new admin token is generated on each app start and passed to the server via `X-Admin-Token` header for delete operations. Restarting the app changes the token.\n\u003e - **Upload safety**: Filenames are sanitized to their basename (no path components). No explicit file size limit is enforced by default; add a Multer limit in code if you need one.\n\n## API Endpoints\n\n- `POST /upload` - Upload a file\n- `GET /list` - List all uploaded files\n   - Returns an array of objects: `{ name: string, size: number }` (`size` in bytes)\n- `GET /files/:filename` - Download a specific file\n- `DELETE /delete/:filename` - Delete a file (admin token required)\n   - Requires header: `X-Admin-Token: \u003ctoken\u003e`\n- `GET /` - Serve the web interface\n\n## API Usage\n\nYou can interact with LocalServerDrop's API programmatically for automation or integration purposes. Below are examples using curl and JavaScript fetch.\n\n### Upload a File\n```bash\ncurl -X POST -F \"file=@/path/to/your/file.txt\" http://localhost:8080/upload\n```\n\n### List Uploaded Files\n```bash\ncurl http://localhost:8080/list\n```\nResponse: `[{\"name\": \"file.txt\", \"size\": 1024}]`\n\n### Download a File\n```bash\ncurl -O http://localhost:8080/files/file.txt\n```\n\n### Delete a File\n```bash\n# Replace TOKEN_HERE with your actual admin token\ncurl -X DELETE \"http://localhost:8080/delete/file.txt\" \\\n   -H \"X-Admin-Token: TOKEN_HERE\"\n```\n\n### JavaScript Examples\n```javascript\n// Upload\nconst formData = new FormData();\nformData.append('file', fileInput.files[0]);\nfetch('http://localhost:8080/upload', {\n  method: 'POST',\n  body: formData\n});\n\n// List files\nfetch('http://localhost:8080/list')\n  .then(res =\u003e res.json())\n  .then(files =\u003e console.log(files));\n\n// Download\nwindow.open('http://localhost:8080/files/filename.ext');\n\n// Delete\nconst token = 'your-admin-token';\nfetch(`http://localhost:8080/delete/filename.ext`, {\n  method: 'DELETE',\n  headers: { 'X-Admin-Token': token }\n});\n```\n\n\u003e [!NOTE]\n\u003e The admin token for delete operations is generated per app session. For programmatic access, you may need to extract it from the running Electron app or set `LSD_ADMIN_TOKEN` environment variable when running the server standalone.\n\n## Configuration\n\n- Port can be configured via environment variable:\n   - `LSD_PORT` (default: `8080`)\n- Binding host can be configured via environment variable:\n   - `LSD_BIND_HOST` (default: `0.0.0.0` to listen on all interfaces)\n   - Set to `127.0.0.1` to restrict access to the local machine only\n- Admin token is managed automatically by the Electron app:\n   - `LSD_ADMIN_TOKEN` is set by the Electron main process per run. You typically do not need to set this manually unless you’re running the server outside the app.\n\nWindows PowerShell (per-session env var):\n\n```powershell\n$env:LSD_PORT = 9000\n$env:LSD_BIND_HOST = \"127.0.0.1\"\n```\n\nWindows Command Prompt:\n\n```bat\nset LSD_PORT=9000\nset LSD_BIND_HOST=127.0.0.1\n```\n\n### Test delete from a browser console or external tools\nIf you need to verify delete via browser, open `http://127.0.0.1:8080` and in the DevTools console run:\n\n```js\nconst TOKEN = 'paste-the-admin-token-here';\nconst NAME = 'existing-file.ext';\nfetch(`http://127.0.0.1:8080/delete/${encodeURIComponent(NAME)}`, {\n   method: 'DELETE',\n   headers: { 'X-Admin-Token': TOKEN }\n}).then(async r =\u003e ({ status: r.status, text: await r.text() }))\n   .then(console.log);\n```\n\nFor testing with **Postman** or **curl**:\n```bash\n# Replace TOKEN_HERE with your actual admin token\ncurl -X DELETE \"http://127.0.0.1:8080/delete/filename.ext\" \\\n   -H \"X-Admin-Token: TOKEN_HERE\"\n```\n\n\u003cimg width=\"885\" height=\"448\" alt=\"Screenshot 2025-09-25 155349\" src=\"https://github.com/user-attachments/assets/e4665baa-e3ea-4f74-8530-74990f74ea68\" /\u003e\n\n\n\u003e [!NOTE]\n\u003e The server's CORS configuration specifically allows the `X-Admin-Token` header for browser console testing and external API tools. Since the token is per-session and managed by the app, delete actions should generally be performed via the Electron UI. Manual testing requires the exact token for that run.\n\n## Troubleshooting\n\n- 403 Forbidden on delete:\n   - The admin token likely doesn’t match. Restart the Electron app and try the delete again from within the app UI.\n   - If testing manually, ensure you’re sending the correct `X-Admin-Token` for the current session.\n- CSS not applying after clone:\n   - Run `npm run buildcss` to generate `renderer/css/output.css` (it is not tracked in git).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristupasjon%2Flocalserverdrop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkristupasjon%2Flocalserverdrop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristupasjon%2Flocalserverdrop/lists"}