-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refator mini alteracoes na localizacao de rotas e compressao de imagens
- Loading branch information
1 parent
f7ac3a9
commit cfa49d9
Showing
20 changed files
with
318 additions
and
1,152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,4 @@ config | |
config/mercadoPagoData.json | ||
|
||
|
||
cart.list | ||
ticket.list | ||
/cart.list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
|
||
const stripe = require('stripe')(require('../config/web-config').stripe); | ||
|
||
const db = require('../Firebase/models') | ||
const fs = require('fs'); | ||
const functions = require('../functions'); | ||
const webConfig = require('../config/web-config'); | ||
const sharp = require('sharp'); | ||
|
||
const { default: axios } = require("axios"); | ||
|
||
router.get('/auth/verify/:acesstoken', async (req, res) => { | ||
let param = req.params.acesstoken | ||
if (param) { | ||
try { | ||
const headers = { | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
'Accept-Encoding': 'application/x-www-form-urlencoded' | ||
}; | ||
let userResponse = await axios.get('https://discord.com/api/users/@me', { | ||
headers: { | ||
Authorization: `Bearer ${param}`, | ||
...headers | ||
} | ||
}).then((res) => { return res.data }) | ||
if (userResponse) { | ||
req.session.uid = userResponse.id | ||
res.redirect('/dashboard') | ||
} else { | ||
res.redirect(webConfig.loginURL) | ||
} | ||
} catch (error) { | ||
res.redirect(webConfig.loginURL) | ||
} | ||
} else { | ||
res.redirect(webConfig.loginURL) | ||
} | ||
}) | ||
|
||
|
||
|
||
router.get('/auth/callback', async (req, res) => { | ||
try { | ||
if (req.session.uid) { | ||
res.redirect('/dashboard') | ||
} else { | ||
if (!req.query.code) { | ||
res.redirect('/logout') | ||
} else { | ||
let param = new URLSearchParams({ | ||
client_id: webConfig.clientId, | ||
client_secret: webConfig.secret, | ||
grant_type: 'authorization_code', | ||
code: req.query.code, | ||
redirect_uri: webConfig.redirect | ||
}) | ||
const headers = { | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
'Accept-Encoding': 'application/x-www-form-urlencoded' | ||
}; | ||
const response = await axios.post('https://discord.com/api/oauth2/token', param, { headers }).then((res) => { return res }).catch((err) => { | ||
console.error(err) | ||
}) | ||
if (!response) { | ||
res.redirect('/logout') | ||
return | ||
} | ||
let userResponse = await axios.get('https://discord.com/api/users/@me', { | ||
headers: { | ||
Authorization: `Bearer ${response.data.access_token}`, | ||
...headers | ||
} | ||
}).then((res) => { return res.data }).catch((err) => { | ||
console.error(err) | ||
}); | ||
await db.create('users', userResponse.id, { | ||
id: userResponse.id, | ||
username: userResponse.username, | ||
profile_pic: userResponse.avatar ? `https://cdn.discordapp.com/avatars/${userResponse.id}/${userResponse.avatar}.png` : 'https://res.cloudinary.com/dgcnfudya/image/upload/v1709143898/gs7ylxx370phif3usyuf.png', | ||
displayName: userResponse.global_name, | ||
email: userResponse.email, | ||
access_token: response.data.access_token | ||
}) | ||
|
||
req.session.uid = userResponse.id | ||
|
||
res.redirect('/dashboard') | ||
} | ||
} | ||
} catch (error) { | ||
res.redirect('/logout') | ||
} | ||
}) | ||
|
||
|
||
|
||
|
||
router.get('/addbot/:serverID', (req, res) => { | ||
if (!req.params.serverID) { | ||
res.redirect(`/`) | ||
return | ||
} | ||
const guilds = client.guilds.cache; | ||
const isBotInServer = guilds.has(req.params.serverID); | ||
if (isBotInServer) { | ||
res.redirect(`/server/${req.body.serverID}`) | ||
} else { | ||
res.redirect(`https://discord.com/oauth2/authorize?client_id=${webConfig.clientId}&permissions=8&response_type=code&scope=bot+applications.commands+guilds.members.read+applications.commands.permissions.update&redirect_uri=${process.env.DISCORDURI}&guild_id=${req.params.serverID}&disable_guild_select=true`) | ||
} | ||
|
||
}) | ||
|
||
|
||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<div align="center" id="top"> | ||
<img src="./.github/app.gif" alt="Sdkbot" /> | ||
|
||
  | ||
