HomeStoreForumsWikiiPhone Native AppsiPhone AppsiPhone Apps modmyifone Downloadsmodmyifone Links






Go Back   ModMyiFone.com - iPhone | iPod Touch forums, news, apps, themes. > 3rd Party Apps For iPhone | iPod Touch > Native iPhone / iPod Touch App Launches
Register FAQ Members List READ THIS Today's Posts Mark Forums Read

Native iPhone / iPod Touch App Launches Post new native iPhone and iPod Touch apps in this forum. Also post updates to apps in this thread. Grab Our Native Apps Launches RSS Feed


iPhone Optimized MMi | Browser Optimized MMi

Get more out of ModMyiFone by joining our free community. By registering you get privileges to download files from our downloads section and you may also post your questions in our forums! It's fast, free, and easy!

Opportunities at MMi | 1.1.4 Unlock|Jailbreak OS X / Win
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-06-2008, 04:47 AM
-V-O-Y-A-G-E-R-'s Avatar
Green Apple
 
Join Date: Dec 2007
Location: Serbia
Posts: 67
Thanks: 21
Thanked 23 Times in 5 Posts
PDF/CHM/DOC/XLS/photo viewer - all-in-one Safari/Lighttpd based (complete instruct.)

I've finally finished something I was banging my head with for quite some time. Here on modmyifone I found several partial instructions on hot to enable Lighttpd server directory listing (with or without CSS styling).

kane.lai improved code of DeathPrawn's dirlist generator. Improvements are listed at the end of this post.

