Giter Site home page Giter Site logo

scrap's Introduction

Scrap

A high performance file upload solution for ShareX.

Requirements

Scrap is powered by php7.2, redis-server and mysql-server.
You must have these installed on your system in order for scrap to work.

If you tweak your memory limit on memcached, you can also use that if specified in the .env

Features

  • User authentication
  • In memory caching for files under FILE_CACHE_THRESHOLD bytes in size
  • Adjustable caching times under APP_CACHE_TIME
  • Duplication checking (duplicated files are aliased)
  • Native Illuminate\Laravel Encryption Facade usage (AES-256-CBC)
  • Proper HTTP Responses (200, 201, 400, 403, 404, 419, 500, 503)
  • Dynamic Protocol Detection (Will automatically return HTTPS or HTTP based on POST method)
  • CloudFlare Reverse Proxy support

any highlighted text in this section can be found in the .env

Installation

$ git clone https://github.com/Elycin/Scrap
$ cd Scrap
$ composer install
$ cp .env.example .env
# At this point, please edit the .env and configure the database with MySQL. 
$ php artisan key:generate
$ php artisan migrate

Want a single threaded ready to go instance rather than configuring a webserver?
run: php artisan serve --host 0.0.0.0 --port 8000

How to use

By default, the upload function in the applications controller looks for the fields username and password.
In ShareX, you should be able to specify a custom domain such as http://$YOUR_DOMAIN/upload with the POST Parameters as follows:

  • username - Your application username
  • password - Your password
  • file - The uploaded file (also known as the "File form upload" field)

Optional Parameters

Below are additional parameters you can pass to modify information about the uploaded file.

  • encrypt (true/false) - Encrypt the user data.
  • expires (datetime/timestamp) - Expiration date of the file.

Cache Server Usage

The use of redis is recommended, and more so required for this application. Redis works by storing data in the memory of your server and Scrap will dump data into it occasionally for faster access times, this is so that data will not be read from the disk if your server is in high demand.

Automatic File Deletion

Scrap has the ability via the form of a cronjob every hour or console command via artisan to automatically delete files older than DAYS_TO_STORE in the .env

To set up automatic scheduling, add this line to your crontab:

* * * * * php /path/to/scrap/artisan schedule:run >> /dev/null/ 2>&1

Or you may choose to manually run the cleanup by:

$ php artisan clean:files

scrap's People

Contributors

coderobe avatar elycin avatar resir014 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

coderobe tamshep

scrap's Issues

Initial migrations do not run when using sqlite as db driver

Git Commit: 6b49099d1f813524bfe43a2339b45f9cdb9ab694

PHP Version:

PHP 7.2.2 (cli) (built: Jan 30 2018 19:18:38) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Issue Description:
Using sqlite as database backend errors on php artisan migrate because the default database path (database/database.sqlite) does not exist yet.

Workaround:
touching the file before running the migrations fixes this issue & the database gets populated correctly.

Benchmarks

Please keep in mind that this isn't meant to be a platform as a service, but rather a do it yourself hosting solution for ShareX. This software isn't meant to compete with platforms such as Gyazo, Lightshot or others however I hope that someone can come along and help me out with benchmarks here.

I have not tested the performance and from the current standpoint, all boast about "performance" is theoretical in this project since files under 5 MB by default are working in-memory rather than being read from the disk.

Can someone please upload a single file to multiple platforms, and compare it to this project?

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.