]> git.proxmox.com Git - pmg-api.git/commitdiff
pmgproxy: implement cache workaround
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 28 Nov 2019 10:22:43 +0000 (11:22 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 28 Nov 2019 10:28:43 +0000 (11:28 +0100)
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 <d.csapak@proxmox.com>
src/PMG/Service/pmgproxy.pm

index 6249c55bcbc3079bcc1ed96583597429e5e185d6..e88d757e34381800317095308154c3e9326d36f2 100755 (executable)
@@ -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;