From: Dominik Csapak Date: Thu, 28 Nov 2019 10:22:43 +0000 (+0100) Subject: pmgproxy: implement cache workaround X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=3fb6d663a4bf13a2dc60616a7cd3226f9f132dd0;p=pmg-api.git pmgproxy: implement cache workaround we include the version of the packages in the temlate, so that we can tell the browser that the file has changed and thus preventing to load an old gui js file the index template has to add the version to the get parameter this is the same logic we use as in PVEs pveproxy Signed-off-by: Dominik Csapak --- diff --git a/src/PMG/Service/pmgproxy.pm b/src/PMG/Service/pmgproxy.pm index 6249c55..e88d757 100755 --- a/src/PMG/Service/pmgproxy.pm +++ b/src/PMG/Service/pmgproxy.pm @@ -215,6 +215,19 @@ sub get_index { $langfile = 1; } + my $wtversionraw = PVE::Tools::file_read_firstline("$widgettoolkit_dir/proxmoxlib.js"); + my $wtversion = ''; + if ($wtversionraw =~ m|^// (.*)$|) { + $wtversion = $1; + }; + + my $versionraw = PVE::Tools::file_read_firstline("$gui_base_dir/js/pmgmanagerlib.js"); + my $version = ''; + if ($versionraw =~ m|^// (.*)$|) { + $version = $1; + }; + + $username = '' if !$username; my $page = ''; @@ -227,6 +240,8 @@ sub get_index { console => $args->{console}, nodename => $nodename, debug => $args->{debug} || $server->{debug}, + version => $version, + wtversion => $wtversion, }; my $template_name;