Skip to content

Commit 3307aa1

Browse files
authored
Merge pull request #51 from WaifuAPI/v4
[v4.0.0]
2 parents bf42ca0 + 7784343 commit 3307aa1

File tree

348 files changed

+14407
-2347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

348 files changed

+14407
-2347
lines changed

.env_example

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,33 @@
1-
## Create a file name with .env, then copy this file and paste over there and fill the details.
2-
3-
# Get the Mongodb URL from their site
4-
MONGODB_URI=
5-
# Your PORT for the API to work on
6-
PORT=
7-
# Node Environment [ production or development ], use development to log errors.
8-
NODE_ENV=
9-
# Creates Log
10-
DISCORD_WEBHOOK_URL=
1+
# Example .env file for configuring environment variables
2+
3+
# MongoDB connection URI
4+
5+
MONGODB_URI= # Specify the URI for MongoDB connection
6+
7+
# Port for the server
8+
9+
PORT= # Define the server port
10+
11+
# Node environment ('development', 'production', etc.)
12+
13+
NODE_ENV= # Set the Node environment
14+
15+
# Logger configuration ('true' or 'false')
16+
17+
LOGGER= # Enable or disable the logger
18+
19+
# Webhook URL for chatbot logger
20+
21+
CHATBOT_LOGGER_WEBHOOK= # Provide the URL for the chatbot logger webhook
22+
23+
# Discord webhook URL
24+
25+
DISCORD_WEBHOOK_URL= # Input the URL for Discord webhook
26+
27+
# Access key for authentication
28+
29+
ACCESS_KEY= # Assign the access key for authentication
30+
31+
# HMAC key for generating secure tokens
32+
33+
HMAC_KEY= # Set the HMAC key for secure token generation

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
ko_fi: Aeryk
2+
github: kyrea

.gitignore

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
# Environment variables
1+
# Ignore environment variables file
22
.env
33

4-
5-
# dependencies
4+
# Ignore dependencies
65
/node_modules
76

8-
# Private files
7+
# Ignore private files
98
/private
109

11-
12-
# jetbrains
10+
# JetBrains IDE files
1311
.idea/
1412

15-
# vscode
13+
# Visual Studio Code settings
1614
.vscode/
1715

18-
# Logs
16+
# Ignore log files
1917
/logs
2018

21-
# Data Files
19+
# Ignore data files
2220
/data

.prettierrc.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"useTabs": false,
3-
"tabWidth": 2,
4-
"semi": false,
5-
"trailingComma": "es5",
6-
"proseWrap": "preserve",
7-
"printWidth": 80,
2+
"semi": true,
3+
"singleQuote": true,
84
"arrowParens": "avoid",
9-
"singleQuote": true
10-
}
5+
"trailingComma": "all",
6+
"printWidth": 120,
7+
"tabWidth": 2,
8+
"useTabs": false,
9+
"proseWrap": "preserve"
10+
}

CONTRIBUTING.md

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,81 @@
1-
# Contributing to Waifu.it
1+
# 🌟 Your Contribution Matters at Waifu.it! 🌟
22

3-
We love your input! We want to make contributing to this project as easy as possible, whether it's:
3+
Greetings, and a heartfelt thank you for considering becoming a part of the Waifu.it project! We're thrilled about the prospect of your contribution and have made the process a breeze. Whether you're fixing something, reporting an issue, joining us as a maintainer, suggesting fantastic new features, or just engaging in lively discussions about our code, here's your invitation to dive in:
44

5-
- Submitting a fix
6-
- Reporting an issue
7-
- Becoming a maintainer
8-
- Proposing new features
9-
- Discussing the current state of the code
5+
## Embrace our Code of Conduct
106

11-
## Code of Conduct
7+
Before you embark on your journey, take a moment to acquaint yourself with our [Code of Conduct](CODE_OF_CONDUCT.md). It's the cornerstone of our respectful and inclusive community.
128

13-
The code of conduct is described in [Code of Conduct](CODE_OF_CONDUCT.md).
9+
## FAQs - Your Shortcut to Wisdom 🧠
1410

15-
## Frequently Asked Questions (FAQs)
11+
To make your initiation smoother, we've compiled a list of Frequently Asked Questions:
1612

17-
<!--- I thought it would be great to have a list of FAQs for the project to help save time for new contributors--->
13+
- **Q:** [The Question?]
14+
- **A:** [The Answer!]
1815

19-
- Q: [The Question?]
20-
- A: [The Answer!]
16+
## Dreaming Up Features? 🚀
2117

22-
## Feature Request
18+
Crafting a Feature Request? Elevate it with:
2319

24-
Great Feature Requests tend to have:
20+
- A snappy summary of your brilliant idea.
21+
- Unveil the why behind your feature vision.
22+
- Sprinkle in some extra context—images, resource links—to paint the full picture.
2523

26-
- A quick idea summary.
27-
- What & why you wanted to add the specific feature.
28-
- Additional context like images, links to resources to implement the feature etc, etc.
24+
## Join Our Dance of Development 💃🕺
2925

