-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #598 from BlueBubblesApp/zach/fix/ngrok-v5
v1.9.3 - ngrok update fix
- Loading branch information
Showing
11 changed files
with
181 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
APPLEID= | ||
APPLEIDPASS= | ||
TEAMID= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
packages/ui/src/app/components/modals/NgrokAuthTokenDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import React, { useState } from 'react'; | ||
import { | ||
AlertDialog, | ||
AlertDialogOverlay, | ||
AlertDialogBody, | ||
AlertDialogContent, | ||
AlertDialogFooter, | ||
AlertDialogHeader, | ||
Button, | ||
Input, | ||
FormControl, | ||
FormErrorMessage, | ||
FormLabel, | ||
Text | ||
} from '@chakra-ui/react'; | ||
import { useAppSelector } from '../../hooks'; | ||
import { FocusableElement } from '@chakra-ui/utils'; | ||
|
||
|
||
interface NgrokAuthTokenDialogProps { | ||
onCancel?: () => void; | ||
onConfirm?: (address: string) => void; | ||
isOpen: boolean; | ||
modalRef: React.RefObject<FocusableElement>; | ||
onClose: () => void; | ||
} | ||
|
||
export const NgrokAuthTokenDialog = ({ | ||
onCancel, | ||
onConfirm, | ||
isOpen, | ||
modalRef, | ||
onClose, | ||
}: NgrokAuthTokenDialogProps): JSX.Element => { | ||
const ngrokToken: string = (useAppSelector(state => state.config.ngrok_key) ?? ''); | ||
const [authToken, setAuthToken] = useState(ngrokToken); | ||
const [error, setError] = useState(''); | ||
const isInvalid = (error ?? '').length > 0; | ||
|
||
return ( | ||
<AlertDialog | ||
isOpen={isOpen} | ||
leastDestructiveRef={modalRef} | ||
onClose={() => onClose()} | ||
> | ||
<AlertDialogOverlay> | ||
<AlertDialogContent> | ||
<AlertDialogHeader fontSize='lg' fontWeight='bold'> | ||
Set Your Ngrok Auth Token | ||
</AlertDialogHeader> | ||
|
||
<AlertDialogBody> | ||
<Text>In order to use Ngrok, you must create a <i>free</i> account and generate an auth token.</Text> | ||
<br /> | ||
<Text> | ||
If you have not done so yet, sign up for an account <u><a href="https://dashboard.ngrok.com/signup" target="_blank" rel="noreferrer">here</a></u> | ||
</Text> | ||
<br /> | ||
<Text> | ||
Once you have signed up copy your auth token from your Ngrok dashboard <u><a href="https://dashboard.ngrok.com/get-started/your-authtoken" target="_blank" rel="noreferrer">here</a></u>. | ||
Then paste it in the field below. | ||
</Text> | ||
<br /> | ||
<FormControl isInvalid={isInvalid}> | ||
<FormLabel htmlFor='address'>Ngrok Auth Token</FormLabel> | ||
<Input | ||
id='ngrok_key' | ||
type='password' | ||
maxWidth="20em" | ||
value={authToken} | ||
onChange={(e) => { | ||
setError(''); | ||
setAuthToken(e.target.value); | ||
}} | ||
/> | ||
{isInvalid ? ( | ||
<FormErrorMessage>{error}</FormErrorMessage> | ||
) : null} | ||
</FormControl> | ||
|
||
</AlertDialogBody> | ||
|
||
<AlertDialogFooter> | ||
<Button | ||
ref={modalRef as React.LegacyRef<HTMLButtonElement> | undefined} | ||
onClick={() => { | ||
if (onCancel) onCancel(); | ||
onClose(); | ||
}} | ||
> | ||
Cancel | ||
</Button> | ||
<Button | ||
ml={3} | ||
bg='brand.primary' | ||
ref={modalRef as React.LegacyRef<HTMLButtonElement> | undefined} | ||
onClick={() => { | ||
if (authToken.length === 0) { | ||
setError('Please enter an Auth Token!'); | ||
return; | ||
} | ||
|
||
|
||
if (onConfirm) onConfirm(authToken); | ||
onClose(); | ||
}} | ||
> | ||
Save | ||
</Button> | ||
</AlertDialogFooter> | ||
</AlertDialogContent> | ||
</AlertDialogOverlay> | ||
</AlertDialog> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters