mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2024-11-25 09:33:50 +01:00
KASM-3542 new yaml options http-header, stun server
This commit is contained in:
parent
d9b5b5db6a
commit
bd8b6d522a
3
spec/fixtures/defaults_config.yaml
vendored
3
spec/fixtures/defaults_config.yaml
vendored
@ -73,9 +73,10 @@ encoding:
|
||||
hextile_improved_compression: true
|
||||
|
||||
server:
|
||||
http:
|
||||
httpd_directory: /usr/share/kasmvnc/www
|
||||
advanced:
|
||||
x_font_path: auto
|
||||
httpd_directory: /usr/share/kasmvnc/www
|
||||
kasm_password_file: ~/.kasmpasswd
|
||||
x_authority_file: auto
|
||||
auto_shutdown:
|
||||
|
@ -33,6 +33,16 @@ sub new {
|
||||
|
||||
scalar $self->configValues() > 0;
|
||||
},
|
||||
toStringSub => $args->{toStringSub} || sub {
|
||||
my $self = shift;
|
||||
|
||||
my $derivedValue = $self->deriveValue();
|
||||
if (defined($derivedValue)) {
|
||||
return "-$self->{name} " . "'$derivedValue'";
|
||||
}
|
||||
|
||||
"-$self->{name}";
|
||||
},
|
||||
errors => []
|
||||
}, $class;
|
||||
}
|
||||
@ -75,12 +85,7 @@ sub toString {
|
||||
|
||||
return unless $self->isActive();
|
||||
|
||||
my $derivedValue = $self->deriveValue();
|
||||
if (defined($derivedValue)) {
|
||||
return "-$self->{name} " . "'$derivedValue'";
|
||||
}
|
||||
|
||||
"-$self->{name}";
|
||||
$self->{toStringSub}->($self);
|
||||
}
|
||||
|
||||
sub toValue {
|
||||
|
@ -15,6 +15,7 @@ network:
|
||||
udp:
|
||||
public_ip: auto
|
||||
port: auto
|
||||
stun_server: auto
|
||||
ssl:
|
||||
pem_certificate: /etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||
pem_key: /etc/ssl/private/ssl-cert-snakeoil.key
|
||||
@ -117,9 +118,13 @@ encoding:
|
||||
hextile_improved_compression: true
|
||||
|
||||
server:
|
||||
http:
|
||||
headers:
|
||||
- Cross-Origin-Embedder-Policy=require-corp
|
||||
- Cross-Origin-Opener-Policy=same-origin
|
||||
httpd_directory: /usr/share/kasmvnc/www
|
||||
advanced:
|
||||
x_font_path: auto
|
||||
httpd_directory: /usr/share/kasmvnc/www
|
||||
kasm_password_file: ${HOME}/.kasmpasswd
|
||||
x_authority_file: auto
|
||||
auto_shutdown:
|
||||
|
@ -1962,11 +1962,32 @@ sub DefineConfigToCLIConversion {
|
||||
name => 'httpd',
|
||||
configKeys => [
|
||||
KasmVNC::ConfigKey->new({
|
||||
name => "server.advanced.httpd_directory",
|
||||
name => "server.http.httpd_directory",
|
||||
type => KasmVNC::ConfigKey::ANY
|
||||
})
|
||||
]
|
||||
}),
|
||||
KasmVNC::CliOption->new({
|
||||
name => 'http-header',
|
||||
configKeys => [
|
||||
KasmVNC::ConfigKey->new({
|
||||
name => "server.http.headers",
|
||||
type => KasmVNC::ConfigKey::ANY
|
||||
})
|
||||
],
|
||||
toStringSub => sub {
|
||||
$self = shift;
|
||||
|
||||
my @values = @{ listify($self->configValues()) };
|
||||
|
||||
my $valuesStr = "";
|
||||
foreach $value (@values) {
|
||||
$valuesStr = $valuesStr . "-http-header '$value' "
|
||||
}
|
||||
chop($valuesStr);
|
||||
return $valuesStr;
|
||||
}
|
||||
}),
|
||||
KasmVNC::CliOption->new({
|
||||
name => 'IgnoreClientSettingsKasm',
|
||||
configKeys => [
|
||||
@ -2199,6 +2220,24 @@ sub DefineConfigToCLIConversion {
|
||||
isActiveSub => sub {
|
||||
$self = shift;
|
||||
|
||||
my $value = $self->configValue();
|
||||
isPresent($value) && $value ne 'auto';
|
||||
}
|
||||
}),
|
||||
KasmVNC::CliOption->new({
|
||||
name => 'StunServer',
|
||||
configKeys => [
|
||||
KasmVNC::ConfigKey->new({
|
||||
name => "network.udp.stun_server",
|
||||
validator => KasmVNC::PatternValidator->new({
|
||||
pattern => qr/^(auto|\S+)$/,
|
||||
errorMessage => "must be 'auto' or an IP address/hostname"
|
||||
}),
|
||||
})
|
||||
],
|
||||
isActiveSub => sub {
|
||||
$self = shift;
|
||||
|
||||
my $value = $self->configValue();
|
||||
isPresent($value) && $value ne 'auto';
|
||||
}
|
||||
@ -2644,7 +2683,9 @@ sub ConfigToCmd {
|
||||
%optFromConfig = %{ ConstructOptFromConfig() };
|
||||
|
||||
my @cmd = map { $cliArgMap{$_}->toString() } (keys %optFromConfig);
|
||||
" " . join " ", @cmd;
|
||||
my $cmdStr = " " . join " ", @cmd;
|
||||
|
||||
return $cmdStr;
|
||||
}
|
||||
|
||||
sub ValidateConfig {
|
||||
|
Loading…
Reference in New Issue
Block a user