• PHP 62.1%
  • JavaScript 19.4%
  • CSS 14.8%
  • Hack 3.7%
Find a file
2026-05-20 00:19:09 -04:00
config feat: add configuration for allowed image hosts 2023-05-23 12:31:11 -04:00
doc feat: re-introduce editing of pages in the admin UI. 2026-04-10 03:49:14 -04:00
includes fix: remove weird uinnecessary hashing of bytes 2026-04-26 10:07:50 -04:00
js fix(archive): make multi-tag search work; display not found message 2025-06-12 21:10:38 -04:00
public fix: fix a bunch of little display bugs on paste view page. 2026-05-10 19:37:48 -04:00
theme chore: expire css 2026-05-20 00:19:09 -04:00
util docs: improved README setup docs. 2026-04-10 03:48:57 -04:00
vendor deps: composer upgrade (Illuminate and Parsedown) 2026-04-10 03:49:16 -04:00
.gitignore feat: bayes spam classifier 2025-05-15 09:18:24 -04:00
babel.config.json code 2021-08-25 02:08:30 -04:00
composer.json feat: re-introduce editing of pages in the admin UI. 2026-04-10 03:49:14 -04:00
composer.lock deps: composer upgrade (Illuminate and Parsedown) 2026-04-10 03:49:16 -04:00
LICENSE chore: add license 2023-07-05 03:49:29 -04:00
package.json fix: some admin pages implementation 2023-05-13 20:05:32 -04:00
phpcs.xml fix: some admin pages implementation 2023-05-13 20:05:32 -04:00
psalm.xml fix: some admin pages implementation 2023-05-13 20:05:32 -04:00
README.md fix: remove weird uinnecessary hashing of bytes 2026-04-26 10:07:50 -04:00
rollup.config.js fix(tags): client-sided tag limit is better; tag highlighting rules slightly better 2023-02-27 05:24:55 -05:00
yarn-error.log code 2021-08-25 02:08:30 -04:00
yarn.lock fix(tags): client-sided tag limit is better; tag highlighting rules slightly better 2023-02-27 05:24:55 -05:00

punishedponepaste

Requirements

  • An HTTP server that can perform URL rewriting and execute PHP 8 code (eg: nginx with php8-fpm,) and the following PHP extensions: pdo, openssl, gd, mbstring, redis.
  • A MySQL-compatible server (eg: MariaDB 10.)
  • A Redis server.

Building the JS

When you change the JS, you need to rebuild it. assets/bundle.js is used in dev, assets/bundle.min.js is used in production.

You need Yarn (version 1, not version 2 - 2 may work, but I haven't tried it.) After that, whenever you change anything under js/, you need to run yarn rollup --config. Good luck!

Local Development

  1. Set up MySQL/MariaDB and Redis/Valkey and note the host+port and credentials for both.
  2. Set up an NGINX site using doc/nginx.local.conf as a template; change things for your environment as necessary.
    • Set up a /etc/hosts file entry for ponepaste.local to 127.0.0.1 if you want to use ponepaste.local.
  3. Copy includes/config.sample.php to includes/config.php.
    • Recommend setting PP_DEBUG to true for local development and testing.
    • Configure PP_REDIS_* constant as needed.
    • Configure $db_* variables as needed.
  4. Copy config/site.example.php to config/site.php. This does not need to be edited; it can be configured in the site's admin UI later.
  5. Import doc/schema.sql into the MySQL database you configured above.
  6. Create the initial admin user by doing the following:
    • php -f util/ppadmin.php hashpw -> enter your desired password, and hit enter. Copy the hashed password to clipboard.
    • Open a MySQL console to the database you configured above, and run something like INSERT INTO users (username, password, role, admin_password_hash, recovery_code_hash) VALUES ('admin', 'THE HASH FROM EARLIER', 2, 'THE SAME HASH FROM EARLIER', '');
  7. Go to http://ponepaste.local (or whatever hostname you configured), log in, and explore the site!

Production Deployment

  1. Set up MySQL/MariaDB and Redis/Valkey and note the host+port and credentials for both.
    • Ensure these are properly secured and firewalled from the public Internet.
  2. Set up an NGINX site using doc/nginx.conf as a template; change things for your environment as necessary.
    • On initial configuration, you may need to comment out the SSL server { } block or change the cert to a dummy (but valid) one, just long enough to get one from Let's Encrypt. TLS is mostly left as an exercise to the reader. You can do it!
  3. Copy includes/config.sample.php to includes/config.php.
    • Ensure PP_DEBUG is set to false for production deployment.
    • Configure the PP_PASSWORD_PEPPER constant to be a long and random string, such as generated by openssl rand -hex 32. This key strengthens the password hashing significantly, and renders the password hashes from a database-only hack/leak effectively uncrackable.
    • Configure the PP_ENCRYPTION_KEY constant to be another, different, long and random string, such as generated by openssl rand -hex 32. This key is used to encrypt all pastes before they are stored in the database. Its use renders the paste data from a database-only hack/leak unrecoverable.
    • Configure PP_REDIS_* constant as needed.
    • Configure $db_* variables as needed.
  4. Copy config/site.example.php to config/site.php. This does not need to be edited; it can be configured in the site's admin UI later.
  5. Import doc/schema.sql into the MySQL database you configured above.
  6. Create the initial admin user by doing the following:
    • php -f util/ppadmin.php hashpw -> enter your desired password, and hit enter. Copy the hashed password to clipboard.
    • Do the same, but use a different password. This second password is the re-authentication password for administrative actions; this is essentially 2FA where both factors are different passwords.
    • Open a MySQL console to the database you configured above, and run something like INSERT INTO users (username, password, role, admin_password_hash, recovery_code_hash) VALUES ('admin', 'THE FIRST HASH FROM EARLIER', 2, 'THE SECOND HASH FROM EARLIER', '');
  7. Go to http://{your-domain}, log in, and explore the site!