Giter Site home page Giter Site logo

rejetto / hfs Goto Github PK

View Code? Open in Web Editor NEW
1.7K 31.0 170.0 11.25 MB

HFS is a web file server to run on your computer. Share folders or even a single file thanks to the virtual file system.

License: GNU General Public License v3.0

HTML 0.15% TypeScript 94.73% SCSS 3.29% JavaScript 1.55% CSS 0.28%
file-sharing file-server http-server nodejs typescript web

hfs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hfs's Issues

(dev) problems about the new `sendList`

The file_list/sendList gives back a Readable.

It can contain error information, but in order to know it before serving, I need to read it -- I could get an entry or an error, but in case an entry I can't put it back.

My thoughts:

  • I see "errors" are put there before listing. So you can by the way set a custom attribute to that readable to indicate it have error.
  • Or instead do it on ret and return list (rather than returning list.return)

Any change is acceptable, my case is in active development too :)

Plugins not loading after update

Describe the bug
The plugins aren't loading in the Admin interface after updating to v0.26.1

To Reproduce
Steps to reproduce the behavior:

  1. Download and extract updated version to file location.
  2. Run the hfs.exe executable.
  3. Open the Admin Interface.
  4. Go to Plugins menu.
  5. Under "Installed" active plugins show up, and some are also showing up as not installed under "Search Online".

Expected behavior
A list of active/enabled plugins in the Admin interface.

Screenshots
Screenshot
Screenshot
Screenshot
Screenshot

Environment (please complete the following information):
Installed on:

  • OS: Windows Server 2019

Accessed on:

  • OS: Windows 11 22H2
  • Browser Brave Browser Nightly
  • Version: Version 1.45.5 Chromium: 105.0.5195.52 (Official Build) nightly (64-bit)

(dev feature req) something like `api.file_list`, but simply easier, in plugin `api`

Played with file-listing APIs and found api.file_list is the best to use.

The simplest approach to my request is to provide another identical function without asyncGeneratorToReadable wrapped to generator.

And my thought: this API is used by frontend ajax request, thus it's also stable enough to be imported with api.require.
... right?


Details:

For myself I started coding on HFS 2 template plugin again. This time it's going flawlessly!
(Status: Approx. 60% of "engine" is completed. Still not functional at all, yet...)
And that's the reason of these requirements.

Drawbacks of file_list:

  • Depending on parameter sse, it returns an Readable or a plain object, with file entries.
    • Readable is streamed, but I know it's for HTTP replying, and it's not that suitable for code, particularly plugins.
      To get entries from this, I need to put event listeners on it. It's (some) slow & silly, after testing.
    • And the plain object is made after listing all files, not streamed & takes resource. ("one big shot")

I also remember you've mentioned walkNode. But it's too basic, and lacks error-reporting/masking etc that are already in file_list.

(dev) `api.setConfig` resets other config to default (i.e. removed them)

FINALLY found it. I don't even know how to tell it until now.

Look here,
Changing to this can solve:

    pluginsConfig.set(v => ({ ...v, [id]: _.isEmpty(config) ? undefined : Object.assign(v[id], config) }))

And a test plugin to test it: test.zip

  1. Manage to install & enable it.
  2. Note the two configs inside, they have default value foo: "apple" and bar: "orange"
  3. Browse root url, the middleware routine inside will setConfig bar to banana, then show the two fruit name on screen
  4. Go to Admin plugin config, change apple to potato, save it. In terminal you can see the change being applied
  5. Refresh page, it's still apple. In terminal you can see foo is changed back to apple, reflected by subscribeConfig

Downloads Managment

Is your feature request related to a problem? Please describe.
It would be cool to be able to set a task to download files via a direct link from the network. A kind of download manager. Let me explain why: all DMs on the network either do not have a web interface, or it is very inconvenient.

