PirateBox on Android

Posted by joschi70 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
Re: PirateBox on Android
May 21, 2014 04:30PM
PirateBox for Android is now available at Google Play.

Here is the blog post: PirateBox at Google Play
Re: PirateBox on Android
May 21, 2014 08:44PM
joschi! I just gave it a short try... I'm impressed, that works nice!

Thanks for your work!

Matthias
Re: PirateBox on Android
May 22, 2014 05:14AM
Hi Matthias,

thanks for testing and all the work you do for PirateBox!
Glad that it's working.

And thanks for retweeting smiling smiley
Re: PirateBox on Android
May 22, 2014 05:58AM
joschi made a great job!

[img42.com]

[img42.com]
Re: PirateBox on Android
May 22, 2014 06:25AM
Thanks for all the help!
Re: PirateBox on Android
May 24, 2014 01:52AM
great stuff to see this on google play, am sure will see more use now smiling smiley

question - any plans to introduce features such as one can get with librarybox e.g. usage stats? landingpage - browser not use cache?

if not any pointers on how to do this oneself?

thanks!
Re: PirateBox on Android
May 24, 2014 02:09PM
Don't know how the LibraryBox stats look like, but this should be possible by writing a filter/handler that stores stats data inside a SQLite database.
Can't tell if or when I can look into that.

In principle you can do that yourself by writing your own handler. You can even add filters/handlers at runtime without having to rebuild the app.
PirateBox is based on the PAW server, everything that is possible with PAW should also work with PirateBox.

If you are interested a filter example can be found here: PAW - Dynamic Handlers and Filters
Re: PirateBox on Android
May 24, 2014 02:59PM
joschi, I'm using some php scripts that store their data in a SQLite database:

[github.com]
Re: PirateBox on Android
May 24, 2014 03:40PM
Matthias,

thanks for the link.

Looked into that, if I got that correctly the file listing does not reference the files directly but calls a stats PHP script which saved the URL and counter to db and afterwards delivers the actual file.
I thing on Android we can use a filter which does do the same thing but is completely transparent and will also work if a file is directly referenced via URL.

Quite sure this will work.
Re: PirateBox on Android
May 24, 2014 09:40PM
Hi Joschi,
yes exactly.

Yeah, maybe you have some better solutions for that smiling smiley - that was the easiest way to implement the download counter and does not interfere in common situation. - Maybe there is a better solution on the normal LBx too ...

See also the visitor counter - it does only track the current user-agend+IP+Date convertet to SHA-1
So, if some value switches, the visitor is counted again.
--- But I think you already made a different solution.

Let me know, If you got it working out.

regards Matthias
Re: PirateBox on Android
May 26, 2014 11:32AM
hi joschi70

i am interested in promoting piratebox to teachers as a way to share files. one of the stumbling blocks to get teachers to use this is that an android phone needs to be rooted. very few teachers will know or be inclined to root their phones.

would you be able to do (and consider) a version that does not require this?

thanks

p.s. thanks for the info about handlers but beyond me at the moment!



Edited 2 time(s). Last edit at 05/26/2014 12:11PM by peelie.
Re: PirateBox on Android
May 26, 2014 08:15PM
In my opinion it is not possible on un-rooted devices.

Consider using a self-build LibraryBox.

Pedagobox - is a french project for using the PirateBox in school with a detailed slide about installing.
Re: PirateBox on Android
May 27, 2014 05:15AM
Matthias is right, the setup won't work without root.
The dnsmasq wrapper needs root and the port 80 redirection also won't work without.
Would be nice if that would be possible without root but unfortunately it isn't.
Re: PirateBox on Android
May 27, 2014 09:10PM
okay thanks for info

regarding the other options i.e. building a box, is even more involved than rooting i feel for most teachers

thanks
Re: PirateBox on Android
June 01, 2014 03:55PM
Just published version 0.4.8 of the app which includes visitor and download statistics.

Here are screenshots of the app settings and the main web page:



