feat(ghost): add ghost integration (#1401)

This commit is contained in:
Rıdvan Akca
2023-11-07 13:30:26 +03:00
committed by GitHub
parent c42374e031
commit f0e8f070a8
11 changed files with 248 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import verifyCredentials from './verify-credentials';
import isStillVerified from './is-still-verified';
export default {
fields: [
{
key: 'instanceUrl',
label: 'Instance URL',
type: 'string' as const,
required: true,
readOnly: false,
value: null,
placeholder: null,
description: null,
clickToCopy: false,
},
{
key: 'apiKey',
label: 'Admin API Key',
type: 'string' as const,
required: true,
readOnly: false,
value: null,
placeholder: null,
description: null,
clickToCopy: false,
},
],
verifyCredentials,
isStillVerified,
};

View File

@@ -0,0 +1,9 @@
import { IGlobalVariable } from '@automatisch/types';
import verifyCredentials from './verify-credentials';
const isStillVerified = async ($: IGlobalVariable) => {
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -0,0 +1,16 @@
import { IGlobalVariable } from '@automatisch/types';
const verifyCredentials = async ($: IGlobalVariable) => {
const site = await $.http.get('/admin/site/');
const screenName = [site.data.site.title, site.data.site.url]
.filter(Boolean)
.join(' @ ');
await $.auth.set({
screenName,
});
await $.http.get('/admin/pages/');
};
export default verifyCredentials;