2021-02-05 12:12:26 +03:00
import ghostPaths from 'ghost-admin/utils/ghost-paths' ;
2018-10-18 02:18:29 +03:00
import mockApiKeys from './config/api-keys' ;
2016-08-17 18:14:33 +03:00
import mockAuthentication from './config/authentication' ;
2019-02-25 17:47:17 +03:00
import mockConfig from './config/config' ;
2021-11-01 20:48:49 +03:00
import mockCustomThemeSettings from './config/custom-theme-settings' ;
2019-11-08 07:14:04 +03:00
import mockEmails from './config/emails' ;
2018-10-18 02:18:29 +03:00
import mockIntegrations from './config/integrations' ;
2016-09-26 19:03:53 +03:00
import mockInvites from './config/invites' ;
2020-02-14 14:07:25 +03:00
import mockLabels from './config/labels' ;
2020-10-15 20:03:18 +03:00
import mockMembers from './config/members' ;
2022-04-04 21:26:49 +03:00
import mockNewsletters from './config/newsletters' ;
2021-10-08 17:15:48 +03:00
import mockOffers from './config/offers' ;
2019-02-22 06:17:33 +03:00
import mockPages from './config/pages' ;
2016-08-17 18:14:33 +03:00
import mockPosts from './config/posts' ;
2021-05-10 23:02:54 +03:00
import mockProducts from './config/products' ;
2016-08-17 18:14:33 +03:00
import mockRoles from './config/roles' ;
import mockSettings from './config/settings' ;
2019-02-25 17:47:17 +03:00
import mockSite from './config/site' ;
2016-08-17 18:14:33 +03:00
import mockSlugs from './config/slugs' ;
2020-10-15 20:03:18 +03:00
import mockSnippets from './config/snippets' ;
2016-08-17 18:14:33 +03:00
import mockTags from './config/tags' ;
2016-08-17 18:01:46 +03:00
import mockThemes from './config/themes' ;
2017-05-23 11:50:04 +03:00
import mockUploads from './config/uploads' ;
2016-08-17 18:14:33 +03:00
import mockUsers from './config/users' ;
2018-10-18 02:18:29 +03:00
import mockWebhooks from './config/webhooks' ;
2015-10-13 16:52:41 +03:00
2016-08-17 18:14:33 +03:00
// import {versionMismatchResponse} from 'utils';
2016-04-15 17:45:50 +03:00
2015-10-13 16:52:41 +03:00
export default function ( ) {
2019-01-23 17:24:29 +03:00
// allow any local requests outside of the namespace (configured below) to hit the real server
// _must_ be called before the namespace property is set
this . passthrough ( '/ghost/assets/**' ) ;
2021-02-05 12:12:26 +03:00
this . namespace = ghostPaths ( ) . apiRoot ;
2019-01-24 22:34:32 +03:00
this . timing = 1000 ; // delay for each request, automatically set to 0 during testing
2019-01-22 20:18:44 +03:00
this . logging = true ;
2015-10-13 16:52:41 +03:00
2016-09-24 18:48:06 +03:00
// Mock endpoints here to override real API requests during development, eg...
2016-06-30 17:45:02 +03:00
// this.put('/posts/:id/', versionMismatchResponse);
2016-09-24 18:48:06 +03:00
// mockTags(this);
// this.loadFixtures('settings');
2022-04-04 21:26:49 +03:00
mockNewsletters ( this ) ;
2019-01-22 20:18:44 +03:00
2016-04-13 12:44:09 +03:00
// keep this line, it allows all other API requests to hit the real server
this . passthrough ( ) ;
// add any external domains to make sure those get passed through too
this . passthrough ( 'http://www.gravatar.com/**' ) ;
2019-01-23 17:24:29 +03:00
this . passthrough ( 'https://cdn.jsdelivr.net/**' ) ;
2019-02-06 13:40:34 +03:00
this . passthrough ( 'https://api.unsplash.com/**' ) ;
2019-08-23 12:01:27 +03:00
this . passthrough ( 'https://ghost.org/**' ) ;
2016-04-13 12:44:09 +03:00
}
// Mock all endpoints here as there is no real API during testing
export function testConfig ( ) {
2021-02-05 12:12:26 +03:00
this . namespace = ghostPaths ( ) . apiRoot ;
2016-04-13 12:44:09 +03:00
// this.timing = 400; // delay for each request, automatically set to 0 during testing
2019-02-26 05:45:29 +03:00
this . logging = false ;
2016-04-13 12:44:09 +03:00
2018-11-12 19:31:47 +03:00
mockApiKeys ( this ) ;
2016-08-17 18:14:33 +03:00
mockAuthentication ( this ) ;
2019-02-25 17:47:17 +03:00
mockConfig ( this ) ;
2021-11-01 20:48:49 +03:00
mockCustomThemeSettings ( this ) ;
2019-11-08 07:14:04 +03:00
mockEmails ( this ) ;
2018-11-12 19:31:47 +03:00
mockIntegrations ( this ) ;
2016-09-26 19:03:53 +03:00
mockInvites ( this ) ;
2019-01-22 20:18:44 +03:00
mockMembers ( this ) ;
2020-02-14 14:07:25 +03:00
mockLabels ( this ) ;
2019-02-22 06:17:33 +03:00
mockPages ( this ) ;
2016-08-17 18:14:33 +03:00
mockPosts ( this ) ;
mockRoles ( this ) ;
mockSettings ( this ) ;
2019-02-25 17:47:17 +03:00
mockSite ( this ) ;
2016-08-17 18:14:33 +03:00
mockSlugs ( this ) ;
mockTags ( this ) ;
2016-08-17 18:01:46 +03:00
mockThemes ( this ) ;
2017-05-23 11:50:04 +03:00
mockUploads ( this ) ;
2016-08-17 18:14:33 +03:00
mockUsers ( this ) ;
2018-11-12 19:31:47 +03:00
mockWebhooks ( this ) ;
2021-05-10 23:02:54 +03:00
mockProducts ( this ) ;
2021-10-08 17:15:48 +03:00
mockOffers ( this ) ;
2022-04-04 21:26:49 +03:00
mockSnippets ( this ) ;
mockNewsletters ( this ) ;
2015-11-13 14:48:59 +03:00
2015-10-13 16:52:41 +03:00
/* Notifications -------------------------------------------------------- */
2017-01-02 21:49:44 +03:00
this . get ( '/notifications/' ) ;
2015-10-13 16:52:41 +03:00
2018-10-04 13:02:36 +03:00
/* Integrations - Slack Test Notification ------------------------------- */
2016-03-29 11:40:44 +03:00
this . post ( '/slack/test' , function ( ) {
return { } ;
} ) ;
2016-08-17 18:14:33 +03:00
/* External sites ------------------------------------------------------- */
2015-12-07 00:24:06 +03:00
2017-09-28 05:33:00 +03:00
this . head ( 'http://www.gravatar.com/avatar/:md5' , function ( ) {
return '' ;
} , 200 ) ;
2016-04-12 14:34:40 +03:00
this . get ( 'http://www.gravatar.com/avatar/:md5' , function ( ) {
return '' ;
} , 200 ) ;
2019-08-23 12:01:27 +03:00
this . get ( 'https://ghost.org/changelog.json' , function ( ) {
return {
changelog : [
{
title : 'Custom image alt tags' ,
custom _excerpt : null ,
2021-01-19 03:18:59 +03:00
html : '<p>We just shipped custom image alt tag support in the Ghost editor. This is one of our most requested features - and great news for accessibility and search engine optimisation for your Ghost publication.</p><p>Previously, you\'d need to use a Markdown card to add an image alt tag. Now you can create alt tags on the go directly from the editor, without the need to add any additional cards or custom tags.</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://ghost.org/changelog/content/images/2019/08/image-alt-tag.gif" class="kg-image"></figure><!--kg-card-end: image--><p>To write your alt tag, hit the <code>alt</code> button on the right in the caption line, type your alt text and then hit the button again to return to the caption text. </p><p><em><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><a href="https://ghost.org/pricing/">Ghost(Pro)</a></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong> users already have access to custom image alt tags. Self hosted developers can use <a href="https://ghost.org/docs/ghost-cli/">Ghost-CLI</a> to install the latest release!</em></p>' ,
2019-08-23 12:01:27 +03:00
slug : 'image-alt-text-support' ,
published _at : '2019-08-05T07:46:16.000+00:00' ,
2021-01-19 03:18:59 +03:00
url : 'https://ghost.org/changelog/image-alt-text-support/'
2019-08-23 12:01:27 +03:00
}
] ,
changelogMajor : [ ] ,
2021-01-19 03:18:59 +03:00
changelogUrl : 'https://ghost.org/changelog/'
2019-08-23 12:01:27 +03:00
} ;
} ) ;
2015-10-13 16:52:41 +03:00
}