Page 1 of 9 123 ... LastLast
Results 1 to 20 of 162

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: PDF/CHM/DOC/XLS/photo viewer - all-in-one Safari/Lighttpd based (complete instruct.)

  1. #1
    Default 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 modmyi 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 Attached Files
    Last edited by -V-O-Y-A-G-E-R-; 04-21-2008 at 05:12 AM. Reason: Updated package with kane.lai tweaks.

  2. The Following 24 Users Say Thank You to -V-O-Y-A-G-E-R- For This Useful Post:

    attila135791 (04-02-2008), betonmoewe (03-20-2008), Cody Overcash (03-10-2008), DobyTheDoggy (07-08-2008), emla2bu7a5 (06-30-2008), eternal (03-06-2008), Eurisko (03-16-2008), iamubiquitous (08-06-2008), j.ajamil (04-09-2008), k1dr0ck (03-11-2008), koucz (07-09-2008), ksong12 (03-24-2008), louiektc (05-12-2008), meomeo2007 (03-12-2008), NiLbReTh (06-05-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)

  3. #2
    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

  4. #3
    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

  5. #4
    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

  6. #5

  7. #6

  8. #7
    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 05:41 PM.

  9. #8
    Kosovo je Srbija

  10. #9
    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 03:32 AM. Reason: Automerged Doublepost

  11. #10
    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?

  12. #11
    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.

  13. #12
    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 08:50 AM.

  14. #13
    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

  15. The Following User Says Thank You to -V-O-Y-A-G-E-R- For This Useful Post:

    cyborg22 (03-28-2008)

  16. #14
    hey,
    thanks for the quick reply.
    thanks
    1.1.4 Winpwned ----> 2.0 Winpwned

    Baseband- 04.05.04_G
    Bootloader- 3.9 (1.0.2 OOTB)
    Call In/Out - Yes/Yes
    SMS In/Out - Yes/Yes
    GPRS - Yes
    YouTube - Yes

  17. #15
    Livin the iPhone Life Eurisko's Avatar
    Join Date
    Aug 2007
    Location
    Toronto, Canada
    Posts
    3,308
    Thanks
    12
    Thanked 562 Times in 483 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
    Get "iPod & iTunes for Dummies", it'll change your life.

  18. #16
    Can the PC iPhone Suite be used to transfers the files or does an FTP program need to be used? If an FTP program, how do i find my iPhone directories using WinSCP?

    I have done everything per the instructions and I get a 404 ERROR when I go to http://127.0.0.1/.dirlist or http://127.0.0.1/dirlist (without the period in front of dirlist). Are there any other files from Installer/Cydia I should have installed on my iPhone?
    Last edited by samsadex; 03-10-2008 at 09:05 PM. Reason: Automerged Doublepost

  19. #17
    Green Apple
    Join Date
    Nov 2007
    Location
    Santa Barbara, California
    Posts
    33
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Quote Originally Posted by Eurisko View Post
    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
    find this line in your config:

    index-file.names = ( "index.php", "index.py", "index.pl", "index.cgi", "index.html", "default.html", "/.dirlist/dir-generator.php" )

    and add the other extensions you want, like "index.htm", "index.xhtml" so on

    e.g.:
    index-file.names = ( "index.php", "index.py", "index.pl", "index.cgi", "index.html", "index.htm", "index.xhtml", "default.html", "/.dirlist/dir-generator.php" )

  20. #18
    Excellent work works perfectly!!

    Any idea how I can zoom more using PDF files? I can't seem to be able to zoom more than the page width.

    Thanks!

  21. #19
    Livin the iPhone Life Eurisko's Avatar
    Join Date
    Aug 2007
    Location
    Toronto, Canada
    Posts
    3,308
    Thanks
    12
    Thanked 562 Times in 483 Posts

    Quote Originally Posted by KamalinO View Post
    Excellent work works perfectly!!

    Any idea how I can zoom more using PDF files? I can't seem to be able to zoom more than the page width.

    Thanks!
    Same way you do with a photo. Pinch and expand.

    Quote Originally Posted by kpavery View Post
    find this line in your config:

    index-file.names = ( "index.php", "index.py", "index.pl", "index.cgi", "index.html", "default.html", "/.dirlist/dir-generator.php" )

    and add the other extensions you want, like "index.htm", "index.xhtml" so on

    e.g.:
    index-file.names = ( "index.php", "index.py", "index.pl", "index.cgi", "index.html", "index.htm", "index.xhtml", "default.html", "/.dirlist/dir-generator.php" )
    My fault. I was changing /etc, not /usr/local/etc
    Last edited by Eurisko; 03-11-2008 at 10:26 AM. Reason: Automerged Doublepost
    Get "iPod & iTunes for Dummies", it'll change your life.

  22. #20
    Quote Originally Posted by Eurisko View Post
    Same way you do with a photo. Pinch and expand.
    Cool!! Didn't think about that actually

    Thanks!

    next question: any chance of doing a search in a doc/pdf page?? I'm not sure i've seen this possibility in Safari at all.

Page 1 of 9 123 ... LastLast
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •