Ghost/core/test/unit
Hannah Wolfe 9eadeb9fbb Prep shared API URL util for use on external sites
refs #5942, #6150

There were a few key problems I was looking to solve with this:

- Introduce a single point of truth for what the URL for accessing the API should be
- Provide a simple way to configure the utility (much like a true SDK)

As of this commit, this utility is still automatically available in a Ghost theme.
To use it on an external site, the code would look like:

```
<script type="text/javascript" src="http://my-ghost-blog.com/shared/ghost-url.min.js"></script>
<script type="text/javascript">
ghost.init({
   clientId: "<your-client-id>",
   clientSecret: "<your-client-secret>"
});
</script>
```

To achieve this, there have been a number of changes:

- A new `apiUrl` function has been added to config, which calculates the correct URL. This needs to be unified with the other url generation functions as a separate piece of work.
- The serveSharedFile middleware has been updated, so that it can serve files from / or /shared and to substitute `{{api-url}}` as it does `{{blog-url}}`.
- ghost-url.js and ghost-url.min.js have been updated to be served via the serveSharedFile middleware
- ghost-url.js has been changed slightly, to take the url from an inline variable which is substituted the first time it is served
- `{{ghost_head}}` has been updated, removing the api url handling which is now in config/url.js and removing the configuration of the utility in favour of calling `init()` after the script is required
- `{{ghost_head}}` has also had the meta tags for client id and secret removed
- tests have been updated
2015-12-15 11:50:46 +00:00
..
controllers/frontend Unify usage of config in unit tests 2015-12-15 10:48:24 +00:00
middleware Prep shared API URL util for use on external sites 2015-12-15 11:50:46 +00:00
models_plugins Add some debugging tools to filters 2015-11-18 19:17:06 +00:00
server_helpers Prep shared API URL util for use on external sites 2015-12-15 11:50:46 +00:00
api_utils_spec.js Add some debugging tools to filters 2015-11-18 19:17:06 +00:00
apps_filters_spec.js Filter plugin with enforce/default logic 2015-11-17 10:39:44 +00:00
apps_spec.js Add jscs task to grunt file and clean up files to adhere to jscs rules. 2014-09-17 21:44:29 -04:00
config_spec.js Prep shared API URL util for use on external sites 2015-12-15 11:50:46 +00:00
error_handling_spec.js Unify usage of config in unit tests 2015-12-15 10:48:24 +00:00
filters_spec.js Add jscs task to grunt file and clean up files to adhere to jscs rules. 2014-09-17 21:44:29 -04:00
ghost_url_spec.js Prep shared API URL util for use on external sites 2015-12-15 11:50:46 +00:00
importer_spec.js Unify usage of config in unit tests 2015-12-15 10:48:24 +00:00
mail_spec.js Unify usage of config in unit tests 2015-12-15 10:48:24 +00:00
migration_spec.js Maintain tag order for posts 2015-09-02 16:39:34 +01:00
permissions_spec.js deps: grunt-jscs@2.1.0 2015-10-12 19:21:16 +01:00
rss_spec.js Unify usage of config in unit tests 2015-12-15 10:48:24 +00:00
server_helpers_index_spec.js Cleans up HTML data attributes on body in default.hbs 2014-11-29 17:09:43 +01:00
server_helpers_template_spec.js Unify code for picking a template to render with 2015-12-01 12:05:46 +08:00
server_spec.js Add jscs task to grunt file and clean up files to adhere to jscs rules. 2014-09-17 21:44:29 -04:00
server_utils_spec.js Make read-directory ignore invalid package.json files 2015-10-28 15:37:52 +01:00
showdown_client_integrated_spec.js Upgrade grunt-jscs to fix whitespace linting. 2015-04-30 16:14:19 -05:00
sitemap_spec.js Cache permalinks & postsPerPage on config.theme 2015-12-15 08:16:53 +00:00
storage_local-file-store_spec.js Unify usage of config in unit tests 2015-12-15 10:48:24 +00:00
utils_pipeline_spec.js Pipeline util tests, clean & fix 2015-11-03 09:14:44 +00:00
xmlrpc_spec.js Refactor sitemaps to use centralised events 2015-04-05 19:32:18 +01:00