nginx-proxy-manager/src/frontend/js/models/proxy-host.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-07-09 01:22:10 +00:00
'use strict';
const Backbone = require('backbone');
const model = Backbone.Model.extend({
idAttribute: 'id',
defaults: function () {
return {
2018-07-18 23:47:55 +00:00
id: 0,
2018-07-09 01:22:10 +00:00
created_on: null,
modified_on: null,
2018-07-17 22:35:49 +00:00
domain_names: [],
2018-07-09 01:22:10 +00:00
forward_ip: '',
2018-07-09 02:21:03 +00:00
forward_port: null,
access_list_id: null,
2018-07-09 01:22:10 +00:00
ssl_enabled: false,
ssl_provider: false,
ssl_forced: false,
caching_enabled: false,
block_exploits: false,
2018-07-23 05:12:24 +00:00
meta: {},
2018-07-17 22:35:49 +00:00
// The following are expansions:
owner: null,
access_list: null
2018-07-09 01:22:10 +00:00
};
2018-07-23 05:12:24 +00:00
},
/**
* @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'];
2018-07-09 01:22:10 +00:00
}
});
module.exports = {
Model: model,
Collection: Backbone.Collection.extend({
model: model
})
};