mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Restructure Configuration API endpoint
refs #6421, #6525 - The configuration API endpoint was a bit of an animal: - It's used currently in two ways, once for general config, another for the about page. - These two things are different, and would require different permissions in future. - There was also both a browse and a read version, even though only browse was used. - The response from the browse was being artificially turned into many objects, when its really just one with multiple keys - The new version treats each type of config as a different single object with several keys - The new version therefore only has a 'read' request - A basic read request with no key will return basic config that any client would need - A read request with the about key returns the about config - A read request with a different key could therefore return some other config
This commit is contained in:
parent
c53fc00a53
commit
c331e06975
2 changed files with 6 additions and 10 deletions
|
@ -31,13 +31,13 @@
|
||||||
<meta name="msapplication-square150x150logo" content="{{asset "img/medium.png" ghost="true"}}" />
|
<meta name="msapplication-square150x150logo" content="{{asset "img/medium.png" ghost="true"}}" />
|
||||||
<meta name="msapplication-square310x310logo" content="{{asset "img/large.png" ghost="true"}}" />
|
<meta name="msapplication-square310x310logo" content="{{asset "img/large.png" ghost="true"}}" />
|
||||||
|
|
||||||
{{#each configuration}}
|
{{#each configuration as |config key|}}
|
||||||
<meta name="env-{{this.key}}" content="{{this.value}}" data-type="{{this.type}}" />
|
<meta name="env-{{key}}" content="{{config.value}}" data-type="{{config.type}}" />
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{#unless skip_google_fonts}}
|
{{#if configuration.useGoogleFonts.value}}
|
||||||
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:400,300,700" />
|
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:400,300,700" />
|
||||||
{{/unless}}
|
{{/if}}
|
||||||
|
|
||||||
<link rel="stylesheet" href="{{asset "vendor.css" ghost="true" minifyInProduction="true"}}" />
|
<link rel="stylesheet" href="{{asset "vendor.css" ghost="true" minifyInProduction="true"}}" />
|
||||||
<link rel="stylesheet" href="{{asset "ghost.css" ghost="true" minifyInProduction="true"}}" />
|
<link rel="stylesheet" href="{{asset "ghost.css" ghost="true" minifyInProduction="true"}}" />
|
||||||
|
|
|
@ -18,7 +18,7 @@ export default AuthenticatedRoute.extend(styleBody, {
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
let cachedConfig = this.get('cachedConfig');
|
let cachedConfig = this.get('cachedConfig');
|
||||||
let configUrl = this.get('ghostPaths.url').api('configuration');
|
let configUrl = this.get('ghostPaths.url').api('configuration', 'about');
|
||||||
|
|
||||||
if (cachedConfig) {
|
if (cachedConfig) {
|
||||||
return cachedConfig;
|
return cachedConfig;
|
||||||
|
@ -26,12 +26,8 @@ export default AuthenticatedRoute.extend(styleBody, {
|
||||||
|
|
||||||
return this.get('ajax').request(configUrl)
|
return this.get('ajax').request(configUrl)
|
||||||
.then((configurationResponse) => {
|
.then((configurationResponse) => {
|
||||||
let configKeyValues = configurationResponse.configuration;
|
let [cachedConfig] = configurationResponse.configuration;
|
||||||
|
|
||||||
cachedConfig = {};
|
|
||||||
configKeyValues.forEach((configKeyValue) => {
|
|
||||||
cachedConfig[configKeyValue.key] = configKeyValue.value;
|
|
||||||
});
|
|
||||||
this.set('cachedConfig', cachedConfig);
|
this.set('cachedConfig', cachedConfig);
|
||||||
|
|
||||||
return cachedConfig;
|
return cachedConfig;
|
||||||
|
|
Loading…
Add table
Reference in a new issue