Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
7c92e832cf
14 changed files with 156 additions and 37 deletions
2
.version
2
.version
|
@ -1 +1 @@
|
||||||
2.12.0
|
2.12.1
|
||||||
|
|
|
@ -164,7 +164,9 @@ const internalNginx = {
|
||||||
* @param {Object} host
|
* @param {Object} host
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
generateConfig: (host_type, host) => {
|
generateConfig: (host_type, host_row) => {
|
||||||
|
// Prevent modifying the original object:
|
||||||
|
let host = JSON.parse(JSON.stringify(host_row));
|
||||||
const nice_host_type = internalNginx.getFileFriendlyHostType(host_type);
|
const nice_host_type = internalNginx.getFileFriendlyHostType(host_type);
|
||||||
|
|
||||||
const renderEngine = utils.getRenderEngine();
|
const renderEngine = utils.getRenderEngine();
|
||||||
|
|
|
@ -23,9 +23,7 @@
|
||||||
"locations",
|
"locations",
|
||||||
"hsts_enabled",
|
"hsts_enabled",
|
||||||
"hsts_subdomains",
|
"hsts_subdomains",
|
||||||
"certificate",
|
"certificate"
|
||||||
"use_default_location",
|
|
||||||
"ipv6"
|
|
||||||
],
|
],
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -151,12 +149,6 @@
|
||||||
"$ref": "./access-list-object.json"
|
"$ref": "./access-list-object.json"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"use_default_location": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"ipv6": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
},
|
},
|
||||||
"forward_scheme": {
|
"forward_scheme": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["$scheme", "http", "https"]
|
"enum": ["$scheme", "auto", "http", "https"]
|
||||||
},
|
},
|
||||||
"forward_domain_name": {
|
"forward_domain_name": {
|
||||||
"description": "Domain Name",
|
"description": "Domain Name",
|
||||||
|
|
|
@ -46,7 +46,10 @@
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"description": "Extra metadata",
|
"description": "Extra metadata",
|
||||||
"example": {},
|
"example": {
|
||||||
|
"redirect": "http://example.com",
|
||||||
|
"html": "<h1>404</h1>"
|
||||||
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,9 +94,7 @@
|
||||||
"avatar": "",
|
"avatar": "",
|
||||||
"roles": ["admin"]
|
"roles": ["admin"]
|
||||||
},
|
},
|
||||||
"certificate": null,
|
"certificate": null
|
||||||
"use_default_location": true,
|
|
||||||
"ipv6": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -79,9 +79,7 @@
|
||||||
"nickname": "Admin",
|
"nickname": "Admin",
|
||||||
"avatar": "",
|
"avatar": "",
|
||||||
"roles": ["admin"]
|
"roles": ["admin"]
|
||||||
},
|
}
|
||||||
"use_default_location": true,
|
|
||||||
"ipv6": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -129,9 +129,7 @@
|
||||||
"roles": ["admin"]
|
"roles": ["admin"]
|
||||||
},
|
},
|
||||||
"certificate": null,
|
"certificate": null,
|
||||||
"access_list": null,
|
"access_list": null
|
||||||
"use_default_location": true,
|
|
||||||
"ipv6": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -114,9 +114,7 @@
|
||||||
"avatar": "//www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?default=mm",
|
"avatar": "//www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?default=mm",
|
||||||
"roles": ["admin"]
|
"roles": ["admin"]
|
||||||
},
|
},
|
||||||
"access_list": null,
|
"access_list": null
|
||||||
"use_default_location": true,
|
|
||||||
"ipv6": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -114,9 +114,7 @@
|
||||||
"avatar": "",
|
"avatar": "",
|
||||||
"roles": ["admin"]
|
"roles": ["admin"]
|
||||||
},
|
},
|
||||||
"certificate": null,
|
"certificate": null
|
||||||
"use_default_location": true,
|
|
||||||
"ipv6": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -99,9 +99,7 @@
|
||||||
"nickname": "Admin",
|
"nickname": "Admin",
|
||||||
"avatar": "",
|
"avatar": "",
|
||||||
"roles": ["admin"]
|
"roles": ["admin"]
|
||||||
},
|
}
|
||||||
"use_default_location": true,
|
|
||||||
"ipv6": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -129,9 +129,7 @@
|
||||||
"roles": ["admin"]
|
"roles": ["admin"]
|
||||||
},
|
},
|
||||||
"certificate": null,
|
"certificate": null,
|
||||||
"access_list": null,
|
"access_list": null
|
||||||
"use_default_location": true,
|
|
||||||
"ipv6": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
"name": "settingID",
|
"name": "settingID",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"minLength": 1
|
"minLength": 1,
|
||||||
|
"enum": ["default-site"]
|
||||||
},
|
},
|
||||||
"required": true,
|
"required": true,
|
||||||
"description": "Setting ID",
|
"description": "Setting ID",
|
||||||
|
@ -31,10 +32,21 @@
|
||||||
"minProperties": 1,
|
"minProperties": 1,
|
||||||
"properties": {
|
"properties": {
|
||||||
"value": {
|
"value": {
|
||||||
"$ref": "../../../components/setting-object.json#/properties/value"
|
"type": "string",
|
||||||
|
"minLength": 1,
|
||||||
|
"enum": ["congratulations", "404", "444", "redirect", "html"]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"$ref": "../../../components/setting-object.json#/properties/meta"
|
"type": "object",
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"redirect": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"html": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
124
test/cypress/e2e/api/Settings.cy.js
Normal file
124
test/cypress/e2e/api/Settings.cy.js
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
|
describe('Settings endpoints', () => {
|
||||||
|
let token;
|
||||||
|
|
||||||
|
before(() => {
|
||||||
|
cy.getToken().then((tok) => {
|
||||||
|
token = tok;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Get all settings', function() {
|
||||||
|
cy.task('backendApiGet', {
|
||||||
|
token: token,
|
||||||
|
path: '/api/settings',
|
||||||
|
}).then((data) => {
|
||||||
|
cy.validateSwaggerSchema('get', 200, '/settings', data);
|
||||||
|
expect(data.length).to.be.greaterThan(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Get default-site setting', function() {
|
||||||
|
cy.task('backendApiGet', {
|
||||||
|
token: token,
|
||||||
|
path: '/api/settings/default-site',
|
||||||
|
}).then((data) => {
|
||||||
|
cy.validateSwaggerSchema('get', 200, '/settings/{settingID}', data);
|
||||||
|
expect(data).to.have.property('id');
|
||||||
|
expect(data.id).to.be.equal('default-site');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Default Site congratulations', function() {
|
||||||
|
cy.task('backendApiPut', {
|
||||||
|
token: token,
|
||||||
|
path: '/api/settings/default-site',
|
||||||
|
data: {
|
||||||
|
value: 'congratulations',
|
||||||
|
},
|
||||||
|
}).then((data) => {
|
||||||
|
cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
|
||||||
|
expect(data).to.have.property('id');
|
||||||
|
expect(data.id).to.be.equal('default-site');
|
||||||
|
expect(data).to.have.property('value');
|
||||||
|
expect(data.value).to.be.equal('congratulations');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Default Site 404', function() {
|
||||||
|
cy.task('backendApiPut', {
|
||||||
|
token: token,
|
||||||
|
path: '/api/settings/default-site',
|
||||||
|
data: {
|
||||||
|
value: '404',
|
||||||
|
},
|
||||||
|
}).then((data) => {
|
||||||
|
cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
|
||||||
|
expect(data).to.have.property('id');
|
||||||
|
expect(data.id).to.be.equal('default-site');
|
||||||
|
expect(data).to.have.property('value');
|
||||||
|
expect(data.value).to.be.equal('404');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Default Site 444', function() {
|
||||||
|
cy.task('backendApiPut', {
|
||||||
|
token: token,
|
||||||
|
path: '/api/settings/default-site',
|
||||||
|
data: {
|
||||||
|
value: '444',
|
||||||
|
},
|
||||||
|
}).then((data) => {
|
||||||
|
cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
|
||||||
|
expect(data).to.have.property('id');
|
||||||
|
expect(data.id).to.be.equal('default-site');
|
||||||
|
expect(data).to.have.property('value');
|
||||||
|
expect(data.value).to.be.equal('444');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Default Site redirect', function() {
|
||||||
|
cy.task('backendApiPut', {
|
||||||
|
token: token,
|
||||||
|
path: '/api/settings/default-site',
|
||||||
|
data: {
|
||||||
|
value: 'redirect',
|
||||||
|
meta: {
|
||||||
|
redirect: 'https://www.google.com',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).then((data) => {
|
||||||
|
cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
|
||||||
|
expect(data).to.have.property('id');
|
||||||
|
expect(data.id).to.be.equal('default-site');
|
||||||
|
expect(data).to.have.property('value');
|
||||||
|
expect(data.value).to.be.equal('redirect');
|
||||||
|
expect(data).to.have.property('meta');
|
||||||
|
expect(data.meta).to.have.property('redirect');
|
||||||
|
expect(data.meta.redirect).to.be.equal('https://www.google.com');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Default Site html', function() {
|
||||||
|
cy.task('backendApiPut', {
|
||||||
|
token: token,
|
||||||
|
path: '/api/settings/default-site',
|
||||||
|
data: {
|
||||||
|
value: 'html',
|
||||||
|
meta: {
|
||||||
|
html: '<p>hello world</p>'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).then((data) => {
|
||||||
|
cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
|
||||||
|
expect(data).to.have.property('id');
|
||||||
|
expect(data.id).to.be.equal('default-site');
|
||||||
|
expect(data).to.have.property('value');
|
||||||
|
expect(data.value).to.be.equal('html');
|
||||||
|
expect(data).to.have.property('meta');
|
||||||
|
expect(data.meta).to.have.property('html');
|
||||||
|
expect(data.meta.html).to.be.equal('<p>hello world</p>');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue