Open schnuckovic opened 2 years ago
I also have the "Clipboard access failed" mistake, when I use Safari in Monterey 12.3.1. With Google-Chrome it works.
please provide more information about your setup (are you using https?) and any errors found in the JS error console
I tested this plugin again with Safari 16.0 with Monterey 12.6. When I click on an encrypted word and have put in the password, java console reports:
AES-CBC and AES-CTR do not provide authentication by default, and implementing it manually can result in minor, but serious mistakes. We recommended using authenticated encryption like AES-GCM to protect against chosen-ciphertext attacks.
When I try to decrypt: I'm getting 'Clipboard access failed' after entering the password.
I'm seeing this as well.
Nothing in the console, except for the same message reported by @virk in https://github.com/cosmocode/dokuwiki-plugin-encryptedpasswords/issues/2#issuecomment-1268351018 above, which occurs right after clicking OK on the passphrase entry dialog.
Safari 16.6, MacOS Ventura 13.5.2, DokuWiki 2023-04-04a, encryptedpasswords 2023-06-19, using https.
Note: problem is not reproducible (i.e. everything works OK) using Firefox 102.11.0esr on Windows (same Dokuwiki instance).
@splitbrain I can consistently reproduce this error, so if you tell me where to look and what to do, maybe I can help you diagnose it.
Here I still experience the same problem with Safari 17.0 and Ventura 13.6 on Apple Mac.
The issue is probably related to this:
I added dumping the caught error to the console, you can check if you get a NotAllowedError
(I expect you do).
From what I understand, Safari only allows clipboard actions with in user interaction event handlers, but is too dumb to understand that actually happens in such a handler. I'm not sure I 100% understand the workarounds outlined above and I don't have access to a Safari browser to test. If someone can provide a PR, I'm happy to merge it.
@splitbrain thanks for the update. I confirm that I do get a NotAllowedError as per your expectation. Here's the actual output from the javascriptconsole
[Log] Object (js.php, line 1)
isTrigger: 3
jQuery36401514503719997845: true
namespace: ""
result: undefined
rnamespace: null
target: <div class="encryptedpasswords-prompt">
timeStamp: 1703232078001
type: "dialogbeforeclose"
Object Prototype
[Error] NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
writeText
(anonymous function) — js.php:12:3805
(anonymous function) (js.php:12:3896)
I do not have time to invest for further analysis and attempt to fix this, sorry no PR from me.
This was bugging me so I had a closer look.
As I understand it, the error occurs because Safari does not allow navigator.clipboard.write() in an asynchronous context. The workaround is to place all async operations in a promise whose result is assigned to a ClipboardItem (reference).
I (kind of) managed to make it work (see PR #17), but my javascript skills are quite limited and I don't know how to properly handle errors:
I did not test this with other browsers.
Maybe you can pick it up from there.
This stopped working for me.
When I try to decrypt: I'm getting 'Clipboard access failed' after entering the password.
When I try to encrypt the highlighted text: The tags are wrapped around the text, but no encryption happens, no question for setting a password.
This happens with Safari and Firefox.
Thanks!