2017-03-17 19:56:33 +03:00
2017-03-17 19:56:33 +03:00
2017-03-17 19:56:33 +03:00

Paste.

This is pastebin replacement. It does not use ads, it is opensource it is relatively small. And it has minimal pastebin API stub, at least pastebinit can paste to it with minimal config changes. Besides pastebinit there are 2 cli clients available on main page of this app.

How do I get set up?

This paste utilizes PDO SQLite driver, well, at least for now :) and mbstrings. Tested php versions are 5.6.30 and 7.0.12. Paste uses paste/paste.sqlite file as db.

Tested on apache/fcgid (windows) for dev and nginx/php-fpm for prod.

Default installation assumes that paste runs as / app on site, but you can change it (BASEURL) in index.php.

Nginx config snippet:

# limit paste size to ~ 200k
client_max_body_size 256k;

location /raw {
	rewrite "^\/raw\/([a-z|A-Z]*)$" /index.php?$1;
}

rewrite "^/([a-z|A-Z]*)$" /index.php?$1;

location / {
	root /var/www/htdocs/empty;

	index index.php;
	location ~ \.php$ {
		if ($request_method !~ ^(GET|HEAD|POST)$ ) {
			return 499;
		}

		root /var/www/htdocs;
		fastcgi_split_path_info                 ^(.+\.php)(/.+)$;
		#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
		fastcgi_index                           index.php;
		include                                 fastcgi.conf;
		fastcgi_pass                            php;
	}
}

Database initialises automatically :)

Contribution guidelines

Clean code, preferably with comments for some quirky places.

PasteBinIt configuration

default pastebin site, ~/.pastebinit.xml:

 <pastebinit>
     <pastebin>http://your.site</pastebin>
     <author>Stephane Graber</author>
     <jabberid>stgraber@stgraber.org</jabberid>
     <format>text</format>
 </pastebinit>

and how to work with it ~/.pastebinit.d/your.site.conf:

[pastebin]
basename = your.site
regexp = http://((([a-zA-Z0-9\-_\.]*)(your\.site)))

[format]
content = api_paste_code
user = api_paste_name
subdomain = api_paste_subdomain
private = api_paste_private
expiry = api_paste_expire_date
format = api_paste_format
email = api_paste_email
page = page
submit = submit
regexp = regexp
api_dev_key = api_dev_key
api_option = api_option

[defaults]
submit = submit
format = text
private = 0
expiry = 1M
subdomain =
email =
api_dev_key = 253ce2f0a45140ee0a44ca99aa492260
api_option = paste
page = /
regexp = (.*)

FYI difference between pastebin and paste are minimal:

diff -ruN pastebin.com.conf your.site.conf
--- pastebin.com.conf
+++ your.site.conf
@@ -1,6 +1,6 @@
 [pastebin]
-basename = pastebin.com
-regexp = http://((([a-zA-Z0-9\-_\.]*)(pastebin\.com)))
+basename = your.site
+regexp = http://((([a-zA-Z0-9\-_\.]*)(your\.site)))

 [format]
 content = api_paste_code
@@ -25,5 +25,5 @@
 email =
 api_dev_key = 253ce2f0a45140ee0a44ca99aa492260
 api_option = paste
-page = /api/api_post.php
+page = /
 regexp = (.*)
Description
Simple pastebin
Readme 36 KiB
Languages
PHP 100%