fix(tools): save screenshots to states table

main
Tsu-ba-me 3 years ago
parent c1859bc8d8
commit f61527edf7
  1. 8
      cgi-bin/get_server_screenshot
  2. 6
      tools/anvil-get-server-screenshot

@ -78,7 +78,13 @@ sub get_screenshot
sleep(2);
}
my ($encoded_image) = $anvil->Database->read_variable({ variable_name => "server_screenshot::".$server_uuid });
my $query = "
SELECT state_note
FROM public.states
WHERE state_name = ".$anvil->Database->quote("server_screenshot::".$server_uuid)."
;";
my $encoded_image = $anvil->Database->query({ query => $query, source => $THIS_FILE, line => __LINE__ })->[0]->[0];
return $encoded_image;
}

@ -72,9 +72,9 @@ sub insert_server_screenshot
my $server_uuid = $parameters->{server_uuid};
my $encoded_image = $parameters->{encoded_image};
$anvil->Database->insert_or_update_variables({
variable_name => "server_screenshot::".$server_uuid,
variable_value => $encoded_image
$anvil->Database->insert_or_update_states({
state_name => "server_screenshot::".$server_uuid,
state_note => $encoded_image
});
}

Loading…
Cancel
Save