Using Theia inside a desktop application

Hi everyone! I have a very specific question about the deployment of Theia. Our use case is the following:

We want to use Theia as a part of a desktop application, but we can´t use Electron for it. Our goal is to display Theia still as browser content running in the background on localhost.
I was wondering, which requirements a client would need to run the production build in the background and also which folder(s) exactly is/are needed to deploy Theia?

Some information about the general way of deploying Theia would be very nice!

[original thread by paulf98]

We actually embrace web tech as much as possible and avoid to use Electron APIs. So even in Electron we run the web server and content is fetched via http/ws requests.

Your app could start Theia web server and integrate it in your desktop framework similarly how we do it for Electron. You should be aware though that there are some security considerations which we worked out for Electron (https://github.com/eclipse-theia/theia/pull/7205) already and Theia app generator is not extensible to support custom target, so it won’t be easy to customize some UI element, i.e. to use native menu or context menus.

[paulf98]

Thanks for the quick reply! Okay that means we cannot use an Electron-Build because we cannot start the .exe and then access the App over localhost because of the security restrictions? So we need do develop theia as a browser application and start a local server in the background manually? So our clients must have a node installation on their machine right?

that means we cannot use an Electron-Build because we cannot start the .exe and then access the App over localhost because of the security restrictions?

security restrictions applied only if you use Electron target, I’ve only mentioned it that if you don’t use Electron you have to still consider securing access to Theia server

So we need do develop theia as a browser application and start a local server in the background manually?

You can do it like that.

So our clients must have a node installation on their machine right?

There should be tools which can create a single distributable which contain Node, Theia and so on.

[paulf98]

Thank you for the help, i used https://github.com/zeit/pkg to build an executable file which starts Theia on localhost, so a client must not have Node installed on his machine

Hmm… @paulf98 now you got me wondering what application that would be :wink:

[paulf98]

@tsmaeder the Theia application will be part of a project at a german university, don´t know what i am allowed to talk about here :wink:

What tech do you use at least to build the desktop app?

[paulf98]

It is for a research tool built in Unreal Engine. We use web tech for UI and integrate it via CEF.

Unreal Engine

haha…now I’ll have to know :wink:

[paulf98]

I realized that I still have a problem with packaging :frowning: Packaging Theia to an .exe-file and starting it in the directory works fine, but when I move the file out of the directory, it doesn´t work anymore. I also read about nexe . Is there a solution so that the configuration of the tools is suitable for Theia?

@paulf98 Did you have a look why? Is it related to some relative links? i.e. how node modules for json language server are looked up?

[paulf98]

So i used zeit-pkg and created an own bin file with a workaround solution from stackoverflow:

#!/usr/bin/env node

var join = require('path').join
var childProcess = require('child\_process');
var args = process.argv.slice(2);

args.unshift(\_\_dirname + '/../');

childProcess.exec('yarn start', (err, stdout) => {
if (err) console.log(err);
console.log(stdout);
})