webOS Nation Forums >  Stuff for your webOS Device >  webOS Apps & Games > [SOLVED] Web - secure downloads
[SOLVED] Web - secure downloads
  Reply
Like Tree9Likes

 
Thread Tools Display Modes
Old 12/03/2011, 06:52 PM   #1 (permalink)
Banned
 
Posts: 91
Here is workaround for secured downloads in Web app ...

INSTALLATION:

Step 1: extract attached downloader.zip anywhere on your device
Step 2: connect to device and run install.sh to install patch (uninstall.sh to revert changes)

Known issues:
- downloading from IP addresses won't work (service does not handle IP-address based cookies yet)
- there is no way to download file if file with same name already exists in /media/internal/downloads (ie you have to delete/rename existing file first, then retry downloading)
- "Downloader" does not hide itself after downloaded file is opened
- no download progress given
- some cookies can contain special characters that will break service from working

USAGE FROM OTHER APPLICATIONS:

Since v0.0.6 it is possible to use Downloader app from other apps.

To get url downloaded into /media/internal/downloads put this into your app:
Code:
var launcher = enyo.create({kind: "PalmService", name : "launcher", service : "palm://com.palm.applicationManager", method : "open"});
launcher.call({"id":"xx.downloader", "params": { target : inUrl, caller : enyo.fetchAppInfo().id }});
After download is finished your app will be relaunched with response, so you can handle it in onRelaunch function.

Code:
onRelaunch: function(inSender, inEvent) {
	console.log('relaunch...' + inEvent.params.downloader);
}
If 'caller' parameter is not specified, then after successful download, document will be automatically opened.


Any questions / comments are welcome.

HISTORY -
v0.0.6: callback now working + fix in url handling
v0.0.5: added option to enter login/password before downloading starts
v0.0.4: added support for IP address based URL
v0.0.3: if Downloader app is uninstalled/not-installed properly then Web app will fallback to original download bar
Attached Files
File Type: zip downloader-0.0.5.zip (38.8 KB, 188 views) Email Attachment
File Type: zip downloader-0.0.6.zip (38.8 KB, 517 views) Email Attachment

Last edited by devwithoutpower; 12/12/2011 at 02:52 PM.
devwithoutpower is offline   Reply With Quote
Liked by Kastoi likes this.
Old 12/03/2011, 09:14 PM   #2 (permalink)
Member
 
The Bard's Avatar
 
Posts: 702
I will try this.

BTW, what is inside the zip file above? Patch or ipk file? Sorry I'm currently on TouchPad, so I can't download and extract it.
The Bard is offline   Reply With Quote
Old 12/04/2011, 01:04 AM   #3 (permalink)
Member
 
Posts: 290
too hard for me a non techy guy. I can't even find cookies in jail....:-(
matchqq is offline   Reply With Quote
Old 12/04/2011, 01:29 PM   #4 (permalink)
Member
 
Posts: 14
Quote:
Originally Posted by devwithoutpower View Post
Here is workaround for secured downloads in Web app ...

Part I: Getting access to cookies (stored in sql database) from jail
a) create new jailer configuration file
Code:
cp /etc/jail_hybrid.conf /etc/jail_cookies.conf
b) add these 3 lines into /etc/jail_cookies.conf
Code:
mkdir /var/palm
mkdir /var/palm/data
mount ro /var/palm/data
Part II: Patching Web app to launch "Downloader" (see bellow)
a) Insert into components: []
Code:
{kind: "PalmService", name : "launcher", service : "palm://com.palm.applicationManager", method : "launch"},
b) modify downloadResource function
Code:
downloadResource: function(inUrl, inMime) {
    this.$.launcher.call({"id":"xx.downloader", "params": { target : inUrl }});
},
Part III: install attached "Downloader" app
Code:
palm-install xx.downloader_0.0.1_all.ipk
Known issues:
- downloading from IP addresses won't work (service does not handle IP-address based cookies yet)
- there is no way to download file if file with same name already exists in /media/internal/downloads (ie you have to delete/rename existing file first, then retry downloading)
- "Downloader" does not hide itself after downloaded file is opened
- no download progress given
- "Downloads" toaster in Web app is not used (is useless anyway)
- some cookies can contain special characters that will break service from working

Any questions / comments are welcome.
Devwithoutpower Thanks a lot! Before I start this is there some program that I need prior to doing this. I am guessing Ubuntu from preware. I am a noob and I wanted to do this the right way to be able to access myschool documents. Thanks.
touchpadmd1203 is offline   Reply With Quote
Old 12/04/2011, 03:45 PM   #5 (permalink)
Banned
 
Posts: 91
Quote:
Originally Posted by matchqq View Post
too hard for me a non techy guy. I can't even find cookies in jail....:-(
you don't have to...

Quote:
Originally Posted by The Bard View Post
BTW, what is inside the zip file above? Patch or ipk file? Sorry I'm currently on TouchPad, so I can't download and extract it.
IPK needed for 3rd step - ie simple application that actually downloads file

