GithubHelp home page GithubHelp logo

rustpaste's Introduction

rustpaste

Build Status codecov

A private pastebin server written in Rust, using actix-web framework. Aiming to be very simple.

This is a work in progress.

REST API

  • To upload a paste, send a POST request to / with application/x-www-form-urlencoded data. This requires authentication (HTTP basic authentication). If the request is successful, response contains the URL of the paste.

    Note that urlencoded data is not the best approach for this because of some limitations (for example the max file size imposed by actix-web, extra overhead for non-ASCII data). I'm planning to change this to use multipart/form-data. Dealing with urlencoded data is so much easier in actix-web; that's why I chose to do it this way initially.

    You can use curl as follows to upload the contents of a file named filename:

    curl <domain> --basic -u "user:pass" --data-urlencode "data@filename"
    

    You should definitely use HTTPS or you'll get owned. Since rustpaste does not have SSL support, put it behind some reverse proxy (such as nginx) with SSL support.

  • To get a paste, send a GET request to the URL returned by the POST. To get the paste with syntax highlighting, add the file extension for the file as a separate path parameter in the GET request. For example, to highlight a paste with name QDRASC3w as Rust source code, send a request to /QDRASC3w/rs.

  • TODO: To delete a paste, send a DELETE request to the paste URL. This requires authentication.

Configuration

TODO: Things like where to store the pastes, username and password to be used by HTTP authentication, base URL to prepend to the POST responses will be configured using a config file.

Planned features

After implementing a very basic API with GET and POST requests, I'm planning to add the following features.

  • HTTP basic authentication for posting/deleting pastes.
  • Syntax highlighting with syntect.
  • DELETE method to delete pastes.
  • Configuration via a config file.

rustpaste's People

Contributors

dependabot-preview[bot] avatar tansly avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  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.