🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

@@ -0,0 +1,92 @@
/* SPDX-License-Identifier: GPL-3.0-only
*
* Copyright (C) 2022 ImmortalWrt.org
*/
'use strict';
'require form';
'require poll';
'require rpc';
'require uci';
'require view';
const callServiceList = rpc.declare({
object: 'service',
method: 'list',
params: ['name'],
expect: { '': {} }
});
function getServiceStatus() {
return L.resolveDefault(callServiceList('ipsec-vpnd'), {}).then(function(res) {
let isRunning = false;
try {
isRunning = res['ipsec-vpnd']['instances']['instance1']['running'];
} catch (e) { }
return isRunning;
});
}
function renderStatus(isRunning) {
let spanTemp = '<em><span style="color:%s"><strong>%s %s</strong></span></em>';
let renderHTML;
if (isRunning)
renderHTML = spanTemp.format('green', _('IPSec VPN'), _('RUNNING'));
else
renderHTML = spanTemp.format('red', _('IPSec VPN'), _('NOT RUNNING'));
return renderHTML;
}
return view.extend({
render() {
let m, s, o;
m = new form.Map('ipsec-vpnd', _('IPSec VPN Server'),
_('IPSec VPN connectivity using the native built-in VPN Client on iOS or Andriod (IKEv1 with PSK and Xauth)'));
s = m.section(form.TypedSection);
s.anonymous = true;
s.render = function() {
poll.add(function() {
return L.resolveDefault(getServiceStatus()).then(function(res) {
let view = document.getElementById('service_status');
view.innerHTML = renderStatus(res);
});
});
return E('div', { class: 'cbi-section', id: 'status_bar' }, [
E('p', { id: 'service_status' }, _('Collecting data...'))
]);
}
s = m.section(form.NamedSection, 'ipsec', 'service');
o = s.option(form.Flag, 'enabled', _('Enable'));
o.default = o.disabled;
o.rmempty = false;
o = s.option(form.Value, 'clientip', _('VPN Client IP'),
_('LAN DHCP reserved started IP addresses with the same subnet mask'));
o.datatype = 'ip4addr';
o.rmempty = false;
o = s.option(form.Value, 'clientdns', _('VPN Client DNS'),
_('DNS using in VPN tunnel.Set to the router\'s LAN IP is recommended'));
o.datatype = 'ip4addr';
o.rmempty = false;
o = s.option(form.Value, 'account', _('Account'));
o.rmempty = false;
o = s.option(form.Value, 'password', _('Password'));
o.password = true;
o.rmempty = false;
o = s.option(form.Value, 'secret', _('Secret Pre-Shared Key'));
o.password = true;
o.rmempty = false;
return m.render();
}
});