rejetto forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - SamePaul

Pages: 1 2 3 ... 5
1
HFS ~ HTTP File Server / Re: For testing purpose (HFS including SSl tools)
« on: September 12, 2014, 05:18:55 PM »
I don't see where I can choose language. I've gone over all menus and didn't find where I can choose language.

Damn localization sucks so much.

2
HFS ~ HTTP File Server / Re: For testing purpose (HFS including SSl tools)
« on: September 12, 2014, 11:13:22 AM »
How to REMOVE god damn russian translation???? Is there option to NOT localize HFS? Can I please stay with english? Pretty please?

3
0. Completely understand and support. Deadline has us all from time to time :)
1. Cookie authentication was just an example. What I actually proposed - macro that can modify HTTP response code. Template then may do all the rest work. Of course I'd be glad to help you in whatever I can.

4
HTML & templates / Re: MIME-type filter in [file] section
« on: May 24, 2011, 06:07:20 PM »
OK. There are more important stuff indeed   ::)
Good that you respond. I was starting to worry

5
1st of all I hope everything is OK with the author. Seems he just got tired of HFS and this forum a bit :)
Now, good news I have almost ready template that CSS-optimized for both desktop browser and mobile. Yes, not 2 templates - just one :)

But I have some problems on my HTC Desire browser.
1. Browser cannot login via "login" link. Namely when I click link https://my-site.com/~login browser asks me for username and password, but then returns to root folder ... and we're not logged in! Problem is that browser consider "~login" part as folder and thus it thinks that authentication valid only for /~login/ tree. If for example I try to enter password-protected folder https://my-site.com/secure/ I'm asked for password and stay authenticated for this folder and all subfolders as well.
I proposed once to support in HFS alternative authentication URL like https://my-site.com/?mode=auth or even better - support template macro {.setHttpError|code.}. I prefer 2nd solution, as it allows more flexible authentication schemes based on cookies etc.

2. Browser can't download archived content. It means, that if I select multiple files in list and then click "Archive" button, nothing happens. Regular file downloading by clicking link works without any problem.
I analyzed response headers of HFS for different scenarios like archiving files, downloading standalone .tar file. In general difference is in content-type and content-disposition: application/x-tar for archiving and application/octet-stream + "attachment" for downloading. Maybe Android doesn't know how to handle /x-tar or can't live without "attachment" keyword? Maybe it's worth to use 2nd variant for both transfers?
There is also chance that Android can't handle correctly downloading after POST... don't know how to verify this.

3. Uploading isn't working at all. I saw in other post that request header may help in debugging, so here they are
Code: [Select]
> POST /upload/sandbox/ HTTP/1.1
> Host: 192.168.2.100
> Accept-Encoding: gzip
> Accept-Language: en-US
> Cookie: HFS_SID=0.939639982767403
> Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
> Referer: https://192.168.2.100/upload/sandbox/
> User-Agent: Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; HTC Desire Build/MIUIAndroid 1.5.13) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
> Origin: https://192.182.2.100
> Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> Authorization: Basic ****************
> Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryKFSXwgyWckAMgljQ
> Content-Length: 554727
Thought it may be use of SSL or authentication, but without it result was the same.
Code: [Select]
> POST /upload/sandbox/ HTTP/1.1
> Host: 192.168.2.100
> Accept-Encoding: gzip
> Accept-Language: en-US
> Cookie: HFS_SID=0.939639982767403
> Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
> Referer: http://192.168.2.100/upload/sandbox/
> User-Agent: Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; HTC Desire Build/MIUIAndroid 1.5.13) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
> Origin: http://192.168.2.100
> Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryLtRTXXJs6CB4l4hy
> Cache-Control: no-cache
> Pragma: no-cache
> Content-Length: 554727
Comparing to upload from desktop browser
Code: [Select]
> POST /upload/sandbox/ HTTP/1.1
> Host: localhost
> User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip, deflate
> Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 115
> Connection: keep-alive
> Referer: http://localhost/upload/sandbox/
> Cookie: HFS_SID=0.665004789130762
> Content-Type: multipart/form-data; boundary=---------------------------248749113712
> Content-Length: 108673
The only significant difference I see is "boundary" part, however I'm not very familiar with encoding, but maybe this "WebKitFormBoundary" makes HFS to choke?

UPD: Forgot to mention, HFS Version 2.3 beta 279

6
HTML & templates / MIME-type filter in [file] section
« on: May 17, 2011, 08:11:03 PM »
Hello there :)

As usual I have crazy proposal that potentially may result in more effective and clean template writing.
As long as I know, today in order to handle differently file types (lets say images diferently than music) I have to write something like this

Code: [Select]
[file.jpg=file.jpeg=file.gif=file.png=file.bmp= ...and other 1000 types of image...]
<tr> <td> handle images one way </td> </tr>

