term.js 780 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. 'require view';
  3. 'require uci';
  4. return view.extend({
  5. load: function() {
  6. return uci.load('ttyd');
  7. },
  8. render: function() {
  9. var port = uci.get_first('ttyd', 'ttyd', 'port') || '7681',
  10. ssl = uci.get_first('ttyd', 'ttyd', 'ssl') || '0',
  11. url = uci.get_first('ttyd', 'ttyd', 'url_override');
  12. if (port === '0')
  13. return E('div', { class: 'alert-message warning' },
  14. _('Random ttyd port (port=0) is not supported.<br />Change to a fixed port and try again.'));
  15. return E('iframe', {
  16. src: url || ((ssl === '1' ? 'https' : 'http') + '://' + window.location.hostname + ':' + port),
  17. style: 'width: 100%; min-height: 500px; border: none; border-radius: 3px; resize: vertical;'
  18. });
  19. },
  20. handleSaveApply: null,
  21. handleSave: null,
  22. handleReset: null
  23. });