Add OpenWrt remote hub
This commit is contained in:
1 parent
48cba62f21
commit
38a92b0b1f
19 files changed
+2080
-2123
No files matched your search
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
'require view';
|
||||
'require fs';
|
||||
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return fs.read('/etc/owrt-remote/web.key').catch(function() {
|
||||
return '';
|
||||
});
|
||||
},
|
||||
|
||||
render: function(key) {
|
||||
key = (key || '').trim();
|
||||
|
||||
if (!key) {
|
||||
return E('div', { 'class': 'cbi-map' }, [
|
||||
E('h2', {}, _('OpenWrt Remote')),
|
||||
E('div', { 'class': 'alert-message warning' }, [
|
||||
_('Web key not found. Reinstall the module or create /etc/owrt-remote/web.key.')
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
var url = '/cgi-bin/owrt-remote?key=' + encodeURIComponent(key);
|
||||
|
||||
window.setTimeout(function() {
|
||||
window.location.replace(url);
|
||||
}, 100);
|
||||
|
||||
return E('div', { 'class': 'cbi-map' }, [
|
||||
E('h2', {}, _('OpenWrt Remote')),
|
||||
E('p', {}, _('Opening remote access panel...')),
|
||||
E('p', {}, [
|
||||
E('a', { 'class': 'btn cbi-button cbi-button-apply', 'href': url }, _('Open panel'))
|
||||
])
|
||||
]);
|
||||
},
|
||||
|
||||
handleSaveApply: null,
|
||||
handleSave: null,
|
||||
handleReset: null
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user