/dopaste

:clipboard: Client-side CopyPaste service

Primary LanguageJavaScriptMIT LicenseMIT

Intro

What is DoPaste?

DoPaste is an open-source website similar to Pastebin where you can store any piece of code, and generate links for easy sharing

However, what makes DoPaste special is that it works with no database, and no back-end code. Instead, the data is compressed and stored entirely in the link that you share, nowhere else!

Notes:

This project is improved version of Bokub's NoPaste.

NoPaste is a copy of Topaz's paste service, with a reworked design and a few additional features (syntax highlighting, line numbers, offline usage, embedding...)

Because of this design:

  • 🗑️ Your data cannot be deleted from DoPaste
  • 🔞 Your data cannot be censored
  • 👁️ The server hosting DoPaste (or any clone of it) cannot read or access your data
  • ⏳ Your data will be accessible forever (as long as you have the link)
  • 🔀 You can access your data on every NoPaste / DoPaste clone, including your own
  • 🔍 Google will not index your data, even if your link is public

How it works

When you click on "Generate Link", DoPaste compresses the whole text using the LZMA algorithm, encodes it in Base64, and puts it in the optional URL fragment, after the first # symbol: dopaste.dimio.org/#<your data goes here>

When you open a link, DoPaste reads, decodes, and decompresses whatever is after the #, and displays the result in the editor.

This process is done entirely in your browser, and the web server hosting DoPaste never has access to the fragment

For example, this is the CSS code used by DoPaste

Other features

Embedded DoPaste snippets

You can include DoPaste code snippets into your own website by clicking the Embed button and using the generated HTML code.

Here is an example of generated code and how it looks (click on the screenshot to see the interactive version)

<iframe width="100%"
        height="155"
        style="border-style: none"
        src="https://dopaste.dimio.org/?l=shll#XQAAAQATAQAAAAAAAAAyG8pmm6wx5WsfNxloo0TeG5PR3eUzyCswaDhV8aq1yi9Yey0phmBft5O/dGwF1rFgo8Aha2QuANm2TNcv9bU61gShwcqwYW1BcgS0kfYyLxbrHQ9xTY6Q17jGH76RQZKX1D7XzaAtAYzSqKbv46nM36N0Dzu1HNyiGCyMM98yYSb611cPvfJRhAZVFD7mUZGQvmXx/Lxh7hLelmA5/eFjhTtNVVABhx/ZBol/6ZlXUsGu+uc2bXZZUzskfMwCmK4hxuY0TwIvmySQ+S///Q/qwA=="
></iframe>

Render preview (clickable): iframe

Feel free to edit the height and width attributes, so they suit your needs

Offline usage

When you visit DoPaste for the first time, its code is saved in your browser cache. After that, every DoPaste link you open will load really quick, even if your internet connexion is slow.

What if you have no internet connexion at all? No problem, DoPaste will still work perfectly!

Editor features

  • Syntax highlighting (use the language selector)
  • Enable / disable line wrapping (use the button next to the language selector)
  • Delete line (Ctrl+D)
  • Multiple cursors (Ctrl+Click)
  • Usual keyboard shortuts (Ctrl+A, Ctrl+Z, Ctrl+Y...)

Maximum sizes for links

DoPaste is great for sharing code snippets on various platforms.

These are the maximum link lengths on some apps and browsers.

App Max length
Reddit 10,000
Twitter 4,088
Slack 4,000
QR Code 2,610
Bit.ly 2,048
Clck.ru 3,810

DoPaste noty you when generated link is too long for each App.

Link is too long

Browser Max length Notes
Google Chrome (win) 32,779 (mac) 10,000 Will not display, but larger links work
Firefox >64,000
Microsoft IE 11 4,043 Will not show more than 2,083
Microsoft Edge 2,083 Anything over 2083 will fail
Android 8,192
Safari Lots

Generate DoPaste links

DoPaste links can be created easily from your system's command line:

# Linux
echo -n 'Hello World' | lzma | base64 -w0 | xargs -0 printf "https://dopaste.dimio.org/#%s\n"

# Mac
echo -n 'Hello World' | lzma | base64 | xargs -0 printf "https://dopaste.dimio.org/#%s\n"

# Windows / WSL / Linux
echo -n 'Hello World' | xz --format=lzma | base64 -w0 | printf "https://dopaste.dimio.org/#%s\n" "$(cat -)"

# Simple Bash function (read from file)
dopaste() {
	[[ -n "${2}" ]] && DOPASTE_URL="${2}" || DOPASTE_URL='https://dopaste.dimio.org'
	FILE_EXT=$(printf '%s' "${1}" | awk -F . '{if (NF>1) {print $NF}}')
	cat "${1}" | xz --format=lzma | base64 -w0 | printf "%s/?e=%s#%s\n" "${DOPASTE_URL}" "${FILE_EXT}" "$(cat -)"
}
echo 'echo "Hello World"' > ./helloworld.sh
dopaste helloworld.sh

Deploy your own version of NoPaste / DoPaste

NoPaste / DoPaste is just a bunch of static files, making it really easy to deploy on any kind of file server.

Read the wiki to see how you can deploy your own version of NoPaste / DoPaste for free using GitHub Pages