Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cfhs-js

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cfhs-js

Complex HTTP File Server

  • 0.1.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

CFHS-js

Complex file HTTP server.

Early WIP.

Features

  • Authentication: UUID tokens are used to manage accessing.
  • Multi-instance: As many instances as you want.
  • Multi-directory: The directories do not have to be located inside one place.

Installation

This project is at the early stage. Simplified installation should be added later.

Now supporting GNU/Linux. BSD users might see problems.

Configuration

Overview

All config files are stored in ~/.config/cfhs-js. It may contain multiple directories; each of them represent one instance. Each instance has 3 files:

  • conf
  • dirs
  • tokens

Config File: conf

This is where main configuration options reside. Now only the port number is configurable.

Example:

Port=1453
ServerName=Example HTTP File Server
UrlPrefix=http://127.0.0.1:1453

This is not shell script, so no need to quote or escape for space characters.

You have to write port number in UrlPrefix again, unless it is the default port of the protocol specified afore. While this program is supposed to listen at a harmless port, users might need to visit through Nginx which listens at 80 or 443, according to your specific setup.

Config File: dirs

Write a list of directories to be shared. Use absolute paths.

Example:

/tmp/cfhs-default:abcd
/tmp/cfhs-new

Optionally append :abcd at the end of a line to let it appear as abcd in the root index. In the example, the 2 directories will appear as abcd and cfhs-new in the root index.

Config File: tokens

Users should not touch this file. The program manages tokens.

This file is a CSV with 5 columns:

IndexField NameDetails
0TimestampTimestamp of generation.
1TypeSingle uppercase letter. A for admin; V for visitor.
2TokenUUID with hyphen.
3PathThe path which this token is authorized to access.
4ExpiryThe expiry date, ISO 8601 format, initial 19 characters.

Manage Instances

Create

cfhs-js-ctl new MyInstanceName

This will create the instance configuration directory.

Start & End Instances

cfhs-js-ctl start MyInstanceName
cfhs-js-ctl end MyInstanceName

You may start and stop instances with the 2 subcommands.

Check Instance Status

cfhs-js-ctl status-all

How Things Work

Process Life Cycle

The program cfhsctl is a small script to manage configrations and processes. It starts and ends serverd.js processes, which actually accepts HTTP requests.

Since this project is an early-stage WIP, you may prefer to use serverd.js with manual configuration, instead of playing with cfhsctl.

Tokens

Tokens include admin tokens and visitor tokens. Admin tokens can be used to generate visitor tokens.

Admin tokens can access all directories and files, but visitor tokens can only access the directories which they are authorized.

Both programs create tokens.

Web User Session

When a user visits a page, the URL should include a token. If the token is an admin token, or a visitor token with correct access at the path, the user will be allowed to see the index of the directory or download the file. When navigating from page to page, the token will be preserved in the URL.

Copyright (c) 2021 Neruthes.

Published under GNU GPLv2. See file LICENSE.

FAQs

Package last updated on 01 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc