Skip to content

Commit

Permalink
Merge pull request #51 from WaifuAPI/v4
Browse files Browse the repository at this point in the history
[v4.0.0]
  • Loading branch information
kyrea authored Jan 10, 2024
2 parents bf42ca0 + 7784343 commit 3307aa1
Show file tree
Hide file tree
Showing 348 changed files with 14,407 additions and 2,347 deletions.
43 changes: 33 additions & 10 deletions .env_example
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
## Create a file name with .env, then copy this file and paste over there and fill the details.

# Get the Mongodb URL from their site
MONGODB_URI=
# Your PORT for the API to work on
PORT=
# Node Environment [ production or development ], use development to log errors.
NODE_ENV=
# Creates Log
DISCORD_WEBHOOK_URL=
# Example .env file for configuring environment variables

# MongoDB connection URI

MONGODB_URI= # Specify the URI for MongoDB connection

# Port for the server

PORT= # Define the server port

# Node environment ('development', 'production', etc.)

NODE_ENV= # Set the Node environment

# Logger configuration ('true' or 'false')

LOGGER= # Enable or disable the logger

# Webhook URL for chatbot logger

CHATBOT_LOGGER_WEBHOOK= # Provide the URL for the chatbot logger webhook

# Discord webhook URL

DISCORD_WEBHOOK_URL= # Input the URL for Discord webhook

# Access key for authentication

ACCESS_KEY= # Assign the access key for authentication

# HMAC key for generating secure tokens

HMAC_KEY= # Set the HMAC key for secure token generation
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ko_fi: Aeryk
github: kyrea
16 changes: 7 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
# Environment variables
# Ignore environment variables file
.env


# dependencies
# Ignore dependencies
/node_modules

# Private files
# Ignore private files
/private


# jetbrains
# JetBrains IDE files
.idea/

# vscode
# Visual Studio Code settings
.vscode/

# Logs
# Ignore log files
/logs

# Data Files
# Ignore data files
/data
16 changes: 8 additions & 8 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"useTabs": false,
"tabWidth": 2,
"semi": false,
"trailingComma": "es5",
"proseWrap": "preserve",
"printWidth": 80,
"semi": true,
"singleQuote": true,
"arrowParens": "avoid",
"singleQuote": true
}
"trailingComma": "all",
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"proseWrap": "preserve"
}
85 changes: 48 additions & 37 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,81 @@
# Contributing to Waifu.it
# 🌟 Your Contribution Matters at Waifu.it! 🌟

We love your input! We want to make contributing to this project as easy as possible, whether it's:
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:

- Submitting a fix
- Reporting an issue
- Becoming a maintainer
- Proposing new features
- Discussing the current state of the code
## Embrace our Code of Conduct

## Code of Conduct
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.

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

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

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

- Q: [The Question?]
- A: [The Answer!]
## Dreaming Up Features? 🚀

## Feature Request
Crafting a Feature Request? Elevate it with:

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

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

## Development Process
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.

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.
## Crafting Pull Requests - Unleash Your Magic ✨

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

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

## Issues
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!

Please ensure your description is
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!

## Running the API Locally
## Magic Happens Locally - Run the API 🎩🐇

**Requirements**

- Node >= 12.x
- Node.js >=18.x
- MongoDB

**1. Create a database**
**1. Create a Database**

Create a MongoDB database.
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.

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

**2. Environment Variables**
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.

You need to set the `MONGODB_URI` environment variable to point to your database.
```shell
MONGODB_URI=<your-mongodb-uri>
```

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._
**3. Cast the Spell of Dependencies**

```shell
MONGODB_URI=<your-mongodb-uri>
$ npm install
```

**4. Begin the Incantation - Start the Server**

The server dances to your tune, restarting gracefully with every code change.

```shell
$ npm run dev
```

**And there you have it!**

## License - Let's Create a Masterpiece Together 🎨

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).

