Is it possible to prompt user with simple html/css from nodejs and return data on submission? - node.js

One way is to start whole server open local host page and wait for response. but I was wondering it's possible to create simple popup and read input and send input etc.
Scenario: a web scraper that backs up hacker news comments, you put credentials, it logs in, scrape, and save it. All of this happens locally. Nothing online. Nothing public. Right now user would have to input stuff inside terminal/cmd which is not great experience for non devs.
Or lets say there is some node script that needs human input, quick to categorize data. you type node app.js it runs, opens a popup, you select settings, click next, next.. finally submit.. data gets returned to node script.

Related

Checking other users are viewing this page in Node Express

I have a NodeJs Express app and when a particular user goes to a page/route would like to identify and display if another user is currently viewing the page as well. So for example it would say "Jerry currently viewing this page" and someone else goes there.
Is there any easy/lightweight way to do this?
First off, with a regular web page, the server only knows who and when a page was requested. It doesn't, all by itself, know whether that user is still viewing that page or not. The user could have closed the browser, typed something else in the URL bar, the computer could have gone to sleep, etc...
Second off, even if the page is still being displayed in the browser, you can't know if someone is actually there at the computer or not. The best you could do is to try to keep track of activity in that web page (last mouse click, recent mouse movements over the web page, etc...).
Then, to even have any idea of the web page is even still open in the browser, you need some way of tracking that notion. There are two possibilities I can think of.
You can have some Javascript in the web page that regularly (say once every few minutes) sends a small little ajax call to your server that basically just says "I'm still here". This wouldn't know immediately when they left the page, but if the server finds that the usual every few minutes ajax call didn't come, then the server can change the status of that user on that page to not there any more.
If that web page makes a webSocket or socket.io connection to the server and keeps that connection alive, then whenever the browser closes or the user closed that tab or navigates to another page, that webSocket or socket.io connection will get automatically closed and the server will be notified that the socket got closed. Using this technique, the server can know pretty much right away when the user leaves the page.

Doing something in the background and notify user when it's done

I am using nodejs has my server and React in the frontend.
There is a menu item on the UI that says View PDF, what I need to do is to get some PDF files from my S3 bucket when users choose this menu item, put some headers etc.
I can easily put a modal screen to show users the PDF files are being generated and display a link to the PDF when it's ready.
But what technology should I use if I want to do away the modal screen, but to allow users to continue to do some other stuffs and display a say dismissable alerts with the link to the PDF when it's ready.
How difficult is that and what do I need?
Definitely take a look at socket.io.
Web sockets allow you to establish two way communication between the client and server. For your use case, this means you can send a notification to the the client from the server.
This is not too difficult to implement but will require a bit of work on both the client and the server. You can find a lot of React examples here.

Logging into a website and then getting asp data in BeautifulSoup4 in Python3

I have to do following tasks:
a. Login into a router GUI with user and password
b. You'll land on http://192.168.10.1/index.asp
c. Navigage to http://192.168.10.1/html/common/getneighbourAPinfo.asp and get all data in a json or text file.
I can go directly to the link provided in point "c" if I have logged into the router in another tab. Otherwise it doesnt go ahead.
Is there any way to start a logged in session and then go to the link and get data? All of that in terminal?
Currently I am using pyautoGUI to get data via GUI.

How to track last login date for IBM Domino web user?

Does IBM Domino track the last login date for web users(UserName/Password and internet certificate)? I know the access logs contains this information but wanted to know if there may be something built into Domino (maybe in Address Book). Trying to come up with a method to disable web accounts that have not accessed a domino server in a specified time period.
Thanks,
Kev
The User Activity area in the Database Properties picks up from the log.nsf, which is where this information is stored. But, typically, the log.nsf will only have a few days' worth of information. When I've had this requirement before, I've manually captured it via a custom login page or an initUser function I've had in applications.
One of the easiest solutions is to trigger an action from a live web page that generates a database.nsf?openagent event.
like:
or
Ideally you've use the openagent to print a content type and a response, but if you don't browsers do pretty well with invalid responses from servers.
inside your "myagent" you will have the users name available to you to write it to a document.
Your next challenge will be in getting the agent to trigger, but, not too often, ideally only on login.
When a user uses a custom login form it submits the username/password and redirection url in POST method. You could change that to ...?openagent&nexturl=/blablabla.nsf
Your tiny little agent would run one and only one time upon login and update a document in a your custom logging database.
That's a developer's solution.
There are also admin solutions. The server does keep track of active web sessions, but, it does not drop them into the log.nsf like it does upon session ending for a notes session. I don't think it would be too much work from an admin standpoint to get that information there are a lot of event triggers available to you. It's just been way too long since I worked on any server that anyone cared about statistics.

Intuitive Website owner verification

Hello I'm developing a web app where the user needs to verify that they are the "Owner" of the website. I know there is code verification but how would I check if that verification is on their site without over complicating the verification method?
Also, I'm thinking about giving the site owner an hour to verify, how would I automatically detect if the hour is over and be able to delete them from the database?
The way Google or Yahoo do this is to require the webmaster to create a file with a special cryptic name (the file length can be 0), which is generated by Google/Yahoo. Could be something like "dsaa6fd4sgfdsf324gd.html". So you generate such a unique (name) string for each websit eto be verified, store it in the DB, and then you go and try to GET it from that site. If the GET succeeds you can set "verified=true" in the DB for that site and file name.
To answer the 1hr question we'd have to know what technology you are using. There are many options to run timed background jobs from a web application. Usually you write the job details into the database, and have a background daemon check the DB periodically and execute any pending jobs. You could tell it (that daemon) to execute a job one hour later to see if the file (see above) exists. Well, you have to do it that way in any case, it's no use simultaneously telling the webmaster to create that file and check for it right away :)

Resources