Project

General

Profile

« Previous | Next » 

Revision 42c33bac

Added by Steve Beaver over 4 years ago

Completed new tunnel functionality when no tunnels exist in hte config

View differences:

src/etc/inc/wg.inc
30 30
function wg_do_post($post, $json = false) {
31 31
	global $config;
32 32

  
33
	init_config_arr(array('wireguard', 'tunnel'));
34

  
33 35
	$input_errors = array();
34 36

  
35 37
	$index = $post['index'];
......
185 187
		<fwprivkey></fwprivkey>
186 188
		<tunnel>
187 189
			<descr>Home office</descr>
190
			<enabled>yes</enabled>
188 191
			<interface>
189 192
				<privatekey>yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=</privatekey>
190 193
				<address>10.0.0.1/24, fdc9:281f:04d7:9ee9::1/64</address>
......
211 214
		</tunnel>
212 215
		<tunnel>
213 216
			<descr>Branch office</descr>
217
			<enabled>yes</enabled>
214 218
			<interface>
215 219
				<privatekey>yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=</privatekey>
216 220
				<address>10.0.0.1/24, fdc9:281f:04d7:9ee9::1/64</address>
src/usr/local/www/vpn_wg.php
45 45

  
46 46
include("head.inc");
47 47

  
48
if ($input_errors) {
49
	print_input_errors($input_errors);
50
}
51

  
52
if ($_POST['apply']) {
53
	print_apply_result_box($retval);
54
}
55

  
56 48
if (is_subsystem_dirty('wireguard')) {
57 49
	print_apply_box(gettext("The Wireguard tunnel configuration has been changed.") . "<br />" . gettext("The changes must be applied for them to take effect."));
58 50
}
59 51
?>
60 52

  
61 53
<form name="mainform" method="post">
54
<?php
55
	if (count($tunnels) == 0) {
56
		print_info_box(gettext('No Wireguard tunnels have benn configured have been configured. Click the "Add tunnel" button below to create one.'), 'warning', false);
57
	} else {
58
?>
62 59
	<div class="panel panel-default">
63 60
		<div class="panel-heading"><h2 class="panel-title"><?=gettext('Wireguard Tunnels')?></h2></div>
64 61
		<div class="panel-body table-responsive">
......
135 132
			</table>
136 133
		</div>
137 134
	</div>
135
<?php } // e-o- else (no tunnels) ?>
138 136

  
139 137
	<nav class="action-buttons">
140 138
		<a href="#" class="btn btn-info btn-sm" id="showpeers">

Also available in: Unified diff