Skip to content

Commit 2fa890a

Browse files
Merge branch 'main' of github.com:Decatur-Robotics/Gearbox
2 parents f4c47a1 + cd67eb7 commit 2fa890a

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

components/AddToSlack.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
export default function AddToSlack() {
22
return (
3-
<a className="link text-accent" href="https://slack.com/oauth/v2/authorize?client_id=10831824934.7404945710466&scope=chat:write,commands&user_scope=email,openid">
3+
<a className="link text-accent" href={`
4+
https://slack.com/oauth/v2/authorize
5+
?client_id=${process.env.NEXT_PUBLIC_SLACK_CLIENT_ID}
6+
&scope=chat:write,commands&user_scope=email,openid
7+
&redirect_uri=https%3A%2F%2Flocalhost%2Fapi%2FaddSlackBot
8+
`}>
49
Add Gearbox to Slack
510
</a>
611
);

enviroment.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ declare global {
2929
FILL_TEAMS: string;
3030

3131
SLACK_BOT_TOKEN: string;
32-
SLACK_CLIENT_ID: string;
32+
NEXT_PUBLIC_SLACK_CLIENT_ID: string;
3333
SLACK_CLIENT_SECRET: string;
3434
SLACK_APP_TOKEN: string;
3535
SLACK_SIGNING_SECRET: string;

lib/API.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ export namespace API {
112112
}
113113
}
114114

115-
var route = req.url.replace(this.basePath, "");
115+
const routeRaw = req.url.replace(this.basePath, "");
116+
const route = routeRaw.substring(0, routeRaw.indexOf("?"));
116117

117118
if (route in this.routes) {
118119
this.routes[route](req, res, {
@@ -1034,6 +1035,10 @@ export namespace API {
10341035
getFtcTeamAutofillData: async (req, res, { tba, data }: RouteContents<{ teamNumber: number }>) => {
10351036
const team = await TheOrangeAlliance.getTeam(data.teamNumber);
10361037
return res.status(200).send(team);
1038+
},
1039+
1040+
addSlackBot: async (req, res, { db, data }) => {
1041+
return res.status(200).send({ result: "success" });
10371042
}
10381043
};
10391044
}

lib/Auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const AuthenticationOptions: AuthOptions = {
4242
}),
4343
*/
4444
SlackProvider({
45-
clientId: process.env.SLACK_CLIENT_ID as string,
45+
clientId: process.env.NEXT_PUBLIC_SLACK_CLIENT_ID as string,
4646
clientSecret: process.env.SLACK_CLIENT_SECRET as string,
4747
profile: async (profile) => {
4848
const user = new User(

0 commit comments

Comments
 (0)