Skip to content

Commit

Permalink
fix: fix checking for dev mode ip
Browse files Browse the repository at this point in the history
  • Loading branch information
reisxd committed Apr 20, 2024
1 parent 3ab3b8b commit 60625f9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ TizenBrew is a modular system, meaning you can install new modded websites and a

## Installation

To install TizenBrew, you need to have a Samsung TV (Tizen) device that has at least Tizen 3.0 (2017 or newer). There are two ways to install TizenBrew.
To install TizenBrew, you need to have a Samsung TV (Tizen) device that has at least Tizen 3.0 (2017 or newer). There are three ways to install TizenBrew.

### Using TizenBrew Installer

Expand Down
2 changes: 1 addition & 1 deletion tizenbrew-app/TizenBrew/config.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns:tizen="http://tizen.org/ns/widgets" xmlns="http://www.w3.org/ns/widgets" id="https://tizentube.live"
version="1.2.0" viewmodes="maximized">
version="1.2.1" viewmodes="maximized">
<access origin="*" subdomains="true" />
<tizen:app-control>
<tizen:src name='index.html' reload='disable'></tizen:src>
Expand Down
9 changes: 7 additions & 2 deletions tizenbrew-app/TizenBrew/js/wsClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function onMessage(msg) {
canLaunchModules = message.inDebug.webDebug;
send({ type: 'loadModules', modules: JSON.parse(localStorage.getItem('modules')) });
} else {
send({ type: 'canLaunchInDebug', isTizen3, tvIp: webapis.network.getIp() });
send({ type: 'canLaunchInDebug' });
/*
const failedStartupAttempts = parseInt(localStorage.getItem('failedStartupAttempts'));
if (failedStartupAttempts < 2) {
Expand Down Expand Up @@ -105,7 +105,12 @@ function onMessage(msg) {
break;
}
case 'canLaunchInDebug': {
if (message.status) {
if (message.status === null) {
setTimeout(() => {
send({ type: 'canLaunchInDebug' });
}, 1000);
break;
} else if (message.status) {
send({ type: 'relaunchInDebug', isTizen3, tvIp: webapis.network.getIp() });
tizen.application.getCurrentApplication().exit();
} else {
Expand Down
13 changes: 8 additions & 5 deletions tizenbrew-app/TizenBrew/service/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ module.exports.onStart = function () {
const server = new WebSocket.Server({ port: 8081 });

let adb;
let canLaunchInDebug = null;
global.inDebug = {
tizenDebug: false,
webDebug: false
};
global.currentClient = null;
createAdbConnection(null, null, true);

function createAdbConnection(isTizen3, ip, testConnection) {
let timeout = null;
Expand Down Expand Up @@ -43,22 +45,23 @@ module.exports.onStart = function () {
});
} else {
timeout = setTimeout(() => {
global.currentClient.send(JSON.stringify({ type: 'canLaunchInDebug', status: true }))
canLaunchInDebug = true;
adb._stream.removeAllListeners('close');
adb._stream.end();
}, 250);
}, 1000);

}
});

adb._stream.on('error', (e) => {
console.log('ADB connection error. ' + e);
global.currentClient.send(JSON.stringify({ type: 'canLaunchInDebug', status: false }));
clearTimeout(timeout);
canLaunchInDebug = false;
});
adb._stream.on('close', () => {
console.log('ADB connection closed.');
clearTimeout(timeout);
global.currentClient.send(JSON.stringify({ type: 'canLaunchInDebug', status: false }));
canLaunchInDebug = false;
});

}
Expand All @@ -79,7 +82,7 @@ module.exports.onStart = function () {
break;
}
case 'canLaunchInDebug': {
createAdbConnection(message.isTizen3, message.tvIp, true);
ws.send(JSON.stringify({ type: 'canLaunchInDebug', status: canLaunchInDebug }));
break;
}
case 'relaunchInDebug': {
Expand Down

0 comments on commit 60625f9

Please sign in to comment.