2019-10-17 08:47:14 +00:00
|
|
|
'use strict';
|
2020-04-03 08:00:06 +00:00
|
|
|
'require view';
|
2019-10-17 08:47:14 +00:00
|
|
|
'require uci';
|
|
|
|
|
2020-04-03 08:00:06 +00:00
|
|
|
return view.extend({
|
2019-10-17 08:47:14 +00:00
|
|
|
load: function() {
|
|
|
|
return uci.load('ttyd');
|
|
|
|
},
|
|
|
|
render: function() {
|
2020-04-05 18:35:03 +00:00
|
|
|
var port = uci.get_first('ttyd', 'ttyd', 'port') || '7681',
|
|
|
|
ssl = uci.get_first('ttyd', 'ttyd', 'ssl') || '0';
|
2019-10-17 08:47:14 +00:00
|
|
|
if (port === '0')
|
|
|
|
return E('div', { class: 'alert-message warning' },
|
|
|
|
_('Random ttyd port (port=0) is not supported.<br>Change to a fixed port and try again.'));
|
|
|
|
return E('iframe', {
|
2020-04-05 18:35:03 +00:00
|
|
|
src: (ssl === '1' ? 'https' : 'http') + '://' + window.location.hostname + ':' + port,
|
2019-10-17 08:47:14 +00:00
|
|
|
style: 'width: 100%; min-height: 500px; border: none; border-radius: 3px; resize: vertical;'
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleSaveApply: null,
|
|
|
|
handleSave: null,
|
|
|
|
handleReset: null
|
|
|
|
});
|