Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions client/services/tizenbrew-installer-service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports.onStart = function () {
const { join, dirname } = require('path');
const { parsePackage, installPackage } = require('./utils/PackageInstallation.js');
const { Connection, Events } = require('./utils/wsCommunication.js');
const { homedir } = require('os');
const { homedir, networkInterfaces } = require('os');
const AccessInfoHTMLPage = require('./utils/HTMLPage.js');
const PushFile = require('./utils/FilePusher.js');

Expand All @@ -33,7 +33,12 @@ module.exports.onStart = function () {
const app = express();
if (!isTV) {
// Enable static file serving for frontend
console.log('Open up http://localhost:8091/ui/dist/index.html to access the TizenBrew Installer.');
const exposedAddress =
Object.values(networkInterfaces())
.flat()
.filter(networkInterface => !networkInterface.internal)[0]
.address; // Get the first non-internal network interface IP address
console.log(`Open up http://${exposedAddress}:8091/ui/dist/index.html to access the TizenBrew Installer.`);
if (existsSync(`${process.platform === 'win32' ? 'C:\\' : '/'}snapshot/client`)) {
app.use(express.static(`${process.platform === 'win32' ? 'C:\\' : '/'}snapshot/client`));
} else app.use(express.static(join(__dirname, '../../')));
Expand Down
3 changes: 2 additions & 1 deletion client/ui/src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export default function App() {


function startService(context) {
const testWS = new WebSocket('ws://localhost:8091');
const host = location?.host ?? 'localhost:8091';
const testWS = new WebSocket(`ws://${host}`);

testWS.onerror = () => {
const pkgId = tizen.application.getCurrentApplication().appInfo.packageId;
Expand Down
3 changes: 2 additions & 1 deletion client/ui/src/components/WebSocketClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const Events = {
class Client {
constructor(context) {
this.context = context;
this.socket = new WebSocket('ws://localhost:8091');
const host = location?.host ?? 'localhost:8091';
this.socket = new WebSocket(`ws://${host}`);
this.socket.onopen = this.onOpen.bind(this);
this.socket.onmessage = this.onMessage.bind(this);
this.socket.onerror = () => location.reload();
Expand Down