Commit Graph

389 Commits

Author SHA1 Message Date
El RIDO 95bf37be8f
implementing DiscussionViewer test, found an issue with slashes in the paste or comment IDs (as per Base64 encoding) 2018-01-02 11:44:54 +01:00
El RIDO 28f1f41c17
removing duplicate code and unused option 2018-01-02 11:42:03 +01:00
El RIDO 85401a1513
Merge branch 'master' into js-unit-testing 2018-01-02 09:37:46 +01:00
El RIDO 98a8591a27
naming JS libraries consistently 2018-01-02 08:01:39 +01:00
El RIDO 094a0c80db
Merge branch 'master' into qrcode 2018-01-02 07:56:16 +01:00
El RIDO bb54d46c7e
updating DOMPurify library, simplifying its use, ensuring HTML entities get escaped before formatting paste - regression introduced in #258, reported in #269 2018-01-01 10:25:07 +01:00
rugk 414ab0eb71
Add config and basic page template support
* load JS file asyncronously (just HTML5 async attribut)
* add basic support for page template, where it generates the code inside
  of a simple div at the top
* added option to turn off QR code support
2017-12-25 14:59:15 +01:00
El RIDO d80c2f83fa
making DiscussionViewer testable, removing some inconsistency 2017-12-18 14:47:17 +01:00
El RIDO 928215dc5e
splitting out PasteViewer, DiscussionViewer, AttachmentViewer tests 2017-12-18 14:25:08 +01:00
El RIDO 893d29a046
splitting out Alert, Editor, PasteStatus, Prompt, UiHelper tests 2017-12-15 07:20:51 +01:00
El RIDO be358a6804
splitting out Model tests 2017-12-14 07:31:09 +01:00
El RIDO 5b9ac67504
splitting out CryptTool tests 2017-12-14 07:23:38 +01:00
El RIDO 3fed63ce28
ensuring internal variables of common module are not changed by providing getter functions, splitting out I18n tests 2017-12-14 07:19:05 +01:00
El RIDO dfd906900b
started to split humongous test.js into separate files 2017-12-13 07:40:48 +01:00
El RIDO 39860dfdc4
making AttachmentViewer testable and implementing tests 2017-12-03 14:29:07 +01:00
El RIDO dac86eb363
making AttachmentViewer testable 2017-11-28 06:38:10 +01:00
rugk 7bf5af761b
Add QR code generation when paste is created 2017-11-26 15:59:12 +01:00
El RIDO d9c6b634b9
remove dangling comma 2017-11-22 22:44:38 +01:00
El RIDO a0740ff79f
getting rid of htmlEntities (except for tests) and setElementText (dropping IE9 support), changing urls2links interface, all to avoid double encoding sanitized HTML 2017-11-22 22:27:38 +01:00
El RIDO d0cccce7a8
removing patterns that don't get sanitized, but also don't get interpreted when inserted into the HTML 2017-11-22 20:49:23 +01:00
rugk 56f4ee5c20
Revert "Try to move sanitisation & links into setElementText"
This reverts commit 8d2e19f791.
2017-11-22 16:48:54 +01:00
rugk 8d2e19f791
Try to move sanitisation & links into setElementText 2017-11-22 16:48:00 +01:00
rugk 3d2dbabaec
add some more tests from OWASP 2017-11-22 15:41:49 +01:00
El RIDO 9fa2ea3373
ensuring text is sanitized in all cases, before being injected into the DOM 2017-11-22 08:05:06 +01:00
El RIDO 2d00202b42
correcting the XSS test, commenting two failing patterns, to be reviewed by @rugk 2017-11-22 07:03:29 +01:00
El RIDO 233bd65b00
Merge branch 'master' into sanitizeMarkdown, changing test to use new library 2017-11-22 06:30:38 +01:00
El RIDO f2628a0bf3
added a test for #183, fails at this point, #258 should fix this 2017-11-22 06:15:09 +01:00
rugk bbec693cab
Allow DOMPurify as a global 2017-11-21 22:26:02 +01:00
rugk b6d7d56774
Sanitize HTML code
using DOMPurify v1.0.2
Fixes https://github.com/PrivateBin/PrivateBin/issues/183
2017-11-21 21:22:51 +01:00
El RIDO 35ea65b797
handling JSVerify RNG state 89fdc94018a35b672e 2017-11-21 10:56:58 +01:00
El RIDO c6ddee317d
adding tests for PasteViewer class 2017-11-21 10:53:33 +01:00
El RIDO 10ee37b35c
handling JSVerify RNG state 08a74d310cfb58269e 2017-11-20 09:43:35 +01:00
El RIDO af073c9ca1
adding tests for Editor class 2017-11-20 09:37:43 +01:00
El RIDO 5a2bb1993d
handling JSVerify RNG state 82fb7d20c918a6e543 2017-11-20 08:58:53 +01:00
El RIDO 360a0921e2
adding tests for Prompt class, typos 2017-11-20 08:49:25 +01:00
El RIDO 984941f901
adding test for hiding messages 2017-11-16 09:04:27 +01:00
El RIDO 9d1a9a0da7
fixing paste success message handling in page template 2017-11-16 08:57:08 +01:00
El RIDO b1e1878861
fully testing remaining time display function 2017-11-16 08:50:38 +01:00
El RIDO 73bc685178
fixing error message display revealed by testing remaining time display function 2017-11-14 06:52:12 +01:00
El RIDO 0cfb019615
handling JSVerify RNG state 0b2b38c4ef690d1a57 2017-11-13 22:00:26 +01:00
El RIDO 6c8f57f91f
making PasteStatus testable, adding test for paste creation notification 2017-11-13 21:57:49 +01:00
El RIDO e51aa7c80f
increasing coverage (by three lines) 2017-11-13 20:44:11 +01:00
El RIDO 9af4a4e2f5
handling JSVerify RNG states 08a8fd9e23076415bc & 8623a0cde74fb19568 2017-11-04 09:02:05 +01:00
El RIDO 01a6c0142a
adding test for alert handler 2017-11-04 08:59:31 +01:00
El RIDO c6e0f2d223
adding test for hiding messages 2017-11-04 07:44:42 +01:00
El RIDO 1fd13981d4
adding test for hiding loading indicator 2017-11-04 07:40:26 +01:00
El RIDO 29419d03cd
avoid logs polluting the unit test output 2017-10-30 07:04:59 +01:00
El RIDO 751731414e
adding test for loading indicator 2017-10-30 06:53:15 +01:00
El RIDO 9c6aec86c4
making Alert class resetable and adding first tests for it 2017-10-23 21:33:07 +02:00
El RIDO d75cea856a
concluding UiHelper tests that are possible in headless jsdom at this time 2017-10-23 05:34:55 +02:00
El RIDO ef6b6816b0
implemented test, but again not supported yet by jsdom 2017-10-22 16:26:41 +02:00
El RIDO 4410ddcd84
adding tests for UiHelper.reloadHome, making UiHelper unit testable and handling JSVerify RNG states 846932d5afb10ce748 & 012c1f9483adb6e750 2017-10-22 13:39:23 +02:00
El RIDO cbcc26ec37
fixing false positive with RNG state 0bc96fe3b8d170254a 2017-10-22 10:55:28 +02:00
El RIDO 4cb21350a0
TravisCI can be a bit slow (locally this test takes 386ms) 2017-10-22 10:45:41 +02:00
El RIDO 414693fa90
testing both cases of the logic required for #167 2017-10-22 10:39:18 +02:00
El RIDO 6dbb098d7a
had to introduce a mock function to test the historyChange state 2017-10-22 09:56:44 +02:00
El RIDO 379571d522
Merge branch 'master' into js-unit-testing 2017-10-22 08:10:49 +02:00
El RIDO 81ac232710
increasing timeouts for travisCI, that seems to have gotten slower 2017-10-08 17:29:07 +02:00
El RIDO 6fa2bfe30e
updated documentation, incremented version 2017-10-08 16:40:51 +02:00
El RIDO ba0ff3545d
started work on UiHelper tests 2017-09-13 07:23:56 +02:00
thororm 08972e4da3 Merge branch 'master' into attachment-handling 2017-08-12 13:29:51 +02:00
thororm 28b8f878dc Fixed decryption of pastes without attachment, that have a password 2017-08-12 13:26:43 +02:00
El RIDO f31a99b1c0
added tests for getCipherData(), hasCipherData() & getTemplate() 2017-05-26 21:52:00 +02:00
El RIDO fcfb02c2b7
added tests for getFormatterDefault(), fixing bug in compact design 2017-05-26 20:55:45 +02:00
El RIDO 9f01ccc80e
added tests for getExpirationDefault() 2017-05-22 22:15:13 +02:00
thororm b5c259dd72 Code review 2017-05-20 16:11:32 +02:00
thororm 39717707b3 Code review 2017-05-20 16:04:10 +02:00
thororm 2c17c35b85 Code review results and further improvements
Added english default for new translations
2017-05-15 22:05:52 +02:00
thororm 24aea957b3 Added possibility to paste an image from the clipboard 2017-05-13 21:43:32 +02:00
thororm 838ca3d38e Call removeAttachment on a new paste
Improved disabled attachments handling
2017-05-13 21:27:41 +02:00
thororm 23f5dfbff8 Merge remote-tracking branch 'remotes/thororm/master' into attachment-handling
# Conflicts:
#	tpl/bootstrap.php
#	tpl/page.php
2017-05-13 19:48:25 +02:00
thororm b9075d7708 Removed attachmentHelpers and moved functionality to AttachmentViewer 2017-05-13 19:46:22 +02:00
rugk 9b6748c54d
Adjust requested changes 2017-04-13 10:46:09 +02:00
rugk 073b52ce96
Pass on event
Thus the receiving function also had to be adjusted, so the right data is passed on.
2017-04-11 22:36:25 +02:00
rugk d53207e404
Add password retry feature 2017-04-11 22:21:30 +02:00
rugk 183ebe518b
Force JSON request for getting paste data 2017-04-11 16:34:13 +02:00
El RIDO 41701bbfe4
trying to fix unit test execution in Travis 2017-04-05 06:55:20 +02:00
El RIDO 8f6c1ee079
added a check for the ZeroBin paste format (uses Base64.js v1.7) 2017-04-05 06:46:21 +02:00
El RIDO 2d4c75be85
added tests for entropy checks and key generation, added base64 experiment, showing we could replace Base64.js v2.1.9 with other options, but still need to find a way to handle v1.7 format and UTF16 to UTF8 conversion (btou / utob functions) 2017-04-04 07:43:41 +02:00
thororm 1a1369ff53 scrutinizer issues 2017-04-02 19:11:49 +02:00
thororm ec9fb750b4 Adapted attachment handling to refactoring 2017-04-02 18:58:11 +02:00
El RIDO 3cf005c8ae
added test with hardcoded v1 pastes to ensure decryption of the original paste format still works, even when the format is changed in the future 2017-03-26 16:16:15 +02:00
El RIDO cdb62b44c7
basic tests for CryptTool classes encryption and compression functions 2017-03-26 11:34:19 +02:00
El RIDO 37f5d99bc4
finalizing tests for I18n class, AJAX loading of translations needs to be tested in browser, mocked for now 2017-03-26 09:24:42 +02:00
El RIDO e1ea14627f
handling JSVerify RNG state 88caf85079d32e416b 2017-03-26 06:47:57 +02:00
El RIDO 6fb3fe51b2
Merge branch 'master' into js-unit-testing 2017-03-26 06:46:42 +02:00
El RIDO cd40717301
fixing #209, refactoring regression when file upload is disabled 2017-03-25 18:44:20 +01:00
El RIDO 145cfccfcb
corrections for rngState 82b19a3e7604cf825d 2017-03-25 10:47:12 +01:00
El RIDO e15e86ac3f
improving coverage of existing tests 2017-03-25 10:18:28 +01:00
El RIDO 2a19b42b15
making I18n class testable, adding minimal test 2017-03-25 09:41:24 +01:00
El RIDO 9d2e282772
removing unused function 2017-03-25 09:17:04 +01:00
El RIDO 57ebc7338d
Merge branch 'master' into js-unit-testing 2017-03-25 09:06:04 +01:00
El RIDO bbcc3e167b
implementing recommendations of scrutinizer 2017-03-25 00:58:59 +01:00
El RIDO 0fb650c3a6
comply with codacys suggestion 2017-03-13 21:15:52 +01:00
El RIDO b5cdfff3e3
fix missing comment status messages - ♫ lovely span, oh wonderful span ♪ (chorus) span, span, span, span, … 2017-03-13 21:11:26 +01:00
El RIDO 5bf25f227e
update JSDoc and re-published to https://privatebin.info/jsdoc/ 2017-03-13 20:24:18 +01:00
El RIDO ee43557a4f
ensure burn after reading and status messages are only changed after a successfull decryption 2017-03-13 19:30:44 +01:00
El RIDO 9deaed9406
working on asynch translation handling 2017-03-12 17:08:12 +01:00
El RIDO 1649ff34f5
restoring password protection 2017-03-12 16:06:17 +01:00
El RIDO 81b00dd422
fixing page template, removing error messages when markdown or source are disabled in configuration, re-removing unnecessary spans 2017-03-12 14:16:08 +01:00
El RIDO b6d8d0f250
found problem with unit test of baseUri function, makes code much simpler 2017-03-06 19:48:07 +01:00
El RIDO fb99d5bb93
Merge branch 'master' into jsrefactor and fixing baseUri unit test 2017-03-05 12:11:55 +01:00
El RIDO 23b09d601d
credited Tulio for the portuguese translation, updated SRI hashes 2017-03-05 11:02:18 +01:00
El RIDO 131e08ca33
made phpUnit and most mocha tests work again, had to remove some injected objects and added a helper method to facilitate a cache reset for the unit tests. Page template is still broken and the JS test for baseUri() fails 2017-02-25 09:35:55 +01:00
rugk 601aa5e3dc
🐛 Fix typo 2017-02-17 22:59:16 +01:00
rugk c033775779
Cleanup 2017-02-17 22:46:18 +01:00
rugk 52d1be1b54
Fix https://github.com/PrivateBin/PrivateBin/issues/187 2017-02-17 22:26:39 +01:00
rugk b0876ea0e0
🐛 Fix error not appearing below comment 2017-02-17 21:48:21 +01:00
rugk da094e2853
make it work(6): discussion/comments 2017-02-17 20:46:10 +01:00
Túlio Leão e59b58308d Add Portuguese Translation file
Support Portugues translation for PrivateBin by adding its corresponding
file.
2017-02-16 00:57:01 -02:00
rugk 7be5206920
makeit work(5): pase cloning & raw button 2017-02-15 22:59:55 +01:00
rugk a652ab5896
make it work(4): display encrypted pastes
also improved file uploader, better structured
2017-02-14 22:21:55 +01:00
rugk 31e66131b7
make it work(3): allow paste submission 2017-02-13 21:12:00 +01:00
rugk f33d702f3d
make it work(2): buttons & preview working 2017-02-13 11:35:04 +01:00
rugk 8a07a0b157
make it work(1): paste input can be shown 2017-02-12 21:13:04 +01:00
rugk dd6e426da7
first round of refactoring
split into modules, moved code around
need to make it work
2017-02-12 18:08:08 +01:00
El RIDO eedb05111a
added test for getCookie function, documenting its limitation of not finding cookies with empty identifier 2017-02-12 17:11:21 +01:00
El RIDO b1396a249d
ensuring that in the JS sprintf tests no replacable patterns occur in the pre- & postfix of the test string 2017-02-12 15:30:11 +01:00
El RIDO b9c05b06d0
added test for sprintf function, removing dead code and optimizing test cases 2017-02-11 19:34:51 +01:00
El RIDO b00bcd1352
added test for urls2links function, fixing bug - asterisk is allowed in URLs query string 2017-02-11 16:02:24 +01:00
El RIDO b992bcc732
added test for setMessage function, fixing bug for elements with only one child 2017-02-11 10:43:00 +01:00
El RIDO 61a59911b8
added test for setElementText function 2017-02-11 09:56:56 +01:00
El RIDO 3ab489e92d
added test for selectText function, but discovered that this can't be tested at the moment without a browser, due to jsdom lacking getSelect support 2017-02-11 09:09:47 +01:00
rugk 52f1fb143e
Revert "JS: tried namespaces"
This reverts commit e84cfc58a1.
2017-02-08 20:12:22 +01:00
rugk e84cfc58a1
JS: tried namespaces 2017-02-08 20:11:04 +01:00
rugk b01a28d580
remove some more this, slightly change comments 2017-02-08 14:15:58 +01:00
rugk 4e86da8f72
Remove proxy
Also I kept care to (fix?) the focus of the password input. It only works in an
anonymous function for some reason.
2017-02-08 13:54:37 +01:00
rugk 2ebcf60516
Use revealing module pattern
ala http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html

