OpenGammaProject / Gamma-MCA

☢️📊 Progressive Web App MCA for gamma spectroscopy including file and live plot support via a serial interface.
https://spectrum.nuclearphoenix.xyz
GNU General Public License v3.0
35 stars 9 forks source link

Simple standalone executable #74

Closed falcon2809 closed 1 year ago

falcon2809 commented 1 year ago

Hallo Phoenix 1747

i would like to ask ,is there any Possibility to create a real OFFLINE APP which could be executed as .EXE. The Gamma MCA (and also the i would say OFFLINE Subfunction) is coupled on Restrictions concerning Browser Version and Types. So if you not fulfill all Requirements very exactly you have unfortunately no Chance for a good read out of the USB connected Hardware. I have a MAC OS Chrome 103 Version which should normally support your MCA .......but it doesent (some Zertificat Troubles from Chrome)

Thank you

Steffen

NuclearPhoenixx commented 1 year ago

Hi Steffen,

I know that it can be frustrating if the browser doesn't support any function of the program, that's unfortunately how web development works. But maybe I can help you with getting it to run on your machine or at least identifying the issue here so that it might be patched in the future. It's always very hard to be compatible with older and older version of very different browsers and my time is limited so I cannot really guarantee everything to work flawlessly except for the newest versions.

Can you give me some more detail on what does or does not work? Also, what is preventing you from upgrading Chrome, version 103 is close to being a year old at this point? This would probably be the easiest way to solve this issue, I think.

A real downloadable executable would be possible through an electron app, although this would mean a lot of additional work. It's not trivial to do well.

falcon2809 commented 1 year ago

Hallo Phoenix 1747,

first of all thank you for your quick answer. So my Setup is an Mac Pro 2010 (which is still an Intel Maschine with a lot of Expansions, that why i can not move so fast to an newer one) I operate it with MAC OS El Captain 10.11 with an Chrome Version 103.0.5060.134 . First what i get if i try to open : https://spectrum.nuclearphoenix.xyz/ is : Dies ist keine sichere Verbindung .......if i say him ignore that, than i get an endless Loading of your Site.......that was my Experience with Gamma MCA.

Unfortunately i can not upgrade Chrome cause google blocks this upgrade path. I have to upgrade first my System, which is by Hardware not possible or only with an unsupported Apple EFI Update. and so on ....and so on

By the way i had just 2 Weeks ago an similar Behavior with an "WebView" based Software called "Interspec" (which operates actually also as an "native" app) from William Johnson. He could prove my Problem and ..yes..he ported this on Electron and than i operate in an seperate Window- Menue, but it works immediately without any Problems.

Your Gamma MCA should work with Alexey Boguslavsky`s Nuclear Pioneer MCA Multichannel Analyzer , which is actually possible, cause i tested this with an Windows 10 Maschine.........which i dont have. Our Software should easely display the Live Data from the Nuclear Pioneer as an so to say "bigger Display" as Alex 3,5 inch LCD.I Hope the Attachement is readable. Maybe you find a way in the Future. I know it is lot of Work and William J. has other "Possibilities" ((-: of Course.

Thank you

Steffen Eckel

IMG_0889 IMG_0892 IMG_0894

NuclearPhoenixx commented 1 year ago

first of all thank you for your quick answer. So my Setup is an Mac Pro 2010 (which is still an Intel Maschine with a lot of Expansions, that why i can not move so fast to an newer one) I operate it with MAC OS El Captain 10.11 with an Chrome Version 103.0.5060.134 . First what i get if i try to open : https://spectrum.nuclearphoenix.xyz/ is : Dies ist keine sichere Verbindung .......if i say him ignore that, than i get an endless Loading of your Site.......that was my Experience with Gamma MCA.

Unfortunately i can not upgrade Chrome cause google blocks this upgrade path. I have to upgrade first my System, which is by Hardware not possible or only with an unsupported Apple EFI Update. and so on ....and so on

Oh, I see. Thanks for your explanation. It looks like there is really no way around it if Chrome already has problems with standard SSL certificates. And it's really a shame that both Google and Apple somewhat block you from upgrading your system...

I can try to set up a very simple electron app that just loads the website like in any other browser. I wouldn't need to change anything with the main app, but it would allow you to bypass your already installed browser.

By the way, nice setup. I really think that the NuclearPioneer looks awesome ;)

falcon2809 commented 1 year ago

Hallo Phoenix

thank you, than i`am looking forward. It would be nice.

Steffen

NuclearPhoenixx commented 1 year ago

Okay it turns out porting the website to a standalone executable is a trivial task with nativefier. However, the problem with this approach is the same as with using electron:

The WebUSB and Web Serial API device pickers do not show up like in a browser. Instead, developers are expected to code in a GUI for this themselves. See https://github.com/electron/electron/issues/14545. That means that while you can use the app just like usual with this approach, I would need to make some modifications to the app itself to get the entire serial connection tab to work again.

