Check that Ghost API key is in a valid format

This commit is contained in:
Southpaw
2023-08-26 10:54:11 +01:00
parent f2a9c02af7
commit 055cab976d

View File

@@ -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.")
}};