Skip to content

Commit d88e4b2

Browse files
authored
Merge pull request #11 from mimamch/dev-session
update v3.2.0
2 parents 130ff6e + 15d5968 commit d88e4b2

File tree

8 files changed

+1553
-4
lines changed

8 files changed

+1553
-4
lines changed

.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
PORT=5001
1+
PORT=5001
2+
KEY=mysupersecretkey # For Securing Some Data

CONTRIBUTING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## Contributing Guidelines
2+
3+
Thank you for considering contributing to the `@mimamch/wa-gateway` library! We welcome your contributions and appreciate your support. To ensure a smooth collaboration process, please follow these guidelines when contributing to the project.
4+
5+
### Bug Reports and Feature Requests
6+
7+
If you encounter a bug or have a feature request, please open an issue on the [GitHub issue tracker](https://github.com/mimamch/cmd/issues). When reporting a bug, provide detailed information about the issue, including steps to reproduce it. For feature requests, clearly describe the new functionality you would like to see in the library.
8+
9+
### Pull Requests
10+
11+
We welcome pull requests for bug fixes, enhancements, and new features. Before submitting a pull request, please ensure that:
12+
13+
1. You have forked the repository and created a new branch for your changes.
14+
2. Your code follows the project's coding style and conventions.
15+
3. You have added appropriate tests to cover your changes.
16+
4. All existing tests pass successfully.
17+
5. Your commits are descriptive and include a clear explanation of the changes.
18+
19+
To submit a pull request, follow these steps:
20+
21+
1. Fork the repository on GitHub.
22+
2. Clone your forked repository to your local machine.
23+
3. Create a new branch for your changes: `git checkout -b my-feature`.
24+
4. Make your changes and commit them: `git commit -m "Add new feature"`.
25+
5. Push your branch to your forked repository: `git push origin my-feature`.
26+
6. Open a pull request on the official repository's GitHub page.
27+
28+
### Development Setup
29+
30+
To set up the development environment and start working on the library, follow these steps:
31+
32+
1. Clone the repository: `git clone https://github.com/mimamch/cmd.git`.
33+
2. Install the project dependencies: `npm install`.
34+
3. Run tests to ensure everything is working: `npm test`.
35+
4. Make your changes and add tests for them.
36+
5. Run tests again to verify that everything is still working: `npm test`.
37+
6. Commit your changes and push to your forked repository.
38+
7. Open a pull request following the guidelines mentioned above.
39+
40+
### Code Style and Conventions
41+
42+
We strive to maintain a clean and consistent codebase. Please adhere to the following guidelines when contributing to the project:
43+
44+
- Use meaningful and descriptive variable and function names.
45+
- Follow the existing code formatting and indentation style.
46+
- Ensure your code is properly commented and documented.
47+
- Write clear commit messages that explain the purpose of each commit.
48+
49+
### License
50+
51+
By contributing to this project, you agree that your contributions will be licensed under the MIT License. Make sure you understand and agree to the licensing terms before submitting your pull request.
52+
53+
### Code of Conduct
54+
55+
Please note that by participating in this project, you are expected to follow the [Code of Conduct](CODE_OF_CONDUCT.md). Be respectful and considerate towards others, and maintain a positive and inclusive environment for collaboration.
56+
57+
We appreciate your contributions and look forward to your involvement in improving the `@mimamch/wa-gateway` library!

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
MIT License
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Multi Session Whatsapp Gateway NodeJS
1+
# Headless Multi Session Whatsapp Gateway NodeJS
22

3-
A multi session Whatsapp Gateway with NodeJS
3+
Easy Setup Headless multi session Whatsapp Gateway with NodeJS
44

55
- Support multi device
66
- Support multi session / multi phone number
@@ -17,6 +17,7 @@ To run this project, you will need to add the following environment variables to
1717
// .env
1818
1919
PORT=5001 // which port to running on your machine
20+
KEY=mysupersecretkey # For Securing Some Data
2021
```
2122

2223
## Install and Running
@@ -97,3 +98,33 @@ Open On Browser & Start New Session
9798
| Parameter | Type | Description |
9899
| :-------- | :------- | :------------------------------------- |
99100
| `session` | `string` | **Required**. Create Your Session Name |
101+
102+
#### Get All Session ID
103+
104+
```
105+
GET /sessions?key=mysupersecretkey
106+
```
107+
108+
| Parameter | Type | Description |
109+
| :-------- | :------- | :------------------------------- |
110+
| `key` | `string` | **Required**. Key on ".env" file |
111+
112+
## Changelog
113+
114+
V3.2.0
115+
116+
- Add Get All Session ID
117+
- Add Key for secret data
118+
- Update README.md
119+
120+
## Documentation
121+
122+
For detailed documentation, including guides and API references, please visit the [official documentation](https://github.com/mimamch/wa-gateway).
123+
124+
## Contributing
125+
126+
Contributions are welcome! Please follow the guidelines outlined in the [CONTRIBUTING.md](https://github.com/mimamch/wa-gateway/blob/main/CONTRIBUTING.md) file.
127+
128+
## License
129+
130+
This library is licensed under the [MIT License](https://github.com/mimamch/wa-gateway/blob/main/LICENSE).

app/controllers/session_controller.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,17 @@ exports.deleteSession = async (req, res, next) => {
4848
next(error);
4949
}
5050
};
51+
exports.sessions = async (req, res, next) => {
52+
try {
53+
const key = req.body.key || req.query.key || req.headers.key;
54+
55+
// is KEY provided and secured
56+
if (process.env.KEY && process.env.KEY != key) {
57+
throw new ValidationError("Invalid Key");
58+
}
59+
60+
res.status(200).json(responseSuccessWithData(whatsapp.getAllSession()));
61+
} catch (error) {
62+
next(error);
63+
}
64+
};

app/routers/session_router.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ const { Router } = require("express");
22
const {
33
createSession,
44
deleteSession,
5+
sessions,
56
} = require("../controllers/session_controller");
67

78
const SessionRouter = Router();
89

910
SessionRouter.all("/start-session", createSession);
1011
SessionRouter.all("/delete-session", deleteSession);
12+
SessionRouter.all("/sessions", sessions);
1113

1214
module.exports = SessionRouter;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "baileys",
3-
"version": "3.1.0",
3+
"version": "3.2.0",
44
"scripts": {
55
"start": "node index.js",
66
"dev": "nodemon index.js --ignore ./wa_credentials --ignore ./public",

0 commit comments

Comments
 (0)