├── lib ├── dist │ ├── src │ │ └── types │ │ │ ├── websockets.js │ │ │ ├── websockets.d.ts.map │ │ │ └── websockets.d.ts │ └── tsconfig.tsbuildinfo ├── README.md ├── tsconfig.json ├── .gitignore └── src │ └── types │ └── websockets.ts ├── signalling ├── .eslintignore ├── .prettierignore ├── nodemon.json ├── .gitignore ├── src │ ├── websockets │ │ ├── types.ts │ │ └── index.ts │ ├── index.ts │ └── lib │ │ └── logger.ts ├── README.md ├── .eslintrc ├── tsconfig.json └── package.json ├── www ├── .prettierignore ├── .env.development ├── global.d.ts ├── postcss.config.js ├── next-env.d.ts ├── components │ ├── room │ │ ├── call.tsx │ │ ├── label.tsx │ │ ├── loading.tsx │ │ ├── local-preview.tsx │ │ ├── peer-video.tsx │ │ ├── video.tsx │ │ ├── local-video.tsx │ │ ├── pre-form.tsx │ │ ├── request-name.tsx │ │ ├── request-permission.tsx │ │ ├── grid-video.tsx │ │ ├── grid.tsx │ │ ├── controls.tsx │ │ └── request-devices.tsx │ ├── container.tsx │ ├── lib │ │ ├── submit.tsx │ │ ├── legal.tsx │ │ ├── link.tsx │ │ ├── input.tsx │ │ ├── button.tsx │ │ └── select.tsx │ ├── home │ │ ├── hero.tsx │ │ ├── create-room.tsx │ │ └── features.tsx │ └── footer.tsx ├── tailwind.config.js ├── pages │ ├── index.tsx │ ├── _app.tsx │ ├── goodbye.tsx │ ├── [roomCode] │ │ └── [roomName].tsx │ ├── privacy-policy.tsx │ └── terms-and-conditions.tsx ├── styles │ └── globals.scss ├── public │ └── favicon.svg ├── lib │ ├── mesh │ │ ├── maps.ts │ │ ├── data.ts │ │ ├── webrtc.ts │ │ ├── stream.ts │ │ └── websocket.ts │ └── rooms │ │ ├── slug.ts │ │ └── room-encoding.ts ├── next.config.js ├── .gitignore ├── tsconfig.json ├── .eslintrc ├── atoms │ ├── room.ts │ ├── peers.ts │ └── local.ts ├── README.md └── package.json ├── .github └── workflows │ └── checks.yml ├── README.md └── LICENSE /lib/dist/src/types/websockets.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /signalling/.eslintignore: -------------------------------------------------------------------------------- 1 | # build 2 | dist 3 | -------------------------------------------------------------------------------- /signalling/.prettierignore: -------------------------------------------------------------------------------- 1 | # build 2 | dist 3 | -------------------------------------------------------------------------------- /www/.prettierignore: -------------------------------------------------------------------------------- 1 | # Build files 2 | .next 3 | -------------------------------------------------------------------------------- /www/.env.development: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_SIGNALLING_URL=http://localhost:8080 2 | -------------------------------------------------------------------------------- /lib/README.md: -------------------------------------------------------------------------------- 1 | # @p2p.chat/lib 2 | 3 | Shared typescript libraries for p2p.chat. 4 | -------------------------------------------------------------------------------- /www/global.d.ts: -------------------------------------------------------------------------------- 1 | declare module "shorthash" { 2 | export const unique: (input: string) => string; 3 | } 4 | -------------------------------------------------------------------------------- /www/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /signalling/nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src/**"], 3 | "ext": "ts", 4 | "exec": "NODE_ENV=development ts-node ./src/index.ts" 5 | } 6 | -------------------------------------------------------------------------------- /signalling/.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | /node_modules 3 | 4 | # build 5 | dist 6 | tsconfig.tsbuildinfo 7 | 8 | # lint 9 | .eslintcache 10 | -------------------------------------------------------------------------------- /www/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /lib/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "es2015", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "outDir": "./dist", 8 | "composite": true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /signalling/src/websockets/types.ts: -------------------------------------------------------------------------------- 1 | import { Server as IOServer, Socket as IOSocket } from "socket.io"; 2 | import { ClientEvents, ServerEvents } from "../../../lib/src/types/websockets"; 3 | 4 | export type Server = IOServer; 5 | export type Socket = IOSocket; 6 | -------------------------------------------------------------------------------- /signalling/src/index.ts: -------------------------------------------------------------------------------- 1 | import { createConsoleLogger } from "./lib/logger"; 2 | import { createServer } from "./websockets"; 3 | 4 | const PORT = 8080; 5 | 6 | const logger = createConsoleLogger(); 7 | const server = createServer(logger); 8 | 9 | server.listen(PORT); 10 | logger.info(`Started listening on ${PORT}`); 11 | -------------------------------------------------------------------------------- /www/components/room/call.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Controls from "./controls"; 3 | import Grid from "./grid"; 4 | 5 | export default function Call() { 6 | return ( 7 |
8 | 9 | 10 |
11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /www/tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | mode: "jit", 3 | purge: ["./pages/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}"], 4 | darkMode: "media", 5 | theme: { 6 | extend: {}, 7 | }, 8 | variants: { 9 | extend: { 10 | backgroundColor: ["active"], 11 | }, 12 | }, 13 | plugins: [], 14 | }; 15 | -------------------------------------------------------------------------------- /www/components/room/label.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | interface Props extends React.HTMLAttributes { 4 | htmlFor: string; 5 | text: string; 6 | } 7 | 8 | export default function Label(props: Props) { 9 | const { htmlFor, text } = props; 10 | 11 | return ; 12 | } 13 | -------------------------------------------------------------------------------- /www/components/room/loading.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Loader from "react-loader-spinner"; 3 | 4 | export default function Loading() { 5 | return ( 6 |
7 | 8 |
9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /signalling/README.md: -------------------------------------------------------------------------------- 1 | # @p2p.chat/signalling 2 | 3 | @p2p.chat/signalling is a simple nodejs websocket signalling server written in Typescript. 4 | 5 | ## Requirements 6 | 7 | Install dependencies: 8 | 9 | ```bash 10 | npm i 11 | ``` 12 | 13 | ## Development 14 | 15 | Run the development server: 16 | 17 | ```bash 18 | npm run dev 19 | ``` 20 | -------------------------------------------------------------------------------- /www/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Footer from "../components/footer"; 3 | import Features from "../components/home/features"; 4 | import Hero from "../components/home/hero"; 5 | 6 | export default function Home() { 7 | return ( 8 | 9 | 10 | 11 |