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 - hanshenrik

Pages: 1
1
i suppose you could use different ports for it, running project1 on port 1001 project2 on port 1002 project3 on port 1003 etc



buuut maybe your needs exceeds HFS2's capabilities

2
HFS ~ HTTP File Server / Re: how to inline images in folder view
« on: April 18, 2022, 12:11:16 PM »
Rejetto could give you a much better answer than mine, but AFAIK this is a normal behavior, since thumbnail icons are automatically generated by HFS (following a numerical order), based on the registered file extensions found on a Windows system
i think i get it, thanks!  and so far HFS2 has everything i need for a small photo gallery + file sharing among friends thing, and it is much easier to set up than.. idk, Apache+mysql+php whatever alternative ^^ (and i did briefly check out HFS3, and quickly determined that it's not nearly as user-friendly as HFS2 yet, and ignored it ^^)

Hi,

Great DIY job :D

To ignore the dynamic icon problem, in your code replace the selector-parent-each line with this:

Code: [Select]
document.querySelectorAll('a[href$=".jpg"i],a[href$=".png"i],a[href$=".gif"i],a[href$=".webp"i]').forEach(function(e) {
thanks, and thanks ^^ was kindof hoping to avoid needing a list of image formats filenames, given that HFS already seems to know what formats are images and what isn't... but since that info seemingly isn't added to the HTML, i guess it's nearly unavoidable :( also you forgot "jfif" and "bmp" and "ico" ! i don't know what jfif is exactly, but it's some kind of obscure image format, because HFS knew its an image (the screenshots in the top post actually contains a jfif ^^)

3
HFS ~ HTTP File Server / Re: how to inline images in folder view
« on: April 16, 2022, 08:53:25 AM »
what the heck? i have hfs on different computers, both are 2.3m, but on the first computer the generic image thumbnail is /~img43 and on the 2nd computer the image thumbnail is /~img42  , what gives?   idk how it happened, but that breaks my "#files img[src*='img42']" selector "on some computers" ???

using the alternative selector "#files img[src='/~img43'],#files img[src='/~img42']" works on both computers, but i'm still confused

4
HFS ~ HTTP File Server / how to inline images in folder view
« on: April 16, 2022, 07:34:01 AM »
i was initially going to ask the forum how to inline images, but i figured it out before completing my post :)
 
but because i didn't find a solution while searching the forum, here's how i did it:

go menu -> HTML Template -> Edit

then find
Code: [Select]
[box folder]
<fieldset id='folder'>

and replace it with
Code: [Select]
[box folder]
<fieldset id='folder'>
<script>
// the DOMContentLoaded is only needed because im too lazy to figure out how to add the script to the end of the pageload
document.addEventListener("DOMContentLoaded",function(){
//return;
                // ??? is it 42 or 43 or both?
$("#files img[src='/~img43'],#files img[src='/~img42']").parent().each(function(){
let preview_size = "250px";
let inline_image = document.createElement("img");
inline_image.name="inline_image";
inline_image.style = "max-width: "+preview_size+";"
inline_image.src = this.href;
inline_image.addEventListener("click",function(ev){
if(ev.target.style["max-width"]){
ev.target.style["max-width"]="";
} else{
ev.target.style["max-width"]=preview_size;
}
});
this.parentNode.appendChild(document.createElement("br"));
this.parentNode.appendChild(inline_image);
});
});
</script>
and all the images in folders will be inlined :)

before:

after:

5
at the moment i'm very busy with hfs3 and hate to work on previous version, because it's very old stuff that's hard to deal with.
i cannot exclude doing some work with it in the future.

stand-alone exe, sure. it's already so.

it's not yet user-friendly, right, but it's still easier than apache.
right now i started working on the administration interface, the equivalent of the hfs2 main window. This alone will take me tens of hours of work.

oh i see, well since i'm seemingly the only person affected by this range issue, it's not particularly important to anyone (including me), no need to prioritize it. good luck with the HFS3 project!


>stand-alone exe, sure. it's already so.

are you sure? when i try to run the 0.8.0 exe file standalone (extracting *just* the exe file from the archive), it just exits with this error

C:\Users\hans\Downloads>hfs
started 1/24/2022, 5:43:01 PM build 2022-01-23T13:59:18.879Z
cwd C:\Users\hans\Downloads
cannot read config.yaml Error: ENOENT: no such file or directory, open 'C:\Users\hans\Downloads\config.yaml'
C:\Users\hans\Downloads>echo %ERRORLEVEL%
0

seems there's a bug right there! it exits with errorcode 0, should surely be 1 or something, 0 is generally a success return code, no?
but also seems like this exe requires at the very least a config.yaml present ^^

6
good news, but hfs3 is still a long way from being user-friendly, right? any chance of a hfs2 fix?

and while we're on the topic of hfs3, will hfs3 support a single stand-alone exe file like hfs2?

7
Bug reports / Re: HFS external IP not working
« on: January 22, 2022, 12:06:31 PM »
sounds like a port-forwarding issue, not a HFS bug.. are you familiar with port-forwarding? if not, maybe try a guide like https://www.hellotech.com/guide/for/how-to-port-forward

if you can't get that to work, what do you get from pressing windows-button+R and writing
cmd /C ipconfig && pause
and pressing enter? like this https://i.imgur.com/DVSn9Bj.png

8
after some investigation, turns out that it *does* in fact respond with a bunch of http headers, but no body, and it does keep the tcp connection alive indefinitely.. curl -v log:

$ curl 'http://127.0.0.1/123.txt' -H "Range: bytes=3-" -vv
* STATE: INIT => CONNECT handle 0x80008eff8; line 1789 (connection #-5000)
* Added connection 0. The cache now contains 1 members
* family0 == v4, family1 == v6
*   Trying 127.0.0.1:80...
* STATE: CONNECT => CONNECTING handle 0x80008eff8; line 1850 (connection #0)
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
* STATE: CONNECTING => PROTOCONNECT handle 0x80008eff8; line 1980 (connection #0)
* STATE: PROTOCONNECT => DO handle 0x80008eff8; line 2003 (connection #0)
> GET /123.txt HTTP/1.1
> Host: 127.0.0.1
> User-Agent: curl/7.80.0
> Accept: */*
> Range: bytes=3-
>
* STATE: DO => DID handle 0x80008eff8; line 2099 (connection #0)
* STATE: DID => PERFORMING handle 0x80008eff8; line 2218 (connection #0)
* Mark bundle as not supporting multiuse
* HTTP 1.1 or later with persistent connection
< HTTP/1.1 400 Bad Request
< Content-Type: text/plain
< Accept-Ranges: bytes
< Server: HFS 2.3m
< Set-Cookie: HFS_SID_=0.732762209838256; path=/; HttpOnly
< ETag: 491C3211A3BA8673626DDF909E1F59BE
< Last-Modified: Sat, 22 Jan 2022 01:00:01 GMT
< Content-Disposition: filename="123.txt";
* no chunk, no close, no size. Assume close to signal end
<

(here curl just hangs indefinitely)


wget:
$ wget 'http://127.0.0.1/123.txt' -v -c
--2022-01-22 02:25:12--  http://127.0.0.1/123.txt
Connecting to 127.0.0.1:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3 [text/plain]
Saving to: %u2018123.txt%u2019

123.txt                                                             100%[==================================================================================================================================================================>]       3  --.-KB/s    in 0s

2022-01-22 02:25:12 (31.1 KB/s) - %u2018123.txt%u2019 saved [3/3]


hans@DESKTOP-2LHJILI ~
$ wget 'http://127.0.0.1/123.txt' -v -c
--2022-01-22 02:25:15--  http://127.0.0.1/123.txt
Connecting to 127.0.0.1:80... connected.
HTTP request sent, awaiting response... 400 Bad Request
2022-01-22 02:25:15 ERROR 400: Bad Request.


- and that 400 breaks wget's -c , which is bad when combined with -r , eg `wget -r -c http://127.0.0.1/ - will only work the first time, the 2nd invocation will be broken with a http bad request error. (because hfs doesn't respond with http 416)

9
on hfs 2.3m and "2.4.0 RC6" range requests are broken, if you request bytes out of range, the http request will just hang indefinitely!
this is mostly bad because it breaks wget's ` wget -r -c url` , but it could likely also likely be abused to implement a very efficient DoS attack,

if you have 123.txt containing the exact text "123" (and no newline), doing
> curl 'http://127.0.0.1/123.txt' -H "Range: bytes=3-"

the correct response would be "HTTP 416 Requested Range Not Satisfiable" (because only byte 0-2 inclusive exists),
 but that doesn't happen, instead the http connection will just hang indefinitely! hfs never responds, it just keeps the tcp connection alive indefinitely..!

10
Bug reports / Re: file-extension-based-content-type ?
« on: June 25, 2021, 06:11:45 AM »
This is already built-in :)
In HFS: Enter Expert mode, Menu - Other options - MIME types..., add a row and fill with | *.mp4 | video/mp4 |

Also, I think feature request is not a bug... :D If no child board fits needs, post on general HFS board

oh thanks, found it. and thanks, will do next time. (hope some moderator can move it?)

11
Bug reports / file-extension-based-content-type ?
« on: June 24, 2021, 05:51:32 PM »
(didn't know where to post feature requests, if this is the wrong place, please let me know the correct place)

would be really nice if we could set content-type headers for file extensions somewhere,

very specifically, i want .mp4 files to be served with the header
Content-Type: video/mp4
not
Content-Type: application/octet-stream

this would allow me to stream mp4 files directly in my web browser, instead of having browsers download the video.

Pages: 1