Describe the solution you'd like
In fact, for a starting point, a pop-up window is enough with entering a link from where to download and selecting a directory within HFS where to download + download in several streams. If the feature takes off, it could turn out to be a great part of a stall of a great program.

"Download zip" option downloads only a single file inside the zip

Describe the bug
I've also tried selecting all in filter list before clicking "download zip" to no avail.
It downloads everything correctly if I only have virtual folders. But if I add a folder from disk anywhere (root/home level or inside a virtual folder) then it again downloads a single file only.

Environment:

  • OS: Windows 10
  • Browser: Google Chrome
  • Version: 0.25.0

Root permissions

Describe the bug
Set to ROOT folder permissions to "Any account (login required)" not working: root dir always shown to guests =\

To Reproduce
Steps to reproduce the behavior:

  1. Set root folder permissions to "Any account (login required)"
  2. Enter to root on frontend without account

Work on Ubuntu 22.04,Out Put Some Error

I have ran the application on my server in ubuntu 22.04 version.
I use nohup to make the program run in the background.
However, I don't know why, after the program runs for a while, it will automatically crash and will not restart. After I checked the log output, I found some key lines.
nohup: ignoring input
HFS ~ HTTP File Server - Copyright 2021-2022, Massimo Melina [email protected]
License https://www.gnu.org/licenses/gpl-3.0.txt
started 9/6/2022, 4:57:46 PM
version 0.26.2
build 2022-09-03T21:16:11.000Z
cwd /root/.hfs
config config.yaml
HINT: type "help" for help
using generic lib for crc32
[Error: EBADF: bad file descriptor, read] {
errno: -9,
code: 'EBADF',
syscall: 'read'
}

Http Error: listen EACCES

Hi, thanks a lot for your project. I'm really a beginner and I met this when I first start the program as the README said.
截图_20220521004128
It didn't open the browser as it should. I've tried with config.yaml and got the same reaction. Could you tell me how to fix it?

In the debug.log, it said:
2022-05-20T16:40:55.671Z: http Error: listen EACCES: permission denied 0.0.0.0:80
Environment: [Win][0.22.0]

some questions

I have some small questions, and I want to know more about the details:

1st

In current repo state code I see Plugin description string should have double quotes.
I also see in code it's for getting description from disabled plugins, without executing them.
I also guess it's for not escaping single quotes. But in this case escaping double quotes won't work, instead...
In my mind a better alternative is backtick `'any' "string"`. Multiline flag maybe also used in that regexp.
Of course tell plugin developers don't use ${}
btw single quote is my code style :)

2nd

Readme say Plugin middleware function could return another function for "executing in upstream".
I found it's just executing the returned function at the very end of plugin cycle.
Think of there can be multiple middlewares, that do different things. We also need correct order.
Is the "upstream" used to do that? I feel not enough...

3rd

What's the supposed way to let a plugin handle authentication? (or should not do it?)
I can't directly get it. Since it's about security, please take consideration :)

4th

Every time I want to sync HFS repo, I pull it but always resulting in file conflict. Notably the 1.4MiB package-lock.json
(I didn't change any dev file manually)
Suggested by git, I just committed a change. But it result in many other dev files can't be merged.
That's even more messy, and what I could do is rm -rf hfs then git clone it again.
This time, in fresh repo I put a * in .gitignore. I don't know if it would work...
Any suggestion?

The last

Consider a user guide? Put "Quick Start" in readme, and detailed "Cookbook" and "Dev Guide" in elsewhere.
I can help it if I have time :)
Many one say HFS 3 is not user friendly. Though I get no point about this...

Well, that's all...

Oh wait, is such kind of things suitable in Discussion?

对于没有图像界面的Linux系统启动报错

在本地用着挺不错的,然后到服务器上启动的时候就报错了。

network veth8b41470
- http://[fe80::a8f8:77ff:fe1b:ca1f]:8011
Error: spawn xdg-open ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',
  spawnargs: [ 'http://localhost:8011/~/admin/' ]
}
loading plugin antibrute