However, I don't have the experience with electron nor the time at the moment to do that easily. If anyone wants to help out, please feel free to let me know by commenting down here or give this post a thumbs up.

NuclearPhoenixx commented 1 year ago

In the mean time, is there an option like "Erweiterte Informationen" or something like that under the error/warning message when you go to the website? If yes, then there should also be a link for "Weiter zu ... (unsicher) that you can click to ignore the message.

falcon2809 commented 1 year ago

....." yes, then there should also be a link for "Weiter zu ... (unsicher) that you can click to ignore the message."....yes exactly that what i do but after that the Gamma MCA takes over in the endless Loading Mode )-:

NuclearPhoenixx commented 1 year ago

I see, can you maybe open the developer console by right-clicking in the browser page, select "Untersuchen" from the menu and then go to "Konsole" in the newly opened window?

falcon2809 commented 1 year ago

hallo, answer via emai maybe are not given yesterday, okay than here again , yes window open with "untersuchen"....

falcon2809 commented 1 year ago

..-okay i see under "Console" Submenue the following Message :

An SSL certificate error occurred when fetching the script. main.ts:302 Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ('https://spectrum.nuclearphoenix.xyz/') with script ('https://spectrum.nuclearphoenix.xyz/service-worker.js'): An SSL certificate error occurred when fetching the script.

-the Menue Elements show :

-and :

-and :

Bildschirmfoto 2023-04-07 um 11 16 56 (2)

NuclearPhoenixx commented 1 year ago

Okay, thank you!

So apparently Chrome allows you to manually bypass the SSL problems with the website, but that doesn't apply to all the Javascript loading which is great for security of course, but it's stupid because not the SSL certificates are a problem here, but the browser itself. I can't really help you with this unfortunately.

In the mean time, I can again only reference this comment: https://github.com/OpenGammaProject/Gamma-MCA/issues/74#issuecomment-1498877275 A standalone would solve this problem, however, there is no way I can think of that makes it not a complete pain to implement the serial connection features.

falcon2809 commented 1 year ago

okay thank you for your Time

NuclearPhoenixx commented 1 year ago

Actually, I just had another thought and maybe this is a solution for you! Are you able to use Python on your machine? Just plain old Python 3...

Here is a tiny script that creates a local webserver that you can open in your browser. It can serve Gamma MCA for you locally without the need for an executable. It should work in your browser since there are no SSL certificates involved.

https://github.com/OpenGammaProject/Gamma-MCA/blob/dev/run_locally.py

from http.server import SimpleHTTPRequestHandler, HTTPServer

PORT = 80

Handler = SimpleHTTPRequestHandler
httpd = HTTPServer(("localhost", PORT), Handler)

print(f"Serving on http://localhost:{PORT}")
httpd.serve_forever()

You just have to put the script in the main Gamma MCA folder and launch it, then go to Chrome and open http://127.0.0.1.

Let me know if this works!

NuclearPhoenixx commented 1 year ago

Do you want to give it a try @falcon2809?

falcon2809 commented 1 year ago

Hi Phoenix,

Syntaxfehler

„„from““ kann hier nicht verwendet werden.

..mmmhhhh no Idea

NuclearPhoenixx commented 1 year ago

What version of Python are you using?

falcon2809 commented 1 year ago

3.7 , but i used the Appke Scribt Editor ...okay no i have ti use Phyton ? Here i nedd a step by step davise,sorry

falcon2809 commented 1 year ago

uups sorry i see it is 3.11

NuclearPhoenixx commented 1 year ago

Can you right-click on the python file itself and does it show any execute button or something like that?

If it doesn't work this way, do you know how to open a command line or some other terminal?

You can also try installing the Python IDE called "IDLE". It will certainly be able to execute the script. If you cannot find it, you can also try to manually install Python from the website. The default install includes IDLE.

Unfortunately, I have absolutely no experience with any Apple device whatsoever, so I really cannot help you too much with this. Sorry. By the way, the script works perfectly fine in Python, so maybe the Apple Script Editor is not setup correctly, no idea.

falcon2809 commented 1 year ago

...i have it already IDLE (IDE 3.11) and under -RUN this Module- Menue there are only Syntax Problems "invalid syntax" or "invalid decimal literal" , okay i see nothing goes over a nativ Programm.... pitty but not to Change for me

NuclearPhoenixx commented 1 year ago

Yeah okay, if you're running into permission problems you can change the port to something like 8080 instead of 80.

Other than that, I can't help you, I'm sorry. It works on every machine I tested it on, including Linux and Windows. Maybe you can use the Google Chrome extended release?

If someone wants to have a go at an electron app, feel free to do so. See https://github.com/OpenGammaProject/Gamma-MCA/issues/74#issuecomment-1498877275.