Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.
/ backblaze-img Public archive

🔥 File uploading service utilizing Backblaze B2 Cloud Storage, Fastify, and ShareX.

License

Notifications You must be signed in to change notification settings

redraskal/backblaze-img

Repository files navigation

backblaze-img

🔥 File uploading service utilizing Backblaze B2 Cloud Storage, Fastify, and ShareX.

Installation

  1. Clone the branch

    git clone https://github.com/JediMasterSoda/backblaze-img.git
    
  2. Install dependencies

    yarn install
    

    or alternatively

    npm install
    
  3. Rename config.json.example to config.json and edit config.json along with backblaze-img.sxcu. More on that at Configuration.

  4. Run

    yarn start
    

    or

    npm start
    
  5. Install ShareX and open the backblaze-img.sxcu settings file.

Configuration

Fastify

Key Value
hostname “localhost” for testing and your server’s IP address or “0.0.0.0” for production.
logger Only enable for debugging because Fastify runs slower with logging enabled.

General

Key Value
fileUrl URL you will receive in ShareX to view the uploaded file. {0} is replaced with a file ID generated by backblaze-img. There are no file extensions with this uploading service.
redirect URL users will be redirected to when trying to view the index.
uploadKeys Array of Strings used to authenticate uploaders. Change the default key “2d9f4679-9a28-4fdc-866e-06c2b1fc1b39” to something unique and extremely random. You will need this key for backblaze-img.sxcu.
uploadLimit The upload limit for any given file.
fileCacheMaxAge The Cache-Control header max age for any given file.
errorCacheTTL How long in milliseconds file 404’s should be stored in memory. This feature is useful to reduce the amount of requests on Backblaze since they charge per request after a certain threshold.

b2

  1. Create a Backblaze account.
  2. Create a bucket. Your bucket unique name can be anything, just make sure to set the files to “Private” mode so random people on the Internet won’t be able to view all of your files.
  3. Copy the Bucket ID you will see on the same page into your config.json along with the bucket name you chose.
  4. Go to https://secure.backblaze.com/app_keys.htm and “Add a New Application Key”. Name the key, set the allow access to just the bucket you created and not “All”, set the “Type of Access” to “Read and Write” and hit “Create New Key”. You will see a “keyID” and a “applicationKey”. Copy those two values to your config.json as well.
Key Value
keyID See above steps.
applicationKey See above steps.
bucketName See above steps.
bucketId See above steps.
authCacheTTL Backblaze generates an authorization token for API usage in this project. The token will be revoked after 24 hours so it must be refreshed at the correct time in order to avoid website errors. This number is the time in milliseconds between token refreshes. The value is currently set at 1 hour.

backblaze-img.sxcu

  1. Modify {WEBSITE_URL} to the URL this project is hosted at.
  2. Change {UPLOAD_KEY} to the upload key you modified in config.json.
{
  "Version": "13.1.0",
  "Name": "backblaze-img",
  "DestinationType": "ImageUploader, FileUploader",
  "RequestMethod": "POST",
  "RequestURL": "https://{WEBSITE_URL}/upload/{UPLOAD_KEY}",
  "Body": "Binary",
  "URL": "$json:file_url$"
}

About

🔥 File uploading service utilizing Backblaze B2 Cloud Storage, Fastify, and ShareX.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published