From 055cab976ddc3428312fe78854bbe8e5011db67d Mon Sep 17 00:00:00 2001 From: Southpaw Date: Sat, 26 Aug 2023 10:54:11 +0100 Subject: [PATCH] Check that Ghost API key is in a valid format --- src/methods/publishPost.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/methods/publishPost.ts b/src/methods/publishPost.ts index a675a7a..91a1ba7 100644 --- a/src/methods/publishPost.ts +++ b/src/methods/publishPost.ts @@ -24,6 +24,7 @@ export const publishPost = async ( ) => { // Ghost Url and Admin API key const key = settings.adminToken; + if (key.includes(":")) { const [id, secret] = key.split(":"); // Create the token (including decoding secret) @@ -78,4 +79,7 @@ export const publishPost = async ( new Notice(`Couldn't connect to the Ghost API. Is the API URL and Admin API Key correct? ${error.name}: ${error.message}`) +}} +else { + new Notice("Error: Ghost API Key is invalid.") }};