30-
## Development Process
26+
Pull requests are your golden ticket to propose changes! Directly submit your pull requests [here](https://github.com/WaifuAPI/Waifu.it/pulls). After a bit of magic in the review, your changes can become part of our enchanting project.
3127

32-
Pull requests are the best way to propose changes. We actively welcome your pull requests and invite you to submit pull requests directly <a href="https://github.com/WaifuAPI/Waifu.it/pulls">here</a>, and after review, these can be merged into the project.
28+
## Crafting Pull Requests - Unleash Your Magic ✨
3329

34-
## Pull Requests
30+
1. Fork the repo and weave your code into the `staging` branch.
31+
2. If your code is a performer, let it showcase with some test examples.
32+
3. Describe your pull request with the elegance it deserves.
3533

36-
1. Fork the repo and pr to `staging` branch only.
37-
2. If you've added code that should be tested, add some test examples.
38-
3. Ensure to describe your pull request.
34+
## Issues - Illuminate the Path 🕯️
3935

40-
## Issues
36+
When reporting issues, cast a clear light with your description. Show us how to find the bug by [opening a new issue](https://github.com/WaifuAPI/Waifu.it/issues); it's as simple as that!
4137

42-
Please ensure your description is
43-
clear and has sufficient instructions to be able to reproduce the issue. Report a bug by <a href="https://github.com/WaifuAPI/Waifu.it/issues">opening a new issue</a>; it's that easy!
44-
45-
## Running the API Locally
38+
## Magic Happens Locally - Run the API 🎩🐇
4639

4740
**Requirements**
4841

49-
- Node >= 12.x
42+
- Node.js >=18.x
5043
- MongoDB
5144

52-
**1. Create a database**
45+
**1. Create a Database**
5346

54-
Create a MongoDB database.
47+
Craft a MongoDB database. No worries if you don't have MongoDB locally; [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) has a free hosted database waiting for you.
5548

56-
If you don't have MongoDB setup locally, then you can use [MongoDB Atlas][mongodb/atlas] to create a free hosted database.
49+
**2. Enchant with Environment Variables**
5750

58-
**2. Environment Variables**
51+
Craft a `.env` file in the project's magical realm. Copy the contents from `.env_example` and replace `<your-database-uri>` with your database connection string. Other mystical environment variables are revealed in the file.
5952

60-
You need to set the `MONGODB_URI` environment variable to point to your database.
53+
```shell
54+
MONGODB_URI=<your-mongodb-uri>
55+
```
6156

62-
Create a file called `.env` in the root directory of the project. Copy everything from `.env_example` and replace `<your-database-uri>` with the connection string for your database, _other env variables info are commented in the file itself._
57+
**3. Cast the Spell of Dependencies**
6358

6459
```shell
65-
MONGODB_URI=<your-mongodb-uri>
60+
$ npm install
61+
```
62+
63+
**4. Begin the Incantation - Start the Server**
64+
65+
The server dances to your tune, restarting gracefully with every code change.
66+
67+
```shell
68+
$ npm run dev
6669
```
6770

71+
**And there you have it!**
72+
73+
## License - Let's Create a Masterpiece Together 🎨
74+
75+
By contributing to Waifu.it, you're authoring a chapter in our story. Your contributions will be elegantly licensed under the terms specified in the [LICENSE file](LICENSE.md).
76+
77+
Let the adventure begin! Explore the realms of Waifu.it, and let's co-create something truly magical! 🚀✨
78+
6879
**3. Installing dependencies**
6980

7081
```shell

DOCS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
## [Click here](https://github.com/WaifuAPI/Documentation) for API Documentaion.
1+
## [Click here](https://docs.waifu.it) for API Documentaion.

README.md

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1-
## Announcements
1+
## 🚀 Exciting News!
22

3-
###### 🕛 23 May, 2023
4-
### 📢 Migration from Private to Public
5-
This repository will continue being as open-source while strictly following the [LICENCE](LICENCE.md).
3+
### 📅 May 23, 2023
64

7-
###### 🕛 01 Feb, 2022
8-
### ~~📢 Migration from Public to Private~~
9-
~~This repository will no longer be updated with the latest versions of code. Our hosted version of this API, [__Waifu.it__](https://waifu.it/) **does not run the code in this repository anymore**. The official API's source code has been made private. We will still maintain this repository over time with patches and so but it will depend on the circumstances. And we will only be providing limited, non-obligatory support to self-hosting users **who have not made changes to the code we deem to be significant**.~~
5+
We're thrilled to announce a major transformation! Our repository is now fully open-source, embracing a new era of collaboration. Dive into the code, explore its possibilities, and contribute to the future of this amazing project. All within the bounds of our [LICENSE](LICENCE.md).
106

117
---
128

139
<div align="center">
1410

15-
<h1 align="center">Waifu.it</h1>
11+
<h1 align="center">🎉 Waifu.it Unleashed!</h1>
1612
<br />
1713
<img align="center" width="256" height="256" src="https://avatars.githubusercontent.com/u/79479798?s=200&v=4" />
1814
<br />
1915
</div>
2016

2117
<div align="center">
22-
<h3>A Random API Serving Anime Stuffs</h3>
18+
<h3>🌟 <b>A Random API Serving Anime Wonders</b>
19+
</h3>
2320
<div align="center">
2421
<img src="https://img.shields.io/github/contributors/WaifuAPI/Waifu.it?color=%236CB4EE" />
2522
<img alt="GitHub issues" src="https://img.shields.io/github/issues/WaifuAPI/Waifu.it?color=%236CB4EE">
@@ -31,44 +28,31 @@ This repository will continue being as open-source while strictly following the
3128

3229
<hr />
3330

34-
# Contributing
31+
# How You Can Contribute
3532

36-
All contributions are greatly appreciated, but I recommend creating an issue or replying in a comment to let me know what you are working on first that way we don't overwrite each other.
33+
Your input is invaluable! Before diving in, let's sync up to avoid overlapping efforts.
3734

38-
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on this project.
35+
## 🌈 Contribution Categories
3936

40-
## Issues
37+
1. **Feature Requests/Enhancements**
38+
2. **Bug Reports**
39+
3. **Questions/Feedback**
4140

42-
- Feature requests/enhancements
43-
- Bug reports
44-
- Questions/feedback
41+
## 🌿 Branching Strategy
4542

46-
## Branches
43+
- **production:** The live, running version. Please refrain from direct changes.
44+
- **staging:** All proposed changes go here. Submit a [pull request](https://help.github.com/en/articles/about-pull-requests) for review.
4745

48-
- production -> don't touch, this is what's running in production
46+
## 🚀 Submitting Your Changes
4947

50-
- staging -> [pull request][pr] this branch for everything
48+
1. **Fork** the repository on GitHub.
49+
2. **Clone** your forked repo locally.
50+
3. Make your changes and **commit** them.
51+
4. **Push** your changes back to your fork.
52+
5. When ready, create a [pull request](https://help.github.com/en/articles/about-pull-requests) for our review.
5153

52-
## Pull Requests
53-
54-
All pull requests are welcome!
55-
56-
- [Fork][fork] the repository on GitHub.
57-
58-
- [Clone][cloning] the forked repo to your local machine.
59-
60-
- Do you changes
61-
62-
- Commit your changes
63-
64-
- Push your changes back up to your fork.
65-
66-
- When you're ready, submit a [pull request][pr] so that we can review your changes.
67-
68-
## Documentation
54+
---
6955

70-
[DOCS.md](DOCS.md)
56+
Explore the [DOCS](DOCS.md) for detailed information.
7157

72-
[fork]: https://help.github.com/en/articles/fork-a-repo
73-
[cloning]: https://help.github.com/en/articles/cloning-a-repository
74-
[pr]: https://help.github.com/en/articles/about-pull-requests
58+
Let's make Waifu.it even more fantastic together! 🌟

config.js

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/**
2+
* Configuration module for managing environment-specific settings.
3+
* @module config
4+
* @type {Object}
5+
*/
6+
7+
import dotenv from 'dotenv';
8+
9+
/**
10+
* Loads environment variables from a .env file into process.env.
11+
* @type {Function}
12+
*/
13+
dotenv.config();
14+
15+
/**
16+
* Application configuration settings.
17+
* @type {Object}
18+
* @property {string} database - Name of the database.
19+
* @property {number} serverPort - Port for the server.
20+
* @property {string} serverHost - Host for the server.
21+
* @property {Object} roles - User roles.
22+
* @property {string} roles.DEVELOPER - Developer role.
23+
* @property {string} roles.ADMIN - Admin role.
24+
* @property {string} roles.MOD - Moderator role.
25+
* @property {string} roles.DB_MOD - Database Moderator role.
26+
* @property {string} roles.PREMIUM - Premium role.
27+
* @property {string} roles.USER - User role.
28+
*/
29+
const config = {
30+
/**
31+
* Name of the database.
32+
* @type {string}
33+
* @default 'mydatabase'
34+
*/
35+
database: process.env.MONGODB_URI || 'mydatabase',
36+
37+
/**
38+
* Port for the server.
39+
* @type {number}
40+
* @default 3000
41+
*/
42+
serverPort: process.env.PORT || 3000,
43+
44+
/**
45+
* Host for the server.
46+
* @type {string}
47+
* @default '127.0.0.1'
48+
*/
49+
serverHost: process.env.HOST || 'http://localhost',
50+
51+
/**
52+
* User roles.
53+
* @type {Object}
54+
* @property {string} DEVELOPER - Developer role.
55+
* @property {string} ADMIN - Admin role.
56+
* @property {string} MOD - Moderator role.
57+
* @property {string} DB_MOD - Database Moderator role.
58+
* @property {string} PREMIUM - Premium role.
59+
* @property {string} USER - User role.
60+
*/
61+
roles: {
62+
DEVELOPER: 'developer',
63+
ADMIN: 'admin',
64+
MOD: 'moderator',
65+
DB_MOD: 'database_moderator',
66+
PREMIUM: 'premium',
67+
USER: 'user',
68+
},
69+
};
70+
71+
/**
72+
* Global configuration object based on the current environment.
73+
* @global
74+
* @type {Object}
75+
*/
76+
global.config = config;

0 commit comments

Comments
 (0)