ShareDrop - 基于WebRTC的简单P2P文件传输-受Apple AirDrop启发

ShareDrop是一个受Apple AirDrop启发的Web应用,它利用WebRTC实现设备间的直接文件传输,无需先上传到服务器。通过Firebase进行设备存在管理和WebRTC信号交换。在同一本地网络中的设备可以直接传输文件,不同网络则可以通过创建房间和唯一URL来实现跨网络文件共享。
摘要由CSDN通过智能技术生成

ShareDrop is a web application inspired by Apple AirDrop service. It allows you to transfer files directly between devices, without having to upload them to any server first. It uses WebRTC for secure peer-to-peer file transfer and Firebase for presence management and WebRTC signaling.

ShareDrop allows you to send files to other devices in the same local network (i.e. devices with the same public IP address) without any configuration - simply open https://www.sharedrop.io on all devices and they will see each other. It also allows you to send files between networks - just click the + button in the top right corner of the page to create a room with a unique URL and share this URL with other people you want to send a file to. Once they open this page in a browser on their devices, you’ll see each other’s avatars.

The main difference between ShareDrop and AirDrop is that ShareDrop requires Internet connection to discover other devices, while AirDrop doesn’t need one - it creates ad-hoc wireless network between them. On the other hand, ShareDrop allows you to share files between mobile (Android) and desktop devices and between networks as well.

Supported browsers
Chrome (desktop and Android) 33+
Opera (desktop and Android) 20+
Firefox (desktop and Android) 28+
Safari (desktop) 12+
How to set it up for local development
Setup Firebase:
Sign up for a Firebase account and create a database.
Go to “Security Rules” tab, click “Load Rules” button and select firebase_rules.json file.
Take note of your database URL and its secret, which can be found in “Secrets” tab.
Run npm install -g ember-cli to install Ember CLI.
Run ember install to install app dependencies.
Run cp .env{.sample,} to create .env file. This file will be used by Foreman to set environment variables when running the app locally.
SECRET key is used to encrypt cookies and generate room name based on public IP address for / route. It can be any random string - you can generate one using e.g. date | md5sum
NEW_RELIC_* keys are only necessary in production
Run npm run dev to start the app.
Deployment
Heroku
When deploying to Heroku, use multi buildpack.

For new apps:

heroku create myapp --buildpack https://github.com/heroku/heroku-buildpack-multi.git
For existing apps:

heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-multi.git
Then run

heroku config:set NPM_CONFIG_PRODUCTION=false
to make Node.js buildpack install development dependencies necessary to build Ember CLI app as well as the production ones.

It uses the default Heroku Node.js buildpack to install Node.js, npm and Node.js packages and then uses Ember CLI buildpack to install Bower packages and build Ember CLI app.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值