Giter Site home page Giter Site logo

axeloz / filesharing Goto Github PK

View Code? Open in Web Editor NEW
207.0 6.0 32.0 9.7 MB

Self-hosted files sharing application, easy to setup, easy to use

Home Page: https://filesharing.box.webinno.fr

License: GNU General Public License v3.0

PHP 76.44% Blade 21.83% JavaScript 0.80% CSS 0.18% Dockerfile 0.75%
php laravel file-sharing file-upload uploader

filesharing's Introduction

Files Sharing

FILES SHARING VERSION 2 JUST RELEASED

Description

This PHP application based on Laravel 10.9 allows to share files like Wetransfer. You may install it on your own server. It does not require any database system, it works with JSON files into the storage folder. It is multilingual and comes with english, french, german and korean translations for now. You're welcome to help translating the app.

This application provides two links per bundle :

Each of these links comes with an authorization code. This code is the same for the preview and the download links.

The application also comes with a Laravel Artisan command as a background task who will physically remove expired bundle files of the storage disk. This command is configured to run every five minutes among the Laravel scheduled commands.

Features

  • uploader access permission: IP based or login/password
  • bundle's settings: title, description, expiration date, number max of downloads, password...
  • upload one or more files via drag and drop or via browsing your filesystem
  • ability to keep adding files to the bundle days later
  • sharing link with bundle content preview
  • download rate limiter
  • ability to download the entire bundle as ZIP archive (password protected when applicable)
  • direct download link (doesn't preview the bundle content)
  • garbage collector which removes the expired bundles as a background task
  • multilingual (EN, FR, DE and KR)
  • easy installation, no database required
  • secured by tokens, authentication codes and non-publicly-accessible files

Demo

Online Demo

You may visit my Online Demo

Video Demo

A video demo is available on Youtube

Screenshot

demo image

Requirements

Basically, nothing more than Laravel itself:

  • PHP >= 8.1
  • Ctype PHP Extension
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

Plus:

  • JSON PHP Extension (included after PHP 5.2+)
  • ZipArchive PHP Extension (included after PHP 5.3+)
  • SQLite

The application also uses:

Installation

Docker

You may now install FileSharing via Docker. See https://hub.docker.com/r/axeloz/filesharing

docker run -d \
-p 8080:80 \
-v <local_path>:/app/storage/content \
--name filesharing \
-e APP_NAME="FileSharing" \
-e APP_URL="<your_url>" \
-e ASSET_URL="<your_asset_url>" \
-e UPLOAD_MAX_FILESIZE="1G" \
-e APP_TIMEZONE="Europe/Paris" \
-e UPLOAD_PREVENT_DUPLICATES=true \
-e HASH_MAX_FILESIZE="1G" \
-e UPLOAD_MAX_FILES=100 \
-e LIMIT_DOWNLOAD_RATE="100K" \
axeloz/filesharing:latest
  • use the -v option to bind your local storage to the docker instance (persisting data)
  • adapt the -p option to listen to the port you need
  • you may pass env variables with the -e option
  • you can use a reverse proxy for SSL termination (example: nginx)

Simple config for Nginx:

server {
	server_name filesharing.box.webinno.fr;
	charset utf-8;

	location / {
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header   X-Forwarded-Proto $scheme;
		proxy_set_header   X-Scheme $scheme;
		proxy_pass http://localhost:8080;
	}

	listen [::]:443 ssl http2;
	listen 443 ssl http2;
	ssl_certificate [...]
	ssl_certificate_key [...]
}

You can also use in docker compose with the following template:

version: '3'
services:
  app:
    image: axeloz/filesharing:latest
    environment:
      UPLOAD_MAX_FILESIZE: "1G"
      UPLOAD_MAX_FILES: "100"
      UPLOAD_LIMIT_IPS: "127.0.0.1"
      UPLOAD_PREVENT_DUPLICATES: true
      HASH_MAX_FILESIZE: "1G"
      LIMIT_DOWNLOAD_RATE: "1M"
    volumes:
      - files_v:/app/storage/content
    ports:
      - 8080:80

volumes:
  files_v:
    driver: local

Standalone

  • configure your domain name. For example: files.yourdomain.com
  • clone the repo or download the sources into the webroot folder
  • configure your webserver to point your domain name to the ./public folder
  • run composer install
  • run yarn --production (or npm install --production)
  • run yarn build (or npm run build)
  • make sure that the PHP process has write permission on the ./storage folder
  • generate the Laravel KEY: php artisan key:generate
  • run cp .env.example .env and edit .env to fit your needs
  • (optional) you may create your first user php artisan fs:user:create
  • start the Laravel scheduler (it will delete expired bundles of the storage). For example * * * * * /usr/bin/php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1
  • (optional) to purge bundles manually, run php artisan fs:bundle:purge

Use your browser to navigate to your domain name (example: files.yourdomain.com) and that's it.

Configuration

In order to configure your application, copy the .env.example file into .env. Then edit the .env file.

Configuration  Description
APP_NAME the title of the application
APP_ENV     change this to production when in production (local otherwise)
APP_DEBUG change this to false when in production (true otherwise)
APP_TIMEZONE change this to your current timezone
APP_LOCALE  change this to "fr", "en", "de" or "kr"
UPLOAD_PREVENT_DUPLICATES Should the app block duplicate files (true / false)
HASH_MAX_FILESIZE max size for hashing file to check for duplicate files. If files are bigger than limit, they will not be hashed. Find the best value for better cpu / memory consumption
UPLOAD_MAX_FILES (optional) maximal number of files per bundle
UPLOAD_MAX_FILESIZE  (optional) change this to the value you want (K, M, G, T, ...). Attention : you must configure your PHP settings too (post_max_size, upload_max_filesize and memory_limit). When missing, using PHP lowest configuration
UPLOAD_LIMIT_IPS  (optional) a comma separated list of IPs from which you may upload files. Different formats are supported : Full IP address (192.168.10.2), Wildcard format (192.168.10.*), CIDR Format (192.168.10/24 or 1.2.3.4/255.255.255.0) or Start-end IP (192.168.10.0-192.168.10.10). When missing, filtering is disabled.
LIMIT_DOWNLOAD_RATE (optional) if set, limit the download rate. For instance, you may set LIMIT_DOWNLOAD_RATE=100K to limit download rate to 100Ko/s

Authentication

You may provide a list of IPs to limit access to the upload feature.
Or you can create users with login/password credentials.
You can also mix the two methods.

Warning: if your leave the UPLOAD_LIMIT_IPS empty and you don't create users, the upload will be publicly accessible

Known issues

If you are using Nginx, you might be required to do additional setup in order to increase the upload max size. Check the Nginx's documentation for client_max_body_size.

Development

If your want to modify the sources, you can use the Laravel Mix features:

  • configure your domain name. For example: files.yourdomain.com
  • clone the repo or download the sources into the webroot folder
  • configure your webserver to point your domain name to the public/ folder
  • run a composer install
  • run a yarn install
  • run a yarn dev in order to recompile the assets when changed

Roadmap / Ideas / Improvements

There are many ideas to come. You are welcome to participate.

  • add PHP unit testing
  • more testing on heavy files
  • background process for creating Zips asynchronously after completion of the bundle
  • invitation to external users to upload file into existing bundle
  • customizable / white labeling (logo, name, terms of service, footer ...)

Licence

GPLv3

Permissions Conditions Limitations
Commercial use Disclose source Liability
Distribution License and copyright notice Warranty
Modification Same license
Patent use State changes
Private use 

https://choosealicense.com/licenses/gpl-3.0/

Welcome on board

If you are willing to participate or if you just want to talk with me : [email protected]

Powered by

filesharing's People

Contributors

axeloz avatar crazynds avatar dependabot[bot] avatar sanskar-mk2 avatar siutaaa avatar tadesf avatar

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

filesharing's Issues

[Feature Request] S3 Compatibility

Many cloud filesystem are s3 compatible, if we can do it, then we can have more ways to store file. I am working on it. Do you have suggestions?

Create a docker image

I really liked your system, I think there's just one way left to go up to production easily, what do you think about creating a docker image? I can help with that if needed.
If you find the idea interesting, let me know and I can create a pull request.

error : permission denied

Hello i have a permission denied on the cosnole of my web page.
I tried with a volume, with changing the user and mounting a local directory, can you provide me some advice to made your container work ? (i don't have any problem with others container)

Translation: German / de

Hey there,

I would be more than happy to contribute by translating the filesharing app to german.

Let me know if you are interested.

All the best,
Tade

Multiplatform docker image build (arm64) ?

I wonder if you'd be willing to get the github action to build this multiplatform so it can run on docker on the arm architecture?

It should be as simple as adding:

platforms: linux/amd64,linux/arm64

to the with block in the docker/build-push-action in the wofkflow (although I've only tested with docker/build-push-action@v5)

Creating Users (docker image) + Upload Issue

Hello, i'd like to make an administrative user (my own) to manage the application via an admin dashboard
On other docker containers i deloyd so far the first user created automatically got admin privileges, for filesharing there don't seem to be an register page.

It would also be nice, if users can register accounts for themselves.

When pressing the crete app bundle button on my instance, nothing seem to happen.

Regards,
FuckingToasters

Mixed Content https error

Hey there,

I wanted to configure this very nice app for my non-profit as a way of sharing data in order to achieve the EUs DSGVO requirements and everything looked very promising.

However, I stumbled across an issue that I could not solve yet – and I was wondering if you could help. The main page is working in order, but when I click on "Create a new upload bundle", I get this Mixed Content error:

Mixed Content: The page at 'https://files.redacted.de/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://files.redacted.de/new'. This request has been blocked; the content must be served over HTTPS.

CleanShot 2024-01-10 at 22 01 00@2x

I configured the container with a traefik proxy. My docker-compose.yml looks like this:

version: '3'
services:
  app:
    image: axeloz/filesharing:latest
    environment:
      APP_NAME: "redacted Filesharing"
      APP_URL: "https://files.redacted.de"
      UPLOAD_MAX_FILESIZE: "1G"
      UPLOAD_MAX_FILES: "100"
      HASH_MAX_FILESIZE: "1G"
      LIMIT_DOWNLOAD_RATE: "1M"
    volumes:
      - ${PERSISTED}:/app/storage/content
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.filesharing.rule=Host(`files.redacted.de`)"
      - "traefik.http.routers.filesharing.entrypoints=websecure"
      - "traefik.http.routers.filesharing.tls.certresolver=myresolver"

      - "traefik.http.routers.filesharing-upload.rule=Host(`files.redacted.de`) && (PathPrefix(`/new`) || PathPrefix(`/upload`))"
      - "traefik.http.routers.filesharing-upload.entrypoints=websecure"
      - "traefik.http.routers.filesharing-upload.tls.certresolver=myresolver"
      - "traefik.http.routers.filesharing-upload.middlewares=redacted@docker"

    networks:
      - traefik

networks:
  traefik:
    external: true

Do you have any Idea what could be causing this? I already skimmed through the codebase and did not find any hardcoded http links, that could cause this – and it seems to work very well in your demo app...

Note: The extra traefik auth middleware for the /new and /upload is not causing this to happen, I already tried with having it removed.

All the best and many thanks,
Tade

[Improvement] Do not 404 the preview links for the creator

Unless bundle is deleted/purged. Do not 404 the preview link. It can be used for record-keeping. Only the creator should be able to see it.

What causes the 404 on the Bundle model?

Moreover I saw deletion_link being used in code. Why is it not used in the website?

Request for new release

Hi, thank you so much for your efforts! Your application looks great and exactly what I am looking for.

However, I am struggling with deploying it behind an Nginx reverse proxy (Nginx Proxy Manager).
I've found out that this commit here will solve my problem: 2fdca6b

Would it be possible for you to tag a new release and update the Docker image? That would be great! <3

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.