blob: 97f205aa4171496f22912aee535a56bd795d22fd [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright 2020 The Cobalt Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<meta charset="utf-8">
<title>test</title>
<script>
var changeChannel = null;
var targetChannel = null;
function tryChangeChannel() {
const currentChannel = window.h5vcc.updater.getUpdaterChannel();
const status = window.h5vcc.updater.getUpdateStatus();
if ((currentChannel == "") ||
((status != "App is up to date") &&
(status != "Update installed, pending restart"))) {
return;
}
if (currentChannel == "prod") {
window.h5vcc.updater.setUpdaterChannel(targetChannel);
console.log("channel was changed to " + targetChannel);
return;
}
if (status == "Update installed, pending restart") {
clearInterval(changeChannel);
console.log("update from " + currentChannel + " channel was installed");
return;
}
}
var query = window.location.search;
if (query) {
// Splits each parameter of the query into an array after removing the
// prepended "?".
query = query.slice(1).split("&");
}
query.forEach(part => {
if (part.startsWith("min_storage=")) {
window.h5vcc.settings.set("Updater.MinFreeSpaceBytes", part.split("=")[1]);
}
if (changeChannel) {
return;
}
if (part.startsWith("channel=")) {
targetChannel = part.split("=")[1];
changeChannel = setInterval(tryChangeChannel, 500);
}
});
</script>
</html>