Private
Public Access
Release 0.13.0
This commit is contained in:
1 parent
7f6eeab39e
commit
c0d891b372
49 files changed
+1523
-478
No files matched your search
+48
-2
@@ -1,6 +1,26 @@
|
||||
'use strict';
|
||||
var pending = [];
|
||||
var actionError = '';
|
||||
var versionCompatible = typeof HYPERDRM_APP_VERSION === 'undefined';
|
||||
|
||||
function checkServiceVersion(result) {
|
||||
if (typeof HYPERDRM_APP_VERSION === 'undefined' || result.returnValue === false) return;
|
||||
versionCompatible = result.version === HYPERDRM_APP_VERSION;
|
||||
var warning = document.getElementById('versionWarning');
|
||||
warning.style.display = versionCompatible ? 'none' : 'block';
|
||||
document.getElementById('reloadService').style.display = versionCompatible ? 'none' : 'inline-block';
|
||||
warning.textContent = versionCompatible ? '' : 'App ' + HYPERDRM_APP_VERSION + ' / service ' + (result.version || 'unknown') + '. The installed service does not match this app. Finish the update, then select Reload service before changing settings. Reloading briefly stops ambient lighting.';
|
||||
['start', 'autostart', 'handover', 'saveTarget', 'testConnection', 'calibrate', 'validateCalibration', 'saveProfile'].forEach(function(id) {
|
||||
var button = document.getElementById(id);
|
||||
if (!versionCompatible) {
|
||||
button.versionBlocked = true;
|
||||
button.disabled = true;
|
||||
} else if (button.versionBlocked) {
|
||||
button.versionBlocked = false;
|
||||
button.disabled = id === 'handover' ? !result.piccapInstalled : id === 'testConnection' && result.connectionTest && ['Connecting', 'Sending request', 'Checking authentication', 'Reading LED layout'].indexOf(result.connectionTest.state) >= 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showActionError(message) {
|
||||
actionError = message || '';
|
||||
@@ -32,6 +52,13 @@ function showProfile() {
|
||||
}
|
||||
|
||||
function call(method, done, data) {
|
||||
if (!versionCompatible && ['start', 'autostart', 'handover', 'settings', 'testConnection', 'calibration', 'calibrationSession', 'calibrationDraft'].indexOf(method) >= 0 && !(method === 'calibrationSession' && data && data.enabled === false)) {
|
||||
done({
|
||||
returnValue: false,
|
||||
errorText: 'App and service versions do not match. Finish the update first.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (['start', 'stop', 'autostart', 'handover', 'settings', 'testConnection', 'calibration'].indexOf(method) >= 0) clearActionError();
|
||||
callUri('luna://org.webosbrew.histogramhyperion.service/' + method, function(result) {
|
||||
if (method !== 'status' && result.returnValue === false) showActionError(result.errorText || 'The action failed.');
|
||||
@@ -117,10 +144,11 @@ function display(result) {
|
||||
toggle.textContent = 'Autostart: ' + (result.autostart ? 'On' : 'Off');
|
||||
}
|
||||
document.getElementById('error').textContent = actionError || result.errorText || result.error || '';
|
||||
document.getElementById('status').textContent = result.returnValue === false ? 'Service unavailable' : (result.running ? 'Running' : 'Stopped') + ' · ' + (result.frames || 0) + ' acknowledged color updates';
|
||||
document.getElementById('status').textContent = result.returnValue === false ? 'Service unavailable' : (result.receiverConnecting ? 'Connecting to receiver' : result.running ? 'Running' : 'Stopped') + ' · ' + (result.frames || 0) + ' acknowledged color updates';
|
||||
if (result.activeSource === 'PicCap') {
|
||||
document.getElementById('status').textContent = 'PicCap · ' + (result.running ? 'Running' : 'Switching capture source') + ' · ' + (result.piccapConnected ? 'Receiver connected' : 'Waiting for receiver');
|
||||
document.getElementById('regions').textContent = '';
|
||||
checkServiceVersion(result);
|
||||
return;
|
||||
}
|
||||
if (result.piccapHandover) document.getElementById('status').textContent += ' · HyperDRM · ' + result.playbackProtection;
|
||||
@@ -143,7 +171,25 @@ function display(result) {
|
||||
e.title = 'Histogram ' + index;
|
||||
box.appendChild(e);
|
||||
});
|
||||
checkServiceVersion(result);
|
||||
}
|
||||
document.getElementById('reloadService').onclick = function() {
|
||||
var button = this;
|
||||
button.disabled = true;
|
||||
clearActionError();
|
||||
call('restartService', function(result) {
|
||||
if (result.returnValue === false) {
|
||||
button.disabled = false;
|
||||
showActionError(result.errorText || 'Reinstall the current package, then restart its service.');
|
||||
return;
|
||||
}
|
||||
setTimeout(function() {
|
||||
button.disabled = false;
|
||||
call('status', display);
|
||||
}, 1500);
|
||||
});
|
||||
};
|
||||
|
||||
document.getElementById('start').onclick = function() {
|
||||
call('start', function(r) {
|
||||
if (r.returnValue === false) display(r);
|
||||
@@ -347,6 +393,6 @@ document.getElementById('editProfile').onclick = function() {
|
||||
showProfile();
|
||||
if (advancedProfile) document.getElementById('customProfileField').focus();
|
||||
};
|
||||
setupRemoteNavigation(['overviewTab', 'receiverTab', 'calibrationTab', 'grantRoot', 'start', 'stop', 'refresh', 'autostart', 'handover', 'calibrationShortcut', 'receiver', 'hostField', 'portField', 'piccapPortField', 'tokenField', 'clearToken', 'saveTarget', 'testConnection', 'calibrate', 'validateCalibration', 'profile', 'saveProfile', 'editProfile', 'customProfileField', 'cancelCalibration'].map(function(id) {
|
||||
setupRemoteNavigation(['overviewTab', 'receiverTab', 'calibrationTab', 'reloadService', 'grantRoot', 'start', 'stop', 'refresh', 'autostart', 'handover', 'calibrationShortcut', 'receiver', 'hostField', 'portField', 'piccapPortField', 'tokenField', 'clearToken', 'saveTarget', 'testConnection', 'calibrate', 'validateCalibration', 'profile', 'saveProfile', 'editProfile', 'customProfileField', 'cancelCalibration'].map(function(id) {
|
||||
return document.getElementById(id);
|
||||
}), document, window);
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"id": "org.webosbrew.histogramhyperion",
|
||||
"version": "0.12.0",
|
||||
"version": "0.13.0",
|
||||
"vendor": "Local development",
|
||||
"type": "web",
|
||||
"main": "index.html",
|
||||
|
||||
+2
-1
@@ -21,6 +21,7 @@ nav{border-bottom:1px solid #456185;padding-bottom:10px;margin-bottom:18px}nav b
|
||||
<h1><img src="logo.png" alt="" width="76" height="76">HyperDRM</h1>
|
||||
<nav aria-label="App sections"><button id="overviewTab" aria-pressed="true">Overview</button><button id="receiverTab" aria-pressed="false">Receiver</button><button id="calibrationTab" aria-pressed="false">Calibration</button></nav>
|
||||
<p id="status" role="status">Checking service …</p><p id="error" role="alert"></p>
|
||||
<p id="versionWarning" role="alert" style="display:none"></p><button id="reloadService" style="display:none">Reload service</button>
|
||||
<section id="overviewPanel" aria-label="Overview">
|
||||
<button id="grantRoot" class="primary" style="display:none">Enable Root Access</button><p id="rootHint" style="display:none"><small>Homebrew Channel grants root to the HyperDRM service. The service then restarts with its updated permissions.</small></p>
|
||||
<div role="group" aria-label="Service controls"><button id="start" class="primary">Start</button><button id="stop">Stop</button><button id="refresh">Refresh status</button></div>
|
||||
@@ -55,4 +56,4 @@ nav{border-bottom:1px solid #456185;padding-bottom:10px;margin-bottom:18px}nav b
|
||||
<div id="customEditor" style="display:none"><div id="customProfileField" class="field wide" tabindex="0" role="button" aria-label="Custom profile JSON, press OK to edit"><label>Custom model profile JSON<textarea id="customProfile" tabindex="-1" readonly rows="4" maxlength="2048" disabled spellcheck="false"></textarea></label></div></div>
|
||||
</fieldset></section>
|
||||
<button id="cancelCalibration" disabled>Cancel calibration</button><video id="calibrationVideo" src="calibration.mp4" muted preload="auto" playsinline></video>
|
||||
<script src="remote.js"></script><script src="calibration.js"></script><script src="navigation.js"></script><script src="app.js"></script><script src="wizard.js"></script></html>
|
||||
<script src="version.js"></script><script src="remote.js"></script><script src="calibration.js"></script><script src="navigation.js"></script><script src="app.js"></script><script src="wizard.js"></script></html>
|
||||
@@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
var HYPERDRM_APP_VERSION = '0.13.0';
|
||||
@@ -89,6 +89,10 @@ function wizardSample() {
|
||||
}
|
||||
|
||||
function wizardStart(validation) {
|
||||
if (typeof versionCompatible !== 'undefined' && !versionCompatible) {
|
||||
document.getElementById('wizardStatus').textContent = 'Finish the app/service update before calibration.';
|
||||
return;
|
||||
}
|
||||
if (wizard) return;
|
||||
if (typeof showPanel === 'function') showPanel('calibration', false);
|
||||
if (targetDirty || profileDirty) {
|
||||
|
||||
Reference in new issue
Block a user