Let the adventure begin! Explore the realms of Waifu.it, and let's co-create something truly magical! 🚀✨

**3. Installing dependencies**

```shell
Expand Down
2 changes: 1 addition & 1 deletion DOCS.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
## [Click here](https://github.com/WaifuAPI/Documentation) for API Documentaion.
## [Click here](https://docs.waifu.it) for API Documentaion.
64 changes: 24 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
## Announcements
## 🚀 Exciting News!

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

###### 🕛 01 Feb, 2022
### ~~📢 Migration from Public to Private~~
~~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**.~~
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).

---

<div align="center">

<h1 align="center">Waifu.it</h1>
<h1 align="center">🎉 Waifu.it Unleashed!</h1>
<br />
<img align="center" width="256" height="256" src="https://avatars.githubusercontent.com/u/79479798?s=200&v=4" />
<br />
</div>

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

<hr />

# Contributing
# How You Can Contribute

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.
Your input is invaluable! Before diving in, let's sync up to avoid overlapping efforts.

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on this project.
## 🌈 Contribution Categories

## Issues
1. **Feature Requests/Enhancements**
2. **Bug Reports**
3. **Questions/Feedback**

- Feature requests/enhancements
- Bug reports
- Questions/feedback
## 🌿 Branching Strategy

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

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

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

## Pull Requests

All pull requests are welcome!

- [Fork][fork] the repository on GitHub.

- [Clone][cloning] the forked repo to your local machine.

- Do you changes

- Commit your changes

- Push your changes back up to your fork.

- When you're ready, submit a [pull request][pr] so that we can review your changes.

## Documentation
---

[DOCS.md](DOCS.md)
Explore the [DOCS](DOCS.md) for detailed information.

[fork]: https://help.github.com/en/articles/fork-a-repo
[cloning]: https://help.github.com/en/articles/cloning-a-repository
[pr]: https://help.github.com/en/articles/about-pull-requests
Let's make Waifu.it even more fantastic together! 🌟
76 changes: 76 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* Configuration module for managing environment-specific settings.
* @module config
* @type {Object}
*/

import dotenv from 'dotenv';

/**
* Loads environment variables from a .env file into process.env.
* @type {Function}
*/
dotenv.config();

/**
* Application configuration settings.
* @type {Object}
* @property {string} database - Name of the database.
* @property {number} serverPort - Port for the server.
* @property {string} serverHost - Host for the server.
* @property {Object} roles - User roles.
* @property {string} roles.DEVELOPER - Developer role.
* @property {string} roles.ADMIN - Admin role.
* @property {string} roles.MOD - Moderator role.
* @property {string} roles.DB_MOD - Database Moderator role.
* @property {string} roles.PREMIUM - Premium role.
* @property {string} roles.USER - User role.
*/
const config = {
/**
* Name of the database.
* @type {string}
* @default 'mydatabase'
*/
database: process.env.MONGODB_URI || 'mydatabase',

/**
* Port for the server.
* @type {number}
* @default 3000
*/
serverPort: process.env.PORT || 3000,

/**
* Host for the server.
* @type {string}
* @default '127.0.0.1'
*/
serverHost: process.env.HOST || 'http://localhost',

/**
* User roles.
* @type {Object}
* @property {string} DEVELOPER - Developer role.
* @property {string} ADMIN - Admin role.
* @property {string} MOD - Moderator role.
* @property {string} DB_MOD - Database Moderator role.
* @property {string} PREMIUM - Premium role.
* @property {string} USER - User role.
*/
roles: {
DEVELOPER: 'developer',
ADMIN: 'admin',
MOD: 'moderator',
DB_MOD: 'database_moderator',
PREMIUM: 'premium',
USER: 'user',
},
};

/**
* Global configuration object based on the current environment.
* @global
* @type {Object}
*/
global.config = config;
Loading

0 comments on commit 3307aa1

Please sign in to comment.