Skip to content

Commit

Permalink
check the stable branch rather than the main branch for updates and i…
Browse files Browse the repository at this point in the history
…mprove the update notice
  • Loading branch information
tomjn committed Sep 19, 2024
1 parent a55582e commit ad3f5bd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions php/notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@
<p><a href="http://vvv.test" class="button">Visit the Dashboard</a></p>
</div>
<div id="vvv_update" class="top-notice box" style="display:none">
<p>There is an updated version of VVV, check the <a href="https://varyingvagrantvagrants.org/docs/en-US/installation/keeping-up-to-date/#thoroughly-updating-vvv">documentation</a> for how to upgrade.</p>
<p>There is an newer version of VVV <strong class="vvv_newest_version">???</strong>! </p>
<?php
if ( file_exists( '/vagrant/version' ) ) {
// note that at this time we cannot check for updates to be 100% sure,
// that requires a network connection which isn't always present
?>
<p>You are on <strong>v<?php echo trim( strip_tags( file_get_contents( '/vagrant/version' ) ) ); ?></strong>, You can run <code>git pull</code> then <code>vagrant up --provision</code> in your VVV folder to update. <a href="https://varyingvagrantvagrants.org/docs/en-US/installation/keeping-up-to-date/#minor-versions">More information on how to update.</a></p>
<?php
}
?>
</div>

<script>
Expand Down Expand Up @@ -103,13 +112,15 @@ function isValidPart(x) {
}
return 0;
}
fetch('https://raw.githubusercontent.com/Varying-Vagrant-Vagrants/VVV/master/version').then(function(response) {
fetch('https://raw.githubusercontent.com/Varying-Vagrant-Vagrants/VVV/stable/version').then(function(response) {
return response.text();
}).then(function(version) {
const currentVersion = document.querySelector('.version').textContent.trim();
if ( versionCompare( version.trim(), currentVersion ) > 0 ) {
document.querySelector('#vvv_update').style.display = 'block';
}
const matches = document.querySelectorAll('.vvv_newest_version');
matches.forEach( match => match.textContent = version.trim() );
});
// If it's not vvv.test then this site has failed to provision, let the user know
// also notify if the dashboard is being shown on the raw IP
Expand Down

0 comments on commit ad3f5bd

Please sign in to comment.