Giter VIP home page Giter VIP logo

dpaste's Introduction

Dpaste

dpaste image Python CI Docker Image CI Code Quality


๐Ÿ“– Full documentation on https://docs.dpaste.org

dpaste is a pastebin application written in Python using the Django framework. You can find a live installation on dpaste.org.

The project is intended to run standalone as any regular Django Project, but it's also possible to install it into an existing project as a typical Django application.

The code is open source and available on Github: https://github.com/darrenofficial/dpaste. If you found bugs, have problems or ideas with the project or the website installation, please create an Issue there.

โš ๏ธ dpaste requires at a minimum Python 3.6 and Django 3.2.

dpaste.org: https://dpaste.org/ pastebin: https://en.wikipedia.org/wiki/Pastebin

dpaste's People

Contributors

747project avatar adsworth avatar augustfengd avatar barttc avatar bitdeli-chef avatar darrenofficial avatar dependabot[bot] avatar efx avatar ferringb avatar hkraal avatar jjguti avatar jmoujaes avatar kdelinx avatar krinkle avatar kulbir avatar lb1c avatar lixeiden avatar lyrixderaven avatar mathieu-aubin avatar mgedmin avatar mozfreddyb avatar neuhaus avatar nixon avatar phrawzty avatar renovate[bot] avatar rezemika avatar rougeth avatar seocam avatar welshjf 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dpaste's Issues

Add one time snippets

Auto delete the snippet once it was viewed by another one (after the second view, the first one is by the author, who shares the link, which gets a view, which deletes the snippet)

Official release tag missing

Thanks for all the work and time you've put into dpaste!
Are there any plans to tag a release stamp on what you're having right here? ;)

Docs for running dpaste from scratch

I've no experience with django, but I'd like to install & run dpaste.

I can clone the repo fine, or install dpaste from pip, but I'm then stumped. I do not know how to run it, and there is nothing in the documents to tell me how.

I'm aware that this is probably due to the fact that I know nothng about djang, but it'd be nice if the docs had something about running dpaste from scratch.

Thanks

How to set syntax language?

  1. Hi, is there a way to specify the language of the pasted text via API?
  2. Is there a way to set the language of a existing paste when viewing?
  3. Is there a way of specified the desired langue using a url parameter?

Thanks!

Keyboard short-cut for non-Mac users

I am not a Mac user and feel discriminated against due to the fact that the submit key combination is cmd+enter ;D
It would be nice if I could submit a paste using CTRL+Enter or ALT+Enter on Linux/WIndows systems.

Templates and static files missing from sdist and installed files (create MANIFEST.in)

The dpaste pypi sdist currently doesn't contain templates and static files, and when using repository sources, templates and static files are not installed.

Currently the setup.py specifies:

package_data={'dpaste': ['static/*.*', 'templates/*.*']},

which only matches non-recursively, and only files not directories.

Create a MANIFEST.in with the following contents:

include *.rst LICENSE
recursive-include dpaste/templates *
recursive-include dpaste/static *

And add the following to setup.py:

include_package_data=True,

You may (should) also add LICENSE, README.rst to this manifest, and any other files you'd like to include in the sdist.

References:

https://docs.djangoproject.com/en/dev/intro/reusable-apps/#packaging-your-app
http://docs.python.org/2/distutils/sourcedist.html#commands
http://blog.nyaruka.com/adding-a-django-app-to-pythons-cheese-shop-py

manage.py uneccessarily installed in LOCALBASE/bin due to scripts= in setup.py

Currently the dpaste setup.py contains:

scripts=('manage.py',),

This unnecessarily adds the file to LOCALBASE/bin when it is only required at the Django project level.

If this is to assist users in "standalone" mode, can I suggest removing the line from setup.py, and instead creating a project_template directory that people can point to & use when running django-admin

DPASTE_MAX_CONTENT_LENGTH doesn't seem to be honored when submitting a long snippet

I'm trying to submit a long JSON snippet (250460 bytes) and for some reason, with an out-of-the-box installation, only 40750 bytes are retained.

I tried to override DPASTE_MAX_CONTENT_LENGTH to make sure the doc wasn't desync from the code:

DPASTE_MAX_CONTENT_LENGTH = 1024 * 1024 * 100

But it doesn't work. I see on https://dpaste.de that submitting the same JSON snippet is working perfectly.

My setup is really simple:

  • I use nginx as a reverse proxy
  • The default client_max_body_size on nginx is 1MB so it doesn't seem to be the problem
  • Dpaste django project is started on a screen session with manage.py runserver

DEBUG = True

You have DEBUG set to True on the live site.

I just wanted to let you know.

Generify the "about" page

The wording of the about page is specific to the particular dpaste.de implementation of this project. Would it be interesting to make this page more generic so that it fits in any implementation? If so, I'd be more than happy to write the text for that.

Just a thought - no worries either way. ๐Ÿ˜„

dpaste strips leading whitespace

  1. Go to dpaste.de
  2. Type something like this in the box
if language == 'python:'
    print "leading whitespace matters a lot"
print "right?"
  1. click the 'Paste' button

Observe the result:
ekrano nuotrauka i 2014-03-13 14 15 23

Expected result: leading whitespace is preserved.

Settle on canonical url