Quote:
Originally Posted by touchpadmd1203 View Post
Devwithoutpower Thanks a lot! Before I start this is there some program that I need prior to doing this. I am guessing Ubuntu from preware. I am a noob and I wanted to do this the right way to be able to access myschool documents. Thanks.
You need some way to edit files directly on device (part I and part II) and then some way to install IPK (application)
devwithoutpower is offline   Reply With Quote
Old 12/04/2011, 09:31 PM   #6 (permalink)
Member
 
The Bard's Avatar
 
Posts: 702
Any way to redo the modification if something go wrong?

For part I & II it is a linux command? Use webOSQI linux command can do, right?
The Bard is offline   Reply With Quote
Old 12/04/2011, 09:41 PM   #7 (permalink)
Member
 
Posts: 280
Quote:
Originally Posted by The Bard View Post
Any way to redo the modification if something go wrong?

For part I & II it is a linux command? Use webOSQI linux command can do, right?
If you want I made a script and a patch to do this. I can post it if devwithoutpower doesn't mind.
knownboyofno is offline   Reply With Quote
Liked by hoopsta1423 and touchpadmd1203 like this.
Thanked by hoopsta1423, The Bard
Old 12/04/2011, 10:56 PM   #8 (permalink)
Member
 
Posts: 14
Quote:
Originally Posted by knownboyofno View Post
If you want I made a script and a patch to do this. I can post it if devwithoutpower doesn't mind.
That would be great...if devwithoutpower doesnt mind. I am somewhat tech savy but the post went over my head and I barely got past the first step. I do not know if it even did anything to my touchpad after entering those commands...sigh. This is such a huge issue and I am surprised more people are not commenting on it. This is such a vital patch to make this device complete.
touchpadmd1203 is offline   Reply With Quote
Old 12/05/2011, 01:59 AM   #9 (permalink)
Member
 
Posts: 4
first off, thank you devwithoutpower.
So ive done everything youve instructed however when I attempt to download a pdf from Blackboard, it never opens. The downloader app opens but nothing happens. The file doesnt exist in the downloads folder either. Any thoughts? And this happens with all downloads, not just pdfs from blackboard.
dconeg is offline   Reply With Quote
Old 12/05/2011, 04:16 AM   #10 (permalink)
Banned
 
Posts: 91
Quote:
Originally Posted by The Bard View Post
Any way to redo the modification if something go wrong?
For part I & II it is a linux command? Use webOSQI linux command can do, right?
I am preparing better patch (more robust) that will automatically detect if Downloader app is installed - and if not, then original code will be executed ... ie you will be able to get old behaviour simply by uninstalling xx.downloader

Quote:
Originally Posted by knownboyofno View Post
If you want I made a script and a patch to do this. I can post it if devwithoutpower doesn't mind.
I don't mind of course ... actually I've prepared script myselft, I just want to test new patch together with updated app - will post it here tomorrow

Quote:
Originally Posted by touchpadmd1203 View Post
That would be great...if devwithoutpower doesnt mind. I am somewhat tech savy but the post went over my head and I barely got past the first step. I do not know if it even did anything to my touchpad after entering those commands...sigh. This is such a huge issue and I am surprised more people are not commenting on it. This is such a vital patch to make this device complete.
Hopefully with installation script more people will be able to test it and report...

Quote:
Originally Posted by dconeg View Post
first off, thank you devwithoutpower.
So ive done everything youve instructed however when I attempt to download a pdf from Blackboard, it never opens. The downloader app opens but nothing happens. The file doesnt exist in the downloads folder either. Any thoughts? And this happens with all downloads, not just pdfs from blackboard.
First of all - do you get 'Downloading <your url here>' text on the screen soon after downloader app is launched? Or can you only see white screen?
Downloader is hybrid application - as soon as service plugin gets connected to UI, there should be information what url is being downloaded displayed. If you don't have this information - then most probably there was problem with executing plugin (for example something went wrong in Part I).
If you see 'Downloading ...' message, but nothing happens afterwards - then you should check running processes on device ... run 'ps -ef | grep service' and 'ps -ef | grep curl' on your Touchpad.

Let me upload new version of IPK with some more logging added - so you can check 'palm-log xx.downloader' (if you have SDK installed) ... or 'cat /var/log/messages | grep downloader' (on device)

NOTE: for Downloader to be able to successfully download files from secured sites (like for example from this forum) - there must be required cookies stored in database ... in most cases this is achieved by checking 'Remember me' or something similar when logging. AFAIK Web app does not store session cookies in db - hence external app won't see them.
devwithoutpower is offline   Reply With Quote
Thanked By: The Bard
Old 12/05/2011, 05:55 AM   #11 (permalink)
Banned
 