Also made the loadTranslations a bit more robust with more error messaged being logged.
2017-02-08 13:20:51 +01:00
rugk 5130d9e2f3
New state for "only new button"
Used when the message cannot be decrypted.
Fixes https://github.com/PrivateBin/PrivateBin/issues/126
2017-02-06 22:39:45 +01:00
rugk 5ad02a3d1c
Use original reload function for manual paste open link
This fixes the issue where clicking on the link took you to the home page.
I seriously missed that this.reloadPage does not do the thing I thought it does,
so I updated the doc to make it clear and switched back to the correct function.

Basically reverts 86cd5e1c15
2017-02-06 20:39:52 +01:00
rugk e483d60eed
Merge branch 'historyupdate'
Conflicts:
	tpl/bootstrap.php
	tpl/page.php

And update SRI.

@elrido also did not properly merge this branch. Doing it now…
2017-02-06 20:25:35 +01:00
El RIDO 4cb0374e11
readding accidentally removed line of #173 2017-02-06 20:16:03 +01:00
El RIDO 2ca2309fc4
Merge branch 'patch-1' of https://github.com/r4sas/PrivateBin into r4sas-patch-1 2017-02-06 19:55:07 +01:00
rugk 86cd5e1c15
Use existing reload function 2017-02-05 22:35:44 +01:00
rugk edb546de54
Add loading indicator
Fixes https://github.com/PrivateBin/PrivateBin/issues/172
2017-02-05 22:09:46 +01:00
rugk 5c603d0978
Improve comment 2017-02-05 21:35:28 +01:00
rugk c96dd0836b
Make link clickable again
We need to emulate the click and manually trigger a reload if the hash is
already shown in the URL.
2017-02-05 21:22:09 +01:00
El RIDO 366b61c32d
adding document title in new history state 2017-02-05 18:53:57 +01:00
El RIDO f699ca6cd4
writing tests for htmlEntities function 2017-02-05 18:46:24 +01:00
El RIDO 67f71f4dd6
writing tests for pageKey function, fixing always added padding bug 2017-02-05 18:03:42 +01:00
El RIDO a97b94640e
writing test for pasteId function 2017-02-05 16:58:58 +01:00
El RIDO 80f7baa604
writing test for scriptLocation function, fixing non-removed query separator bug 2017-02-05 16:45:11 +01:00
El RIDO 5442af6e20
slight JS refactoring 2017-02-05 14:47:03 +01:00
rugk ca51a80803
Update the history when a paste is created
Fixes https://github.com/PrivateBin/PrivateBin/issues/167
2017-02-01 19:24:56 +01:00
El RIDO 4bbfd5045e
ensure that JS is *really* only initialized after the DOM is fully loaded, resolves #166 2017-01-30 20:29:04 +01:00
El RIDO 368aa2305b
removing unused pieces of code (legacy?), resolves #165 2017-01-29 16:19:12 +01:00
El RIDO b76a73aa06
upgrading showdown 2017-01-29 16:17:56 +01:00
El RIDO f1df27f46c
allowing for parameter strings starting with & 2017-01-29 15:09:57 +01:00
El RIDO 177c9d7114
Merge branch 'js-unit-testing' 2017-01-29 14:50:31 +01:00
El RIDO cae5a71151
fix missing class renaming 2017-01-29 14:48:56 +01:00