mirror of
https://github.com/neongamerbot-qk/hackclub-nest
synced 2024-11-14 21:19:36 +00:00
enhancement(lint): Fix lint errors for hackclub-spotify-bot/src/index.js
Co-authored-by: NeonGamerBot-QK <saahilattud@gmail.com> Signed-off-by: zeon-neon[bot] <136533918+zeon-neon[bot]@users.noreply.github.com>
This commit is contained in:
parent
fc0dc7cf16
commit
0b6212d240
1 changed files with 45 additions and 45 deletions
|
@ -1,45 +1,45 @@
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
require("dotenv").config({ path: path.join(__dirname, ".env") });
|
require("dotenv").config({ path: path.join(__dirname, ".env") });
|
||||||
console.debug(process.env);
|
console.debug(process.env);
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const session = require("express-session");
|
const session = require("express-session");
|
||||||
const { WebClient } = require("@slack/web-api");
|
const { WebClient } = require("@slack/web-api");
|
||||||
const { InstallProvider } = require("@slack/oauth");
|
const { InstallProvider } = require("@slack/oauth");
|
||||||
const { getLoginUrl, refreshToken } = require("./spotify");
|
const { getLoginUrl, refreshToken } = require("./spotify");
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
// Initialize
|
// Initialize
|
||||||
const web = new WebClient(process.env.SLACK_TOKEN);
|
const web = new WebClient(process.env.SLACK_TOKEN);
|
||||||
const oauth = new InstallProvider({
|
const oauth = new InstallProvider({
|
||||||
clientId: process.env.SLACK_CLIENT_ID,
|
clientId: process.env.SLACK_CLIENT_ID,
|
||||||
clientSecret: process.env.SLACK_CLIENT_SECRET,
|
clientSecret: process.env.SLACK_CLIENT_SECRET,
|
||||||
stateSecret: Math.random().toString(36).substring(2),
|
stateSecret: Math.random().toString(36).substring(2),
|
||||||
});
|
});
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(express.static(path.join(__dirname, "public")));
|
app.use(express.static(path.join(__dirname, "public")));
|
||||||
app.set("view engine", "ejs");
|
app.set("view engine", "ejs");
|
||||||
app.set("views", "src/views");
|
app.set("views", "src/views");
|
||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(express.urlencoded({ extended: true }));
|
||||||
app.use(
|
app.use(
|
||||||
session({
|
session({
|
||||||
secret: Math.random().toString(36).substring(2),
|
secret: Math.random().toString(36).substring(2),
|
||||||
resave: false,
|
resave: false,
|
||||||
saveUninitialized: true,
|
saveUninitialized: true,
|
||||||
cookie: { secure: true },
|
cookie: { secure: true },
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get("/", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
res.render("index", {
|
res.render("index", {
|
||||||
title: "Hack Club Spotify Bot",
|
title: "Hack Club Spotify Bot",
|
||||||
description: "Contribute to the hackclub spotify playlist!",
|
description: "Contribute to the hackclub spotify playlist!",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
app.get("/login", async (req, res) => {
|
app.get("/login", async (req, res) => {
|
||||||
if (req.session.token) {
|
if (req.session.token) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(process.env.PORT || 3000, () => {
|
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