Fix fullscreen launch and embedded Edge Console navigation
This commit is contained in:
parent
1e2e8d79d5
commit
3ddd2a2b1e
|
|
@ -524,7 +524,7 @@ LOCK="${LOCK_FILE}"
|
|||
export XDG_CONFIG_HOME=/var/lib/itscreen/config
|
||||
export XDG_DATA_HOME=/var/lib/itscreen/data
|
||||
export ITSCREEN_LOG_DIR=/var/lib/itscreen/logs
|
||||
exec flock -n "\$LOCK" /opt/itscreen/bin/itscreen fullscreen "\$@"
|
||||
exec flock -n "\$LOCK" /opt/itscreen/bin/itscreen --fullscreen "\$@"
|
||||
EOF
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
import pathlib
|
||||
import unittest
|
||||
|
||||
|
||||
INSTALLER = pathlib.Path(__file__).with_name("stage_itscreen_install.sh")
|
||||
|
||||
|
||||
class FullscreenContractTest(unittest.TestCase):
|
||||
def test_wrapper_passes_declared_command_line_option(self):
|
||||
installer = INSTALLER.read_text(encoding="utf-8")
|
||||
|
||||
self.assertIn("/opt/itscreen/bin/itscreen --fullscreen", installer)
|
||||
self.assertNotIn("/opt/itscreen/bin/itscreen fullscreen", installer)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
import pathlib
|
||||
import unittest
|
||||
|
||||
|
||||
FRONTEND = pathlib.Path(__file__).resolve().parents[1] / "frontend"
|
||||
|
||||
|
||||
class EmbeddedConsoleNavigationContractTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.source = (FRONTEND / "console.js").read_text(encoding="utf-8")
|
||||
|
||||
def test_local_service_links_can_navigate_in_embedded_webview(self):
|
||||
self.assertNotIn('target="_blank"', self.source)
|
||||
self.assertIn('browserHost === "127.0.0.1"', self.source)
|
||||
self.assertIn('browserHost === "localhost"', self.source)
|
||||
|
||||
def test_registration_reset_uses_console_dialog(self):
|
||||
reset_start = self.source.index("window.__itscreenReset = async function")
|
||||
reset_end = self.source.index("window.__setItscreenLogSearch", reset_start)
|
||||
reset_source = self.source[reset_start:reset_end]
|
||||
self.assertIn("await confirmAction(", reset_source)
|
||||
self.assertNotIn("window.confirm", reset_source)
|
||||
|
||||
def test_webui_service_is_named_edge_console(self):
|
||||
self.assertIn('label: "Edge Console"', self.source)
|
||||
self.assertNotIn('label: "Edge WEB UI"', self.source)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
@ -1314,7 +1314,7 @@
|
|||
const tunnelLinks = [
|
||||
{ name: "cockpit", label: "Cockpit", href: `https://${host}:9090` },
|
||||
{ name: "z2m", label: "Zigbee2MQTT", href: `http://${host}:8081` },
|
||||
{ name: "webui", label: "Edge WEB UI", href: `http://${host}:8099` }
|
||||
{ name: "webui", label: "Edge Console", href: `http://${host}:8099` }
|
||||
];
|
||||
const restartBusy = !!state.serviceActions.busyById[card.id];
|
||||
|
||||
|
|
@ -1386,7 +1386,7 @@
|
|||
${tunnelLinks.map((link) => {
|
||||
const tunnel = tunnels.find((item) => item.name === link.name);
|
||||
return tunnel && tunnel.active
|
||||
? `<a class="actionBtn" href="${esc(link.href)}" target="_blank" rel="noopener noreferrer">${esc(t(link.label))}</a>`
|
||||
? `<a class="actionBtn" href="${esc(link.href)}">${esc(t(link.label))}</a>`
|
||||
: `<button class="actionBtn" type="button" disabled>${esc(t(link.label))}</button>`;
|
||||
}).join("")}
|
||||
</div>
|
||||
|
|
@ -2089,6 +2089,8 @@
|
|||
}
|
||||
|
||||
function currentAccessHost() {
|
||||
const browserHost = textValue(window.location.hostname, "").toLowerCase();
|
||||
if (browserHost === "127.0.0.1" || browserHost === "localhost") return browserHost;
|
||||
const identity = state.identity || {};
|
||||
return textValue(identity && identity.endpoint_host, textValue(identity && identity.primary_ipv4, textValue(identity && identity.hostname, window.location.hostname || "localhost")));
|
||||
}
|
||||
|
|
@ -2132,7 +2134,7 @@
|
|||
<div class="actionRow serviceActionRow">
|
||||
${action ? (action.disabled
|
||||
? `<button class="actionBtn" type="button" disabled title="${esc(action.title)}">${esc(action.label)}</button>`
|
||||
: `<a class="actionBtn" href="${esc(action.href)}" target="_blank" rel="noopener noreferrer" title="${esc(action.title)}">${esc(action.label)}</a>`
|
||||
: `<a class="actionBtn" href="${esc(action.href)}" title="${esc(action.title)}">${esc(action.label)}</a>`
|
||||
) : ""}
|
||||
${restartable
|
||||
? `<button class="actionBtn secondary" type="button" ${busy ? "disabled" : ""} onclick="window.__restartService('${esc(card.id)}')">${esc(busy ? t("Restarting...") : t("Restart"))}</button>`
|
||||
|
|
@ -5467,7 +5469,12 @@
|
|||
};
|
||||
|
||||
window.__itscreenReset = async function () {
|
||||
if (!window.confirm(t("Reset current cloud registration?\n\nThe device will forget its current cloud binding and can be registered again."))) return;
|
||||
const confirmed = await confirmAction(
|
||||
t("Reset current cloud registration?"),
|
||||
t("The device will forget its current cloud binding and can be registered again."),
|
||||
t("Reset")
|
||||
);
|
||||
if (!confirmed) return;
|
||||
state.itscreen.error = "";
|
||||
state.itscreen.busyAction = "reset";
|
||||
if (state.activeTab === "tscreen") renderActiveTab();
|
||||
|
|
|
|||
Loading…
Reference in New Issue