Skip to content

Commit

Permalink
Merge pull request #2 from mailosaur/updatetext
Browse files Browse the repository at this point in the history
Update prompts
  • Loading branch information
th-mailosaur authored Jun 26, 2024
2 parents 145bbc5 + db3ecf6 commit 59d0d20
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions src/inputs/apiKeyInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ export async function apiKeyInput(isServerApiKey: boolean): Promise<string> {
{
type: 'password',
name: 'value',
message: 'Please enter your api key:',
validate: async (value) => {
message:
'Please enter your Mailosaur API key (see https://mailosaur.com/app/account/keys):',
validate: async value => {
const encodedApiKey = Buffer.from(`key:${value}`).toString('base64');

const res = await fetch('https://mailosaur.com/api/servers', {
Expand All @@ -31,7 +32,7 @@ export async function apiKeyInput(isServerApiKey: boolean): Promise<string> {
return true;
}

return 'Invalid api key';
return 'This is not a valid Mailosaur API key';
},
},
{
Expand All @@ -43,7 +44,11 @@ export async function apiKeyInput(isServerApiKey: boolean): Promise<string> {

if (isServerApiKey) {
console.log(
pc.yellow(pc.bold('\nApi key is a server api key (some tests wont work)'))
pc.yellow(
pc.bold(
'WARNING: This API key only supports email/SMS testing for a specific inbox (server). Some examples will not work with this API key.'
)
)
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/inputs/serverIdInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export async function serverIdInput(): Promise<string> {
{
type: 'text',
name: 'value',
message: 'Please enter your server id:',
message: 'Enter your Server ID (see https://mailosaur.com/app/servers):',
validate: async (value: string) => {
if (value.length === 8) {
return true;
}

return 'Invalid server id';
return 'Could not find inbox (server) with this ID. Please check and try again.';
},
},
{
Expand Down

0 comments on commit 59d0d20

Please sign in to comment.