Compare commits

...

5 commits

Author SHA1 Message Date
zeon-neon[bot]
989b582cf4
enhancement(lint): Fix lint errors for .gitignore
Some checks are pending
Remote SSH Command / Build (push) Waiting to run
Co-authored-by: NeonGamerBot-QK <saahilattud@gmail.com>
Signed-off-by: zeon-neon[bot] <136533918+zeon-neon[bot]@users.noreply.github.com>
2024-10-11 19:28:09 +00:00
5eb6e633f2
Merge remote-tracking branch 'refs/remotes/origin/feat/spotify-bot' into feat/spotify-bot 2024-10-11 19:28:03 +00:00
8fb5236dc7
update: .gitignore 2024-10-11 19:27:52 +00:00
zeon-neon[bot]
0b6212d240
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>
2024-10-11 19:27:38 +00:00
fc0dc7cf16
update: .env stuff 2024-10-11 19:27:28 +00:00
3 changed files with 52 additions and 40 deletions

1
.gitignore vendored
View file

@ -14,5 +14,6 @@ sent # all sent mail is there
.cache/* .cache/*
.env .env
.env.* .env.*
!.env.example
.uptime-url .uptime-url
main.cron main.cron

View file

@ -0,0 +1,6 @@
SLACK_CLIENT_ID=
SLACK_CLIENT_SECRET=
SLACK_TOKEN=
SPOTIFY_CLIENT_ID=
SPOTIFY_CLIENT_SECRET=
SPOTIFY_REDIRECT_URI=

View file

@ -1,40 +1,45 @@
require('dotenv').config(); const path = require("path");
const express = require('express'); require("dotenv").config({ path: path.join(__dirname, ".env") });
const session = require('express-session'); console.debug(process.env);
const { WebClient } = require('@slack/web-api'); const express = require("express");
const { Client } = require('@slack/oauth'); const session = require("express-session");
const { getLoginUrl, refreshToken } = require('./spotify'); const { WebClient } = require("@slack/web-api");
const path = require('path'); const { InstallProvider } = require("@slack/oauth");
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 Client({ 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,
state: 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(session({ app.use(
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', { title: 'Hack Club Spotify Bot', description: "Contribute to the hackclub spotify playlist!" }); 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) { 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!");
}); });