Posts: 91
check 1st post for new instructions ... I will update archive later (promised improved BrowserApp.js patch) when I have chance to test my changes on device, but at least installation (and reverting back to original state) should be much easier now. You only need way to execute shell command on device.
devwithoutpower is offline   Reply With Quote
Thanked by olivier.martin, The Bard
Old 12/05/2011, 07:30 PM   #12 (permalink)
Member
 
Posts: 9
still dosent seem to work but its not like i can fix it so i'll be waiting patiently. Hopefully this will get resolve before the start of my next semester .

Ps. if any developpers working on the patch needs a university account (blackboard login) for testing purposes let me know and i would be more then happy to give them my username & password.
olivier.martin is offline   Reply With Quote
Old 12/05/2011, 07:51 PM   #13 (permalink)
Member
 
Posts: 280
Quote:
Originally Posted by olivier.martin View Post
still dosent seem to work but its not like i can fix it so i'll be waiting patiently. Hopefully this will get resolve before the start of my next semester .

Ps. if any developpers working on the patch needs a university account (blackboard login) for testing purposes let me know and i would be more then happy to give them my username & password.
What do you mean doesn't work exactly?
knownboyofno is offline   Reply With Quote
Old 12/05/2011, 07:57 PM   #14 (permalink)
Member
 
Posts: 9
When i try to download a word document it gives me the same problem as the original thread....it gives me the relativedownloadmanager thing in the download bar and stays gray.
olivier.martin is offline   Reply With Quote
Old 12/05/2011, 08:26 PM   #15 (permalink)
Homebrew Developer

 
Posts: 3,332
You say this is a hybrid? So, could a developer make use of that plugin to download things specifically related to a particular app, setting up their own access cookies or something? Would you allow that?
__________________
Author:
Remove Messaging Beeps patch for webOS 3.0.5, Left/Right bezel gestures in LunaCE,
Whazaa! Messenger and node-wa, SynerGV 1 and 2 - Google Voice integration, XO - Subsonic Commander media streamer, AB:S Launcher
Quote:
(1:39:33 PM) halfhalo: Android multitasking is like sticking your fingers into a blender
GO OPEN WEBOS!
People asked me for a donate link for my non-catalog work, so here you are:
eblade is offline   Reply With Quote
Old 12/05/2011, 08:27 PM   #16 (permalink)
Member
 
Posts: 280
Quote:
Originally Posted by olivier.martin View Post
When i try to download a word document it gives me the same problem as the original thread....it gives me the relativedownloadmanager thing in the download bar and stays gray.
Do you have a new window popup? If not, it isn't installed correctly.
knownboyofno is offline   Reply With Quote
Old 12/05/2011, 08:39 PM   #17 (permalink)
Member
 
Posts: 9
Yes i do have a new window that pop's up and the ''downloader'' icon app
olivier.martin is offline   Reply With Quote
Old 12/05/2011, 08:40 PM   #18 (permalink)
Member
 
Posts: 9
*the ''downloader'' icon app in my launcher
olivier.martin is offline   Reply With Quote
Old 12/05/2011, 08:53 PM   #19 (permalink)
Member
 
Posts: 280
oh, well. I thought it might just be a bad install but there is something else going on here.
knownboyofno is offline   Reply With Quote
Old 12/06/2011, 12:34 AM   #20 (permalink)
Banned
 
Posts: 91
Quote:
Originally Posted by olivier.martin View Post
Ps. if any developpers working on the patch needs a university account (blackboard login) for testing purposes let me know and i would be more then happy to give them my username & password.
That is one option - at least I could confirm that downloading from blackboard is possible ... so as last option if anything else fails - change your password to something temporary and send me details

Quote:
Originally Posted by olivier.martin View Post
When i try to download a word document it gives me the same problem as the original thread....it gives me the relativedownloadmanager thing in the download bar and stays gray.
If 'Downloader' card is not launched - then patch (Part II) is not functional. There are 3 main reasons for this: a) problem with compatibility (ie BrowserApp.js included in patch does not match rest of Web app); b) problem with overwriting BrowserApp.js (ie ro only filesystem); c) restart is needed - LunaSysMgr caches Web app , so after you modify one of its JS files you have to restart luna or device.
Try running uninstall.sh followed by install.sh and check output - post it here...

Quote:
Originally Posted by eblade View Post
You say this is a hybrid? So, could a developer make use of that plugin to download things specifically related to a particular app, setting up their own access cookies or something? Would you allow that?
Yes - it is hybrid ... and I plan extending its functionality so most of the known issues are no longer issues ... and if by 'YOU' you mean me - then yes - I would allow whatever...

Quote:
Originally Posted by olivier.martin View Post
Yes i do have a new window that pop's up and the ''downloader'' icon app
Do you have 'Downloader' card started? If yes - can you see 'Waiting to connect'? 'Downloading....'? Result?
devwithoutpower is offline   Reply With Quote
Reply

 

Thread Tools
Display Modes



 


Content Relevant URLs by vBSEO 3.6.0