### PostgreSQL Database URL Example Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-migrate-to-the-Universal-Container Example DATABASE_URL format for connecting to a PostgreSQL database. ```bash DATABASE_URL=postgresql://pwpush_user:pwpush_passwd@postgres:5432/pwpush_db ``` -------------------------------- ### PostgreSQL Database URL Example Source: https://github.com/pglombardo/passwordpusher/wiki/Guide-to-DATABASE_URL An example DATABASE_URL for connecting to a PostgreSQL database. ```text postgres://myuser:mypassword@localhost:5432/mydatabase ``` -------------------------------- ### MySQL Database URL Example Source: https://github.com/pglombardo/passwordpusher/wiki/Guide-to-DATABASE_URL An example DATABASE_URL for connecting to a MySQL database. ```text mysql2://myuser:mypassword@localhost:3306/mydatabase ``` -------------------------------- ### Install gh-signoff Extension Source: https://github.com/pglombardo/passwordpusher/blob/master/RELEASE.md Installs the gh-signoff extension for the GitHub CLI. ```bash gh extension install basecamp/gh-signoff ``` -------------------------------- ### MySQL Database URL Example Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-migrate-to-the-Universal-Container Example DATABASE_URL format for connecting to a MySQL database. Note the 'mysql2' prefix. ```bash DATABASE_URL=mysql2://pwpush_user:pwpush_passwd@mysql:3306/pwpush_db ``` -------------------------------- ### Install Bundler for Ruby Source: https://github.com/pglombardo/passwordpusher/wiki/Troubleshooting If you encounter a 'Command not found: bundle' error, you need to install the bundler gem. This command installs the bundler. ```bash gem install bundler ``` -------------------------------- ### MariaDB Database URL Example Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-migrate-to-the-Universal-Container Example DATABASE_URL format for connecting to a MariaDB database. Note the 'mysql2' prefix. ```bash DATABASE_URL=mysql2://pwpush_user:pwpush_passwd@mariadb:3306/pwpush_db ``` -------------------------------- ### Install SQLite3 and Ruby SQLite3 Support on Ubuntu Source: https://github.com/pglombardo/passwordpusher/wiki/Troubleshooting When 'bundle install' fails with a 'sqlite3.h' not found error, install the necessary SQLite3 packages for your operating system. This command is for Ubuntu. ```bash sudo apt-get install sqlite3 ruby-sqlite3 libsqlite3-ruby libsqlite3-dev ``` -------------------------------- ### SQLite3 Database URL Example Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-migrate-to-the-Universal-Container Example DATABASE_URL format for using SQLite3. Data will be ephemeral and lost on container restart. ```bash DATABASE_URL=sqlite3:db/db.sqlite3 ``` -------------------------------- ### Run Universal Docker Container Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-migrate-to-the-Universal-Container Example of how to run the new universal Docker container, exposing port 5100 and setting the DATABASE_URL environment variable. ```bash docker run -p "5100:5100" -e DATABASE_URL= pglombardo/pwpush:latest ``` -------------------------------- ### Production Log Error Example Source: https://github.com/pglombardo/passwordpusher/wiki/Switch-to-Production-Environment This is an example of the log entry that indicates a failure to precompile assets in the production environment. ```text ActionView::Template::Error (application.css isn't precompiled): ``` -------------------------------- ### SQLite3 Database URL Example Source: https://github.com/pglombardo/passwordpusher/wiki/Guide-to-DATABASE_URL Example DATABASE_URL for SQLite3. This format specifies the protocol and the path to the database file. ```text sqlite3:///app/db/development.sqlite3 ``` -------------------------------- ### Precompile Assets for Production Source: https://github.com/pglombardo/passwordpusher/wiki/Switch-to-Production-Environment Run this command in the production environment before starting the server to precompile your application's assets. Failure to do so can result in runtime errors. ```bash export RAILS_ENV=production bundle exec rake assets:precompile ``` -------------------------------- ### Install Password Pusher with Helm Source: https://github.com/pglombardo/passwordpusher/blob/master/containers/helm/README.md Installs the Password Pusher application using Helm, creating a new namespace if it doesn't exist. Ensure Helm 3+ is installed and the current directory is the 'helm' directory of the project. ```bash helm install --create-namespace \ --namespace pwpush \ my-passwordpusher \ . ``` -------------------------------- ### Production Error Example Source: https://github.com/pglombardo/passwordpusher/wiki/Switch-to-Production-Environment This is an example of the user-facing error that may occur if assets are not precompiled in the production environment. ```text We're sorry, but something went wrong. ``` -------------------------------- ### Example Success Output from Console Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-Validate-and-Test-Email-Settings This output shows a successful test email delivery, including configuration details and confirmation messages. It also provides guidance on what to include in GitHub issues if errors occur. ```bash ╰─ ./bin/pwpush console Password Pusher Version: 1.39.8 Loading development environment (Rails 7.1.3.2) [1] pry(main)> TestMailer.send_test_email('user@domain.com').deliver_now --> Configured FROM: address: '"Password Pusher" ' --> raise_delivery_errors is set to true in the configuration. This will raise an error if the email fails to send. --> Attempting to send a test email to user@domain.com... --> It seems that the Email sent successfully! Check destination inbox for the test email. --> If you see an error, please paste this output into a GitHub issue for help. --> Make sure that no sensitive data is included. --> https://github.com/pglombardo/PasswordPusher/issues/new/choose TestMailer#send_test_email: processed outbound mail in 15.6ms Delivered mail 6615a15c85a96_6c3b170c6251@The-Studio.local.mail (5413.4ms) Date: Tue, 09 Apr 2024 22:13:16 +0200 From: Password Pusher To: user@domain.com Message-ID: <6615a15c85a96_6c3b170c6251@The-Studio.local.mail> Subject: Test Email from Password Pusher Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =E2=AD=90 If you are reading this, sending email works! =E2=AD=90= => #, >, , >, , , , > [2] pry(main)> ``` -------------------------------- ### Heroku Example: Run Daily Expiration Task Source: https://github.com/pglombardo/passwordpusher/wiki/Periodic-Background-Tasks Example of how to run the daily expiration task on a Heroku instance. Ensure you replace 'mypwp' with your actual Heroku app name. ```bash heroku run --app=mypwp rails daily_expiration ``` -------------------------------- ### Starting Password Pusher Console Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-Validate-and-Test-Email-Settings Launches the Password Pusher Rails console within the container. This console provides an interactive Ruby environment to inspect application settings. ```bash ./bin/pwpush console ``` -------------------------------- ### Heroku Example: Delete Expired and Anonymous Records Task Source: https://github.com/pglombardo/passwordpusher/wiki/Periodic-Background-Tasks Example of how to run the delete expired and anonymous records task on a Heroku instance. Replace 'mypwp' with your Heroku app name. ```bash heroku run --app=mypwp rails delete_expired_and_anonymous ``` -------------------------------- ### Port-forward Password Pusher Service Locally Source: https://github.com/pglombardo/passwordpusher/blob/master/containers/helm/README.md Forwards the Password Pusher service to a local port for browser access. This command requires kubectl and should be run after the Helm installation. ```bash kubectl port-forward --namespace pwpush svc/my-passwordpusher-helm 5555:5100 ``` -------------------------------- ### Set PWPUSH_MASTER_KEY Environment Variable Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-Set-a-Custom-Encryption-Key-For-a-Private-Instance Apply the generated custom encryption key to your Password Pusher instance by setting the PWPUSH_MASTER_KEY environment variable. Ensure this variable is set before starting the application. ```bash PWPUSH_MASTER_KEY=0c110f7f9d93d2122f36debf8a24bf835f33f248681714776b336849b801f693 ``` -------------------------------- ### Retrieve a Password via GET Request Source: https://github.com/pglombardo/passwordpusher/wiki/Password-API Use this curl command to retrieve a password using its unique ID. Append '.json' to the URL to receive a JSON response. ```bash curl -X GET https://pwpush.com/p/.json ``` -------------------------------- ### Modify Persistent Volume Host Path Source: https://github.com/pglombardo/passwordpusher/blob/master/containers/kubernetes/README.md Use sed to replace the default host path in the persistent volume manifest. This allows you to specify a custom path matching your cluster's setup. ```bash sed -i 's|/nfs/k8s/services/pwpush/data|/your/path/here|g' containers/kubernetes/pv.yaml ``` -------------------------------- ### Quick Reference for Release Process Source: https://github.com/pglombardo/passwordpusher/blob/master/RELEASE.md A condensed overview of the commands for releasing a new version and updating the stable Docker tag. ```bash # On master, with a clean tree bin/ci bin/rails version:bump # or version:bump:minor / version:bump:major git push oss master git push oss vX.Y.Z # Edit and publish the Release Drafter draft on GitHub # Later, when proven stable (weeks later, no issues reported) bin/move_up_stable_tag.sh X.Y.Z ``` -------------------------------- ### Default Ephemeral SQLite3 Configuration Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-migrate-to-the-Universal-Container Demonstrates the default behavior when DATABASE_URL is not specified, resulting in ephemeral SQLite3 storage. ```bash # If DATABASE_URL isn't specified, the container will default to the ephemeral backend using SQLite3. ``` -------------------------------- ### Run CI Suite and Sign Off Commit Source: https://github.com/pglombardo/passwordpusher/blob/master/RELEASE.md Executes the full CI suite (tests, linting, security checks) and signs the latest commit using gh signoff. Requires a pristine repository. ```bash bin/ci ``` -------------------------------- ### Run Docker Compose Source: https://github.com/pglombardo/passwordpusher/blob/master/README.md Deploy Password Pusher using Docker Compose. Ensure DNS is configured and relevant environment variables are set in the docker-compose.yml file. ```bash docker compose up -d ``` -------------------------------- ### MySQL Database Configuration Source: https://github.com/pglombardo/passwordpusher/wiki/Switch-to-Another-Backend-Database Replace the default configuration with this block to use MySQL. ```yaml private: adapter: mysql database: yourdbname username: yourdbusername password: yourdbpassword pool: 5 encoding: utf8 ``` -------------------------------- ### PostgreSQL Database Configuration Source: https://github.com/pglombardo/passwordpusher/wiki/Switch-to-Another-Backend-Database Replace the default configuration with this block to use PostgreSQL. ```yaml private: adapter: postgresql database: yourdbname username: yourdbusername password: yourdbpassword pool: 5 timeout: 5000 encoding: utf8 reconnect: false ``` -------------------------------- ### Send Test Email from Console Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-Validate-and-Test-Email-Settings Use this Ruby command within the application console to send a test email. Replace `user@example.com` with your email address. This command is available from v1.39.8 onwards. ```ruby TestMailer.send_test_email("user@example.com").deliver_now ``` -------------------------------- ### Ephemeral Kubernetes Deployment Source: https://github.com/pglombardo/passwordpusher/blob/master/containers/kubernetes/README.md Apply the Kubernetes manifests for an ephemeral deployment. This includes namespace, deployment, service, and ingress configurations. ```bash kubectl apply -f containers/kubernetes/namespace.yaml kubectl apply -f containers/kubernetes/ephemeral_deploy.yaml kubectl apply -f containers/kubernetes/service.yaml kubectl apply -f containers/kubernetes/ingress.yaml ``` -------------------------------- ### PostgreSQL Database URL Format Source: https://github.com/pglombardo/passwordpusher/wiki/Guide-to-DATABASE_URL The standard format for a PostgreSQL DATABASE_URL. It includes credentials, host, port, and database name. ```text postgres://username:password@hostname:port/database_name ``` -------------------------------- ### API v2 Smoke Test Source: https://github.com/pglombardo/passwordpusher/blob/master/README.md Perform a quick test of the API v2 endpoint to check the version. Replace YOUR_HOST with your Password Pusher instance's domain. ```bash curl -s https://YOUR_HOST/api/v2/version ``` -------------------------------- ### Default SQLite3 Database Configuration Source: https://github.com/pglombardo/passwordpusher/wiki/Switch-to-Another-Backend-Database This is the default configuration for the 'private' environment using SQLite3. ```yaml base: &base adapter: sqlite3 timeout: 5000 private: database: db/private.sqlite3 <<: *base ``` -------------------------------- ### Add PostgreSQL Gem to Gemfile Source: https://github.com/pglombardo/passwordpusher/wiki/Switch-to-Another-Backend-Database Add the 'pg' gem to your Gemfile to enable PostgreSQL support. ```ruby gem "pg" ``` -------------------------------- ### Add MySQL Gem to Gemfile Source: https://github.com/pglombardo/passwordpusher/wiki/Switch-to-Another-Backend-Database Add the 'mysql' gem to your Gemfile to enable MySQL support. ```ruby gem "mysql" ``` -------------------------------- ### Create Password using JavaScript Fetch API Source: https://github.com/pglombardo/passwordpusher/wiki/Password-API This JavaScript snippet demonstrates how to create a password using the Fetch API with JSON payload. It logs the shareable secret URL to the console upon successful creation. ```javascript fetch( "https://pwpush.com/p.json", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ password: { payload: "mypassword", expire_after_days: 2, expire_after_views: 10 } }) }) .then(response => response.json()) .then(data => { console.log("Share this secret URL: https://pwpush.com/p/" + data.url_token); }); ``` -------------------------------- ### Run Daily Expiration Task Source: https://github.com/pglombardo/passwordpusher/wiki/Periodic-Background-Tasks Execute the daily expiration task to preemptively expire pushes based on their settings. This task helps save CPU and database calls. ```bash /opt/PasswordPusher/bin/rails daily_expiration ``` -------------------------------- ### Generate SECRET_KEY_BASE Source: https://github.com/pglombardo/passwordpusher/wiki/SECRET_KEY_BASE Use this command to generate a new random secret key for the SECRET_KEY_BASE environment variable. This is useful for ensuring consistent session cookies across deployments. ```bash $) bin/rails secret f7af32f6f51fff9df4e0ae9dd127a6588ab07d0988bd805ba5e650cb5399z30cc225aec2848c9c763549c31260203a751601e7ef28c2b7aa353ee533644c0d05 ``` ```bash $) bin/rails secret df04f112ff508f8f8aa92e942ffb0ed8b252cbd9ae59fadc7b69e1d3190439796e62f20c7b431ae1285682857183fb55c567223210b98a7558de6975499468b6 ``` ```bash $) bin/rails secret 7ea591173da2443a65a3d601c3876fb63c3b75855e54a61dfc0bacd64d7748450d176c8b15218c6d11fa244a26a6d0c0214485e9356458606f075d002a503289 ``` -------------------------------- ### Persistent Kubernetes Deployment Source: https://github.com/pglombardo/passwordpusher/blob/master/containers/kubernetes/README.md Apply the Kubernetes manifests for a persistent deployment. This includes namespace, persistent volume, persistent volume claim, deployment, service, and ingress configurations. ```bash kubectl apply -f containers/kubernetes/namespace.yaml kubectl apply -f containers/kubernetes/pv.yaml kubectl apply -f containers/kubernetes/pvc.yaml kubectl apply -f containers/kubernetes/persistent_deploy.yaml kubectl apply -f containers/kubernetes/service.yaml kubectl apply -f containers/kubernetes/ingress.yaml ``` -------------------------------- ### Push to GitHub Source: https://github.com/pglombardo/passwordpusher/blob/master/RELEASE.md Pushes the master branch and the new version tag to the 'oss' remote on GitHub. Pushing the tag triggers the Docker Container Builds workflow. ```bash git push oss master git push oss vX.Y.Z ``` -------------------------------- ### Bump Version with Rake Tasks Source: https://github.com/pglombardo/passwordpusher/blob/master/RELEASE.md Updates the version in the project using the version gem's rake tasks. Use patch for minor fixes, minor for new features, and major for breaking changes. ```bash bin/rails version:bump ``` ```bash bin/rails version:bump:minor ``` ```bash bin/rails version:bump:major ``` -------------------------------- ### MySQL Database URL Format Source: https://github.com/pglombardo/passwordpusher/wiki/Guide-to-DATABASE_URL The format for a MySQL DATABASE_URL, using the mysql2 protocol. It requires credentials, host, port, and database name. ```text mysql2://username:password@hostname:port/database_name ``` -------------------------------- ### Enable Email Error Reporting Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-Validate-and-Test-Email-Settings Ensure `raise_delivery_errors` is set to `true` in your `settings.yml` or environment variables to see detailed SMTP errors. ```yaml mail: raise_delivery_errors: true ``` -------------------------------- ### Create Password Source: https://github.com/pglombardo/passwordpusher/wiki/Password-API Allows users to create a new password entry. Supports both form-urlencoded and JSON content types for the request body. Optional parameters can be set to application defaults if not specified. ```APIDOC ## POST /p.json ### Description Creates a new password entry with optional expiration and note fields. ### Method POST ### Endpoint /p.json ### Parameters #### Request Body - **password[payload]** (string) - Required - The password to be stored. - **password[expire_after_days]** (integer) - Optional - The number of days after which the password will expire. - **password[expire_after_views]** (integer) - Optional - The number of views after which the password will expire. - **password[note]** (string) - Optional - A note associated with the password, visible only to the creator. - **password[retrieval_step]** (boolean) - Optional - Enables a retrieval step for the password. - **password[deletable_by_viewer]** (boolean) - Optional - Allows the viewer to delete the password. ### Request Example (x-www-form-urlencoded) ``` password[payload]=mypassword&password[expire_after_days]=10&password[expire_after_views]=2 ``` ### Request Example (JSON) ```json { "password": { "payload": "mypassword", "expire_after_days": "2", "expire_after_views": "10", "note": "Reference Note.", "retrieval_step": "true", "deletable_by_viewer": "false" } } ``` ### Response #### Success Response (200) - **url_token** (string) - The token to access the created password URL. ### Response Example ```json { "url_token": "" } ``` ``` -------------------------------- ### JavaScript Localization Logic Source: https://github.com/pglombardo/passwordpusher/blob/master/public/422.html This snippet handles language detection, retrieval from local storage, and application of translations. It supports English, French, German, Dutch, Spanish, and Italian. ```javascript var STORAGE_KEY = 'pwp_error_lang'; var SUPPORTED = ['en','fr','de','nl','es','it']; function getLocaleFromNavigator() { if (!navigator.languages) return 'en'; for (var i = 0; i < navigator.languages.length; i++) { var code = navigator.languages[i].split('-')[0].toLowerCase(); if (SUPPORTED.indexOf(code) !== -1) return code; } return 'en'; } function getLocale() { try { var saved = localStorage.getItem(STORAGE_KEY); if (saved && SUPPORTED.indexOf(saved) !== -1) return saved; } catch (e) {} return getLocaleFromNavigator(); } function setLocale(locale) { try { localStorage.setItem(STORAGE_KEY, locale); } catch (e) {} } function applyTranslations(locale) { var t = T[locale] || T.en; document.documentElement.lang = locale; document.title = (locale === 'en' ? 'Change rejected' : t.heading) + ' — Password Pusher'; document.querySelectorAll('[data-i18n]').forEach(function(el) { var key = el.getAttribute('data-i18n'); if (t[key]) el.textContent = t[key]; }); document.querySelectorAll('[data-i18n-html]').forEach(function(el) { var key = el.getAttribute('data-i18n-html'); if (t[key]) el.innerHTML = t[key]; }); document.querySelectorAll('.lang-flag').forEach(function(btn) { var isActive = btn.getAttribute('data-lang') === locale; btn.classList.toggle('active', isActive); btn.setAttribute('aria-pressed', isActive ? 'true' : 'false'); }); } var T = { en: { brand_tagline: 'Go Ahead. Email Another Password.', heading: 'Change rejected', intro: "The request couldn't be completed. This often happens when a link has already been used, the session expired, or the action isn't allowed.", btn_home: 'Go to home page', btn_try_again: 'Try again', help_title: 'What you can do', help_body: 'Go back and start again from the home page, or try the same action once more. If the problem continues, see docs.pwpush.com for support.' }, fr: { brand_tagline: 'Allez-y. Envoyez un autre mot de passe par e-mail.', heading: 'Modification refusée', intro: 'La requête n\'a pas pu aboutir. Cela arrive souvent quand un lien a déjà été utilisé, la session a expiré ou l\'action n\'est pas autorisée.', btn_home: 'Aller à l\'accueil', btn_try_again: 'Réessayer', help_title: 'Que faire', help_body: 'Revenez et recommencez depuis l\'accueil, ou réessayez la même action. Si le problème persiste, consultez docs.pwpush.com pour l\'assistance.' }, de: { brand_tagline: 'Einfach. Noch ein Passwort per E-Mail versenden.', heading: 'Änderung abgelehnt', intro: 'Die Anfrage konnte nicht abgeschlossen werden. Das passiert oft, wenn ein Link bereits verwendet wurde, die Sitzung abgelaufen ist oder die Aktion nicht erlaubt ist.', btn_home: 'Zur Startseite', btn_try_again: 'Erneut versuchen', help_title: 'Was Sie tun können', help_body: 'Gehen Sie zurück und starten Sie von der Startseite neu, oder versuchen Sie die gleiche Aktion erneut. Bei anhaltenden Problemen siehe docs.pwpush.com für Support.' }, nl: { brand_tagline: 'Ga je gang. Stuur nog een wachtwoord per e-mail.', heading: 'Wijziging geweigerd', intro: 'Het verzoek kon niet worden voltooid. Dit gebeurt vaak wanneer een link al is gebruikt, de sessie is verlopen of de actie niet is toegestaan.', btn_home: 'Naar startpagina', btn_try_again: 'Opnieuw proberen', help_title: 'Wat u kunt doen', help_body: 'Ga terug en begin opnieuw vanaf de startpagina, of probeer dezelfde actie nog eens. Als het probleem aanhoudt, zie docs.pwpush.com voor ondersteuning.' }, es: { brand_tagline: 'Adelante. Envíe otra contraseña por correo.', heading: 'Cambio rechazado', intro: 'No se pudo completar la solicitud. Suele ocurrir cuando un enlace ya se usó, la sesión expiró o la acción no está permitida.', btn_home: 'Ir al inicio', btn_try_again: 'Intentar de nuevo', help_title: 'Qué puede hacer', help_body: 'Vuelva y empiece de nuevo desde el inicio, o intente la misma acción otra vez. Si el problema continúa, consulte docs.pwpush.com para soporte.' }, it: { brand_tagline: 'Avanti. Invia un\'altra password via email.', heading: 'Modifica rifiutata', intro: 'La richiesta non è stata completata. Succede spesso quando un link è già stato usato, la sessione è scaduta o l\'azione non è consentita.', btn_home: 'Vai alla home', btn_try_again: 'Riprova', help_title: 'Cosa puoi fare', help_body: 'Torna indietro e ricomincia dalla home, o riprova la stessa azione. Se il problema continua, consulta docs.pwpush.com per supporto.' } }; var locale = getLocale(); applyTranslations(locale); document.querySelectorAll('.lang-flag').forEach(function(btn) { b ``` -------------------------------- ### Accessing Password Pusher Container Console Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-Validate-and-Test-Email-Settings Executes a bash shell inside the specified Password Pusher container. This is the first step to interact with the application's environment. ```bash docker exec -it /bin/bash ``` -------------------------------- ### Viewing SMTP Settings in Rails Console Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-Validate-and-Test-Email-Settings Retrieves and displays the current SMTP settings configured for Action Mailer within the Password Pusher application. Ensure sensitive information is redacted before sharing. ```ruby Rails.application.config.action_mailer.smtp_settings ``` -------------------------------- ### GMail SMTP Configuration Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-Validate-and-Test-Email-Settings Configuration for sending emails via GMail. Requires an application-specific password for authentication. Note the use of `plain` authentication. ```yaml mail: raise_delivery_errors: true smtp_address: smtp.gmail.com smtp_port: 587 smtp_authentication: plain smtp_user_name: smtp_password: smtp_enable_starttls_auto: true smtp_open_timeout: 10 smtp_read_timeout: 10 ``` -------------------------------- ### Update Docker Stable Tag Source: https://github.com/pglombardo/passwordpusher/blob/master/RELEASE.md Updates the Docker 'stable' tag for all OSS images after a release has been proven stable for a few weeks. Pass the version without the 'v' prefix. ```bash bin/move_up_stable_tag.sh X.Y.Z ``` -------------------------------- ### BibTeX Citation for Password Pusher Source: https://github.com/pglombardo/passwordpusher/blob/master/README.md This BibTeX entry can be used to cite the Password Pusher project in academic or technical documents. It includes author, title, year, publisher, and a URL for reference. ```bibtex @misc{PasswordPusher, author = {Peter Giacomo Lombardo}, title = {Password Pusher: Securely share sensitive information with automatic expiration and deletion. Track who, what and when with full audit logs.}, year = {2026}, publisher = {GitHub}, howpublished = {\url{https://github.com/pglombardo/PasswordPusher}} } ``` -------------------------------- ### Create Password with JSON POST Data Source: https://github.com/pglombardo/passwordpusher/wiki/Password-API Use this JSON structure when making a POST request with Content-Type: application/json to create a password. All fields are optional and will use application defaults if not specified. ```json { "password": { "payload": "mypassword", "expire_after_days": "2", "expire_after_views": "10", "note": "Reference Note. Encrypted & Visible Only to You. E.g. Employee, Record or Ticket ID etc..", "retrieval_step": "true", "deletable_by_viewer": "false" } } ``` -------------------------------- ### Create Password with Form URL Encoded Data Source: https://github.com/pglombardo/passwordpusher/wiki/Password-API Use this format for POST requests with Content-Type: application/x-www-form-urlencoded. Only the 'payload' field is required; others will use application defaults if omitted. ```bash curl -X POST --data "password[payload]=mypassword&password[expire_after_days]=2&password[expire_after_views]=10" https://pwpush.com/p.json ``` -------------------------------- ### Modify Ingress Domain Name Source: https://github.com/pglombardo/passwordpusher/blob/master/containers/kubernetes/README.md Use sed to replace the default domain name in the ingress manifest. This is necessary to map the correct domain to your cluster for automatic certificate generation. ```bash sed -i 's|pwpush.domain.tld|pwpush.your.domain.here|g' containers/kubernetes/ingress.yaml ``` -------------------------------- ### Sendgrid SMTP Configuration Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-Validate-and-Test-Email-Settings Configuration for sending emails via Sendgrid. Uses `apikey` as the username and your Sendgrid API key as the password. `plain` authentication is used. ```yaml mail: raise_delivery_errors: true smtp_address: smtp.sendgrid.net smtp_port: 587 smtp_authentication: plain smtp_user_name: apikey smtp_password: smtp_starttls: true smtp_enable_starttls_auto: true smtp_open_timeout: 10 smtp_read_timeout: 10 mailer_sender: '"Your Name" ' ``` -------------------------------- ### Handle Language Selection and Translations Source: https://github.com/pglombardo/passwordpusher/blob/master/public/406-unsupported-browser.html This JavaScript code handles user interaction for selecting a language flag, setting the locale, and applying translations. It attaches event listeners to elements with the class 'lang-flag'. ```javascript var locale = getLocale(); applyTranslations(locale); document.querySelectorAll('.lang-flag').forEach(function(btn) { btn.addEventListener('click', function() { var lang = this.getAttribute('data-lang'); setLocale(lang); applyTranslations(lang); }); }); })(); ``` -------------------------------- ### Uninstall Password Pusher with Helm Source: https://github.com/pglombardo/passwordpusher/blob/master/containers/helm/README.md Uninstalls the Password Pusher application from the specified namespace using Helm. This command removes all resources created by the Helm chart. ```bash helm uninstall \ -n pwpush \ my-passwordpush ``` -------------------------------- ### Unsupported Browser Page Logic Source: https://github.com/pglombardo/passwordpusher/blob/master/public/406-unsupported-browser.html This JavaScript code handles locale detection, translation application, and UI updates for the unsupported browser page. It prioritizes saved locale settings, falls back to navigator language, and applies translations based on the detected locale. ```javascript (function() { var STORAGE_KEY = 'pwp_error_lang'; var SUPPORTED = ['en','fr','de','nl','es','it']; function getLocaleFromNavigator() { if (!navigator.languages) return 'en'; for (var i = 0; i < navigator.languages.length; i++) { var code = navigator.languages[i].split('-')[0].toLowerCase(); if (SUPPORTED.indexOf(code) !== -1) return code; } return 'en'; } function getLocale() { try { var saved = localStorage.getItem(STORAGE_KEY); if (saved && SUPPORTED.indexOf(saved) !== -1) return saved; } catch (e) {} return getLocaleFromNavigator(); } function setLocale(locale) { try { localStorage.setItem(STORAGE_KEY, locale); } catch (e) {} } function applyTranslations(locale) { var t = T[locale] || T.en; document.documentElement.lang = locale; document.title = (locale === 'en' ? 'Browser not supported' : t.heading) + ' — Password Pusher'; document.querySelectorAll('[data-i18n]').forEach(function(el) { var key = el.getAttribute('data-i18n'); if (t[key]) el.textContent = t[key]; }); document.querySelectorAll('[data-i18n-html]').forEach(function(el) { var key = el.getAttribute('data-i18n-html'); if (t[key]) el.innerHTML = t[key]; }); document.querySelectorAll('.lang-flag').forEach(function(btn) { var isActive = btn.getAttribute('data-lang') === locale; btn.classList.toggle('active', isActive); btn.setAttribute('aria-pressed', isActive ? 'true' : 'false'); }); } var T = { en: { brand_tagline: 'Go Ahead. Email Another Password.', heading: 'Browser not supported', intro: 'Password Pusher needs a modern browser to work properly. Please upgrade or switch to a supported browser.', btn_docs: 'View documentation', help_title: 'What you can do', help_1: 'Update your browser to the latest version (Chrome, Firefox, Safari, or Edge).', help_2: 'If you can\'t update, try a different device or browser.', help_3: 'See docs.pwpush.com.' }, fr: { brand_tagline: 'Allez-y. Envoyez un autre mot de passe par e-mail.', heading: 'Page introuvable', intro: 'La page que vous recherchez n\'existe pas ou a peut-être été déplacée.', btn_home: 'Aller à l\'accueil', help_title: 'Que faire', help_body: 'Utilisez le lien ci-dessus pour revenir à l\'accueil et créer un nouveau push, ou vérifiez l\'URL et réessayez. Pour de l\'aide, consultez docs.pwpush.com.' }, de: { brand_tagline: 'Einfach. Noch ein Passwort per E-Mail versenden.', heading: 'Seite nicht gefunden', intro: 'Die gesuchte Seite existiert nicht oder wurde möglicherweise verschoben.', btn_home: 'Zur Startseite', help_title: 'Was Sie tun können', help_body: 'Nutzen Sie den obigen Link, um zur Startseite zurückzukehren und einen neuen Push zu erstellen, oder prüfen Sie die URL und versuchen Sie es erneut. Hilfe unter docs.pwpush.com.' }, nl: { brand_tagline: 'Ga je gang. Stuur nog een wachtwoord per e-mail.', heading: 'Pagina niet gevonden', intro: 'De pagina die u zoekt bestaat niet of is mogelijk verplaatst.', btn_home: 'Naar startpagina', help_title: 'Wat u kunt doen', help_body: 'Gebruik de link hierboven om terug te gaan naar de startpagina en een nieuwe push te maken, of controleer de URL en probeer het opnieuw. Voor hulp, zie docs.pwpush.com.' }, es: { brand_tagline: 'Adelante. Envíe otra contraseña por correo.', heading: 'Página no encontrada', intro: 'La página que busca no existe o puede haber sido movida.', btn_home: 'Ir al inicio', help_title: 'Qué puede hacer', help_body: 'Use el enlace de arriba para volver al inicio y crear un nuevo push, o compruebe la URL e intente de nuevo. Para ayuda, consulte docs.pwpush.com.' }, it: { brand_tagline: 'Avanti. Invia un\'altra password via email.', heading: 'Pagina non trovata', intro: 'La pagina che cerchi non esiste o potrebbe essere stata spostata.', btn_home: 'Vai alla home', help_title: 'Cosa puoi fare', help_body: 'Usa il link sopra per tornare alla home e creare un nuovo push, o controlla l\'URL e riprova. Per assistenza, consulta docs.pwpush.com.' } }; var locale = getLocale(); applyTranslations(locale); document.querySelectorAll('.lang-flag').forEach(function(btn) { btn.addEventListener('click', function() { var lang = this.getAttribute('data-lang'); setLocale(lang); applyTranslations(lang); }); }); })(); ``` -------------------------------- ### Generate Encryption Key for Password Pusher Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-Set-a-Custom-Encryption-Key-For-a-Private-Instance Access the key generator endpoint to obtain a new random encryption key for your Password Pusher instance. This key is essential for encrypting sensitive data. ```text https://pwpush.com/en/pages/generate_key ``` -------------------------------- ### Microsoft 365 / Exchange Online SMTP Configuration Source: https://github.com/pglombardo/passwordpusher/wiki/How-to-Validate-and-Test-Email-Settings Configuration for sending emails via Microsoft 365 or Exchange Online. Uses `login` authentication, which is required by `smtp.office365.com`. `smtp_domain` is optional. ```yaml mail: raise_delivery_errors: true smtp_address: 'smtp.office365.com' smtp_user_name: 'm365 email' smtp_password: 'm365 password' #smtp_domain: 'outlook.com' //optional it work with or without it smtp_port: '587' smtp_authentication: 'login' smtp_starttls: true smtp_enable_starttls_auto: true smtp_open_timeout: 10 smtp_read_timeout: 10 mailer_sender: '"Password Pusher" ' ``` -------------------------------- ### Delete Expired and Anonymous Records Task Source: https://github.com/pglombardo/passwordpusher/wiki/Periodic-Background-Tasks Run the task to delete expired and anonymous records from the database. This helps in cleaning up unnecessary data. ```bash /opt/PasswordPusher/bin/rails delete_expired_and_anonymous ``` -------------------------------- ### Destroy a Password via DELETE Request Source: https://github.com/pglombardo/passwordpusher/wiki/Password-API This curl command demonstrates how to destroy a password using its unique ID. This action is only possible if the 'deletable_by_viewer' option was set to true during creation. ```bash curl -X DELETE https://pwpush.com/p/.json ``` -------------------------------- ### Password Pusher Maintenance Page Localization and Translations Source: https://github.com/pglombardo/passwordpusher/blob/master/public/maintenance.html This JavaScript code manages the localization and translation for the Password Pusher maintenance page. It detects the user's preferred language, applies translations to UI elements, and updates the page's language attribute and title accordingly. It supports multiple languages and persists the user's choice using local storage. ```javascript (function() { var STORAGE_KEY = 'pwp_error_lang'; var SUPPORTED = ['en','fr','de','nl','es','it']; function getLocaleFromNavigator() { if (!navigator.languages) return 'en'; for (var i = 0; i < navigator.languages.length; i++) { var code = navigator.languages[i].split('-')[0].toLowerCase(); if (SUPPORTED.indexOf(code) !== -1) return code; } return 'en'; } function getLocale() { try { var saved = localStorage.getItem(STORAGE_KEY); if (saved && SUPPORTED.indexOf(saved) !== -1) return saved; } catch (e) {} return getLocaleFromNavigator(); } function setLocale(locale) { try { localStorage.setItem(STORAGE_KEY, locale); } catch (e) {} } function applyTranslations(locale) { var t = T[locale] || T.en; document.documentElement.lang = locale; document.title = (locale === 'en' ? 'Maintenance' : t.badge) + ' — Password Pusher'; document.querySelectorAll('[data-i18n]').forEach(function(el) { var key = el.getAttribute('data-i18n'); if (t[key]) el.textContent = t[key]; }); document.querySelectorAll('[data-i18n-html]').forEach(function(el) { var key = el.getAttribute('data-i18n-html'); if (t[key]) el.innerHTML = t[key]; }); document.querySelectorAll('.lang-flag').forEach(function(btn) { var isActive = btn.getAttribute('data-lang') === locale; btn.classList.toggle('active', isActive); btn.setAttribute('aria-pressed', isActive ? 'true' : 'false'); }); } var T = { en: { brand_tagline: 'Go Ahead. Email Another Password.', badge: 'Maintenance', heading: "We're making things better", intro: "We're pushing out updates and will be back shortly. Thanks for your patience.", btn_check: 'Check again', help_title: "What's going on?", help_body: "We're performing scheduled maintenance or deploying improvements. This usually only takes a few minutes. Try the button above in a moment, or check docs.pwpush.com for status updates." }, fr: { brand_tagline: 'Allez-y. Envoyez un autre mot de passe par e-mail.', badge: 'Maintenance', heading: 'Nous améliorons le service', intro: 'Nous déployons des mises à jour et serons de retour sous peu. Merci de votre patience.', btn_check: 'Réessayer', help_title: "Que se passe-t-il ?", help_body: 'Nous effectuons une maintenance programmée ou déployons des améliorations. Cela ne prend généralement que quelques minutes. Réessayez dans un instant ou consultez docs.pwpush.com pour les mises de statut.' }, de: { brand_tagline: 'Einfach. Noch ein Passwort per E-Mail versenden.', badge: 'Wartung', heading: 'Wir verbessern gerade etwas', intro: 'Wir spielen Updates ein und sind gleich wieder da. Vielen Dank für Ihre Geduld.', btn_check: 'Erneut prüfen', help_title: 'Was passiert gerade?', help_body: 'Wir führen geplante Wartungsarbeiten durch oder setzen Verbesserungen um. Das dauert in der Regel nur wenige Minuten. Versuchen Sie es in Kürze erneut oder prüfen Sie .json ### Description Retrieves a password by its unique identifier. ### Method GET ### Endpoint /p/.json ### Parameters #### Path Parameters - **ID** (string) - Required - The unique identifier of the password to retrieve. ### Response #### Success Response (200) - **payload** (string) - The content of the password. - **url_token** (string) - The token associated with the password URL. - Other fields related to the password may be included. ### Response Example ```json { "payload": "mypassword", "url_token": "", "expire_after_days": 10, "expire_after_views": 2, "note": "Reference Note." } ``` ```