Hope it's working as expected...
Re: PirateBox on Android
June 02, 2014 04:38AM
Hi Jochen

Tested the 0.4.7

the connection status on the widget sometimes shows more than the connected devices tested this with one laptop and 2 android devices. sometimes shows 5 until i refresh the widget by tapping it.

[img42.com]

also updated to 0.4.8

shows connected users on the piratebox landing page and top downloads (the top downloads counter i think is being affected by the # of visitors counter. see pic). the connected users counter on the widget is fixed now.

[img42.com]

great work jochen!



Edited 1 time(s). Last edit at 06/02/2014 04:41AM by ora600.
Re: PirateBox on Android
June 02, 2014 03:26PM
Good that it's working ... thanks for testing!
uwe
Re: PirateBox on Android
June 03, 2014 10:34PM
i can confirm the app as working on a fairphone first edition with android 4.2.2 - had to use .apk-version 0.4.6 though. the newer one would install (in android 4.2.1 at the time), run, accept settings, offer the AP etc - but it wouldn't accept files or downloads. version 0.4.6 works, but sometimes crashes every like 5 minutes or so and sometimes runs for hours for no obvious reasons.
also, both versions would only offer files for download which had been uploaded through piratebox, which made it harder to offer lots of files by simply copying them to the shared folder. i had to upload them one by one, as uploading folders also did not work (could this be added?). re-organising the single uploaded files in folders did work though.
third, i couldn't manage to set the shared folder to my micro-sd-card yet, which makes me a little uncomfortable running the piratebox as anybody could upload stuff directly to the device. maybe fairphone is to blame for that, but would it be possible to include a point-and-click-selection for the shared folder?

if you want me to do some further testing, let me know. you certainly put lots off efforts into this, so i'd be happy to do the same (on a noob level, but i'd like this to be broadly available and therefore also working for noobs :-).
Re: PirateBox on Android
June 04, 2014 05:29AM
Hi Uwe,

thanks for the report.
On my GalaxayNexus the app runs very stable to it is strange that it crashes on your FairPhone. If that happens again, it would be good if you could send me (jochen [at] fun2code.de) the logcat output of your phone.

I don't know how easy it is to implement folder upload but if you like open a feature request on GitHub, so it does not get lost.

The storage folder can be changed inside the preferences (Settings->Storage Directory). For the time being you have to edit the folder location manually. There is already a feature request to implement a file chooser on GitHub.
Your external sd card should be mounted somewhere below /mnt. If you have the path to the sd card, you could change the storage location and things will hopefully work.
Re: PirateBox on Android
June 04, 2014 08:50AM
Keep up the good work
preserving modified html during google play update
June 05, 2014 01:32AM
hi

i was wondering what is best way to preserve modified html files when updating program via google play?

it seems one needs to have the content to SD option on but that means when updating this gets overwritten with default html files?

thanks
Re: preserving modified html during google play update
June 05, 2014 05:25AM
Hi peelie,

If you do not tick the Content to SD option, the HTML/CSS files and the configuration is stored inside the /data/data/de.fun2code.android.piratebox/files/piratebox directory.
You can also edit the files there (your device is rooted anyway), so you don't have to use the Content to SD option. IMHO it's just more convenient to have the files on sdcard.

To prevent the next update to overwrite your changes, un-check the Enable Updates option. In any case do a backup of your files, we are still in early stage of development ... so some things might not work as expected.
Re: PirateBox on Android
June 05, 2014 06:13AM
Thank you for that information, i have been trying to alter some pages since the app can save the html folder on the sd card. I am trying to emulate offlineart 's setup since i may attend an art fair by the end of july.



Edited 1 time(s). Last edit at 06/05/2014 06:19AM by ora600.
Re: PirateBox on Android
June 05, 2014 07:28PM
First off, thanks for the app, this is fantastic!

I have been running the 0.4.8 beta on my Nexus 4 running stock 4.4.2 for the last 5 days or so and haven't run into any issues, everything is nice and stable and the transfer speeds are really good.

