mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
350e3d1481
closes https://github.com/TryGhost/Ghost/issues/8859, requires https://github.com/TryGhost/Ghost/pull/8895 - adds Unsplash app to app settings - enable/disable toggle - validation and testing of Unsplash App ID - Unsplash App ID field hidden if provided via Ghost config - adds `fetchPrivate` method to `config` service to pull config that requires authentication and updates authentication routines to fetch private config - adds Unsplash buttons to editor toolbar and `{{gh-image-uploader}}` - only present when Unsplash app is enabled - opens Unsplash image selector when clicked - `{{gh-image-uploader}}` has a new `allowUnsplash` attribute to control display of the unsplash button on a per-uploader basis - adds Unsplash image selector (`{{gh-unsplash}}`) - uses new `unsplash` service to handle API requests and maintain state - search - infinite scroll - zoom image - insert image - download image - adds `{{gh-scroll-trigger}}` that will fire an event when the component is rendered into or enters the visible screen area via scrolling - updates `ui` service - adds `isFullscreen` property and updates `gh-editor` so that it gets set/unset when toggling editor fullscreen mode - adds `hasSideNav` and `isSideNavHidden` properties - updates `media-queries` service so that it fires an event each time a breakpoint is entered/exited - removes the need for observers in certain circumstances
79 lines
2.8 KiB
JavaScript
79 lines
2.8 KiB
JavaScript
import mockAuthentication from './config/authentication';
|
|
import mockConfiguration from './config/configuration';
|
|
import mockInvites from './config/invites';
|
|
import mockPosts from './config/posts';
|
|
import mockRoles from './config/roles';
|
|
import mockSettings from './config/settings';
|
|
import mockSlugs from './config/slugs';
|
|
import mockSubscribers from './config/subscribers';
|
|
import mockTags from './config/tags';
|
|
import mockThemes from './config/themes';
|
|
import mockUploads from './config/uploads';
|
|
import mockUsers from './config/users';
|
|
|
|
// import {versionMismatchResponse} from 'utils';
|
|
|
|
export default function () {
|
|
// this.urlPrefix = ''; // make this `http://localhost:8080`, for example, if your API is on a different server
|
|
this.namespace = '/ghost/api/v0.1'; // make this `api`, for example, if your API is namespaced
|
|
this.timing = 400; // delay for each request, automatically set to 0 during testing
|
|
|
|
// Mock endpoints here to override real API requests during development, eg...
|
|
// this.put('/posts/:id/', versionMismatchResponse);
|
|
// mockTags(this);
|
|
// this.loadFixtures('settings');
|
|
|
|
// 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('https://count.ghost.org/');
|
|
this.passthrough('http://www.gravatar.com/**');
|
|
}
|
|
|
|
// Mock all endpoints here as there is no real API during testing
|
|
export function testConfig() {
|
|
this.passthrough('/write-coverage'); // For code coverage
|
|
// this.urlPrefix = ''; // make this `http://localhost:8080`, for example, if your API is on a different server
|
|
this.namespace = '/ghost/api/v0.1'; // make this `api`, for example, if your API is namespaced
|
|
// this.timing = 400; // delay for each request, automatically set to 0 during testing
|
|
// this.logging = true;
|
|
|
|
mockAuthentication(this);
|
|
mockConfiguration(this);
|
|
mockInvites(this);
|
|
mockPosts(this);
|
|
mockRoles(this);
|
|
mockSettings(this);
|
|
mockSlugs(this);
|
|
mockSubscribers(this);
|
|
mockTags(this);
|
|
mockThemes(this);
|
|
mockUploads(this);
|
|
mockUsers(this);
|
|
|
|
/* Notifications -------------------------------------------------------- */
|
|
|
|
this.get('/notifications/');
|
|
|
|
/* Apps - Slack Test Notification --------------------------------------- */
|
|
|
|
this.post('/slack/test', function () {
|
|
return {};
|
|
});
|
|
|
|
/* External sites ------------------------------------------------------- */
|
|
|
|
let downloadCount = 0;
|
|
this.get('https://count.ghost.org/', function () {
|
|
downloadCount++;
|
|
return {
|
|
count: downloadCount
|
|
};
|
|
});
|
|
|
|
this.get('http://www.gravatar.com/avatar/:md5', function () {
|
|
return '';
|
|
}, 200);
|
|
}
|