Coder Social home page Coder Social logo

pi-file-server's Introduction

pi-file-server

It's not necessarily a raspberry pi server. It can run anywhere. The backend is written in Golang. Mainly because I wanted to experiment with Golang and did not want to build a "tutorial" project. So here's me experimenting. The frontend is written in SvelteJS as it has a small footprint.

Here's how you get started. You would obviously need Golang to compile on the Pi.

These are the command line flags

addr =v"HTTP network address"
globalPath = "Directory to files"
secret = "Secret key for the crypto library."
signUpSecret = "This is the 'admin password' for creating new accounts"

Files can be read without signing up, but POST, DELETE requires authentication. None of the files are encrypted, however I do on user specific directories and password protected zip files. But that's a work-in-progress. So if anyone yoinks the hard drive they have sensitive data. Also you need a SQLITE3 database with the name users in the root and here's you create table command. You could use SQLITE3 browser.

CREATE TABLE users ( name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, hashed_password CHAR(60) NOT NULL, created DATETIME DEFAULT (datetime('now','localtime')), active BOOLEAN NOT NULL DEFAULT TRUE );

The files directory contains css and the html for the frontend. The build folder within "files" will have the files uploaded, deleted, accessed etc.

If you use the globalPath copy the files directory structure with the contents over to your preferred directory.

generate.go file is added in tls. Heres an example of the command line flags

go run ./tls/generate_cert.go --rsa-bits=2048 --host=your ip domain etc

Here's some pictures of the frontend.

Frontend Add Folder Add Files Files Preview Files

P.S. I stole a lot of the CSS from Alex Edwards. It was from his book Let's Go. His book started me off on the Golang journey. Don't blame my badly written code on him. His book is crazy good. Excellent teacher as well.

pi-file-server's People

Contributors

syedzayyan avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.