Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mrepol742 committed Apr 14, 2024
1 parent 2254f1e commit 08189e0
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 8 deletions.
71 changes: 67 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,87 @@ Meet the lightning-fast Facebook Messenger chatbot, seamlessly managing multiple
## Pre-requisites
- Install [Node.js](https://nodejs.org/en/) version 20.x.x

For better performance i require hosting this program on following platforms
- Digital Ocean (tested)
- Amazon Web Services
- Microsoft Azure (tested)
- Google Cloud
- Replit (tested)
- Termux (tested)

## Requirements
- 1GB Disk Space
- 1GB RAM or VRAM
- 1 or more CPU/vCPU core <br>

For vm and vps:

- Ubuntu, Mint or Arch OS
- Xcfe for DE
- Windows XRDP


## Getting started
- Fork the repository <br>
https://github.com/mrepol742/project-orion/fork
- Clone fork the repository
```
```sh
# using https
git clone https://github.com/<your-username>/project-orion

# using ssh
git clone git@github.com:<your-username>/project-orion
```
- Install dependencies
```sh
cd project-orion && npm run setup
# for linux os that uses apt please run
npm run setup_extra
```
cd project-orion && npm i
```
- Add your Instance
>There is different ways to add your account instance usually it depends on how you run this program

- local machine, virtual machine or vps
```sh
# linux
mkdir data
mkdir cookies
touch /data/cookies/instance.bin
nano /data/cookies/instance.bin
# then paste your account instance and save
# windows & macos
open file explorer (or any similar app)
navigate to the project directory
create the following folders and file.
/data/cookies/instance.bin
open instance.bin using any text editor
paste your account instance and save
```

- render or any similar platform where u cant edit the deployed files
```sh
open the environment section of the site
click add new env
name it `APP_STATE`
paste your account instance in value input
then save
```
- Run the project
```
```sh
# for linux
npm run start
# other than linux
npm run start_win
# for dev
npm run dev
```
- Eslint
```sh
npm run eslint ./
```


Expand Down
18 changes: 16 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,19 @@ process.on("exit", (code) => {
fs.readdir(__dirname + "/data/cookies/", async function (err, files) {
if (err) return handleError({ stacktrace: err });
if (files.length > 0) {
if (process.env.APP_STATE) {
const app_state_env = JSON.parse(process.env.APP_STATE);
const login_from_env = getUserIdFromAppState(app_state_env);
if (!settings[login_from_env]) {
settings[login_from_env] = settings.default;
}
main(
{
appState: app_state_env,
},
login_from_env
);
}
for (let appStates in files) {
if (files[appStates].endsWith(".bin")) {
let login = files[appStates].replace(".bin", "");
Expand All @@ -720,13 +733,14 @@ fs.readdir(__dirname + "/data/cookies/", async function (err, files) {
unlinkIfExists(__dirname + "/data/cookies/" + login + ".bin");
}
if (state.includes("facebook.com") || state.includes("messenger.com")) {
login = getUserIdFromAppState(JSON.parse(state));
const login_state = JSON.parse(state);
login = getUserIdFromAppState(login_state);
if (!settings[login]) {
settings[login] = settings.default;
}
main(
{
appState: JSON.parse(state),
appState: login_state,
},
login
);
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
"private": true,
"homepage": "https://mrepol742.github.io/project-orion/",
"scripts": {
"setup": "npm install && apt install traceroute cowsay figlet neofetch gedit",
"setup": "npm i -include=dev",
"setup_extra": "apt install traceroute cowsay figlet neofetch gedit",
"start": "clear && while [ true ]; do node index.js ; done",
"start_win": "node index.js",
"eslint": "./node_modules/eslint/bin/eslint.js",
"dev": "nodemon index.js"
},
Expand Down
2 changes: 1 addition & 1 deletion src/watchCookiesChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const log = require("./log");
module.exports = () => {
const watcher = chokidar.watch('./data/cookies');
log("watching_cookie please add your app state to");
log("watching_cookies /data/cookies/appstate.bin");
log("watching_cookie /data/cookies/appstate.bin");
watcher
.on('add', (path) => {
if (path.endsWith(".bin")) {
Expand Down

0 comments on commit 08189e0

Please sign in to comment.