biblioteka.git

command module
v0.0.0-...-2d2cc06 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

README

biblioteka Web Storage

  • biblioteka (library in Polish) is a web storage application designed for users to self-host on their own machines/servers
  • biblioteka is simple and lightweight, with a plain low-noise UI. Feel free to add your own custom styling to /client/style.css if you prefer a different look
  • Features include multiple users, persistent sessions using JWT authentication, basic directory and file operations, and a command line interface for admin tasks

Project Background

  • The main design goals are:
    • For users to be able to self-host web file storage. Note that you will still need to know how to correctly setup and administer a web server securely
    • To be accessible on all web enabled devices, therefore the browser is the only platform for the frontend
  • biblioteka was tested on Linux, but should work with any operating system

Installation

  • Clone this repo
  • Download and install Go go.dev
  • Use the command go build biblioteka.go in the cloned repo to build the biblioteka binary for your system
  • (Optional) add custom styling to /client/style.css if you like
  • Copy the resulting biblioteka binary and the /client directory to wherever you would like to run the application from. Note that the biblioteka binary and the client directory should be in the same directory

Configuration

Initial Setup

  • Once installed, create a directory called config in the same directory as the biblioteka binary. Inside config create a file called host and enter on one line the host and port number the application is to run on. For example 123.123.1.1:3000 where 123.123.1.1 is the ip address of the host and 3000 is the port you would like it to run on
  • Then open the biblioteka CLI (see Usage section) and run the keygen command to generate a JWT signing key. The application will save the jwt.key file in the config directory
  • Run the create-user command to create a user. Enter the help command for details
  • For the newly created user, run the define-storage-dir command to tell the application where the user's files are to be stored. Enter the help command for details
  • Note that biblioteka requires a TLS certificate to run outside of localhost

Adding Users

  • Use the create-user CLI command to create a user and their web login password (see Usage section)
  • Then create that user's storage directory and use the CLI command define-storage-dir to enter the storage directory's filepath into the application

Usage

CLI

  • Once biblioteka is running and listening on a port, running biblioteka again as a seperate process will open the biblioteka CLI
  • enter help to see a list of available commands

Development and Testing

  • For development and testing remember to:
    • Add a host file in /config (see Configuration section)
    • Run the CLI command keygen to generate a JWT signing key
    • Add a user 'testuser' with password '12345678' using the create-user CLI command before running tests
    • Use the CLI command define-storage-dir to add the storage directory location for 'testuser'
    • All tests and static code scans can be ran by executing the script /testAll.sh

Documentation

Overview

main entry point for the biblioteka web server

Directories

Path Synopsis
package app stores global consts for other packages to use
package app stores global consts for other packages to use
auth provides common user authentication functions
auth provides common user authentication functions
cli implements a command line interface for server
cli implements a command line interface for server
generates a jwt signing key for use during installation
generates a jwt signing key for use during installation
provides a pointer to a database handler so all packages share the same db handler
provides a pointer to a database handler so all packages share the same db handler
package errUtils contains error handlers and middlewares for the web server
package errUtils contains error handlers and middlewares for the web server
httpUtils provides functions and middlewares for working with http requests and responses
httpUtils provides functions and middlewares for working with http requests and responses
package requestBody contains types, generics, and functions related to working with http request bodies
package requestBody contains types, generics, and functions related to working with http request bodies
server implements a web server for remote file hosting
server implements a web server for remote file hosting
package storage implements web file storage
package storage implements web file storage
package testUtils contains useful functions for writing tests
package testUtils contains useful functions for writing tests
a package to validate data against various criteria such as length, acceptable characters etc.
a package to validate data against various criteria such as length, acceptable characters etc.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL