WebExtension redirect and block websites - firefox-addon

I have started simple web extension for firefox which in theory should block access to specific websites based on some response from the remote server. User tries to navigate, new page will not be loaded until confirmation is not received from the remote server. Unfortunately remote "check" server is limited to a few requests in a second for each user so I can't (and it's unnecessary to) check each request made after user navigates to some page. Is there any method to listen for "real" navigation not all those requests and redirect whole tab somewhere before any requests are even made?
I've tried add-on API:
tab events fired after content is already received, which is not nice.
"http-on-modify-request" event is fired for each request separately spamming remote check server.
WebExtensions:
browser.webNavigation.onBeforeNavigate seems like what I need, but I can't neither send check request neither redirect from there and I am not sure I will able to.

"http-on-modify-request" event is fired for each request separately spamming remote check server.
that observer notification gives you a http channel, the channel has a loadInfo property, which has an externalContentPolicyType property which allows you to filter for top level document loads by matching one of the content policy constants.
WebRequest.jsm and browser.webRequest are abstractions over the http observers and provide similar functionality.

Related

Vaadin Flow UI stops updating

We have some users reporting an odd problem with our Vaadin 23 application in Chrome and Edge. The application randomly "hangs" such that the user can still interact with client-side components, but nothing seems to reach the server. The problem occurs more frequently when the users are connected to their corporate network from home via VPN.
The application is configured to use push with long polling, and is deployed as a WAR file on Tomcat 9 under Java 11.
There are no error messages in the Javascript console
A network trace (screen shot below) shows successful heartbeats, push renegotiations, and UI interactions
The server access logs mirror the requests from the network trace, so we are confident all requests are making it through to the server
What we are seeing is that the XHR POST requests are being generated when the client interacts with the UI (the ?v-r=uidl requests), but no server updates are ever applied to the UI. The application becomes unresponsive to user input. Interactions that are purely client-side (e.g. selecting a tab in a tabbed layout) still work, but no server-side updates ever get applied.
Any clues as to what is going wrong?
EDITED 10-aug-22:
An interesting observation that indicates the problem may be server-side: The XHR POST requests in the network trace above are triggered by clicking on tabs within a Tabs component. I added logging in the tab event handling to log a message every time a tab is clicked. When the application freezes, I can see the XHR requests in the server's access log, but I do not see the event handler log messages.

Twilio Studio - Make outgoing call make http request on hangup

I have a Studio Flow where I want to send HTTP requests a lot between different steps in my flow.
At first, I trigger the flow with rest API and use "make outgoing call" widget to call the user. If anything else happens than the user picking up, I want to send a HTTP request to my server what happened.
I have created the first part of my flow to test these HTTP requests:
Whatever I do except for picking up the phone, eg: letting it ring untill the end, immediately hanging up when i get called, making sure my line is busy when i get called, ... None of these events are being sent to my database.
I know the HTTP request widget and my URL to post to is working, because when I attach a HTTP request widget under "Answered", I am getting results in my database.
I have played around with the "TIMEOUT" option in the 'make outgoing call' widget. But I am unsure how to play around this.
If I set it too low (ie: 10seconds), the phone will stop ringing after 10seconds (but the http requests will go through fine). If I set it too high (ie: 60seconds), my phone will have stopped the phone call after +- 20seconds by itself, and no http requests will have gone through.
How do I make sure I catch all actions that happen?
EDIT: An example of a log for a flow where the timeout is set to 60seconds.

Docusign API - Recipient and Sender View Timeout

