I'd like to execute a shell script form my Rails app on the client.
In my case, I want to open a .odt file on the Client PC when he clicks on a link.
As for now, all I can do is run shell script on my server using e.g.
`libreoffice path_to_my_odt_file`.
In this case, I'm opening my file using LivreOffice on the Server.
Is there a way to execute this code on my Client from Rails?
If I try to run my app as it is, when I call the action that calls my script, the file is opened on my Server.
Thank you in advance.
As mentionned in the comments, running arbitrary shell scripts on the client from the http server would be a huge security flaw.
As long as your Rails server provides a download link with send_data (e.g. dynamically_generated_odt_file), the browser will ask if it should download the file or open it. If the user wants to avoid any extra interaction, there's the possibility to tick :
"Do this automatically for files like this from now on"
You might have to specify the MIME type, by adding
Mime::Type.register "application/vnd.oasis.opendocument.text", :odt
to config/initializers/mime_types.rb.
Related
Sending SMS url in my php class is working with the curl library. The problem is that if the url request is delayed (in CURLOPT_CONNECTTIMEOUT_MS or CURLOPT_TIMEOUT_MS), my site will be loaded for the user with a delay. What do you suggest? Should I run SMS url asynchronously? How do I do this? Or put a Schedule on the server? The problem with Schedule is that I want the SMS to be sent exactly when the user runs the script, so I can't set a timeline for Schedule to run in certain time. If the Schedule runing time is short, the database gets involved and I do not like this. In fact, I want to ask php to execute the Schedule after the user runs the script. How do I do this?
so I asked myself how to tell the server computer that a new SMS event has occurred?
(My computer operating system is Windows and I use xampp). I saved the text messages in the database. And for each text message I created a small empty file in a folder (smsevents) on the Windows server, With the same name that is stored in the database in the ip field for each SMS. And on the server I used the powershell to call a url when a new file is placed in the (smsevents) folder. That url contains the name of the newly created file. Then in this url, a record of the database in the SMS table is called, whose Ip field is the same as the name of the created file. And is sent to the SMS sending system, And url deletes the file created in the folder (smsevents). I created a .bat file that runs when the server is turned on and runs the powershell script. And it was done. I will write more details soon.
I am trying to get rails to select document attachments, then kick off the email client with the documents attached.
I have it working on my development laptop. If I build a string with the appropriate parameters and pass that to system() then it kicks off the email client with the attachments..
The string looks something like
#email_content = "C:\Program Files (x86)\IBM\Lotus\Notes\notes.exe"
"Mailto:?Attach=C:\Users\cm\RubymineProjects\technical_library\public\images\1\8302_printed.pdf
The first part calls the notes exe and the second part starts and email with the attachments. That worked fine on my laptop.
However, when I moved it to the server, it isn't kicking off the email client. I believe that it is because the shell commands are trying to execute on the server, not on the client.
Is it possible to run a shell command on the client machine? I am trying to get this working with Windows first and then the Mac environmemnt. I tried changing the C:\ to the machine name. i.e. \chrislaptop\Program Files (x86)\IBM\Lotus\Notes\notes.exe. but that didn't work.
No, fortunately that is not possible.
Imagine what happens when a request to some random page on the internet could trigger shell scripts on your local computer...
Arbitrary code execution escaping the browser is too invasive-- your app should not have access to the client's machine.
However, some applications may support URIs that open specific applications outside the browser. You generally see this more on mobile devices, but Spotify for example supports links that look like: spotify:artist:5lsC3H1vh9YSRQckyGv0Up which asks the user whether it is ok to open the Spotify application.
https://news.spotify.com/us/2008/01/14/linking-to-spotify/
When my program successfully installs via Inno Setup, how do I run a URL in the background? I want to just load a tracking pixel (or a postback) which says that my program was installed.
I'm aware than in the [Run] section, I can run a .url file with the flag "runhidden", but as far as I know that won't do what I need it to. Am I wrong about that, or are there better option?
Thank you.
There is no TCP/IP related Support Functions, defined by default.
You could build this functionality into a DLL and call it from you Install Script.
This is done installation's where Activation is required to make the program work.
However, I would just launch a browser window using the [Run] section that contains "Getting Started" information. You can then track hits to that page.
I'm in Internet Explorer 8, using MVC 1 and IIS 7.
I have an action on a controller which serves up an excel file.
I go to the action, a dialog pops up asking if I want to save or open the file, and I select open.
Then Excel makes a HEAD request to the server, followed by opening up a password prompt, then goes up a directory and makes an OPTIONS request, followed by 5 PROPFIND requests. Then if I cancel the password prompt, the excel document opens fine, and makes one final HEAD request to the original directory.
What is going on, and how do I stop it? Can I do something in global.asax or my web.config to mass block all these HEAD/OPTIONS/PROPFIND requests that excel is making? I don't have access to make changes to the web server.
This occurs in office documents where the microsoft programs try to open the file from the server itself. It then tries to authenticate and sends requests such as OPTIONS and PROPFIND to get the server type and tool available to do live editing and updating the local copy from the server, etc. Basically, its done for synchronization.
How do you stop it? no idea, probably have to look at the settings in your local excel tool.
How do you block specific requests in global.ascx? Whats the advantage of blocking it instead of just leaving it, its not like your application is using the request anyways. I'd like to see an answer for this though.
CruiseControl.net newbie question: Following a build/deploy of a website, I'd like to invoke a specific URL on the server. I don't need anything back from the resulting page, just need to request it to make something happen.
I could create an entry to to fire up IE with the URL as an argument, but I don't want to actually run IE on the server - I just want to invoke the URL.
Is there a Windows shell command to do that? Or, is there a CruiseControl.net-specific way to hit a URL?
you can use wget, a command line browser to accomplish this.
http://gnuwin32.sourceforge.net/packages/wget.htm