Brackets Shell URI - url

Does anyone know if Brackets Shell uses any URI except the file://...index.html format? I want to point a web service back to the shell and need to provide a valid URI with the URL. The problem is that I noticed that the URL for the index file uses basic system paths and this can change per system or user configuration.
Any way around this little problem?
Edit:
I am trying to access the Instagram API through brackets shell. In order to gain an access token to the OAuth method they use I need to redirect the user to the Instagram Login page to log in then grant access and then Instagram will redirect them back to me based on the call back or redirect url provided from me. If it was as simple as providing just the URL when the call was made I would be fine however to get a client key (which is also needed to access the api) I need to provide the correct call back URL once the key is made and since the shell seems to have no custom file path it's almost impossible to predict the file path based on each users setup on their own pc's. I hope this made sense :)

I searched the source of the brackets-shell, but couldn’t find the startup path. A quick workaround would be adding a meta-refresh to your index.html which redirects to the corresponding URL of your web service.
For example:
<meta http-equiv="refresh" content="0; url=http://example.com">
If you don’t want to select your index.html each time you start your custom shell, you should place your index.html at
Mac: Brackets.app/Contents/dev/src/index.html or Brackets.app/Contents/www/index.html
Win: dev/src/index.html or www/index.html (these folders must be in the same folder as Brackets.exe)
Linux: dev/src/index.html or www/index.html (these folders must be in the same folder as the Brackets executable)

You can get the current location through javascript using
document.location.href
this will return a string like
"file:///C:/Program%20Files%20(x86)/YourApp/www/index.html"
which you might try sending to Instagram. I'm not sure if they will accept file URI's though.

Related

WOPI Host implementation, trying to render doc in iframe

I'm trying to get Wopi host implementation in Ruby on Rails application.
My domain is whitelisted under CSPP. Trying to get the file contents in iframe, but I just see "Word Online" and a loading gif, I return binary file contents of docx as response to ..wopi/files/:id/contents. I don't get any calls hitting my host server.
Sample wopi_src_url: https://word-view.officeapps-df.live.com/wv/wordviewerframe.aspx?ui=1033&rs=1033&dchat=false&IsLicensedUser=0&WOPISrc=https://sgdevwopi.test-wopi.sycamoreinformatics.com/wopi/files/31/contents?access_token=eyJhbGciOiJIUzI1NiJ9.eyJ1c2&access_token_ttl=160000000
Able to get the Wopi validation page in Iframe using .wopitest file. How should I proceed further? Or what am I missing? Please help.
Note: I'm using ngrok to make my local app server visible publicly with whitelisted domain.
I see to problems with your URL. You must ensure that
the URL is of the form http://server/<...>/wopi/files/(file_id) (so drop the /contents part - WOPI client will call the /contents endpoint automatically when necessary)
the WOPISrc parameter value is encoded to a URL-safe string
More info here and here.

Trying to open an application with parameter via an Application Protocol Handler

I am currently trying to figure out an issue with an Application Protocol Handler I've created. Following the directions listed on MSDN (http://msdn.microsoft.com/en-us/library/aa767914%28v=vs.85%29.aspx), I was able to register my application, PDF Annotator, to open via a URL. The issue I am experiencing is when I try to pass a parameter along with the call. The application will open, but the file parameter that gets passed is not opening within the application.
My registry key is verbatim as dictated by MSDN. My HTML code is as follows:
PDFAnnotator:C:\path\to\file\file.pdf
The way I understood the protocol handler is it takes the URL and tries to launch it via the command line. That being said, I am able to open my pdf file in PDFAnnotator with following command in the prompt:
PDFAnnotator.exe C:\path\to\file\file.pdf
I've tried formatting the file path in the HTML differently thinking that would be the issue too. Has anyone else come across this issue or something similar?
Obligatory Update for future generations (http://xkcd.com/979/):
The reason I was doing this is because half of the PDFs my application handled would be editable while the other half were read-only. I was trying to keep the read-only ones in browser with the Acrobat plugin (I'm targeting chrome only) while the protocol would allow me to set the links of the editable ones to open with Annotator. I tried, on whim, to reverse this (setting the default to Annotator and creating a protocol for Acrobat). I did this, first by trying Acrobat's URI Scheme (acrobat://), which didn't work outside of opening Acrobat. Then, I tried creating a protocol for Acrobat. When that fired off, it gave me an error stating the path was wrong for the file name, path name, or volume. So, progress? I'm giving up on this for now as other priorities have come up, but hopefully this helps somebody down the road.

How To Dynamically Route to Downloads

Basically, this is what my app does:
It sends an AJAX request
The server creates a file
The server sends back the URL of the
file location
The client-side will attempt to
create a dialog to download the file
at that location (probably using a
frame? I haven't got this far yet).
My question is, how do I dynamically route to the files I create so that they are accessible when you browse to them? If I don't add a route for them, then they will get a 404 if they try and access the directory they're in.
The files are currently stored in a folder in public.
Would the best way to deal with this make the folder somehow not require a route, so that it can be browsed to directly, and then have an index page on it so they can't view the full list of files? If so, please let me know how I can accomplish this. And on a side note, if you have an idea of how I can accomplish JS displaying the download dialog let me know.
It's Rails 3 by the way.
Thanks!
For a full private set of files: choose a place for your files outside your public directory, then configure X-SendFile support in your web server and finally use send_file in your rails application.

Saving the file on a user selected location using rails

We are developing a functionality that allows the users to save the downloaded file. We are struggling to get a popup where the user can select a target location / folder to save his file. Can this be achieved using rails?
I think you're looking for send_file - it's very easy to use.
I think it depends on the content-type and similar headers you're returning to the user.
Try returning something like:
header('Content-disposition: attachment; filename=movie.mpg');
header('Content-type: video/mpeg');
EDIT: I am assuming you're able to generate headers and returning a file to the user by HTTP (no simple links to files)
I think you are trying to give something like file browser dialog box which allows client to save file on a particular location.
In case you are trying to give this from your server then I should say it is not possible due to security restriction which browser makers have applied to ensure client's security.
Another way is to let client download your browser plugin/activeX Control which basically is control over client's machine then you can do what you want i.e. something like this also.
I think without this the filetype downloaded by client is identified (based on headers) by browser and it opens the file save dialog box automatically and you cant enter into client's secure arena.
I think you want download file option. For example on hitting a URL you
want user to download a zip file code for it you can do something like
this:
class MyController < ApplicationController
def downloadzip
send_file "path_to_file", :type=>"application/zip"
end
end

Do you need to put something in your code to access an asset allowed by crossdomain.xml?

Wondering if I need to do something in my swf to be able to access the assets on a different server, meaning more than just specify the url to the asset. Will flash handle the 'go get crossdomain.xml and authenticate everything' behind the scenes or do I need to include some special code beyond simply requesting the swf file?
Will flash handle the 'go get
crossdomain.xml and authenticate
everything' behind the scenes or do I
need to include some special code
beyond simply requesting the swf file?
In the event of any cross-domain request, Flash will look for the crossdomain.xml file at the root of the domain. For example, if you are requesting an XML file from: http://mysubdomain.mydomain.com/fu/bar/
Flash will check if a crossdomain.xml file exist at: http://mysubdomin.mydomain.com/crossdomain.xml
If you ever need to load a crossdomain.xml file from a different location, you can do it via Security.loadPolicyFile . Bear in mind that the location of this crossdomain have any impact on the security access you have.
You may also want to read up on the security changes in Flash Player 10.
If you're just trying to access another swf, adding the crossdomain.xml will do all the work for you since Flash will do it for you

Resources