• Stars
    star
    522
  • Rank 84,811 (Top 2 %)
  • Language
    TypeScript
  • License
    BSD 3-Clause Clea...
  • Created almost 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📲 WebRTC file transfer - React/TypeScript front end.

filedrop

Easy peer-to-peer file transfer.

Click here to open drop.lol.

Screenshot

Self-hosting

Docker

Requirements:

  • docker
  • docker-compose
  • bash
  • openssl

Clone the repo and run the following command:

./docker-start.sh

Make sure that your user is in the docker group.

In case another reverse proxy is used make sure to change the default port (from 80) and to add the X-Forwarded-For header with client's IP address.

TURN uses TCP port 3478 and UDP ports 49152-65535.

docker-start.sh arguments

Option Description
-n <name> Sets application name.
-e <email> Sets contact email.
-p <port> Sets port for the application to be exposed at.
-f Enables WS_USE_X_FORWARDED_FOR.
-s Enables WS_REQUIRE_CRYPTO.

Manual

First you need to set up a TURN server (like coturn).

Then you need to clone this repository, run yarn build and then yarn start. I also use nginx to proxy the back end through it. Here's a guide on how to achieve that.

Environment variables

The following variables are used in the build process of the frontend:

Variable Default value Description
VITE_APP_NAME filedrop Application title.
VITE_APP_USE_BROWSER_ROUTER 0 1 if you want the application to use BrowserRouter instead of HashRouter.

The following variables are used in the WebSockets server:

Variable Default value Description
WS_APP_NAME filedrop Application title.
WS_ABUSE_EMAIL null E-mail to show in the Abuse section.
WS_HOST 127.0.0.1 IP address to bind to.
WS_PORT 5000 Port to bind to.
WS_USE_X_FORWARDED_FOR 0 Set to 1 if you want the application to respect the X-Forwarded-For header.
WS_MAX_SIZE 65536 The limit should accommodate preview images (100x100 thumbnails).
WS_MAX_NETWORK_CLIENTS 64 Limits the amount of clients that can connect to one room.
WS_REQUIRE_CRYPTO 0 Set to 1 if you want to ensure that all communication between clients is encrypted. HTTPS is required for this to work.
STUN_SERVER stun:stun1.l.google.com:19302 STUN server address.
TURN_MODE default default for static credentials, hmac for time-limited credentials.
TURN_SERVER null TURN server address.
TURN_USERNAME null TURN username.
TURN_CREDENTIAL null TURN credential (password).
TURN_SECRET null TURN secret (required for hmac).
TURN_EXPIRY 3600 TURN token expiration time (when in hmac mode), in seconds.
NOTICE_TEXT null Text of the notice to be displayed for all clients.
NOTICE_URL null URL the notice should link to.

FAQ

What is the motivation behind the project?

I didn't feel comfortable logging into my e-mail account on devices I don't own just to download an attachment and cloud services have extremely long URLs that aren't really easy to type.

Where do my files go after I send them through the service?

To the other device. Sometimes the (encrypted, since WebRTC uses encryption by default) data goes through the TURN server I run. It's immediately discarded after being relayed. File metadata also is not saved.

Doesn't this exist already?

While ShareDrop and SnapDrop are both excellent projects and most definitely exist, I felt the need to create my own version for a several reasons:

  • I wanted to build something using React.js and TypeScript.
  • ShareDrop doesn't work when the devices are on different networks but still behind NAT.
  • I didn't like the layout and design of both, I feel like the abstract design of FileDrop makes it easier to use.
  • I was not aware of these projects while I started working on this project.
  • ShareDrop's URLs are extremely long.

How is it related to the other projects you've mentioned?

I don't use PeerJS (while the other two projects do) and I also host TURN and WebSocket servers myself (instead of relying on Firebase). Sometimes you may get connected to Google's STUN server (always if a TURN server is not provided in the configuration).

HTTPS setup

Setup with a reverse proxy in front of nginx

  1. Configure your reverse proxy to proxy requests to 127.0.0.1:PORT and then follow your usual instructions for using SSL certificates with said proxy.
  2. Rebuild the application.
  3. Make sure the TURN server can be connected to from the outside.

Nginx configuration example

More details available here: https://www.nginx.com/blog/websocket-nginx/

worker_processes auto;

events {
  worker_connections 1024;
}

http {
  upstream filedrop {
    server 127.0.0.1:5000; # 5000 = PORT
  }

  map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
  }

  # ...

  server {
    listen 80;
    # server_name should be configured here.
    # HTTPS should be configured here. (certbot will handle this for you, if you're using Let's Encrypt.)

    # ...

    location / {
      proxy_pass http://filedrop;
      proxy_http_version 1.1;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $host;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection $connection_upgrade;
    }
  }
}

More Repositories

1

react-letter

✉️ Display e-mails in your React.js projects. (Targets Gmail rendering.)
TypeScript
237
star
2

filedrop-ws

📲 WebRTC file transfer - WebSockets server.
TypeScript
112
star
3

pongloader

🏓 Pong in 512 bytes. (boot sector)
Assembly
87
star
4

react-var-ui

React component library for variable setting and preview.
TypeScript
69
star
5

2048

🎮 2048 clone (React/TypeScript/Redux). No canvas.
TypeScript
64
star
6

bfloader

🧠 Brainfuck IDE and interpreter in 512 bytes. (boot sector)
Assembly
47
star
7