[file.mp3=file.m4a=file.aac=file.flac=file.mpc= ...and other 1000 types of audio...]
<tr> <td> handle audio files another way </td> </tr>

[file.avi=file.mkv=file.mp4=file.flv=file.mpg= ...and other 1000 types of video...]
<tr> <td> handle video files third way </td> </tr>

In my example it looks compact but is actually not.
1.  we indeed have thousands of file types for audio/video/pictures/other documents.
2. consider if type-specific section handles only small part of whole HTML code - file icon - but all other attributes are handled uniformly
Code: [Select]
[file=folder]
<tr><td><a href="%item-url%">

[+file.jpg=+file.gif....]
<img src="/images/picture.png">

[+file.avi=+file.mkv....]
<img src="/images/video.png">

[+file=+folder]
</td><td>... all item attributes</td>

[+file.jpg=+file.gif....]
<button onclick="preview('%item-url%')">Preview</button>

[+file.avi=+file.mkv....]
<button onclick="play_flash('%item-url%')">Play</button>

[+file=+folder]
</tr>

Nice feature, isn't? Now consider every section [file.xxx=..] indeed includes many types?

My proposal is as follows. Support for file section like this [file|mime: filter].
For example [file|mime: images/*] would match every images registered in HFS MIME-types list; [file|mime: image/jpeg] would match only JPEG images etc.
This format is just proposal. There are different variants, like [file(image/*)]. This has advantage that it can be used like this: [+file(images/*)=+file(video/*)]

Hope rejetto finds it useful.

7
HTML & templates / Re: iPhone template
« on: May 15, 2011, 06:23:49 PM »
I dont know if it is normal, but the file template/style.css begins with stranges characters :
body {

It's UTF-8 identifier (so called BOM).

For everyone else asking why this doesn't work. Well, it specifically designed for browsers based on WebKit engine (Safary, Chrome). Hence it works only on iPhone and Adnroid smartphones. Don't expect it to work in Mini Opera, Windows Mobile etc.

I personally find this template pretty exciting, but it has to be adapted to CSS3.

And for questions about choosing template. I would propose different solution. Every modern browser support choosing CSS stylesheet according to attribute "media" in <link /> tag.

For example the following code will work just fine, desktop browser will automatically choose "normal.css", but phone browser will use "mobile.css"
Code: [Select]
<link href="/template/normal.css" rel="stylesheet" type="text/css" media="screen" />
<link href="/template/mobile.css" rel="stylesheet" type="text/css" media="handheld" />
This will work even with old phones. Even my ancient Sony Ericsson works with it :)
Now it's question of layouting desktop version correctly by CSS. Which is not a big deal ;)

8
HFS ~ HTTP File Server / Re: Idea? Drag and Drop Upload
« on: October 02, 2010, 04:14:30 PM »
Writing template is not real problem here. I did it by mainly copy-paste example code to default template. However it needs some tuning.
The main problem is to encode file contents to application/x-www-form-urlencoded mime type. Actually I remeber had somewhere example of doing that specifically for XHR.
I maybe would even bother with it a bit more but I realized soon that whole approach is based on reading whole file into RAM and then just submit it via XHR. And I say it sucks. No. it SUCKS. Just imagine you want to upload 2-hours 320kbps mp3 DJ set to your home HFS. Woohoo!
In the current implementation it's just a waste. Maybe guys at MDC will think a little bit more and add some conversion or encoding engine that can be plugged in between FileReader and XHR and do all necessary tasks without need to load whole data into RAM
And then we can talk about any usability.

9
HFS ~ HTTP File Server / Re: HTTP Error Code
« on: October 01, 2010, 02:15:04 PM »
well, Windows versions of FireFox, Chrome and Opera do not have this limitation. Other browsers/platforms I didn't check.
Actually I find this behavior correct - if you become authenticated for some subtree it should not make authenticated to whole tree

I've read both threads but can't say I found "very effective workaround". Can you explain, please?

10
HFS ~ HTTP File Server / Re: Idea? Drag and Drop Upload
« on: September 30, 2010, 07:11:08 PM »
It's pure client side. Write template :)

11
HFS ~ HTTP File Server / Re: HTTP Error Code
« on: September 30, 2010, 05:45:58 PM »
Some idea just came up.

Maybe HFS needs additional authentication signal. Something that looks like parameter to browser. Lets say, instead of http://server/~login use something like http://server/?mode=login
Anyway "mode" parameter is used heavily in default template, so here is new meaning. It would solve just my immediate problem, but it seems a lot easier to implement... and who said that we always should solve problems globally? :)

12
HFS ~ HTTP File Server / HTTP Error Code
« on: September 30, 2010, 05:13:25 PM »
I'm adopting HFS template to use on mobile browser and encountered some strange quirk.
Some browsers consider path during authentication, so if you authenticate at http://server/some/folder/~login you become logged in for http://server/some/folder/ and deeper. But if after authentication you go to http://server/some/ or http://server/some/other/folder you suddenly discover that browser does not send "Authorization" header anymore. Usually it is not problem, as by default you log in at root folder, i.e. at http://server/~login and hence become logged in for the whole HFS tree. But unfortunately Android browser considers "~login" part as folder, so when after successful authentication you are redirected back to root folder you become unauthorized again. So you are effectively unable to login.
So either you have to restrict access to whole site and thus making anonymous access impossible.
Another solution, which is not available yet, would be to modify HTTP response code within template and switch to corresponding error section like [not found] [overload] [deny] etc.
For example, within template  I could inspect protocol (http, https), cookie or any other condition, and then require user authentication accordingly by setting HTTP code to "401 Unauthorized".

Something like
Code: [Select]
[]
{.if not|{.header|Authorization.}| {: {.http-error|401.} :} .}
<!DOCTYPE...

In this example HFS would set HTTP code to 401 and jumps to [unauthorized] section.

This macro can have optional parameter "no-switch"
Code: [Select]
{.http-error|401|no-switch.}and in this case  HFS just updates error code, but continues to process template normally, i.e. to <!DOCTYPE... and so on.

Code: [Select]
{.http-error|200|no-switch.}is great example of doing nothing :)

13
HFS ~ HTTP File Server / Re: thumbnails on the fly
« on: August 08, 2010, 05:50:12 PM »
Diff tpl applies to subfolders here, at least where all are real.
Maybe you are right and I just misinterpret the way diff template works.

The main idea originally was to execute some console tool, which resizes image to specified size and the dumps JPEG data to stdout. Then HFS takes this output and send it to client.

So I build template:
Quote
...
[file.jpg=file.png=file.gif=file.bmp|private]
...
<a href="%item-name%"><img src="%item-folder%/~thumbnail?file=%item-name%" /> %item-name%</a>
...

[thumbnail]
{.add header|Content-Type: image/jpeg.}
{.exec|resize.exe "%item-resource%{.?file.} -scale 50x50"|out=x.}{.^x}

So basically if everithing works as expected, URL http://mysite.com/photos/july2010/~thumbnail?file=IMG_200.JPG would open as thumbnail version of file http://mysite.com/photos/july2010/IMG_200.JPG

Advantages:
- works on the fly with any picture you have on your server, including newly uploaded
- doesn't use diskspace
- works on any VFS

Disadvantages:
-relatively slow if you have lots of files in folder (thus not suitable if you have high hit rate)
-it doesn't work :) when I attempt to open the mentioned URL I get error 404 Not Found.

Another solution (proposed by rejetto) was to create thumbnail cache on disk and in template create thumbnails on the fly only when absent in cache. Finally template would look like this

<a href="%item-name%"><img src="/cache/%item-name%" /> %item-name%</a>

Of course it needs some polish (my is more complex), but it's just example to introduce principle.

Advantages:
-works on the fly
-it actually works(!!)
-consequent requests are pretty fast, as HFS takes thumbnails from cache
-spares disk reads

Disadvantages:
-takes diskspace (not a much however)
-in case of name conflicts there is no automatic way to resolve it
-requires additional hidden VFS share (which is not really a problem)

For image scaling I use ImageMagic tool set, which is pretty fast. However I'm going to write my own tool, because I need it to be even faster :)  pipelined and more suitable for my specific task.

14
HFS ~ HTTP File Server / Re: thumbnails on the fly
« on: August 08, 2010, 02:45:14 PM »
I'm not sure of that.

Actually it was his idea, so I hope he's going to make it work as well ;)
you should consider accessing /folder/~thumbnail?file=picture1.jpeg
and then using {.?file.} to know the file



But until an answer or solution from rejetto, you can use the template that includes [mysec] in folders of your choice as diff template, and keep the template without [mysec] as default template.
I guess it can work. However it will work for a specific folder added directly to VFS and only for it. Not even for subfolders, as the become inaccessible...

Anyway, I think that my phrase "picture gallery" mislead most of you, guys. I used this term only for example. My real objective is to preview any picture accessible via HFS. That's why I can't use "preprocessing" tools like TPGen.

It's just an idea, don't be angry. :D
Nah, I'm not that bad ;)

15
HFS ~ HTTP File Server / Re: thumbnails on the fly
« on: August 08, 2010, 01:00:46 PM »
SilentPliz thanks again. Now it works

bacter Thank you, but don't need it either for same reason I didn't want RAWR or Live: it's workaround which just makes something that looks like what I need, but not solution.

rejetto Do you think it will be possible in some future to run sections on arbitrary folder, not only on root? I mean, if I have [mysec] section in template, will URL http://mysite.com/some/folder/~mysec work?

Pages: 1 2 3 ... 5