I am using both the REST API and the .NET library to work with Docusign from our site. I was just checking if there were any properties anywhere inside the envelope that let you know if a sender or recipient has the envelope "open" (aka the signing or tagging view URL was loaded, but the user hasn't finished).
Within our web app, we can easily tell when they've "opened" it because when users sign or place tags, they click on one of our own internal links first before being redirected, but unless the user finished the process (either clicking SEND or FINISH or just plain TIMING OUT and getting redirected back to our page), we can't tell is the user currently is looking at the document or if they opened it and then closed it.
So basically, I guess I'm asking if the user closes their browser without sending or signing, is there some kind of date or flag that can tell this?
One follow-up question: Speaking of Timeout, I set ours to 15 minutes. Once you open the console URL to place signature tags or to sign, does the timeout start and then ONLY stop once you've SENT or FINISHED the envelope? Do other actions like scrolling, partially signing, etc reset the timer? Or is it X minutes after the console is open, no matter what?
Sorry, no, the sender view does not offer a ping facility.
In the usual use case, the sender is motivated to send out the envelope for signing. So the problem of the user "abandoning" the sender view is generally not a concern.
You can check the envelope's status periodically or register for a webhook message when the envelope is sent. The envelope will be sent when the sender successfully finishes using the sender view.
If the sender is a concern, I suggest that you not use the sender view. Instead, get the necessary information (docs, recipients, notes, etc) from the sender, then send the envelope programmatically. Use "the Send on Behalf of" (SOBO) feature to send the envelope for the sender.

IOS api call continuously

If I have a app in which the user can set remainders for when there is a new article in a blog. And we can find out if there is a new article in the blog by sending a api request. How should I make the app to continuously send requests to the api. Is there an other way to do this or should we just keep sending requests to api continuously. And if so in how much time interval should we send it.
Thanks
In this case delegating the check for updates to some sort of server side would be ideal. The server side logic could send push notifications to your clients.

Suggtestions for sending e-mail notifications from a 2 tier application with client potentially not connected to the internet

I have to add e-mail notifications to a client server application.
Notifications happen as the user do some particular action on the client UI.
If I had a middle tier or a service running at server I can imagine how to do it:
1) I simply create a DB tables with "pending notifications"
2) as a user does an action that generates a notification I add a record to the table
3) serverside I would continuously try to send those mails and removing them from the table once sending is succesful
Now I cannot do this now, I have a plan to add a service later on, but for now I must go the quick and dirty way.
So somehow what I was thinking to is to implement something like this:
1) as a notify-worth event occurs at client, the same client (my exe) tries to send the notification, upon failure it will log the notification in the "pending notifications" table (failure can be becuase lack of internet connection or any other problem)
2) I add a Timer that will work from any client machine to check for pending notifications. If there are any the client will try to send the e-mail (using a transaction: I will mark a field as "TryngToSendFromClientX" and in case of failure I will reset that field to NULL)
I think this approach would work, it has obvious limitations (if after failure no one logs into the system, no notification will be sent - same would be if service goes "down"). But can you comment on this approach and suggest a better one?
Additional notes (to better understand the scenario):
a) Note: all notifications are sent from the same e-mail account.
b) I don't need to keep track of who sent the e-mail.
c) the problem of creating the service now is that it will basically complicate significantly deployment and I need to create tools for monitoring the status of the service. Something that I will do in future but not now, in future I have plan to add more functionality (not only sending notifications) to the service, so in that case it makes more sense to create it.
d) I will send e-mails by using Indy components and SMTP server.
If you are not willing to create the service now, I think you are stuck with the scenario you describe. There are some things though you could do to circumvent the problem of no user firing up the client anymore while there are still pending messages.
You could add a commandline utility (or commandline parameter as bepe4711 suggested) that will only check for pending messages and try to send them.
Add this commandline utility to the StartUp folder or Run key in the registry. This way messages will at least get sent when the computer restarts, even if the user does not fire up the your app.
Add a scheduled task to run this utility at least once every day. The scheduled task can be added by code or by your installer.
If you do both, you will only have to worry about pending messages of users that never start their computer again.
Perhaps you can add a parameter to your client which causes it to just look at the pending notifications and send them. After this it can terminate itself. It will just act like some kind of service.
Then you install the client on the server and start it every x minutes.
I do something very similar to the approach you describe. Instead of sending emails I need to call a web service. My application is installed on several laptops and they are commonly not connected to any network.
When my application raises an exception I collect various bits of information including user comments and screen shots. Then I attempt to send this to our web service. If by chance the web service is not available. (i.e. not connected to the internet or web service is down) I write the results to an XML file on disk in the User Profile (App_Data) directory.
The one major difference is I don't poll to check to see if the server is up. I attempt to send them again on the startup of the application.
If both Systems are running on Windows, have a look at MS Message Queue. It is designed to send notifications to systems, which are not allways online. I did it in .Net, there are already easy to use classes implemented. Not sure about Delphi.
Latest version of Windows uses much more the Windows Task Scheduler, and now task can be fired on event (i.e. when a network card gets connected...). You could write a separate utility that tries to send pending notification, even if noone is logged in.

Resources