Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Decatur-Robotics/Gearbox
Browse files Browse the repository at this point in the history
  • Loading branch information
renatodellosso committed Jul 26, 2024
2 parents f4c47a1 + cd67eb7 commit 2fa890a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
7 changes: 6 additions & 1 deletion components/AddToSlack.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
export default function AddToSlack() {
return (
<a className="link text-accent" href="https://slack.com/oauth/v2/authorize?client_id=10831824934.7404945710466&scope=chat:write,commands&user_scope=email,openid">
<a className="link text-accent" href={`
https://slack.com/oauth/v2/authorize
?client_id=${process.env.NEXT_PUBLIC_SLACK_CLIENT_ID}
&scope=chat:write,commands&user_scope=email,openid
&redirect_uri=https%3A%2F%2Flocalhost%2Fapi%2FaddSlackBot
`}>
Add Gearbox to Slack
</a>
);
Expand Down
2 changes: 1 addition & 1 deletion enviroment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ declare global {
FILL_TEAMS: string;

SLACK_BOT_TOKEN: string;
SLACK_CLIENT_ID: string;
NEXT_PUBLIC_SLACK_CLIENT_ID: string;
SLACK_CLIENT_SECRET: string;
SLACK_APP_TOKEN: string;
SLACK_SIGNING_SECRET: string;
Expand Down
7 changes: 6 additions & 1 deletion lib/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export namespace API {
}
}

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

if (route in this.routes) {
this.routes[route](req, res, {
Expand Down Expand Up @@ -1034,6 +1035,10 @@ export namespace API {
getFtcTeamAutofillData: async (req, res, { tba, data }: RouteContents<{ teamNumber: number }>) => {
const team = await TheOrangeAlliance.getTeam(data.teamNumber);
return res.status(200).send(team);
},

addSlackBot: async (req, res, { db, data }) => {
return res.status(200).send({ result: "success" });
}
};
}
2 changes: 1 addition & 1 deletion lib/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const AuthenticationOptions: AuthOptions = {
}),
*/
SlackProvider({
clientId: process.env.SLACK_CLIENT_ID as string,
clientId: process.env.NEXT_PUBLIC_SLACK_CLIENT_ID as string,
clientSecret: process.env.SLACK_CLIENT_SECRET as string,
profile: async (profile) => {
const user = new User(
Expand Down

0 comments on commit 2fa890a

Please sign in to comment.