Right now there is no redirect from any to any of these. 2 have an invalid certificate. 4 have broken javascript (#15).

I'd recommend picking a non-www HTTPS domain as the canonical one. And redirect everything else to that (or at least specify <link rel=canonical>).

The easiest choice would be https://dpaste.de since that one has a valid SSL certificate. If dpaste.org is simply a redirect, it is OK not to have an HTTPS version I guess.

Though certificates aside, I personally prefer dpaste.org over dpaste.de (since it isn't Germany specific and org seems cool for FOSS utilities). Perhaps you could get an SSL certificate on dpaste.org/www.dpaste.org like you got for dpaste.de/www.depaste.de and use https://dpaste.org as primary.


Additionally fix the SESSION_COOKIE_DOMAIN cause right now we use separate cookies for [www.]?

Integrate test_suite into setup.py to enable test command support

Utilise test_suite and tests_require in setup.py to enable running unit tests via python setup.py test

You can either hook it into your existing run_tests.py, or point it to the nose collector. I've included references for doing either below.

References:

https://nose.readthedocs.org/en/latest/setuptools_integration.html
http://pythonhosted.org/setuptools/setuptools.html#test
http://pytest.org/latest/goodpractises.html#integrating-with-distutils-python-setup-py-test

Document the various settings you can override

ugettext = lambda s: s

DPASTE_SLUG_LENGTH = 32
DPASTE_EXPIRE_CHOICES = (
    (3600, ugettext(u'In one hour')),
    (3600 * 24 * 7, ugettext(u'In one week')),
    (3600 * 24 * 30, ugettext(u'In one month')),
    (3600 * 24 * 30 * 12 * 100, ugettext(u'100 Years')),
)
DPASTE_EXPIRE_DEFAULT = 3600 * 24 * 30 * 12 * 100
DPASTE_MAX_CONTENT_LENGTH = 250 * 1024 * 1024
DPASTE_MAX_SNIPPETS_PER_USER = 10
DPASTE_LEXER_LIST = (
    ('delphi', 'Delphi'),
    ('php', 'PHP'),
    ('text', 'Text'),
)
DPASTE_LEXER_DEFAULT = 'php'
DPASTE_SLUG_LENGTH = 32
DPASTE_SLUG_CHOICES = 'abcdefghijkmnopqrstuvwwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ1234567890'
DPASTE_BASE_URL = 'https://dpaste.de'

Trove classifiers missing in pypi entry (use list not tuple)

The classifiers specified in the dpaste setup.py dont seem to be reflected in the dpaste pypi entry: https://pypi.python.org/pypi/dpaste

classifiers=(
    'Development Status :: 5 - Production/Stable',
    'Environment :: Web Environment',
    'Intended Audience :: Developers',
    'License :: OSI Approved :: MIT License',
    'Operating System :: OS Independent',
    'Programming Language :: Python',
    'Framework :: Django',
),

I think this may be related to using a list not a tuple as per:

http://docs.python.org/2/distutils/setupscript.html#additional-meta-data
http://docs.python.org/3.3/distutils/apiref.html#distutils.core.setup

Thanks to SilentGhost @ #python FreeNode for this

Allow user to delete their snippets via the slug

Sometimes people add snippets via the API and they can't simply delete them. Add a form to let them delete any snippet by submitting the slug. They can delete any snippet, even foreign ones, but thats fine.

No CSRF protection :(

I don't think this is a serious issue - I mean...for a nopaste service, but still. Why did you disable CSRF protection?
Probably to put things into dpaste via curl and other APIs?

It would be great to at least have it for snippet_delete ;)

snippet's secret_id's are deterministic

The random number generator used to generate secret IDs is deterministic
This means that given an certain amount of secret IDs (by generating a few empty snippets) it is possible to generate previous and future IDs.

To support a greater deal of secrecy, you could generate >4 random bytes using os.urandom and encode them to your current output alphabet. This can be easily done with Base36:

bytes = os.urandom(5)
secret_id = base36_encode(bytes)

API Enhancement, lexer + store time

Suggestion API Update

As discussed by mail I open a ticket hereby. I`m not a good python coder so I hope somebody or you find some time to add those changes.

Problem

Currently the API is limited to receive CONTENT as only POST data. I`m using sublime to code a lot in PHP + JS and also some other languages. The Problem is that there is currently no way to let a sublime plugin pass the currently used lexer to dpaste or choose the time of store.

Solution

Adding the acceptance of LEXER + STORETIME to the POST API would solve this problem.

Sublime Text Plugin

A simple change to the official sublime dpaste plugin could be used to submit the right lexer:

def paste_code(self,content):
    values = {
        'content' : content,
        'lexer' : get_language(self)
    }
    request = urllib2.Request(
        'http://dpaste.de/api/',
        urllib.urlencode(values),
    )

And the called function:

def get_language(self):
    return self.view.settings().get("syntax").split('/')[-1].split('.')[0]

Thank's alot.

JavaScript exceptions on HTTPS

I like that dpaste has a properly set up HTTPS domain (valid certificate, all urls relative so you stay on HTTPS etc.)

However one problem. jQuery is loaded from a fixed HTTP url (http://code.jquery.com/jquery.js) which is blocked by modern browsers over HTTPS.

Perhaps host is locally or load it from a CDN that does support HTTPS (such as Google APIs):

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>

By using protocol-relative urls it'll load it from http or https based on the current request.

Add possibility to link to diffs

Add an entry for views.snipped_diff to the urls.py like /diff/$pasteid1/$pasteid2/ and add a link to this url when selecting "compare"

Integration docs

Document how to integrate dpaste into an existing project structure.

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.