Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: omegle-push-video-example #932

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
echo "\nRunning GIT hooks..."
yarn cleanbuild
yarn nx affected --target=lint
yarn nx affected --target=test
# yarn nx affected --target=test
4 changes: 4 additions & 0 deletions packages/examples/omegle-push-video/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.dist

./client/node_modules
./server/node_modules
65 changes: 65 additions & 0 deletions packages/examples/omegle-push-video/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Omegle but Push Chat

## Description

This project randomly connects 2 peers online and opens up a Push chat between the peers.

## Getting Started

### Installation - Server

1. Navigate to the server directory:

```bash
cd server
```

2. Install dependencies using Yarn or npm:

```bash
# Using Yarn
yarn

# Using npm
npm install
```

3. Start the Server:

```bash
# Using Yarn
yarn start

# Using npm
npm start
```

#### The server will run on the specified port (default is 3001).

### Installation - Client

1. Navigate to the server directory:

```bash
cd client
```

2. Install dependencies using Yarn or npm:

```bash
# Using Yarn
yarn

# Using npm
npm install
```

3. Start the Client:

```bash
# Using Yarn
yarn start

# Using npm
npm start
```
1 change: 1 addition & 0 deletions packages/examples/omegle-push-video/client/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_SERVER_URL=""
25 changes: 25 additions & 0 deletions packages/examples/omegle-push-video/client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
package-lock.json
yarn.lock
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.env
32 changes: 32 additions & 0 deletions packages/examples/omegle-push-video/client/config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const webpack = require("webpack");

module.exports = function override(config) {
const fallback = config.resolve.fallback || {};
Object.assign(fallback, {
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
assert: require.resolve("assert"),
http: require.resolve("stream-http"),
https: require.resolve("https-browserify"),
os: require.resolve("os-browserify"),
url: require.resolve("url"),
zlib: require.resolve("browserify-zlib"),
});
config.resolve.fallback = fallback;
config.plugins = (config.plugins || []).concat([
new webpack.ProvidePlugin({
process: "process/browser",
Buffer: ["buffer", "Buffer"],
}),
]);
config.ignoreWarnings = [/Failed to parse source map/];
config.module.rules.push({
test: /\.(js|mjs|jsx)$/,
enforce: "pre",
loader: require.resolve("source-map-loader"),
resolve: {
fullySpecified: false,
},
});
return config;
};
64 changes: 64 additions & 0 deletions packages/examples/omegle-push-video/client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@pushprotocol/restapi": "1.6.2",
"@pushprotocol/socket": "^0.5.3",
"@pushprotocol/uiweb": "1.1.22",
"@rainbow-me/rainbowkit": "^1.3.1",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.2.1",
"@vercel/analytics": "^1.1.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-icons": "^5.0.1",
"react-router-dom": "^6.21.2",
"react-scripts": "5.0.0",
"socket.io-client": "^4.4.1",
"styled-components": "^6.1.1",
"viem": "^1.20.1",
"wagmi": "^1.4.12",
"web-vitals": "^2.1.0"
},
"devDependencies": {
"assert": "^2.0.0",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"daisyui": "^4.6.0",
"https-browserify": "^1.0.0",
"os-browserify": "^0.3.0",
"process": "^0.11.10",
"react-app-rewired": "^2.2.1",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"tailwindcss": "^3.4.1",
"url": "^0.11.0"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
42 changes: 42 additions & 0 deletions packages/examples/omegle-push-video/client/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Come, hangout with bored random web3 peers"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Bored Anons</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"short_name": "Bored Anons",
"name": "Bored Anons",

"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions packages/examples/omegle-push-video/client/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
Loading
Loading