nginx-proxy-manager/src/frontend/js/models/proxy-host.js
2018-07-23 15:12:24 +10:00

45 lines
1.2 KiB
JavaScript

'use strict';
const Backbone = require('backbone');
const model = Backbone.Model.extend({
idAttribute: 'id',
defaults: function () {
return {
id: 0,
created_on: null,
modified_on: null,
domain_names: [],
forward_ip: '',
forward_port: null,
access_list_id: null,
ssl_enabled: false,
ssl_provider: false,
ssl_forced: false,
caching_enabled: false,
block_exploits: false,
meta: {},
// The following are expansions:
owner: null,
access_list: null
};
},
/**
* @param {String} type 'letsencrypt' or 'other'
* @returns {Boolean}
*/
hasSslFiles: function (type) {
let meta = this.get('meta');
return typeof meta[type + '_certificate'] !== 'undefined' && meta[type + '_certificate'] && typeof meta[type + '_certificate_key'] !== 'undefined' && meta[type + '_certificate_key'];
}
});
module.exports = {
Model: model,
Collection: Backbone.Collection.extend({
model: model
})
};