`localhost` issue of admin interface

In 0.14.3, particularly after commit da616fe found with git bisect,
in function ctxAdminAccess of adminApis.ts,
in some conditions ctx.ip of localhost addresses is ::ffff:127.0.0.1 rather than expected 127.0.0.1 or ::1.

An obvious symptom is Firefox can't access the admin interface when starting "cleanly" (i.e. first run) -- it requires auth immediately because it's not being considered localhost (though at this point there's no account, making accounts.yaml manually is needed)
curl and wget is partially affected too, but it doesn't affect Chromium, in which ctx.ip is just 127.0.0.1

All these is tested on my Linux and Android (Termux). On web search there are some relative cases (of other stuffs) on Windows

So at this time just add ::ffff:127.0.0.1 to function isLocalHost nearby 😃

Plugin & License

See around here of GNU GPL FaQ.

From the view of license, a plugin must be (also) released under GPL 3, otherwise it's a violate.

My thought is, it's necessary to check the license of a plugin, from search result of GitHub.
(Maybe when installing, to avoid low performance of course)
(And maybe analyze from file COPYING)

Another matter is "exception" system of GPL 3, could be used to deal with necessary circumstances.
For example to allow plugins with non-copyleft license -- but whatever, they should be free-as-in-freedom!

Zipped folder with nonstandard encoding

Describe the bug
I have a bug for files with names in a non-standard encoding if such a directory is downloaded through an archive. In this case, in the example, the OS encoding is Russian, after unpacking the archive it turns into a mess.

Screenshots
https://share.dvor-net.ptz.ru/Z4ZEnuNj2J.png

Environment (please complete the following information):

  • OS: windows 10 21H2 Pro
  • Browser: last Maxthon 6 (Chromium)
  • Archiver: WinRar 6.02 x64

Support to generate linke QR code

I want to download the files on HFS on my mobile phone, but I have to manually enter the URL every time, which is very troublesome. If I can generate a QR code on HFS, I can directly access my resources by scanning the code on my mobile phone.

Uploading files

Hello! Thx for your work! But server need some feature for uploading files =\

Editable theme templates

It would be cool to be able to modify html/css/js files, which would make it possible to change the appearance of the web interface.

404 home root in new window

Describe the bug
After reboot my CLIENT pc i get 404 on white window in root =\ To reproduce this bug - clear temp dir on windows os

Uploads

Thanks for this extremely powerful tool. is amazing.
Uploads are the only thing missing and that is it!

can not use"Internet download manager" login dialog to login HFS after session expired

A downloader software call "Internet Download Manager", or short for "IDM", have ability to login in some kind of server that do not need to run in browser. But this feature didn't work in HFS after session expired. the error code is http "401" unauthorized with HFS user name and password. Hope can have a solution to deal with that. Thank you so much!

Bug/Feature request ? - The search shows results from folders with restricted access to users who are not part of who can access those folders

video showc

Very simple, a user who doesn't have permission to download should also NOT view the contents of the folder in question. He actually gets a 401 error trying to access the folder. However, using the "deep Search" function it is able to find files and folders that were supposed to remain hidden.
This may be intentional (since it refers to a simple "disable downloading for the contents of this folder" instead of an actual "hide this folder and its contents and prevent viewing/downloading").
Anyway, thanks again 👍

Environment (please complete the following information):

  • OS: Windows 10 x64 22h2
  • Browser chrome
  • Version 0.26.3

Direct links to the file and authorization

Describe the bug
Greetings! If you send a direct link to a file to a person and he did not log in before, then instead of authorization -> file download, Not Found tells him and that's it. This is very inconvenient, especially if you don't need to show the file storage interface once again.

Localization?

Well, just a question... is localization support planned in the future?

(dev feature req) plugin & private/external files?

I want that:

  • In plugin config it's able to select an external file/directory, and return its path or content.
  • Plugin can store "private" files somewhere, that are meant to be assets, cache, etc., and have a good way to manipulate them.

I think some security should be concerned, too. For 3rd-party plugins, it is possible to ruin an environment by allowing something like real file/dir path.

Download zipped folder from link

It would be nice to be able to download the zipped directory via a direct link: this makes it possible to download files with multi-threaded managers like Download Manager

`git pull --force` fails on `package-lock.json`

When forcing the pull (as usual) from version 0.21.0 cf525a7 to version 0.22.0 10ee26d, it fails on package-lock.json.

By "restoring" that file it solved.

git restore package-lock.json

I guess it's because change at 91a45a0? (And my local modification, didn't add/commit, all automatically by node)

