diff --git a/.gitattributes b/.gitattributes index e7b5654c..6c76c7c4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -23,7 +23,6 @@ js/test/ export-ignore .styleci.yml export-ignore .travis.yml export-ignore .vscode export-ignore -codacy-analysis.yml export-ignore crowdin.yml export-ignore BADGES.md export-ignore CODE_OF_CONDUCT.md export-ignore diff --git a/codacy-analysis.yml b/.github/workflows/codacy-analysis.yml similarity index 72% rename from codacy-analysis.yml rename to .github/workflows/codacy-analysis.yml index 31d065cd..920224d3 100644 --- a/codacy-analysis.yml +++ b/.github/workflows/codacy-analysis.yml @@ -24,26 +24,30 @@ jobs: steps: # Checkout the repository to the GitHub Actions runner - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 + + - name: Remove folders causing errors in report + run: rm -rf doc img *.md # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis - name: Run Codacy Analysis CLI - uses: codacy/codacy-analysis-cli-action@1.1.0 + uses: codacy/codacy-analysis-cli-action@v4 with: # Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository # You can also omit the token and run the tools that support default configurations project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - verbose: true - output: results.sarif - format: sarif + # verbose: true + # output: results.sarif + # format: sarif # Adjust severity of non-security issues - gh-code-scanning-compat: true + # gh-code-scanning-compat: true # Force 0 exit code to allow SARIF file generation # This will handover control about PR rejection to the GitHub side - max-allowed-issues: 2147483647 + # max-allowed-issues: 2147483647 # Upload the SARIF file generated in the previous step - - name: Upload SARIF results file - uses: github/codeql-action/upload-sarif@v1 - with: - sarif_file: results.sarif + # disabled due to: https://github.com/codacy/codacy-analysis-cli-action/issues/142 + #- name: Upload SARIF results file + # uses: github/codeql-action/upload-sarif@v4 + # with: + # sarif_file: results.sarif diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 25c8d787..b212c2a3 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -26,8 +26,8 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + language: [ 'actions', 'javascript' ] + # CodeQL supports [ 'actions', 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed @@ -37,7 +37,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -46,4 +46,4 @@ jobs: # queries: ./path/to/local/query, your-org/your-repo/queries@main - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 diff --git a/.github/workflows/snyk-scan.yml b/.github/workflows/snyk-scan.yml index 851211f2..e48dfa08 100644 --- a/.github/workflows/snyk-scan.yml +++ b/.github/workflows/snyk-scan.yml @@ -30,6 +30,6 @@ jobs: with: args: --sarif-file-output=snyk.sarif - name: Upload result to GitHub Code Scanning - uses: github/codeql-action/upload-sarif@v3 + uses: github/codeql-action/upload-sarif@v4 with: sarif_file: snyk.sarif diff --git a/BADGES.md b/BADGES.md index 7724869c..5bd6301e 100644 --- a/BADGES.md +++ b/BADGES.md @@ -1,11 +1,7 @@ # Badges -[](https://travis-ci.org/PrivateBin/PrivateBin) [](https://scrutinizer-ci.com/g/PrivateBin/PrivateBin/build-status/master) -[](https://www.codacy.com/app/PrivateBin/PrivateBin) -[](https://codeclimate.com/github/PrivateBin/PrivateBin) +[](https://scrutinizer-ci.com/g/PrivateBin/PrivateBin/build-status/master) [](https://codeclimate.com/github/PrivateBin/PrivateBin) [](https://scrutinizer-ci.com/g/PrivateBin/PrivateBin/?branch=master) -[](https://insight.sensiolabs.com/projects/57c9e74e-c6f9-4de6-a876-df66ec2ea1ff) -[](https://www.codacy.com/app/PrivateBin/PrivateBin) -[](https://codeclimate.com/github/PrivateBin/PrivateBin/coverage) [](https://scrutinizer-ci.com/g/PrivateBin/PrivateBin/?branch=master) +[](https://scrutinizer-ci.com/g/PrivateBin/PrivateBin/?branch=master) [](https://www.browserstack.com/) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88e2d05d..d02219b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,13 @@ # PrivateBin version history ## 2.0.1 (not yet released) +* ADDED: Auto shorten URLs with config option `shortenbydefault` (#1627) +* ADDED: Added `shortenviashlink` endpoint with an `shlink` configuration section +* ADDED: Password peek (#1254) * CHANGED: CSP recommendation around bootstrap5 template resolved in Firefox 131 (#1613) * FIXED: Allow pasting a password for decrypting a paste (#1620) * FIXED: Allow copying the shortened link after using a URL shortener (#1624) -* ADDED: Auto shorten URLs with config option `shortenbydefault` (#1627) -* ADDED: Added `shortenviashlink` endpoint with an `shlink` configuration section -* FIXED: Check for quotes and conical braces when extracting short url (#1644) +* FIXED: URL extraction fails when frame-ancestors is set in CSP (#1644) ## 2.0.0 (2025-07-28) * ADDED: Error logging in database and filesystem backend (#1554) diff --git a/i18n/ar.json b/i18n/ar.json index 1ba7dc63..34dcb6ec 100644 --- a/i18n/ar.json +++ b/i18n/ar.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "نُسخ الرابط إلى الحافظة", "Document text": "لصق النص", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "مفتاح التبويب يعمل كشخصية (انقر Ctrl+m أو Esc للتبديل)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "السمة" } diff --git a/i18n/bg.json b/i18n/bg.json index 5aa0b00d..3f3cc2b3 100644 --- a/i18n/bg.json +++ b/i18n/bg.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/ca.json b/i18n/ca.json index 5c3c6073..2c8ef463 100644 --- a/i18n/ca.json +++ b/i18n/ca.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/co.json b/i18n/co.json index b029068e..89597154 100644 --- a/i18n/co.json +++ b/i18n/co.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "U liame hè statu cupiatu in u preme’papei", "Document text": "Testu di u ducumentu", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "U tastu di tabulazione ghjova cum’è un caratteru (Appughjate nant’à Ctrl+m o Scapp per scambià)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Tema" } diff --git a/i18n/cs.json b/i18n/cs.json index 3dfa081c..d8a12de4 100644 --- a/i18n/cs.json +++ b/i18n/cs.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Odkaz zkopírován do schránky", "Document text": "Text dokumentu", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulátor funguje jako znak (pro přepnutí stiskněte Ctrl+m nebo Esc)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Vzhled" } diff --git a/i18n/de.json b/i18n/de.json index 188243d5..37c10d48 100644 --- a/i18n/de.json +++ b/i18n/de.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Verknüpfung wurde in die Zwischenablage kopiert.", "Document text": "Text des Dokuments", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulatortaste als Zeichen interpretieren (Umschalten durch Strg+m oder Esc)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Design" } diff --git a/i18n/el.json b/i18n/el.json index 0be86a5c..a87c2b19 100644 --- a/i18n/el.json +++ b/i18n/el.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/en.json b/i18n/en.json index c0d21fca..0ccb0422 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/es.json b/i18n/es.json index 4d530078..b917a8a2 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Enlace copiado al portapapeles", "Document text": "Texto del documento", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "La tecla de tabulación funciona como carácter (presione Ctrl+m o Esc para alternar)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Tema" } diff --git a/i18n/et.json b/i18n/et.json index dfa643e3..60a23a29 100644 --- a/i18n/et.json +++ b/i18n/et.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link kopeeriti lõikelauale", "Document text": "Kleebi tekst", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Teema" } diff --git a/i18n/fi.json b/i18n/fi.json index 185db758..bb7bb44b 100644 --- a/i18n/fi.json +++ b/i18n/fi.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Linkki kopioitu leikepöydälle", "Document text": "Liitä teksti", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulaattori toimii merkkinä (Paina Ctrl+m tai Esc vaihtaaksesi)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Teema" } diff --git a/i18n/fr.json b/i18n/fr.json index ad71679e..5eff94de 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Lien copié dans le presse-papier", "Document text": "Texte du document", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "La touche de tabulation sert de caractère (Presser Ctrl+m ou Esc pour basculer)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Thème" } diff --git a/i18n/he.json b/i18n/he.json index 31d2afd9..36c30770 100644 --- a/i18n/he.json +++ b/i18n/he.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "הקישור הועתק ללוח", "Document text": "הדבק טקסט", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "משטח ה-tab פועל כמקש תו (לחץ על Ctrl+m או Esc להחלפה)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "נושא" } diff --git a/i18n/hi.json b/i18n/hi.json index c0d21fca..0ccb0422 100644 --- a/i18n/hi.json +++ b/i18n/hi.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/hu.json b/i18n/hu.json index b451a789..d284ee18 100644 --- a/i18n/hu.json +++ b/i18n/hu.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/id.json b/i18n/id.json index 89212292..5f77d582 100644 --- a/i18n/id.json +++ b/i18n/id.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/it.json b/i18n/it.json index 1d91186c..65a1af4d 100644 --- a/i18n/it.json +++ b/i18n/it.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Testo del messaggio", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/ja.json b/i18n/ja.json index 54650f04..c722f58e 100644 --- a/i18n/ja.json +++ b/i18n/ja.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/jbo.json b/i18n/jbo.json index 90160ecf..b5501292 100644 --- a/i18n/jbo.json +++ b/i18n/jbo.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/ko.json b/i18n/ko.json index c0d21fca..0ccb0422 100644 --- a/i18n/ko.json +++ b/i18n/ko.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/ku.json b/i18n/ku.json index e72469d0..ff3b2042 100644 --- a/i18n/ku.json +++ b/i18n/ku.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/la.json b/i18n/la.json index 081d551f..91f8d7b4 100644 --- a/i18n/la.json +++ b/i18n/la.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/lt.json b/i18n/lt.json index 02253d08..e611d979 100644 --- a/i18n/lt.json +++ b/i18n/lt.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/nl.json b/i18n/nl.json index 220ff9db..361d3c7d 100644 --- a/i18n/nl.json +++ b/i18n/nl.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link gekopieerd naar klembord", "Document text": "Tekst plakken", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulatortoets dient als teken (gebruik Ctrl+m of Esc om te schakelen)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Thema" } diff --git a/i18n/no.json b/i18n/no.json index 538364ec..13046723 100644 --- a/i18n/no.json +++ b/i18n/no.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/oc.json b/i18n/oc.json index 5ba5af14..d9a7adcc 100644 --- a/i18n/oc.json +++ b/i18n/oc.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/pl.json b/i18n/pl.json index c4371f94..4e4c8431 100644 --- a/i18n/pl.json +++ b/i18n/pl.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link skopiowany do schowka", "Document text": "Treść dokumentu", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Klawisz Tabulatora służy jako znak (użyj Ctrl+m lub Esc, aby przełączyć tryb)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Motyw" } diff --git a/i18n/pt.json b/i18n/pt.json index 91d8ea4b..73c6812c 100644 --- a/i18n/pt.json +++ b/i18n/pt.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/ro.json b/i18n/ro.json index aaf35e0d..c1751bd2 100644 --- a/i18n/ro.json +++ b/i18n/ro.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/ru.json b/i18n/ru.json index ee4c4013..bef5a3dd 100644 --- a/i18n/ru.json +++ b/i18n/ru.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Ссылка скопирована в буфер обмена", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Тема" } diff --git a/i18n/sk.json b/i18n/sk.json index 95dae475..0007e12a 100644 --- a/i18n/sk.json +++ b/i18n/sk.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Odkaz vložený do schránky", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/sl.json b/i18n/sl.json index 8098381b..4dae8239 100644 --- a/i18n/sl.json +++ b/i18n/sl.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/sv.json b/i18n/sv.json index 8e9ac275..09219db1 100644 --- a/i18n/sv.json +++ b/i18n/sv.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/th.json b/i18n/th.json index d7d2a133..10e87c95 100644 --- a/i18n/th.json +++ b/i18n/th.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "คัดลอกลิงก์ไปที่คลิปบอร์ดแล้ว", "Document text": "ฝากข้อความ", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "ปุ่ม Tabulator ใช้เป็นอักขระ (กด Ctrl+m หรือ Esc เพื่อสลับ)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "ธีม" } diff --git a/i18n/tr.json b/i18n/tr.json index c5f6ab21..ec0ccf95 100644 --- a/i18n/tr.json +++ b/i18n/tr.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/uk.json b/i18n/uk.json index efdbc89e..5cfa63b5 100644 --- a/i18n/uk.json +++ b/i18n/uk.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "Link copied to clipboard", "Document text": "Document text", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "Theme" } diff --git a/i18n/zh.json b/i18n/zh.json index 12aa7d71..dc4ea8f0 100644 --- a/i18n/zh.json +++ b/i18n/zh.json @@ -229,5 +229,7 @@ "Link copied to clipboard": "链接已复制到剪贴板", "Document text": "粘贴文本", "Tabulator key serves as character (Hit Ctrl+m or Esc to toggle)": "Tab 键可作为字符(按 Ctrl+m 或 Esc 切换开关)", + "Show password": "Show password", + "Hide password": "Hide password", "Theme": "主题" } diff --git a/img/bootstrap-icons.svg b/img/bootstrap-icons.svg index 18390345..1fea2e1a 100644 --- a/img/bootstrap-icons.svg +++ b/img/bootstrap-icons.svg @@ -1 +1 @@ - + diff --git a/js/privatebin.js b/js/privatebin.js index 22554a0d..742abb42 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -5675,6 +5675,73 @@ jQuery.PrivateBin = (function($) { return me; })(); + /** + * + * @name PasswordPeek + * @class + */ + const PasswordPeek = (function () { + const me = {}; + + /** + * Switch between visible and hidden password + * + * @name PasswordPeek.handleRevealButtonClick + * @private + * @function + */ + function handleRevealButtonClick() { + const element = $(this); + const passwordInput = element.siblings('.input-password'); + const isHidden = passwordInput.attr('type') === 'password'; + + passwordInput.attr('type', isHidden ? 'text' : 'password'); + + const tooltip = I18n._(isHidden ? 'Hide password' : 'Show password'); + + element.attr('title', tooltip); + element.attr('aria-label', tooltip); + + // handle bootstrap 5 icons: eye & eye-slash + const buttonSvg = element.find('use'); + if (buttonSvg.length) { + const iconHref = buttonSvg.attr('href'); + if (isHidden) { + buttonSvg.attr('href', iconHref + '-slash'); + } else { + buttonSvg.attr('href', iconHref.substring(0, iconHref.length - 6)); + } + return; + } + + // handle bootstrap 3 icons: eye-open & eye-close + const buttonSpan = element.find('span'); + if (buttonSpan.length) { + if (isHidden) { + buttonSpan.addClass('glyphicon-eye-close'); + buttonSpan.removeClass('glyphicon-eye-open'); + } else { + buttonSpan.addClass('glyphicon-eye-open'); + buttonSpan.removeClass('glyphicon-eye-close'); + } + } + } + + /** + * Initialize + * + * @name PasswordPeek.init + * @function + */ + me.init = function() { + const revealButton = $('.toggle-password'); + + revealButton.click(handleRevealButtonClick); + }; + + return me; + })(); + /** * (controller) main PrivateBin logic * @@ -5923,6 +5990,7 @@ jQuery.PrivateBin = (function($) { TopNav.init(); UiHelper.init(); CopyToClipboard.init(); + PasswordPeek.init(); // check for legacy browsers before going any further if (!Legacy.Check.getInit()) { @@ -5982,6 +6050,7 @@ jQuery.PrivateBin = (function($) { ServerInteraction: ServerInteraction, PasteEncrypter: PasteEncrypter, PasteDecrypter: PasteDecrypter, + PasswordPeek: PasswordPeek, CopyToClipboard: CopyToClipboard, Controller: Controller }; diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 099b2558..89829bd4 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -109,7 +109,12 @@ if (count($class)) {
@@ -368,7 +373,12 @@ if ($PASSWORD) : ?>-