Skip to content

Instantly share code, notes, and snippets.

View orels1's full-sized avatar
🎮
Making the world better, one texel at a time

orels1 orels1

🎮
Making the world better, one texel at a time
View GitHub Profile
router.get('/callback', catchAsync(async (req, res) => {
if (!req.query.code) throw new Error('NoCodeProvided');
const code = req.query.code;
const creds = btoa(`${CLIENT_ID}:${CLIENT_SECRET}`);
const response = await fetch(`https://discordapp.com/api/oauth2/token?grant_type=authorization_code&code=${code}&redirect_uri=${redirect}`,
{
method: 'POST',
headers: {
Authorization: `Basic ${creds}`,
},
const express = require('express');
const fetch = require('node-fetch');
const btoa = require('btoa');
const { catchAsync } = require('../utils');
<!Doctype html>
<html>
<head>
<title>Discord Token Generator</title>
<style>
.container {
display: flex;
width: 100%;
padding: 40px 0;
align-items: center;
// Routes
app.use('/api/discord', require('./api/discord'));
router.get('/login', (req, res) => {
res.redirect(`https://discordapp.com/api/oauth2/authorize?client_id=${CLIENT_ID}&scope=identify&response_type=code&redirect_uri=${redirect}`);
});
const CLIENT_ID = process.env.CLIENT_ID;
const CLIENT_SECRET = process.env.CLIENT_SECRET;
const redirect = encodeURIComponent('http://localhost:50451/api/discord/callback');
const express = require('express');
const router = express.Router();
const CLIENT_ID = process.env.CLIENT_ID;
const CLIENT_SECRET = process.env.CLIENT_SECRET;
const redirect = encodeURIComponent('http://localhost:50451/api/discord/callback');
router.get('/login', (req, res) => {
res.redirect(`https://discordapp.com/api/oauth2/authorize?client_id=${CLIENT_ID}&scope=identify&response_type=code&redirect_uri=${redirect}`);
const express = require('express');
const path = require('path');
const app = express();
app.get('/', (req, res) => {
res.status(200).sendFile(path.join(__dirname, 'index.html'));
});
app.listen(50451, () => {
tracer kanobu.ru source 87.229.246.113
Thu Apr 20 15:50:15.032 MSK
Type escape sequence to abort.
Tracing the route to 137.74.93.62
1 p1.Barnaul.gldn.net (79.104.247.225) [MPLS: Label 651004 Exp 0] 72 msec
p2.Barnaul.gldn.net (79.104.247.229) 61 msec 62 msec
2 p1.Nsk.gldn.net (79.104.230.85) [MPLS: Labels 541326/648672 Exp 0] 70 msec
p2.Nsk.gldn.net (79.104.231.85) 75 msec
@orels1
orels1 / gist:bb42efed032ca4f26b37f1917752754f
Last active April 20, 2017 12:18
# traceroute 87.229.246.114
traceroute to 87.229.246.114 (87.229.246.114), 30 hops max, 60 byte packets
1 137.74.93.253 (137.74.93.253) 3.397 ms 28.979 ms 29.138 ms
2 po110.gra-g1-a75.fr.eu (37.187.231.91) 0.192 ms 0.236 ms po110.gra-g2-a75.fr.eu (37.187.231.93) 0.170 ms
3 10.95.33.10 (10.95.33.10) 2.048 ms 10.95.33.8 (10.95.33.8) 1.719 ms *
4 * * *
5 * * *
6 * * *