|
||
<!-- <a href="https://sdkbot.netlify.app">Demo</a> --> | ||
</div> | ||
|
||
<h1 align="center">Sdkbot</h1> | ||
|
||
<p align="center"> | ||
<img alt="Github top language" src="https://img.shields.io/github/languages/top/{{YOUR_GITHUB_USERNAME}}/sdkbot?color=56BEB8"> | ||
|
||
<img alt="Github language count" src="https://img.shields.io/github/languages/count/{{YOUR_GITHUB_USERNAME}}/sdkbot?color=56BEB8"> | ||
|
||
<img alt="Repository size" src="https://img.shields.io/github/repo-size/{{YOUR_GITHUB_USERNAME}}/sdkbot?color=56BEB8"> | ||
|
||
<img alt="License" src="https://img.shields.io/github/license/{{YOUR_GITHUB_USERNAME}}/sdkbot?color=56BEB8"> | ||
|
||
<!-- <img alt="Github issues" src="https://img.shields.io/github/issues/{{YOUR_GITHUB_USERNAME}}/sdkbot?color=56BEB8" /> --> | ||
|
||
<!-- <img alt="Github forks" src="https://img.shields.io/github/forks/{{YOUR_GITHUB_USERNAME}}/sdkbot?color=56BEB8" /> --> | ||
|
||
<!-- <img alt="Github stars" src="https://img.shields.io/github/stars/{{YOUR_GITHUB_USERNAME}}/sdkbot?color=56BEB8" /> --> | ||
</p> | ||
|
||
<!-- Status --> | ||
|
||
<!-- <h4 align="center"> | ||
🚧 Sdkbot 🚀 Under construction... 🚧 | ||
</h4> | ||
<hr> --> | ||
|
||
<p align="center"> | ||
<a href="#dart-about">About</a>   |   | ||
<a href="#sparkles-features">Features</a>   |   | ||
<a href="#rocket-technologies">Technologies</a>   |   | ||
<a href="#white_check_mark-requirements">Requirements</a>   |   | ||
<a href="#checkered_flag-starting">Starting</a>   |   | ||
<a href="#memo-license">License</a>   |   | ||
<a href="https://github.com/{{YOUR_GITHUB_USERNAME}}" target="_blank">Author</a> | ||
</p> | ||
|
||
<br> | ||
|
||
## :dart: About ## | ||
|
||
Describe your project | ||
|
||
## :sparkles: Features ## | ||
|
||
:heavy_check_mark: Feature 1;\ | ||
:heavy_check_mark: Feature 2;\ | ||
:heavy_check_mark: Feature 3; | ||
|
||
## :rocket: Technologies ## | ||
|
||
The following tools were used in this project: | ||
|
||
- [Expo](https://expo.io/) | ||
- [Node.js](https://nodejs.org/en/) | ||
- [React](https://pt-br.reactjs.org/) | ||
- [React Native](https://reactnative.dev/) | ||
- [TypeScript](https://www.typescriptlang.org/) | ||
|
||
## :white_check_mark: Requirements ## | ||
|
||
Before starting :checkered_flag:, you need to have [Git](https://git-scm.com) and [Node](https://nodejs.org/en/) installed. | ||
|
||
## :checkered_flag: Starting ## | ||
|
||
```bash | ||
# Clone this project | ||
$ git clone https://github.com/{{YOUR_GITHUB_USERNAME}}/sdkbot | ||
|
||
# Access | ||
$ cd sdkbot | ||
|
||
# Install dependencies | ||
$ yarn | ||
|
||
# Run the project | ||
$ yarn start | ||
|
||
# The server will initialize in the <http://localhost:3000> | ||
``` | ||
|
||
## :memo: License ## | ||
|
||
This project is under license from MIT. For more details, see the [LICENSE](LICENSE.md) file. | ||
|
||
|
||
Made with :heart: by <a href="https://github.com/{{YOUR_GITHUB_USERNAME}}" target="_blank">{{YOUR_NAME}}</a> | ||
|
||
  | ||
|
||
<a href="#top">Back to top</a> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.