Skip to content

Commit b931652

Browse files
committed
Add roblox login feature
1 parent 82f6397 commit b931652

File tree

15 files changed

+402
-467
lines changed

15 files changed

+402
-467
lines changed

dashboard/src/components/EnvComponents/OAuthConfig.tsx

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import {
1717
FaApple,
1818
FaTwitter,
1919
FaMicrosoft,
20-
FaTwitch, FaDiscord,
20+
FaTwitch,
21+
FaDiscord,
2122
} from 'react-icons/fa';
2223
import {
2324
TextInputType,
@@ -474,6 +475,44 @@ const OAuthConfig = ({
474475
/>
475476
</Center>
476477
</Flex>
478+
<Flex direction={isNotSmallerScreen ? 'row' : 'column'}>
479+
<Center
480+
w={isNotSmallerScreen ? '55px' : '35px'}
481+
h="35px"
482+
marginRight="1.5%"
483+
border="1px solid #3b5998"
484+
borderRadius="5px"
485+
>
486+
Roblox
487+
</Center>
488+
<Center
489+
w={isNotSmallerScreen ? '70%' : '100%'}
490+
mt={isNotSmallerScreen ? '0' : '3'}
491+
marginRight="1.5%"
492+
>
493+
<InputField
494+
borderRadius={5}
495+
variables={envVariables}
496+
setVariables={setVariables}
497+
inputType={TextInputType.ROBLOX_CLIENT_ID}
498+
placeholder="Roblox Client ID"
499+
/>
500+
</Center>
501+
<Center
502+
w={isNotSmallerScreen ? '70%' : '100%'}
503+
mt={isNotSmallerScreen ? '0' : '3'}
504+
>
505+
<InputField
506+
borderRadius={5}
507+
variables={envVariables}
508+
setVariables={setVariables}
509+
fieldVisibility={fieldVisibility}
510+
setFieldVisibility={setFieldVisibility}
511+
inputType={HiddenInputType.ROBLOX_CLIENT_SECRET}
512+
placeholder="Roblox Client Secret"
513+
/>
514+
</Center>
515+
</Flex>
477516
</Stack>
478517
</Box>
479518
</div>

dashboard/src/constants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const TextInputType = {
1414
MICROSOFT_CLIENT_ID: 'MICROSOFT_CLIENT_ID',
1515
MICROSOFT_ACTIVE_DIRECTORY_TENANT_ID: 'MICROSOFT_ACTIVE_DIRECTORY_TENANT_ID',
1616
TWITCH_CLIENT_ID: 'TWITCH_CLIENT_ID',
17+
ROBLOX_CLIENT_ID: 'ROBLOX_CLIENT_ID',
1718
JWT_ROLE_CLAIM: 'JWT_ROLE_CLAIM',
1819
REDIS_URL: 'REDIS_URL',
1920
SMTP_HOST: 'SMTP_HOST',
@@ -46,6 +47,7 @@ export const HiddenInputType = {
4647
TWITTER_CLIENT_SECRET: 'TWITTER_CLIENT_SECRET',
4748
MICROSOFT_CLIENT_SECRET: 'MICROSOFT_CLIENT_SECRET',
4849
TWITCH_CLIENT_SECRET: 'TWITCH_CLIENT_SECRET',
50+
ROBLOX_CLIENT_SECRET: 'ROBLOX_CLIENT_SECRET',
4951
JWT_SECRET: 'JWT_SECRET',
5052
SMTP_PASSWORD: 'SMTP_PASSWORD',
5153
ADMIN_SECRET: 'ADMIN_SECRET',
@@ -141,6 +143,8 @@ export interface envVarTypes {
141143
MICROSOFT_ACTIVE_DIRECTORY_TENANT_ID: string;
142144
TWITCH_CLIENT_ID: string;
143145
TWITCH_CLIENT_SECRET: string;
146+
ROBLOX_CLIENT_ID: string;
147+
ROBLOX_CLIENT_SECRET: string;
144148
ROLES: [string] | [];
145149
DEFAULT_ROLES: [string] | [];
146150
PROTECTED_ROLES: [string] | [];

dashboard/src/graphql/queries/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export const EnvVariablesQuery = `
3939
MICROSOFT_ACTIVE_DIRECTORY_TENANT_ID
4040
TWITCH_CLIENT_ID
4141
TWITCH_CLIENT_SECRET
42+
ROBLOX_CLIENT_ID
43+
ROBLOX_CLIENT_SECRET
4244
DEFAULT_ROLES
4345
PROTECTED_ROLES
4446
ROLES

dashboard/src/pages/Environment.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ const Environment = () => {
5959
MICROSOFT_ACTIVE_DIRECTORY_TENANT_ID: '',
6060
TWITCH_CLIENT_ID: '',
6161
TWITCH_CLIENT_SECRET: '',
62+
ROBLOX_CLIENT_ID: '',
63+
ROBLOX_CLIENT_SECRET: '',
6264
ROLES: [],
6365
DEFAULT_ROLES: [],
6466
PROTECTED_ROLES: [],

server/constants/env.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ const (
126126
EnvKeyTwitchClientID = "TWITCH_CLIENT_ID"
127127
// EnvKeyTwitchClientSecret key for env variable TWITCH_CLIENT_SECRET
128128
EnvKeyTwitchClientSecret = "TWITCH_CLIENT_SECRET"
129+
// EnvKeyRobloxClientID key for env variable ROBLOX_CLIENT_ID
130+
EnvKeyRobloxClientID = "ROBLOX_CLIENT_ID"
131+
// EnvKeyRobloxClientSecret key for env variable ROBLOX_CLIENT_SECRET
132+
EnvKeyRobloxClientSecret = "ROBLOX_CLIENT_SECRET"
129133
// EnvKeyOrganizationName key for env variable ORGANIZATION_NAME
130134
EnvKeyOrganizationName = "ORGANIZATION_NAME"
131135
// EnvKeyOrganizationLogo key for env variable ORGANIZATION_LOGO

server/env/env.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ func InitAllEnv() error {
7979
osMicrosoftClientID := os.Getenv(constants.EnvKeyMicrosoftClientID)
8080
osMicrosoftClientSecret := os.Getenv(constants.EnvKeyMicrosoftClientSecret)
8181
osMicrosoftActiveDirectoryTenantID := os.Getenv(constants.EnvKeyMicrosoftActiveDirectoryTenantID)
82+
osTwitchClientID := os.Getenv(constants.EnvKeyTwitchClientID)
83+
osTwitchClientSecret := os.Getenv(constants.EnvKeyTwitchClientSecret)
84+
osRobloxClientID := os.Getenv(constants.EnvKeyTwitchClientID)
85+
osRobloxClientSecret := os.Getenv(constants.EnvKeyTwitchClientSecret)
8286
osResetPasswordURL := os.Getenv(constants.EnvKeyResetPasswordURL)
8387
osOrganizationName := os.Getenv(constants.EnvKeyOrganizationName)
8488
osOrganizationLogo := os.Getenv(constants.EnvKeyOrganizationLogo)
@@ -501,6 +505,34 @@ func InitAllEnv() error {
501505
envData[constants.EnvKeyMicrosoftActiveDirectoryTenantID] = osMicrosoftActiveDirectoryTenantID
502506
}
503507

508+
if val, ok := envData[constants.EnvKeyTwitchClientID]; !ok || val == "" {
509+
envData[constants.EnvKeyTwitchClientID] = osTwitchClientID
510+
}
511+
if osTwitchClientID != "" && envData[constants.EnvKeyTwitchClientID] != osTwitchClientID {
512+
envData[constants.EnvKeyTwitchClientID] = osTwitchClientID
513+
}
514+
515+
if val, ok := envData[constants.EnvKeyTwitchClientSecret]; !ok || val == "" {
516+
envData[constants.EnvKeyTwitchClientSecret] = osTwitchClientSecret
517+
}
518+
if osTwitchClientSecret != "" && envData[constants.EnvKeyTwitchClientSecret] != osTwitchClientSecret {
519+
envData[constants.EnvKeyTwitchClientSecret] = osTwitchClientSecret
520+
}
521+
522+
if val, ok := envData[constants.EnvKeyRobloxClientID]; !ok || val == "" {
523+
envData[constants.EnvKeyRobloxClientID] = osRobloxClientID
524+
}
525+
if osRobloxClientID != "" && envData[constants.EnvKeyRobloxClientID] != osRobloxClientID {
526+
envData[constants.EnvKeyRobloxClientID] = osRobloxClientID
527+
}
528+
529+
if val, ok := envData[constants.EnvKeyRobloxClientSecret]; !ok || val == "" {
530+
envData[constants.EnvKeyRobloxClientSecret] = osRobloxClientSecret
531+
}
532+
if osRobloxClientSecret != "" && envData[constants.EnvKeyRobloxClientSecret] != osRobloxClientSecret {
533+
envData[constants.EnvKeyRobloxClientSecret] = osRobloxClientSecret
534+
}
535+
504536
if val, ok := envData[constants.EnvKeyResetPasswordURL]; !ok || val == "" {
505537
envData[constants.EnvKeyResetPasswordURL] = strings.TrimPrefix(osResetPasswordURL, "/")
506538
}

server/go.mod

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.21
55
toolchain go1.21.4
66

77
require (
8-
github.com/99designs/gqlgen v0.17.39
8+
github.com/99designs/gqlgen v0.17.45
99
github.com/arangodb/go-driver v1.6.0
1010
github.com/aws/aws-sdk-go v1.47.4
1111
github.com/coreos/go-oidc/v3 v3.6.0
@@ -16,19 +16,19 @@ require (
1616
github.com/gocql/gocql v1.6.0
1717
github.com/gokyle/twofactor v1.0.1
1818
github.com/golang-jwt/jwt v3.2.2+incompatible
19-
github.com/google/uuid v1.3.1
19+
github.com/google/uuid v1.6.0
2020
github.com/guregu/dynamo v1.20.2
2121
github.com/joho/godotenv v1.5.1
2222
github.com/pquerna/otp v1.4.0
2323
github.com/redis/go-redis/v9 v9.2.1
2424
github.com/robertkrimen/otto v0.2.1
2525
github.com/sirupsen/logrus v1.9.3
26-
github.com/stretchr/testify v1.8.4
26+
github.com/stretchr/testify v1.9.0
2727
github.com/tuotoo/qrcode v0.0.0-20220425170535-52ccc2bebf5d
2828
github.com/twilio/twilio-go v1.14.1
29-
github.com/vektah/gqlparser/v2 v2.5.10
29+
github.com/vektah/gqlparser/v2 v2.5.11
3030
go.mongodb.org/mongo-driver v1.12.1
31-
golang.org/x/crypto v0.14.0
31+
golang.org/x/crypto v0.21.0
3232
golang.org/x/oauth2 v0.13.0
3333
google.golang.org/appengine v1.6.8
3434
gopkg.in/mail.v2 v2.3.1
@@ -69,7 +69,7 @@ require (
6969
github.com/golang/snappy v0.0.4 // indirect
7070
github.com/gorilla/websocket v1.5.0 // indirect
7171
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
72-
github.com/hashicorp/golang-lru/v2 v2.0.3 // indirect
72+
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
7373
github.com/jackc/pgpassfile v1.0.0 // indirect
7474
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
7575
github.com/jackc/pgx/v5 v5.4.3 // indirect
@@ -83,7 +83,7 @@ require (
8383
github.com/libsql/libsql-client-go v0.0.0-20231026052543-fce76c0f39a7 // indirect
8484
github.com/libsql/sqlite-antlr4-parser v0.0.0-20230802215326-5cb5bb604475 // indirect
8585
github.com/maruel/rs v1.1.0 // indirect
86-
github.com/mattn/go-isatty v0.0.19 // indirect
86+
github.com/mattn/go-isatty v0.0.20 // indirect
8787
github.com/microsoft/go-mssqldb v1.6.0 // indirect
8888
github.com/mitchellh/mapstructure v1.5.0 // indirect
8989
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
@@ -95,24 +95,24 @@ require (
9595
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
9696
github.com/rogpeppe/go-internal v1.11.0 // indirect
9797
github.com/russross/blackfriday/v2 v2.1.0 // indirect
98-
github.com/sosodev/duration v1.1.0 // indirect
98+
github.com/sosodev/duration v1.2.0 // indirect
9999
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
100100
github.com/ugorji/go/codec v1.2.11 // indirect
101-
github.com/urfave/cli/v2 v2.25.5 // indirect
101+
github.com/urfave/cli/v2 v2.27.1 // indirect
102102
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
103103
github.com/xdg-go/scram v1.1.2 // indirect
104104
github.com/xdg-go/stringprep v1.0.4 // indirect
105105
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
106106
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
107107
golang.org/x/arch v0.3.0 // indirect
108108
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
109-
golang.org/x/mod v0.10.0 // indirect
110-
golang.org/x/net v0.17.0 // indirect
111-
golang.org/x/sync v0.3.0 // indirect
112-
golang.org/x/sys v0.13.0 // indirect
113-
golang.org/x/text v0.13.0 // indirect
114-
golang.org/x/tools v0.9.3 // indirect
115-
google.golang.org/protobuf v1.31.0 // indirect
109+
golang.org/x/mod v0.16.0 // indirect
110+
golang.org/x/net v0.22.0 // indirect
111+
golang.org/x/sync v0.6.0 // indirect
112+
golang.org/x/sys v0.18.0 // indirect
113+
golang.org/x/text v0.14.0 // indirect
114+
golang.org/x/tools v0.19.0 // indirect
115+
google.golang.org/protobuf v1.33.0 // indirect
116116
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
117117
gopkg.in/inf.v0 v0.9.1 // indirect
118118
gopkg.in/sourcemap.v1 v1.0.5 // indirect

0 commit comments

Comments
 (0)