OK, I want to start using imgur for my new web app (on all browsers and my server) and will submit anonymous images for paid storage, but from the user's browser to minimize loading on my server. Almost all the software runs in javascript client-side (with very few server interactions... hence fast and distributed).
Currently the only way I can see using the ID from imgur is to first bring the image to my server and then send to imgur with my ID. Because putting it into the javascript on the browser makes the ID visible to the world.
I was hoping for some kind of solution like: I call imgur to get a token good for ONE time use only. The user gets the token from my server (which I would have previously polled imgur to get) and then I send to my javascript code on their browser, which would upload the image directly to imgur with the token. The token is then dead, and it doesn't matter if someone else sees it, it cannot be used again.
Does imgur API have anything like this? Or maybe another solution? Key points are:
Don't upload to my server since I wont keep it there anyway
Don't expose my client ID to world on user's browser in Javascript
Any help would be appreciated.
Related
I'm looking to do the following:
I have a device that receives data from a website, in this case to light up an LED. However, I would like to do the reverse now, where I can click a physical button on the device (to trigger code) and send a message to display on the website. The website itself is just simple HTML, and I'm using the ESP8266 to send the data over wifi, programmed using arduino code and the WebSocketServer library. I'm not quite sure how to get a message across, nor how to actually display it within the website. I apologize if this is quite easy, but I'be been wracking my head for two hours trying to find it online, and have had no luck. Cheers!
In reference to http://www.instructables.com/id/Arduino-Esp8266-Post-Data-to-Website/ blog by Khalilm , It seems to be much easy for accomplishing your aim.He explains it in six steps.
HTTP works as a request-response protocol between a client and server. A web browser may be the client, and an application on a computer that hosts a web site may be the server. Example: A client (browser) submits an HTTP request to the server; then the server returns a response to the client. The response contains status information about the request and may also contain the requested content. On our example the esp8266 is the client and the server that is hosting our website is the server.
Because HTTP is a request-response protocol, as mentioned above, it's not really about "sending" anything to a browser, but rather of making it available to the browser when someone visits the page, the page is reloaded, or the page "reaches out" to the server with a webservice call, for example, to update part of the page.
However, one twist you could do on your project is:
1. Press the button
2. Record the time in millis() for example.
3. Create a small webpage to show "Button was last pressed at ___ millis()"
4. Then press button whenever you like and refresh the page to see updated time.
Beyond that, you'll need scripting on the browser side to poll the webserver. Given that you don't really ever "send" to a website, does this idea make sense, a reasonable derivative of what you were attempting? If so, give it a try and we'll help if you run into problems.
I would like to use Javascript to retrieve thumbnail URLs from Brightcove-hosted videos.
I can't see a way to do that without exposing my Media API token to the client browser. (The with-token method is documented here.)
I don't need a token to show the whole video, so it seems insane and unnecessary that I need a token to get the thumbnail url, which obviously I would want to show to the user anyway.
The only workaround I can devise is to create a middleman interface on the server. (The client JS makes a request to my server, which uses the token to request the thumbnail from BC, then returns it back to the JS.) That's just annoying.
Am I missing something? Is there an alternate way to retrieve video thumbnails in the client without exposing the Media API key?
According to Brightcove's support, they tell me that the answer is "NO".
They do recommend a server-side relay, which is what I ended up writing, and it works fine.
Disappointing, though.
I'm trying to make a Firefox addon with the Firefox Add-on SDK and API, and I have some questions about their possibilities before I start using them.
My college's Wi-Fi authorization expires every 30 minutes only to have fun pissing off their students. There are already some autofill addons available on many browsers but it's still destructing to move the mouse pointer onto the "Login" button and click it when there is one second left to turn in a midterm paper. I've heard my friends complaining like this for months and I myself think the thing is actually annoying sometimes, so I decided to develop a Firefox addon that takes charge of the job so that the authorization process will feel not even existing once the addon is activated. (I just want to impress my friends honestly.)
For ease I would like to develop the addon within the Firefox add-on SDK. I found that my addon would be utilizing the page-mod, password and request APIs; page-mod to detect the Wi-Fi service's auto-redirection into their authorization page, password to fill in the page's form by a student ID and password stored in the individual Firefox browser, request to redirect the "Login Successful!" page into the originally given destination.
So I guess it should be possible to achieve my goal with this SDK and APIs, but there are still some questions that I need to ask before I proceed:
Is it possible to pass a callback function to page-mod::PageMod (not as a String or a URL to another JavaScript file)? If not, can it be done using the lower level API?
Is it possible to actually redirect a page in a tab into another page only using high level APIs?
Is it possible to remember the original destination's location (with the request method and contents) and call it in the process of page-mod::PageMod (in order to re-redirect out of the authorization page)? If not, can it be done using the lower level API?
Is it possible to perform the addon's redirection function on inactive (background) tabs where the opened webpages automatically keep connecting to the Internet and get redirected to the authorization page?
Thank you so much for reading and please spare a little bit of your time for me. Thank you again!
Is it possible to pass a callback function to page-mod::PageMod (not as a String or a URL to another JavaScript file)? If not, can it be done using the lower level API?
No, everything that goes through the port is serialized using JSON serialization (See docs). Instead you would probably emit an event from your content script to execute the callback method with parameters you pass it in the module scope and hardcode parts that need to be done in the content script with port event listeners.
Is it possible to actually redirect a page in a tab into another page only using high level APIs?
Totally, if you're in a content script, you can just set window.location, or in your modules you set the location of a tab, see https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/tabs#url.
Is it possible to remember the original destination's location (with the request method and contents) and call it in the process of page-mod::PageMod (in order to re-redirect out of the authorization page)? If not, can it be done using the lower level API?
Possible? Yes, depends a lot on how the redirection from the W-LAN works. Generally all the SDK offers you is getting load/ready events for tabs and reading a tab's current URL. So if you get a ready event at the point of the redirect you're fine. If your college login remembers the redirect target using a get parameter in the URL you're fine. If your college doesn't adjust the URL, you're fine. If you really need to dig through the request, you'll have to ge a bit deeper than even what the SDK offers you, but it is possible.
Is it possible to perform the addon's redirection function on inactive (background) tabs where the opened webpages automatically keep connecting to the Internet and get redirected to the authorization page?
JS execution for Add-ons is not paused based on a tabs state.
I am facing a scenario where live Twilio call gets dropped, if the browser window in which call is received is reloaded. Is there a way to overcome this set-back without affecting the live calls?
Twilio Evangelist here.
Based on your question, I assume you are using the Twilio Client JavaScript SDK? If that is indeed the case, then unfortunately, if the page thats hosting the SDK gets reloaded the connection between the browser and Twilio will drop since the browser is reloading everything, including the JavaScript SDK.
There are a couple of different techniques I can think of off the top of my head that you can use to help avoid page reloads, and another idea that could help you recover a call where the connection to the browser has dropped because of a page reload. A lot of this is going to depend on your specific app and the experience you are trying to create for your users.
So to help avoid having to reload the page:
1) Use AJAX requests to your server in order to avoid page reloads. If your page includes content like a form, or you want to update the page content with data form the server, you can look using AJAX requests to the server instead of a normal full page postback to submit the form, or to retrieve the data form the server. This would help in avoiding having to reload the entire page in those two scenarios.
2) Use an iFrame to host your page content, and then put the Twilio SDK in the parent page (the one that defined the iFrame). This would let you reload the content hosted in the iframe, without having to reload the entire host page, avoiding a reload the the Twilio library. The downside to this is that communicating between content in an iframe and its host can get really messy fast.
Neither of these two techniques is fool-proof. Obviously a user can always just hit the refresh button on their browser, and thats going to cause the connection to drop.
In a case where the page does get reloaded, and the connection from Twilio to the browser gets dropped, one idea is to leverage Twilios capability to help reconnect the caller together. When a user calls your twilio phone number, instead of connecting them directly to the Twilio Client running in the browser (by dialing a client with <Client>), instead dial that caller into a conference <Conference>, and then have the browser client connect into that same conference. The benefit to that is if the browser disconnects, the original caller won't get hung up on, they will still be sitting in the conference room. As long as you've saved the Conference SID or name, you can have the browser client reconnect to that conference.
Hope that helps point you in the right direction.
I am looking for a web service kind of like Google Analytics.
Paste some javascript into your web page and if any of the links there become invalid, hey presto, an email is sent to someone telling them which link, which page etc etc has the incorrect link.
Anyone heard of such a service?
This would slow the page loading down a lot if it had to check for broken links every time someone visited it (basically a http request for every link). Not that it isn't possible, but the implementation would have to be very very good.
Javascript cannot send emails, you would have to use ajax to post the details to another page that would then email the admin. As this is all client side, it is very open to abuse.
I would suggest using a program to do it every now and again. There are even Firefox extensions to do it rather than a program. Google will also list a whole host of websites offering the service.