Consider a tip for people in the docs?

enter a URL without login cause 401 in webpage

HFS ver: 0.24.1
error reproduce steps:
0.if logined already, logout first, or simply open a privacy window in browser;
1.enter a URL without permission;
2.use the login dialog box to login;
3.webpage will show 401 errorcode instead of file list
image

About file sorting and hidden file loading

hi,Thanks for your work,
It's a great tool, and version 3 is a good one, but there are some things that would like to keep some of the settings of version 2. For example: the sorting of files can be the same as in version 2, and for hidden files in folders, you can choose whether to load them in.

Blank site when open File Server in iOS 12.5.5

Like title when Start HFS 0.22.1 File Server at 192.168.88.101 but when open it on my iPhone it still show blank site.

  • Device: iPhone 6
  • OS: iOS 12.5.5
  • Browser: Safari version 12, Chrome version 92

IMG_2441

allow a user to upload a file?

Hi, I'm a hfs user for a vary long time, mainly I used the Delphi version.

Today, I first tried the Node.js version, works correctly.

One missing feature is that can a user upload a file to the server?
I can't find the option here.

Thanks.

request "Zip" file can be resume download after network interrupted

currently I'm facing network failure in busy hour, it is easily disconnecting from HFS server. and "zip" file has no resume download feature after connection lost , it's a torture when lost connection on downloading huge size files and can not continue from where the files was downloaded😭.
thank you!

Selecting files to download as an archive

It would be cool to be able to select some of them with checkmarks in the list of files and by clicking the "Download archive" button, download not the entire directory, but only the previously selected files. As for me - it will be very convenient.

Photo and tile view mode

An excellent feature that is sorely lacking along with the ability to upload files: this is the ability to view directories in the form of tiles and photo previews, as well as open images in some viewer with the ability to slideshow (the same greybox). It's quite easy to screw it on and it seems to me that it will raise the level of the software quite well.

`git pull --force` fails on `package-lock.json`

When forcing the pull (as usual) from version 0.21.0 cf525a7 to version 0.22.0 10ee26d, it fails on package-lock.json.

By "restoring" that file it solved.

git restore package-lock.json

I guess it's because change at 91a45a0? (And my local modification, didn't add/commit, all automatically by node)

Consider a tip for people in the docs?

Issue with zip functionality and large folders

Describe the bug
When downloading a large folder (14GB) using the Download Zip button, the download seems to complete sucessfully, but right when it looks like its about to finish it restarts the download. This happens from multiple PCs in multiple locales. The download would continue to do this forever if you do not cancel it.

To Reproduce
Steps to reproduce the behavior:

  1. Share folder with 14GB of files in it
  2. Browse to file share page and click Download zip to get
  3. Watch download restart before it finishes

Expected behavior
I would expect the download to complete and not restart.

Environment (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 0.22.0

(dev) Bugs on HFS/plugin config

I've encountered several tough bugs while making some other plugin config.

Let me say one here... (and the rest after me successfully debug them, in separate issues.)

At here, HFS checks if the config being set is the same as default, if yes then don't set -- so, the config remains unchanged :(
(i.e. you can't have default value anymore, once you set it to something else)

P.S. it's 2 hours debugging on this. Hope I have better luck

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.