## 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. And as a bonus this app can short links too! But it either shorts links **or** stores paste, not both at same time. ### 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 app.ini. #### Settings for paste mode #### edit app.ini and set correct address, base url, db path, application type (type = paste) 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 initializes automatically :) #### Settings for link shortener mode #### edit app.ini and set correct address, base url, db path, application type (type = short) Nginx config snippet: ``` # limit links size to ~ 50k client_max_body_size 64k; 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 initializes automatically :) ### Contribution guidelines ### Clean code, preferably with comments for some quirky places. ### PasteBinIt configuration ### default pastebin site, __~/.pastebinit.xml__: ```xml http://your.site Stephane Graber stgraber@stgraber.org text ``` and how to work with it __~/.pastebinit.d/your.site.conf__: ```ini [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 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 = (.*) ``` ### TODO ### * Make one app that shorten links, stores paste, stores pictures (yes! image hosting). * Configurable features (not everyone wants all features enabled). * Before implementing picture storage, there should be made authorization. * Sane and clear API.