mirror of
https://git.proxmox.com/git/pve-http-server
synced 2025-08-13 19:00:47 +00:00
new helper add_dirs (copied from pveproxy.pm)
This commit is contained in:
parent
225bad0c07
commit
911ede9b12
@ -8,6 +8,7 @@ use POSIX qw(strftime EINTR EAGAIN);
|
|||||||
use Fcntl;
|
use Fcntl;
|
||||||
use IO::File;
|
use IO::File;
|
||||||
use File::stat qw();
|
use File::stat qw();
|
||||||
|
use File::Find;
|
||||||
use MIME::Base64;
|
use MIME::Base64;
|
||||||
use Digest::MD5;
|
use Digest::MD5;
|
||||||
use Digest::SHA;
|
use Digest::SHA;
|
||||||
@ -1577,6 +1578,7 @@ sub new {
|
|||||||
|
|
||||||
$self->{cookie_name} //= 'PVEAuthCookie';
|
$self->{cookie_name} //= 'PVEAuthCookie';
|
||||||
$self->{base_uri} //= "/api2";
|
$self->{base_uri} //= "/api2";
|
||||||
|
$self->{dirs} //= {};
|
||||||
|
|
||||||
# init inotify
|
# init inotify
|
||||||
PVE::INotify::inotify_init();
|
PVE::INotify::inotify_init();
|
||||||
@ -1649,6 +1651,24 @@ sub new {
|
|||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# static helper to add directory including all subdirs
|
||||||
|
# This can be used to setup $self->{dirs}
|
||||||
|
sub add_dirs {
|
||||||
|
my ($result_hash, $alias, $subdir) = @_;
|
||||||
|
|
||||||
|
$result_hash->{$alias} = $subdir;
|
||||||
|
|
||||||
|
my $wanted = sub {
|
||||||
|
my $dir = $File::Find::dir;
|
||||||
|
if ($dir =~m!^$subdir(.*)$!) {
|
||||||
|
my $name = "$alias$1/";
|
||||||
|
$result_hash->{$name} = "$dir/";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
find({wanted => $wanted, follow => 0, no_chdir => 1}, $subdir);
|
||||||
|
}
|
||||||
|
|
||||||
# abstract functions - subclass should overwrite/implement them
|
# abstract functions - subclass should overwrite/implement them
|
||||||
|
|
||||||
sub verify_spice_connect_url {
|
sub verify_spice_connect_url {
|
||||||
|
Loading…
Reference in New Issue
Block a user