Looking at the rewrites file in the conf directory, is it possible to redirect a certain URL to another page? For example when I type in "chat" into my browser I would like my custom chat page to come up, when I type "files" into my browser I would like my custom file browser page to come up.

Thanks
Re: PirateBox on Android
June 06, 2014 10:57AM
Hi aaron,

thanks for the report, glad that it's working.

There is a rewrite handler active which was used in older PirateBox versions.
You can of course use that, but for you testing I would suggest to use redirects. When using redirects you'll see the result in the browser's address bar, this is not the case when using rewrites.
You can simply add a redirect handler by adding the following lines above the "URL Rewrite" handler inside the conf/handler.xml file:

<handler status="active">
    <name>Redirector</name>
    <description>Redirects URLs</description>
    <removable>true</removable>
    <id>redirect</id>
    <files>
      <file>redirects</file>
    </files>
    <params>
      <param name="redirect.class" value="org.paw.handler.RedirectHandler" />
      <param name="redirect.rules" value="[PAW_HOME]/conf/redirects" />
    </params>
  </handler>


After that you can create the file conf/redirects. The file contains a left hand (incoming) and a right hand (redirect URL) separated by a tab.
Perl 5 regular expressions can be used and back references are supported by using $1 ... $9.
Here is an example:

^/chats.*	http://pirate.box/chat/bsoread.xhtml


This should redirect all request starting with /chats to http://pirate.box/chat/bsoread.xhtml.

The new handler will be active after a PirateBox restart.
Hope it's working for you ...
Re: PirateBox on Android
June 08, 2014 12:14AM
Hi joschi70,

I added the redirects handler into the handler.xml file, created the redirects file in the conf directory just like you had explained in your post but every time I enter chats or /chats into my browser I get the main pirate box page.

If I change the redirects to something like
^*     http:// pirate. box/chat/bsoread.xhtml
things break and I get a browser error saying it can't find
pirate.box/.html.html.html.html.html
. Not sure if I am doing something wrong with my redirects, I am using the option to put the pirate box files on the SD card, not sure if that makes a difference.

p.s. had to put the spaces in the pirate box URL in my code line, if I didn't it would format like this [pirate.box]

Thanks
Re: PirateBox on Android
June 08, 2014 11:10AM
Hi aaron,

just checked the configuration I've posted.
This seems to work. It is important that you do not just enter /chats into the browser. A hostname needs to be specified before /chats (e.g.http://whatever.com/chats) because the redirect only inspects the requested URL path.
Ame
Re: PirateBox on Android
June 10, 2014 01:11AM
I've been trying to setup pirate box 0.4.8 on my old android phone for the past couple of days..

When I try to set it up, it says "Setting up networking, please wait..." forever and ever.

Then when I disabled "Autostart AP" it says "pirate box is running", with no hotspot of course.

Anybody know how to start the AP manually? I tried downloading some tether app and could connect my laptop to it but pirate box wouldn't recognise it.

I'm using the stock operating system(rooted).


I managed to get the old, old version running with the PAW server, but it was really unreliable and wouldn't start up 90% of the time. It also wouldn't redirect the user to the piratebox page so they would have to type in the IP address. And the hotspot didn't show up on my other phone, only on my laptop

Please help, I really want to get this up and running.
Re: PirateBox on Android
June 10, 2014 10:40AM
Hi Ame,

what version of Android are you running?

The PirateBox app uses the standard WiFi tethering Android funktionality. So if the standard tethering is not working, the app will most likely not run.
I've some reports that on some roms the menu entry Settings->More...(Wireless & Networks section)->Tethering & portable hotspot->Portable Wi-Fi hotspot is not available.
The tethering functionality should be available since Android 2.2.

The app seems to wait for the AP to come up, but that seems never to happen.
So it might be, that the AP is not working correctly or not available on your system.
Re: preserving modified html during google play update
June 10, 2014 09:16PM
hi

thanks for info. so does that mean when i do update that the files in /data/data... will not be changed?

also the widget does not seem to be available under latest android 4.4.3?

thanks