I chose Lighttpd as it uses less resources (and I won't bother disabling it through BossPrefs).

Apache servers should display root folder content as soon as you delete index.html in ~/Sites. Lighttpd requires more attention

INSTRUCTIONS: HOW TO SETUP COOL DIRECTORY LISTING ON LIGHTTPD




1. Install Lighttpd and PHP (via Installer)

(after finished PHP installation you'll see a message "Please add /opt/iphone/bin/ to your $PATH", ignore it, it's all already set), restart iPhone, lighttpd will be started on the next boot.

2. Check if Lighttpd is installed correctly. Point your iPhone browser to 127.0.0.1 and you should be greeted by Lighttpd welcome screen.

3. Unpack "Lighttpd server.zip" archive (attached at the end of this post) and copy dirlist folder from archive to ~/Sites (/private/var/root/Sites) using your weapon of choice (WinSCP, Putty, Terminal/SSH, AFPd, SFTP...)

Also, rename dirlist to .dirlist (add a dot in front of the directory name, which will make folder invisible and it will not be shown in directory listing). Should you encounter any problems with renaming, navigate to /private/var/root/Sites and type following command in Terminal/SSH (small HOM icon in WinSCP).

Code:
mv dirlist .dirlist
Make sure that .dirlist is actually named .dirlist and not just dirlist or something else, because if it's not .dirlist, this thing won't work. Easy way for checking its name is navigating with MobileFinder (enable system access and showing of hidden files in MobileFinder's preferences) from your iPhone to folder /private/var/root/Sites. There you will see .dirlist. If you see folder named "2edirlist", it's not good. You have to rename it into .dirlist.

4. Edit lighttpd.conf located in /usr/local/etc/ just copy mine over your original (it's also inside .zip archive)

If you feel like editing it all over again, here it's what it takes...this means you don't have to follow the next step (under stars) if you will overwrite your original .conf file with the modified one that you will find in attached zip file.

*************************************************

+ Add two more server modules

Code:
,"mod_indexfile","mod_dirlisting"
After editing it should look like this..

Code:
server.modules = ( "mod_cgi","mod_indexfile","mod_dirlisting" )
+ Add line which defines index file

Code:
'index-file.names = ( "/.dirlist/dir-generator.php" )'
+ In cgi.assign array add at the end of line (together with comma)

Code:
, ".php" => "/opt/iphone/bin/php-cgi"
After editing it should look like this..

Code:
cgi.assign = ( ".pl"  => "/usr/bin/perl", ".py" => "/usr/bin/python", ".rb" => "/usr/local/bin/ruby", ".cgi" => "", ".sh" => "", ".php" => "/opt/iphone/bin/php-cgi" )
+ Add two lines bellow in order to point out where the CSS style file is

Code:
dir-listing.activate = "enable"
dir-listing.external-css = "/.dirlist/iphonedirlist.css"
+ If you don't want other people to have access to files hosted on your iPhone (~/SItes/ content) ad the following line:

Code:
server.bind = "localhost"
When you change your mind and want to allow acces to hosted files, just comment the line above (add # sign in front) so that it looks like this..

Code:
#server.bind = "localhost"

After editing it should look like this..

Lighttpd with only folder listing turned on (looks much like Apache without index.html) and screenshot of Lighttpd with PHP/CSS improved view



Folder navigation



Viewing Word and Excel files



PDF file in landscape view


Thanks to DeathPrawn, DaveiPhone and cazlar for their initial involvement in this. I've just collected it all together, tweaked CSS and provided screenshots


===============================
CHANGELOG OF KANE LAI'S TWEAKS
===============================
Version 1.5.1 (Apr 19, 2008)
* fixed a bug where folders/files with spaces in their name cannot be hyperlinked (sorry about this)

Version 1.5 (Apr 19, 2008)
+ added support for ".htm", ".html" and ".php" files
+ added experimental support for ".mp3" and ".mp4" files

Version 1.32 (Apr 5, 2008)
* fixed a bug where folders containing the "+" character fails to open
* fixed a bug where changing the orientation of Safari messes up the font size

Version 1.31 (Apr 3, 2008)
+ added icon for ".jpeg" files (in addition to ".jpg" files)
* added a space between icon and filename
* ignored the case of the file extension (".JpG", ".JPG", ".jpg" are the same)

Version 1.3 (Mar 31, 2008)
+ added icon for txt files
* increased thumbnail size and removed the filenames for photos (coz filenames are generally not important for photos)
* fixed a minor bug about hyperlinks
* renamed apple-touch-icon.png to favicon.png


Version 1.2 (Mar 30, 2008)
+ icons support - for PDF/DOC/XLS/folder, icons are shown; for JPG/GIF/PNG, picture preview are shown.

Version 1.1 (Mar 27, 2008)
* the original script fails to enter directory/file which contains the "#" character in directory name or filename
* when the length of file/dir is too long, the ">" at the right of the line get overlapped. now it's fixed.
+ the original script only shows 127.0.0.1 as the root folder name. i've added a constant in the script that allows the user to customize the name. i preset it as "Library"
+ web clip icon support. just put an icon named "apple-touch-icon.png" in the ".dirlist" folder (or use the one i attached). and try to add the web page to the home screen
+ the page auto scroll to hide the address bar of safari (only if the length of the list of files reached a full screen of safari)

CREDITS
===============================
kane.lai, -V-O-Y-A-G-E-R-, DeathPrawn, DaveiPhone and cazlar
Attached Files
Lighttpd server 1.51.zip (23.3 KB, 482 views)

Last edited by -V-O-Y-A-G-E-R- : 04-21-2008 at 04:12 AM. Reason: Updated package with kane.lai tweaks.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
The Following 19 Users Say Thank You to -V-O-Y-A-G-E-R- For This Useful Post:
attila135791 (04-02-2008), betonmoewe (03-20-2008), cash7c3 (03-10-2008), eternal (03-06-2008), Eurisko (03-16-2008), j.ajamil (04-09-2008), k1dr0ck (03-11-2008), ksong12 (03-24-2008), louiektc (05-12-2008), meomeo2007 (03-12-2008), ptemples (04-13-2008), Sandric (05-05-2008), Stefans (03-11-2008), taku42 (04-07-2008), tonydeli7 (03-06-2008), user.exe (04-25-2008), vijay7_7 (04-22-2008), zacklyn (03-28-2008), zheleznov (03-09-2008)
  #2 (permalink)  
Old 03-09-2008, 06:39 AM
What's Jailbreak?
 
Join Date: Oct 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

This is great, thanks for the detailed instructions, I was looking for this!!!

However it seems not to work on my iPhone with 1.1.4 as I only see the greeting screen of Lighttpd when navigating to the IP 127.0.0.1.
I followed all the instructions and checked that also lighttpd.conf has been replaced... No idea why it won't work?
Many thanks and best regards,

Alexander
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #3 (permalink)  
Old 03-09-2008, 07:30 AM
-V-O-Y-A-G-E-R-'s Avatar
Green Apple
 
Join Date: Dec 2007
Location: Serbia
Posts: 67
Thanks: 21
Thanked 23 Times in 5 Posts

Navigate from Safari to 127.0.0.1/.dirlist to see if it's properly hidden (named). All the problems probably arose from .dirlist not being setup right. Doesn't matter if you're on 1.1.3 or 1.1.4, you see Lighttpd welcome screen so the whole idea works
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #4 (permalink)  
Old 03-09-2008, 11:41 AM
What's Jailbreak?
 
Join Date: Oct 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Many thanks for the quick reply! I do see the .plist .dirlist contents (iPhoneArrow.jpg, etc). So I can create a subfolder, such as Docs, in ∕private/var/root/Sites where I then can put all my docs and pdfs, navigating to the directory by entering 27.0.0.1/Docs to see them all?
Many thanks and best regards,

Alexander
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #5 (permalink)  
Old 03-09-2008, 02:55 PM
Green Apple
 
Join Date: Nov 2007
Posts: 58
Thanks: 6
Thanked 4 Times in 4 Posts

Srbija!
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #6 (permalink)  
Old 03-09-2008, 03:56 PM
Green Apple
 
Join Date: Dec 2007
Posts: 31
Thanks: 8
Thanked 3 Times in 2 Posts

Kosovo !
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #7 (permalink)  
Old 03-09-2008, 04:21 PM
What's Jailbreak?
 
Join Date: Dec 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Please your help: where do I find Otpakovati.zip?

I´ve browsed download section and googled, I didn't find it.

[Edit]

Sorry, found the files within the attached zip

Last edited by mortiz : 03-09-2008 at 04:41 PM.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #8 (permalink)  
Old 03-09-2008, 08:00 PM
Green Apple
 
Join Date: Nov 2007
Posts: 58
Thanks: 6
Thanked 4 Times in 4 Posts

Kosovo je Srbija
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #9 (permalink)  
Old 03-10-2008, 02:32 AM
-V-O-Y-A-G-E-R-'s Avatar
Green Apple
 
Join Date: Dec 2007
Location: Serbia
Posts: 67
Thanks: 21
Thanked 23 Times in 5 Posts

Quote:
Originally Posted by afriedrich View Post
So I can create a subfolder, such as Docs, in /private/var/root/Sites where I then can put all my docs and pdfs, navigating to the directory by entering 27.0.0.1/Docs to see them all?
Many thanks and best regards,

Alexander
Technically you can, you can even delete index.html in Sites and see whether dirlisting is enabled at all or not (please do that, just rename .html to .htxx) and refresh. You should see unstyled listing od /Sites folder. If not, then dirlinsting is still not enabled. It's one more step towards successful implementation od this idea

Quote:
Originally Posted by mortiz View Post
Please your help: where do I find Otpakovati.zip?

I´ve browsed download section and googled, I didn't find it.

[Edit]

Sorry, found the files within the attached zip
Sorry, it was my mistake, I was referring to "Lighttpd server.zip" and "otpakovati" means to unpack in Serbian

I have a sort of a problem here, don't see screenshots in my first post every time I load this page? Can you see them or should I relocate them to another hosting site?

Last edited by -V-O-Y-A-G-E-R- : 03-10-2008 at 02:32 AM. Reason: Automerged Doublepost
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #10 (permalink)  
Old 03-10-2008, 05:44 AM
Green Apple
 
Join Date: Oct 2007
Posts: 36
Thanks: 7
Thanked 2 Times in 2 Posts

i think this is a great mod...

i'm a noob so sorry...

step 1 is in installer right?

can you make an instruction for dummies on steps 3 and 4?

i'm confused sorry

there is a part where i use terminal right? can i use vt-100 on my iphone?
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #11 (permalink)  
Old 03-10-2008, 06:44 AM
-V-O-Y-A-G-E-R-'s Avatar
Green Apple
 
Join Date: Dec 2007
Location: Serbia
Posts: 67
Thanks: 21
Thanked 23 Times in 5 Posts

Quote:
Originally Posted by k1dr0ck View Post
i think this is a great mod...

i'm a noob so sorry...

step 1 is in installer right?

can you make an instruction for dummies on steps 3 and 4?

i'm confused sorry

there is a part where i use terminal right? can i use vt-100 on my iphone?
Yup, Step 1 is done through Installer (updated that in HOWTO).

Actually, you don't have to use Terminal. If you're on Windows, use WinSCP, if you're on OS X install AFPd via Installer and you'll see you're iPhone as a network disk.

Step 3 and 4

Unpack attached "Lighttpd server.zip" file and move .dirlist folder (it's dirlist, but rename it to .dirlist) and lighttpd.conf to /private/var/root/Sites and /usr/local/etc/ (respectively).

Copying files around with WinSCP/AFPd+Finder is quite selfexplanatory, like everyday file management.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #12 (permalink)  
Old 03-10-2008, 07:45 AM
iPhone? More like MyPhone
 
Join Date: Oct 2007
Posts: 175
Thanks: 17
Thanked 15 Times in 11 Posts

hey,
nice hack voyager, but can you ask someone like the mods or big boss to make a complete installer package including first step also. i know i am asking for too much but installer can also run scripts and place files. also i have thanked you as you deserve it. Also I would love to feature it on my blog once it's an installer package.
thanks

Last edited by Eurisko : 03-10-2008 at 07:50 AM.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #13 (permalink)  
Old 03-10-2008, 08:07 AM
-V-O-Y-A-G-E-R-'s Avatar
Green Apple
 
Join Date: Dec 2007
Location: Serbia
Posts: 67
Thanks: 21
Thanked 23 Times in 5 Posts

Well, this is not much of a work once you download Lighttpd and PHP...I doubt BB or other guys would bother with scripting
Feel free to ask them if you would like
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
The Following User Says Thank You to -V-O-Y-A-G-E-R- For This Useful Post:
cyborg22 (03-28-2008)
  #14 (permalink)  
Old 03-10-2008, 08:16 AM
iPhone? More like MyPhone
 
Join Date: Oct 2007
Posts: 175
Thanks: 17
Thanked 15 Times in 11 Posts

hey,
thanks for the quick reply.
thanks
__________________
1.1.3 -----> 1.1.4 (Patched Ziphone Jailbreak)
Baseband- 04.04.05g
Bootloader- 3.9 (1.0.2 OOTB)
Call In/Out - Yes/Yes
SMS In/Out - Yes/Yes
GPRS - Yes
YouTube - Yes
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #15 (permalink)  
Old 03-10-2008, 05:52 PM
Eurisko's Avatar
Moderator
 
Join Date: Aug 2007
Device + Firmware: iPhone 1.1.4 - unlocked
Operating System: Mac OSX
Location: Toronto, Canada
Posts: 2,033
Thanks: 5
Thanked 344 Times in 303 Posts

When completed, I can load the webpage, but when I rename index.html to index.htxx and reload, all I get is 404 - Not Found
__________________
If you found anything I wrote useful, honor me with a Thanks
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
Reply

  ModMyiFone.com - iPhone | iPod Touch forums, news, apps, themes. > 3rd Party Apps For iPhone | iPod Touch > Native iPhone / iPod Touch App Launches


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

ModMyMoto.com - ModMyGPhone.com - ModMyiFone.com - Managed Dedicated Servers by SingleHop - iPhone Wallpapers - Contact Us - Link to us - Archive - Privacy Statement - - Top
Copyright © 2007-08 by ModMy, LLC. All rights reserved. You may not copy anything on this site unless you link to the original.
All times are GMT -6. The time now is 08:45 PM. Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5
ModMyiFone.com is an independent publication and has not been authorized, sponsored, or otherwise approved by Apple, Inc or Cisco Systems, Inc. The information contained on this site is for educational purposes only.
Forum skin by poetic_folly