Initial commit

This commit is contained in:
2025-04-12 10:34:26 -04:00
parent 06ffcc1400
commit f094a1f705
11 changed files with 315 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?php $url = $block->getCustomUrl(); ?>
<script type="text/javascript">
require(["jquery"],function($) {
$('#whi_test_connection').click(function() {
if (!confirm('Save the configuration before testing.')) {
return;
}
$.ajax({
url: "<?php echo $url; ?>",
type: 'GET',
complete: function (response) {
switch (response.status) {
case 204:
alert('Connection successful.');
break;
case 401:
case 403:
alert('Invalid API key.');
break;
default:
alert('Failed to connect to the provided URL.');
break;
}
}
});
});
});
</script>
<?php echo $block->getButtonHtml(); ?>
<p><sub><em>Note: Currently only works in Chromium-based browsers (Firefox blocks script execution).</em></sub></p>