Hey so i started using Electron becouse of HTML/CSS/JS possibilites.
I have expirience mostly with PHP and some little with JS.
Was searching how to hide files of Electron (becouse .asar file can be unpacked) and its just stupid to put my MySQL server info in .js file and let users see that info..
Is there any way to hide atleast 1 .js file where i would put all necessery stuff like mysql connection and mysql managing?
I googled a lot about that some people say that Node.JS can to that but i cant find anywhere how to exacly do it?
Tried to switch to CEFSharp but cant realise how to interact between C# and Webpage (used webserver for template and php stuff but like how to tell C# that variable of A is A and use that C# variable for something)..
Hope somebody will help me, maybe its dumb question for some expirienced developers but i mostly work in PHP and i wanna learn new stuff..
Thanks!
Long story in short - no. In deep down, any code you ship in client to users should be considered to be revealed, just matter of how hard will it be. Instead of shipping important credential and obfuscate to not able to read it, application should be designed to be safe even if user reads whole code in client.
I'm not really any sort of expert on Electron. I'll assume that you will either create a login or a config file. In the first case you can use the database to determine if access is allowed. If you don't want to setup a login script then you can use a config.json file that is not part of the build file. There are a few node packages you can use - I believe one is "electron-storage" to help with the access to the database. Hope this helps.
Johnf
Related
I'm working on a webapp that is currently running on a server, where there are also some .JSON files, which I would like the user to be able to type some information and press enter where it will be stored to the .JSON file.
The webapp is written in HTML, CSS, and vanilla Javascript, there aren't any external libraries being used.
I am already pulling information from the .JSON files to be used in the app using the GET function, and I know I can't directly modify server side files with javascript unless I'm running a Node.js server (which isn't currently an option).
So I believe my only option is to use a server side language such as PHP (which I nothing about), to modify the file. My question is, how can I do this relatively simply? Possibly when a JS function is run to push the change to the file.
Can anyone give me a sliver of example code, or point me in the direction of some simple documentation or tutorial on how to do this, I'm not very adept at server side programming at all, and as this is a simple project just for me, I don't want to dive deep into PHP at the moment.
Thank you in advanced!
So I believe my only option is to use a server side language such as PHP (which I nothing about), to modify the file.
Since you already know JavaScript, I'd revisit why you feel you can't use Node.js server-side. In any case, if you're going ahead with PHP...
To write files, file_put_contents().
To encode JSON, json_encode().
Note that there are other servers out there. You don't have to write your own stuff in PHP. If you don't need any checking on what's being sent, you can probably even modify your web server's config to accept a PUT.
I'm trying to find something that can run my javascript project so that I can send it as a finished project?
I've tried googling for results, which wasn't helpful.
I also found a few youtube videos. They didn't have much of what I wanted.
I have a friend who doesn't have javascript and I want to send him over my finished project. Either as a file or an application, but I'd like it to be sent over so he can see it without the use of javascript and seeing the code.
If they have a browser they have JavaScript. Package up your code as an HTML file that loads the JavaScript.
If this is a Node application then you may need to look at packaging it up differently. Installing Node isn't difficult, and it's available for pretty much anything that can compute.
For a more ambitious packaging you can use something like Electron to make a distributable application. This is a larger investment of time, but it's the easiest for the user to use.
I've a web working on a web page that's basically just a big table of links. I use javascript to read from a text file, parse it, and create a table based on that.
I'd like to be able to have a button on the page to add new a row of links and add them to the text file (or another file type if it's better).
I know you can accomplish this with php, node.js, and others, but all the methods I've found require server software to be running. Is there any way around this? For example, is there a way to use javascript to call a python script, or any other way?
The page is just for personal use, so I'd like to avoid running server software just to use it if possible. I know you can set it to download a text file, and you can save it in the same location, but I'd also like to avoid that.
From the research I've done, it doesn't seem possible, but I just thought I'd ask before I give up. Thanks in advance.
You can only read from files locally in browser with javascript.
This would be a huge security vulnerability if scripts in browsers could write files to your machine.
I have a small company and I need show my result from MySQL to amcharts.
I am easy user and I study this link but can't use this tut for myself because i don't undestand each code for which file and what manage my files to show chart for example witch code depend html file or js or php file.
i use netbeans and xampp for run codes.
please help me and if you can send me exmaple file that i can use amcharts.
thanks a lot.
Welcome to SO,
Here usually coders help for the major bugs which have been tried for long time still hard to find the solution and or help people who are constantly learning and facing some bugs...
For you, quick help I can give but you make sure you go through the code, learn some basics regarding that...
Download the link in tutorial tutorial_assets_external-data_v3.zip, extract it and place it in htdocs in xampp folder(c drive or where you installed it).
Run XAMPP, open this localhost/phpmyadmin in browser and create a database named "test".
Open the database and import the data.sql in extracted folder.
Run in browser localhost/"specify_name_of_extracted_folder"
Start small... Study the tutorial... enjoy coding
I have some text stored in a POST variable that I need to append to an HTML file. I want to do within my PHP webpage, but it could use HTML, JQuery, Javascript, or anything else that will run natively. I've tried the PHP approach, but it hasn't worked despite my numerous attempts. Always a 500 internal server error. And I can't find anything on writing to files using JQuery, so if anyone out there knows something I don't, it would be appreciated. Thanks :)
Writing directly to you html/php documents is extremely bad practice. As your comment said you need to validate the input and if you make a mistake you could screw up your whole website.
There are a couple of options you could use:
localstorage: This saves the changes to the browser of the user. This means that the changes wont be on the server. Very easy solution.
Add a database: With PHP it is very easy to add a SQL databse. Write some functions that write the data to the database and read the data from there. Safer than writing directly to HTML/PHP but still needs validation
Do some extreme reading into all the PHP IO functions. You need some extreme good handling if you want this site live.
I think that with the DB you`ll manage, just be safe and build in some security