My main use of Snapdrop is to enable Airdrop-like file transfers between my iOS devices and other devices since, well, the Airdrop works with iOS devices only. However, the original Snapdrop does not work well in pure LAN environment and with my iOS devices so I implemented several extensions and fixes.
Basically Snapdrop only allows clients in the same room to see each other and clients are put in a room based on their IP address. This works well if clients are behind NATed router while the server is outside, so all clients would be identified with a common public IP. However, when the server is also behind the NAT, the server would see clients private IP addresses instead, resulting in the clients put into different rooms. This is discussed in SnapDrop#159 and the simple workaround is to create a single room mode as suggested in SnapDrop#159 (comment)
sed -i 's/peer.ip/0/g' server/index.js
sed -i 's/sender.ip/0/g' server/index.js
Note that this would make all clients put into the same room so do this only for pure LAN environment!
With local docker image, simply defining SINGLE_ROOM=1 environment variable would enable this feature.
Snapdrop server is doing signaling only and data transfer is done peer to peer with WebRTC. However, WebRTC is problematic especially in pure LAN environment and I was having great problems trying to get it work in all OSes and browsers my devices use.
In this case an option to disable WebRTC and route everything through server could be nice. Surely this would put burden on the server and there would be security issue due to everything passing through the server, but for pure LAN environment and simple Airdrop replacement this is much better than a non-working WebRTC.
sed -i 's/window.isRtcSupported = .*/window.isRtcSupported = false;/' client/scripts/network.js
sed -i 's/window.isWSRelayEverything = .*/window.isWSRelayEverything = true;/' client/scripts/network.js
With local docker image, simply defining DISABLE_RTC=1 and WS_RELAY=1 environment variables would do both the above.
iOS Safari is always trying to display blobs when it thinks it can, even if download link is specified. And the worst part is, it would fail to display a PDF blob, giving message: "The operation couldn't be completed" - "WebKitBlobResource error 1".
To fix this, the blob is converted to data url with type application/octet-stream to prevent iOS Safari from trying to display it and force it to download instead.
Snapdrop: local file sharing in your browser. Inspired by Apple's Airdrop.
- Vanilla HTML5 / ES6 / CSS3 frontend
- WebRTC / WebSockets
- NodeJS backend
- Progressive Web App
Have any questions? Read our FAQ.
You can host your own instance with Docker.
Snapdrop is free. Still, we have to pay for the server. If you want to contribute, please use PayPal:
or Bitcoin:
Alternatively, you can become a Github Sponsor.
Thanks a lot for supporting free and open software!