Interacting with Firebase (offline and online) - javascript

I now this is probably a dumb question, but I'm new to web development and I need to clarify this: to interact with Firebase, my code needs to be in a web server or a CDN, right? I can only test if the connection between Firebase and my files if they are online?
Thanks.

You can build and test Firebase apps without putting the files online anywhere. You can simply create a test.html on your local filesystem and open it in a browser (i.e. as a file://.../test.html url) and Firebase will work 100% fine.
Note that if you want to use Firebase Simple Login (for facebook/twitter/github/email+password auth), the files do have to be served by a web server. You can still do this locally though. You just have to spin up a local web server. This can be as easy as "python -mSimpleHTTPServer" if you're on a unix-like OS (linux, OSX, etc.). Then point your browser at http://localhost:8000/test.html or whatever.
You don't need to put the files online until you actually want to deploy your app and have other people use it.

Your server-side code will need to be on a server to execute, but that server doesn't need to be online. Try a local server like XAMPP or a bitnami stack

Related

How do I move a file located on the internet to my google cloud storage without downloading them?

I found this https://cloud.google.com/storage-transfer/docs/create-url-list but it is no way helpful to me as i dont have the size and have the md5 of the files and i cant even download them as they are too huge like 2 gb 3gb .
If anyone has knowledge of making a script that makes a tsv file for a public url of a file for Google cloud storage transfer job without downloading the file .
Thanks in advance
(i am not a developer so plz explain answer step by step)
Unfortunately, there is no such solution. You must download and upload the files manually!
But, there is an alternative solution if you're familiar with the cloud!
You can go for a cloud-based solution, if you don't want to download the files on your pc and upload them manually.
Like, your cloud server will pull the files from your predefined URLs, download them locally on that virtual machine, finally upload them on your Google Cloud Storage and remove the local file from the virtual machine.
All these can be done through a script which you have to write and run on that virtual machine.
You may launch a ubuntu virtual server from Digitalocean, AWS, GCP or any other cloud providers.
So, the steps are:-
Launch a ubuntu virtual server
Write automation script
Configure the server to run your script
Run your script
Now sleep!

NodeJS from localhost to online site

I have a site that I created using NodeJS and one page html/jquery everything is working as expected on the localhost provided but I'm getting some issue in putting that site online www.xxxx.com, I already got a .com domain but I don't know which configuration should I do on my site and on code , which mean is there steps to follow on the app.js which contain the localhost:3500 ?
This is the structure of my folder developped under VSCODE
and this is my statement app.js of the localhost
//start the server.
app.listen(3500, function () {
console.log('Example app listening on port 3500!');
});
Hope I mentioned everything
Best Regards
To host a website you don't' just need the domain name (.com) but you need the server and hosting as well.
Here you can find details:
Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu using NGINX (free and open-source)
https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04
For Windows:
https://www.rapidvaluesolutions.com/tech_blog/nginx-server-deploying-web-applications/
If you're like me who doesn't want to get into the configuration details of the host server, check out heroku. It's a platform-as-a-service that allows you to host a site really easily and it has a pretty generous free-tier. Not much will have to change code-wise maybe just making the port a variable.
One major issue I had with the platform is that you cannot save files on the filesystem using code, you'll have to use an external file storage like AWS.
The other, slightly minor issue is that you need to be using git to push your code to the heroku servers (Not really an issue tbh since you really should look into git if you aren't using it already)

Simulate XMLHttpRequest as from localhost or Remote Connection to a machine

I have a website hosted in ISS (can be other) that loads when it's called on localhost but not from extern :) like: http://:8081/Website.html.
The verification whether the website is called from localhost it's on the client in a js script that I can’t modify as it’s encrypted.
So I was thinking at two options:
Develop an ASP application that has a remote desktop connection to the machine that host the website (not some many example on how to).
Maybe configure the IIS configuration (didn't found how)
I'm out of ideas
Do you have any other solution or can you point on how can I do one of the above?
I have tried the WinForm solution from here: https://www.codeproject.com/kb/cs/remotedesktop_csharpnet.aspx and it doesn't work. And I prefer a website.
Updates:
The only working solution that I have for now is to configure a Remote Desktop Services (Web Access) as I hosted the application on Server 2008 R2. Then I only shared the browser that has the localhost page as default page
The javascript files are all minified and encrypted, meaning that if I search localhost as a word in all the files, nothing shows up. So fixing the client will be hard.
Is it possible to create a new Site Binding on IIS and access the site using the binding hostname? This requires your network DNS to register the hostname to the IP Address.
I assume you are dealing with encrypted(???) javascript that is hardcoded to display DOM only if it is loaded from localhost.
If by encrypted you mean minified you should still be able to find reference to "localhost" and modify javascript in minified version. If it is really encrypted by a wrapper of third party javascript library then I would suggest you to rewrite javascript. I mean how can there be any quality code in javascript code that is hardcoded to load only from localhost?
Fix the client and stop exploring other solutions like remote desktop connection. None of them are practical and sustainable solutions.
I think you need to use WebRTC, but it's supported for Chrome and Firefox. It allows two users to communicate directly, browser to browser using the RTCPeerConnection API.

Auto updating an html/angular app in client side

I'm building an app using angular. The app will run on the clients computer. When an update is there it will download a zip file from the server and upgrade the required files.
I guess js and html is incapable of copying and modifying files. Our first idea was to run a background application on the os to check for updates and do the updates as necessary. But what other approaches are there to achieve this?
Even if the application is offline, you can still host it, just use AppCache or something like it.
See this post for a tutorial:
http://www.sitepoint.com/creating-offline-html5-apps-with-appcache/

Enabling XSS from files hosted on local filesystem

I have HTML and JavaScript files on my filesystem for a mobile application that is in development. When the application is deployed to a mobile device, these files will be hosted on the local filesystem there, where XSS from file:// is not an issue. An important part of this application is sending XHR POST requests to a RESTful API.
It seems like XSS should not be a security issue for browsers if the files making the request are hosted on a local filesystem instead of deployed to a web server.
Does anyone know of a browser extension or configuration change that will enable XSS from files hosted on a local file system?
Well, although you will have to change the server and client code a little bit, it isn't very clean and you will have to trust the server, you can load the data as a javascript which contains a call to a function in your page and a big string or so as the parameter. This seems to be a good example.
Alternatively, you could serve the files from a local webserver and fiddle around with the hostsfile and document.domain.
I've found a useful link that's helped me execute POST requests from localhost to another domain. It is a Firefox hack that allows XSS from files hosted at localhost. It's not perfect, but it helps me get this thing developed.

Categories

Resources