mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
OpenVPN export, work in progress for https://github.com/opnsense/core/issues/2787
Add custom input and cleanup supportedOptions() method
This commit is contained in:
parent
94f49e3627
commit
0b028c1799
@ -45,21 +45,10 @@
|
||||
<help>Verify the server certificate Common Name (CN) when the client connects</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>openvpn_export.testxx1</id>
|
||||
<label>TestXX1</label>
|
||||
<id>openvpn_export.plain_config</id>
|
||||
<label>Custom config</label>
|
||||
<style>export_option</style>
|
||||
<type>text</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>openvpn_export.testxx2</id>
|
||||
<label>TestXX2</label>
|
||||
<style>export_option</style>
|
||||
<type>text</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>openvpn_export.testxx3</id>
|
||||
<label>TestXX3</label>
|
||||
<style>export_option</style>
|
||||
<type>text</type>
|
||||
<type>textbox</type>
|
||||
<help>Custom configuration, which will be returned in the output file without modifications</help>
|
||||
</field>
|
||||
</form>
|
||||
|
||||
@ -37,6 +37,6 @@ class ArchiveOpenVPN extends PlainOpenVPN
|
||||
|
||||
public function supportedOptions()
|
||||
{
|
||||
return array("testxx2");
|
||||
return array("plain_config");
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ class PlainOpenVPN extends BaseExporter implements IExportProvider
|
||||
|
||||
public function supportedOptions()
|
||||
{
|
||||
return array("testxx1", "testxx3");
|
||||
return array("plain_config");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,6 +107,14 @@ class PlainOpenVPN extends BaseExporter implements IExportProvider
|
||||
$conf[] = "auth-user-pass";
|
||||
}
|
||||
|
||||
if (!empty($this->config['plain_config'])) {
|
||||
foreach (preg_split('/\r\n|\r|\n/', $this->config['plain_config']) as $line) {
|
||||
if (!empty($line)) {
|
||||
$conf[] = $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $conf;
|
||||
}
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
<default>1</default>
|
||||
<Required>Y</Required>
|
||||
</validate_server_cn>
|
||||
<plain_config type="TextField"/>
|
||||
</server>
|
||||
</servers>
|
||||
</items>
|
||||
|
||||
@ -29,6 +29,11 @@
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
white-space: nowrap;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user