mirror of
https://github.com/neongamerbot-qk/hackclub-nest
synced 2024-11-25 18:03:42 +00:00
Compare commits
No commits in common. "989b582cf4043ea1cec2fd2b4da1633c9905a4df" and "26f5382fce48ebeab552c0a34ee60750370ab0ad" have entirely different histories.
989b582cf4
...
26f5382fce
3 changed files with 40 additions and 52 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,6 +14,5 @@ sent # all sent mail is there
|
|||
.cache/*
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
.uptime-url
|
||||
main.cron
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
SLACK_CLIENT_ID=
|
||||
SLACK_CLIENT_SECRET=
|
||||
SLACK_TOKEN=
|
||||
SPOTIFY_CLIENT_ID=
|
||||
SPOTIFY_CLIENT_SECRET=
|
||||
SPOTIFY_REDIRECT_URI=
|
|
@ -1,45 +1,40 @@
|
|||
const path = require("path");
|
||||
require("dotenv").config({ path: path.join(__dirname, ".env") });
|
||||
console.debug(process.env);
|
||||
const express = require("express");
|
||||
const session = require("express-session");
|
||||
const { WebClient } = require("@slack/web-api");
|
||||
const { InstallProvider } = require("@slack/oauth");
|
||||
const { getLoginUrl, refreshToken } = require("./spotify");
|
||||
require('dotenv').config();
|
||||
const express = require('express');
|
||||
const session = require('express-session');
|
||||
const { WebClient } = require('@slack/web-api');
|
||||
const { Client } = require('@slack/oauth');
|
||||
const { getLoginUrl, refreshToken } = require('./spotify');
|
||||
const path = require('path');
|
||||
|
||||
const app = express();
|
||||
// Initialize
|
||||
const web = new WebClient(process.env.SLACK_TOKEN);
|
||||
const oauth = new InstallProvider({
|
||||
const oauth = new Client({
|
||||
clientId: process.env.SLACK_CLIENT_ID,
|
||||
clientSecret: process.env.SLACK_CLIENT_SECRET,
|
||||
stateSecret: Math.random().toString(36).substring(2),
|
||||
state: Math.random().toString(36).substring(2),
|
||||
});
|
||||
app.use(express.json());
|
||||
app.use(express.static(path.join(__dirname, "public")));
|
||||
app.set("view engine", "ejs");
|
||||
app.set("views", "src/views");
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
app.set('view engine', 'ejs');
|
||||
app.set('views', 'src/views');
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
app.use(
|
||||
session({
|
||||
app.use(session({
|
||||
secret: Math.random().toString(36).substring(2),
|
||||
resave: false,
|
||||
saveUninitialized: true,
|
||||
cookie: { secure: true },
|
||||
}),
|
||||
);
|
||||
cookie: { secure: true }
|
||||
}));
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.render("index", {
|
||||
title: "Hack Club Spotify Bot",
|
||||
description: "Contribute to the hackclub spotify playlist!",
|
||||
app.get('/', (req, res) => {
|
||||
res.render('index', { title: 'Hack Club Spotify Bot', description: "Contribute to the hackclub spotify playlist!" });
|
||||
});
|
||||
});
|
||||
app.get("/login", async (req, res) => {
|
||||
app.get('/login', async (req, res) => {
|
||||
if(req.session.token) {
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
app.listen(process.env.PORT || 3000, () => {
|
||||
console.log("Example app listening on port 3000!");
|
||||
console.log('Example app listening on port 3000!');
|
||||
});
|
Loading…
Reference in a new issue