diff --git a/README.md b/README.md
index f954fcf2..e78b344b 100644
--- a/README.md
+++ b/README.md
@@ -7,11 +7,31 @@ 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
+
+ For vm and vps:
+
+ - Ubuntu, Mint or Arch OS
+ - Xcfe for DE
+ - Windows XRDP
+
+
## Getting started
- Fork the repository
https://github.com/mrepol742/project-orion/fork
- Clone fork the repository
- ```
+ ```sh
# using https
git clone https://github.com//project-orion
@@ -19,12 +39,55 @@ Meet the lightning-fast Facebook Messenger chatbot, seamlessly managing multiple
git clone git@github.com:/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 ./
```
diff --git a/index.js b/index.js
index 987ac06b..570eef8f 100644
--- a/index.js
+++ b/index.js
@@ -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", "");
@@ -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
);
diff --git a/package.json b/package.json
index bac9c041..24d11714 100644
--- a/package.json
+++ b/package.json
@@ -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"
},
diff --git a/src/watchCookiesChanges.js b/src/watchCookiesChanges.js
index 80bfec3d..718496ff 100644
--- a/src/watchCookiesChanges.js
+++ b/src/watchCookiesChanges.js
@@ -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")) {