imtool

🖼️ Client-side canvas-based image manipulation library.
TypeScript
40
star
8

flight

🕹 3D video game experiments. three.js, TypeScript, React, Redux and GLSL shaders at once.
TypeScript
27
star
9

typesocket

🌐 TypeScript WebSockets library.
TypeScript
25
star
10

droplol

📲 drop.lol CLI client for easy peer-to-peer file transfers.
TypeScript
21
star
11

letterparser

✉️ Isomorphic e-mail parser (with MIME support) written in TypeScript.
TypeScript
19
star
12

upload

⬆ Isomorphic TypeScript file upload library.
TypeScript
16
star
13

platinum.css

🖥️ Pixel perfect recreation of MacOS 9's Platinum UI. (Work in progress)
CSS
15
star
14

lettersanitizer

📧 DOM-based HTML email sanitizer for in-browser email rendering.
TypeScript
12
star
15

microMTA

✉️ node.js MTA library. (inbound mail only SMTP server)
TypeScript
10
star
16

fxGlue

💥 WebGL-based image effects library. (TypeScript)
TypeScript
8
star
17

inkball

🎱 TypeScript reimplementation of the game included with Windows Vista.
TypeScript
8
star
18

filedrop-docker

📦 docker-compose configuration for filedrop.
Shell
6
star
19

pasteoverflow

🎨 Paste StackOverflow snippets directly from your Command Palette. (VS Code)
TypeScript
6
star
20

catchmail-web

✉️ Self-hosted e-mail debugging tool. (React.js frontend/TypeScript)
TypeScript
5
star
21

vue-letter

✉️ Display HTML e-mails in your Vue projects. (Targets Gmail rendering.)
JavaScript
5
star
22

DUI

✏️ Developing under influence... (of SwiftUI) - Declarative UI syntax for JS.
5
star
23

react-nano-scrollbar

🖱️ Tiny React component for minimalist scrollbars, no external dependencies. (React.js/TypeScript)
TypeScript
5
star
24

photos-web

📸 React + TypeScript front-end for my photo storage app.
TypeScript
4
star
25

6502

🖥️ 6502 emulator (TypeScript)
JavaScript
3
star
26

nailit

🖼 Deprecated, see: https://github.com/mat-sz/imtool
TypeScript
3
star
27

WebAppSignature

✍️ A proposal for creating a system for client-side cryptographic validation of web application code and assets.
3
star
28

fitool

📂 TypeScript file functions library.
TypeScript
2
star
29

nailit-demo

📸 Demo for my nailit JS library. (React.js)
JavaScript
2
star
30

photos-api

📸 node.js/express.js back-end for my photo storage app.
JavaScript
2
star
31

tabcast

⚡️ TypeScript message passing (broadcasting) across multiple tabs of same origin.
TypeScript
2
star
32

infiniplayer

🎶 Infinite stream of music from YouTube. (CLI)
JavaScript
2
star
33

95wm

🖥️ Windows 95 inspired window manager for X11.
C++
2
star
34

util

🔧 A collection of programming-related utilities.
TypeScript
1
star
35

microIMAP

✉️ node.js IMAP client/server library.
TypeScript
1
star
36

jumpcall-web

📞 Quick WebRTC calls - React.js frontend (TypeScript).
TypeScript
1
star
37

lettercoder

✉️ Isomorphic Quoted-Printable (RFC 2045) and MIME word (RFC 2047) decoding library.
TypeScript
1
star
38

WebAppSignatureExtension

🧩 A Chrome/Firefox extension that enables WebAppSignature support.
TypeScript
1
star
39

drum-machine

🥁 React + TypeScript drum machine.
TypeScript
1
star
40

shadowbin-web

📝 Encrypted text hosting service (React.js/TypeScript frontend)
TypeScript
1
star
41

shadowbin-api

📝 Encrypted text hosting service (Backend)
TypeScript
1
star
42

plist

📝 An universal TypeScript library for handing Apple's Property Lists. Supports binary, text and XML plists; works well in both browser and node.
TypeScript
1
star
43

catchmail-ws

✉️ Self-hosted e-mail debugging tool. (WebSockets backend/TypeScript)
TypeScript
1
star
44

cra-template-mat-sz

📝 Personal React template (React, TypeScript, Redux, Redux-Saga, SCSS, Prettier)
TypeScript
1
star
45

apple2

🍎 Apple II emulator (TypeScript)
TypeScript
1
star
46

todo-api

📋 A project management app with support for multiple projects, users and lists. C# (asp.net core) backend.
C#
1
star
47

react-statusbar

📶 A simple React library for beautiful statusbars.
TypeScript
1
star
48

ebin

💿 Epic binary parser/serializer for TypeScript
TypeScript
1
star
49

media-api

📺 Unofficial API for multimedia websites. (node.js only)
TypeScript
1
star
50

tetris

🕹️ Tetris written in TypeScript using HTML5 canvas.
TypeScript
1
star
51

todo-web

📋 React + TypeScript front-end for my project management app.
TypeScript
1
star
52

SwiftUI-Clicker

📱SwiftUI experiments - an uninspired incremental game.
Swift
1
star
53

pongloader-v86

🏓 An online demo for pongloader.
JavaScript
1
star
54

matcrypt

🔐 Wrapper for WebCrypto designed to optimize certain tasks.
TypeScript
1
star