Flash drive webserver - angularjs

Hopefully someone here can help me out.
Currently I have a small AngularJS app. I want to put this on an USB drive and make it very easy to run. The idea is someone can just plug in the drive click a file and run the app. I've been thinking about using node for this and then make a little script that would start the server and app. So people can click the script and the app runs. The problem is however (afaik) you need to have node installed on the computer which can't be done.
The client hasn't got his webserver running and still want to run the app. So please don't tell me why would you make an angular app and wanna run it without webserver.
Hopefully anyone has any solution or idea to make this work.
So in short:
AngularJS Application on USB
Plug in the USB, click a file and run the app in the browser.
Thanks for reading and thinking with me.

Have you considered running a standard web server on the USB Stick?
I see that you have suggested Node, but another alternative could be to use XAMPP?
XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.

Related

How to lock an exe file?

(Sorry in advance, if I have the wrong tags)
Hello!
So I am trying to work on a personal WPF project which would allow the client application exe to download another application exe (Unity Application) and open it within the client exe's Grid. Everything is working fine.
But, I am wondering if there's a way to "lock" the downloaded application in a way that only my client exe can open the downloaded exe?
Here's the only solution I have thought of but not sure with
Check for command line arguments within the Unity Applications
This works well but people who knows about the existence of decompiler might be able to decode that I am trying to check the arguments, and input relevant data there. :(. So, it won't help too much?
Thanks for any insights.
-Kevin
There is no non-hackable solution, you can only make it harder for crackers to break into the app by code obfuscation (hard to read the code) + adding integrity checks (make sure that your app is not modified).. There are commecial apps out there to do this (ex. PreEmptive), and their solutions differ from each other, nothing is ultimate.
Anyway, You might make Unity Application read some file or some registry value that Client application has updated just before launching the Unity Application, along with command line args method that you mentioned..

Packaging Sox inside electron / react app

I have made an electron-app using react. The app uses the command line-utility Sound eXchange (Sox) to manipulate audio. It works in my local environment, but every time i try to run the application on another device, i get the error: "sox could not be found". Naturally this error derives from the fact, that Sox isn't installed on this device.
Have anyone got a clue on how I can make sure that Sox is passed along with my application? I have tried downloading Sox and putting it inside my application, but I think I have to setup some kind of "environment path" then? Presumably, in my package.json file or perhaps in the node-module itself (which is Sox-audio).
If anyone knows how to crack this mystery, please do not hesitate to respond - It is much appreciated! Thanks in advance!

How to (semi-)automatically sync local files with remote devcontainer?

My Goal
I've been using devcontainers in combination with WSL2 for a little while now. But I keep running into issues and besides that I like off-loading resources of my laptop to a server. Moving the containers to a native Linux server would solve my issues.
My ideal situation would be to have a solution that works just like working locally on my Windows laptop (later probably moving to Macbook) but using the facilities of a Linux server (which has systemd and netns) and moving the workload there as well so my laptop doesn't sound like a vacuum cleaner.
My Journey
I'm trying to setup remote containers as described here: https://code.visualstudio.com/remote/advancedcontainers/develop-remote-host
Actually the containers are running fine, I'm using the second storage solution what means I add the following to my .devcontainer.json:
"workspaceMount": "source=/home/marvink/code,target=/workspaces,type=bind,consistency=cached"
And my workflow currently looks something like this:
Clone project locally (with .devcontainer already in the project)
Add workspaceMount above to devcontainer.json
Clone project on remote (e.g. to /home/marvink/code/new-project)
Open project locally
Build and reopen in container
Work on the files on the remote
My issue
This works but now I have files on my local drive that never get touched which isn't ideal but not a disaster, the bigger issue is when I want to update the devcontainer. I need to do that locally (in a seperate window), manually need to copy paste that to the remote if I want to commit it to git and off-course I sometimes forget this and try to edit it remotely which is causing a lot of frustration (and sometimes it seems like it does use the remote config, but that might have been a mistake?).
This is why I want to setup rsync both ways to sync changes to files and as a bonus I can edit files locally when I'm offline. In the link it's described how to do it manually but I want it automated so that I can't forget or make mistakes.
From Powershell I'm able to run an rsync command that syncs one-way and I can extend that to sync 2-way:
wsl rsync -rlptzv --progress --exclude=.git '$PWD' 'marvink#s-dev01:~/code/new-project'
This needs to be ran locally but I can't find a way to do that. I'd need to run a task locally for example, but that isn't possibly when working on a remote (https://github.com/microsoft/vscode-remote-release/issues/168).
The other way around doesn't seem like an option to me as I don't want to expose any ports on my laptop and firewalls would get in the way depending on where I am.
My question
My workflow still seems a bit convoluted so I'm open to suggestions on that end but any ideas on how to sync my workspace files?
You don't need a local version of your code (containing the .devcontainer folder) if you're storing that code on the remote server. You should be able to open an ssh target in VScode using the Remote - SSH extension, which is the recommended approach in the link you added. The extension Remote - Containers 'stacks' on top of the SSH extension, so once connected over SSH you then connect to the container using the .devcontainer.json configuration located on your remote server.
If you don't want to use the extension and use a bind mount + specify docker.host in your settings.json file, you can sync code using the approaches in that same article, through SSHFS, docker machine, or rsync.

WebkitGtk application is not loading file URL

I am building a kiosk application using webkitgtk on the raspberry pi 4.
This application will not be connected to the internet and all the html,css, javascript for the UI are all located on the local filesystem.
I am using buildroot to setup the Linux system, starting with the pi 4 defconfig provided in buildroot.
I have enabled all the packages needed to get webkitgtk running.
Also, the kiosk application has been tested on my desktop, using the same software stack and it works
However, when i try to launch the application on the raspberry pi, a blank page pops up. I have played around with the WebKitWebSettings object associated with my WebKitWebView by enabling local file access. It still shows up a blank screen.
Also included in my pi4 application bundle is a simple gtk3+ application. This launches successfully!
I will really appreciate some pointers as to why this is happening as i have sort of reached a dead end
UPDATE
I enabled the MiniBrowser app that comes with the Webkitgtk package.
Entering the local url, The page does not load. It only gives me a message at the top saying "Successfully downloaded".
It seems to be treating my input as a download
UPDATE 2
After some more experimenting, i was finally able to get webkitgtk working on the pi 4.
The problem seems to originate from using the webkit_web_view_load_uri() api.
It does not seem to recognize my html document as a web page.
I got around it using the webkit_web_view_load_html() call. This included some hacks by first reading in the contents of the html doc into a character buffer, and passing it to webkit_web_view_load_html().
You also have to provide a base path to this function call to be able to resolve all the urls (scripts, css, images etc) in your html document.
Another problem i haven't been able to work around is, SVG images are not loading in webkitgtk. I have used jpg formats and they work. I suspect this my be due to a configuration switch in building webkigtk
It's hard for me to figure out what might be happening without having access to your environment and settings. My gut feeling is that pages are showing blank because perhaps some shared libraries are missing. You can check that with:
$ ldd WebKitBuild/GTK/Release/bin/MiniBrowser
I am using buildroot to setup the Linux system, starting with the pi 4 defconfig provided in buildroot.
There's a buildroot repository for building WPE for RPi. WPE (WebPlatform for Embeded) is like WebKitGTK but doesn't depend on GTK toolkit. Another important difference is that WPE runs natively on Wayland.
If you're interested in having a webapp embedded in a browser running in a device with limited capabilities, WPE is a better choice than WebKitGTK. The buildroot repo for building WPE for RPi is here:
https://github.com/WebPlatformForEmbedded/buildroot
There's is also this very interesting step-by-step guide on how to build WPE for RPi3:
https://samdecrock.medium.com/building-wpe-webkit-for-raspberry-pi-3-cdbd7b5cb362
I'm not sure whether the buildroot recipe would work for RPi4. It seems to work for all previous versions, so you might be stepping in new land if you try to build WPE on RPi4.
If you have an RPi3 available I'd try to build WPE for RPi3 first, and make sure that works. Then try for RPi4.

Can I run a web app from usb with Bitlocker

As per the title, can I run a web application (AngularJS) from usb with Bitlocker.
I installed xampp portable, git portable and nodejs in usb. But I don't know my application can run normaly. I need distribute my application to many customer and secure my source code. Please let me know what I do is possible or not.
NOTE: my question is not duplicated with question Secure distribution of NODEJS application
Many Thanks

Resources