Cimbali / markdown-viewer

Markdown (.md) file viewer WebExtension for your browser.
Other
167 stars 28 forks source link

Firefox requires confirmation every time after 2.0.2 update for local files #105

Open polirritmico opened 1 year ago

polirritmico commented 1 year ago

Hi. After the 2.0.2 update I get this screen every time I open a file through the command line: /usr/bin/firefox-bin /path/to/my_file.md

imagen

Is there any way to avoid this? It completely breaks my use case for this plugin.

Thanks!


Firefox Version: 114.0.2 (64-bit) Operating System: Gentoo Linux 2.13 KDE Plasma Version: 5.27.5 KDE Frameworks Version: 5.106.0 Qt Version: 5.15.9 Kernel Version: 6.1.31-gentoo (64-bit) Graphics Platform: X11

Cimbali commented 1 year ago

Hi! Yeah there is a check box, both in the add-on preferences and on the update on-boarding page that opens when you update.

In the options it’s the one called “Inject javascript directly in local markdown files

The page is meant as the default way to open local pages as it avoids the download-as-attachment issue. To quickly confirm the access on this page you can simply click on the displayed path to copy it, then click on the line below to open the prompt, and paste the path you just copied.

It’s the lowest overhead way that works with the limitations of Firefox (can’t access local files from extension, downloads md files as attachment, etc.)

seagullgithub commented 1 year ago

I don't want to sound harsh, but this is neither a solution nor an explanation ...

I love your add-on, but sadly there will be no future use if I need to click a dozen UI items to get a rendered view (cmdline and serverless documentation)

what happened? is there a major change in firefox that led to your latest update? are there other ad-ons that can help to bypass this behavior?

if this was a decision from firefox, I would like to let them know what I think about it 💩 (although usually they have very good reasons)

thank you anyway for spending so much time on this awesome add-on

Ma-Ba commented 1 year ago

The "GitLab Markdown Viewer" (https://github.com/painyeph/GitLabMarkdownViewer) still works without confirmation, so there must be a way to do it.

af4jm commented 1 year ago

Agreed. I had the latest Firefox & this extension worked, then got the latest update to this extension & it broke. This is an extension issue not a Firefox issue.

Also, the behavior is the same whether that box is checked or not... the comment under that box that you only need to do it the first time for each file, is also wrong, you need to do it every time.

And it doesn't use the style sheet or load images, whether that option is checked or not... I have local links colored differently a[href^="."], a[href^="#"] { color: #77b2ee; } and it no longer works in this extension.

Cimbali commented 1 year ago

what happened?

There has always been this issue, there was a whole paragraph in the README about workarounds (which did not always work for everyone, see #93, add-on ratings, etc.). It doesn’t affect you on some systems, such as e.g. Windows.

if I need to click a dozen UI items to get a rendered view

It’s 2 clicks + ctrl-v + enter, that enable people who couldn’t get a rendered view to get it. And should have stayed 0 for people who could get it already. I’ve tried it for a while and it seemed quite easy to use, but if you have any improvement suggestions on how to streamline the prompt process I’m definitely open.

Also, the behavior is the same whether that box is checked or not...

That’s a bug... though it does work for me, so I’m not sure what happens. I’ve taken v2.0.2 offline so it doesn’t affect too many people. I’ll try again and ensure the page is disabled by default next time. Sorry about that.

the comment under that box that you only need to do it the first time for each file, is also wrong

You can refresh the file in the same tab without having to re-prompt. I’ll clarify that too.

Cimbali commented 1 year ago

Note that this page was always supposed to be optional, as mentioned above! Reopening as the bug seems to be: disabling the confirmation page doesn’t work.

Cimbali commented 1 year ago

@polirritmico did the checkbox work for you? @seagullgithub @af4jm @Ma-Ba can you provide debugging details so I can try to find out why the preference did not work? FF version, Operating system, any error messages in the browser console? (Ctrl + Shift + J or menu Tools > Browser tools > Browser console)

Ma-Ba commented 1 year ago

I had already deinstalled the add-on. Now after re-installing it I no longer see the purple confirmation page, markdown from local file://... URL renders fine. Add-on version is shown as "1.8.1". I don't see any setting called “Inject javascript directly in local markdown files”. FF 114.0.2 (64-bit) on Windows.

Treer commented 1 year ago

From today it started asking every time, "Inject javascript" was already checked. I saw @Ma-Ba's comment so clicked "Check for Updates" - none were found. So I tried removing it and reinstalling it like Ma-Ba said, and not only is it working now but its options screen is very different. The options screen is much tidier, has a version "1.8.1" when it did not show a version before, the "Inject javascript" checkbox option is gone etc.

Perhaps we were running an old version and something broke with the automatic update / Check for Updates?

Cimbali commented 1 year ago

1.8.1 is the previous version yes, I’ve removed the 2.0.2 version from addons.mozilla.org as it was buggy. Simply hoping the people who had installed it had some hints on what to fix.

seagullgithub commented 1 year ago

It’s 2 clicks + ctrl-v + enter, that enable people who couldn’t get a rendered view to get it. And should have stayed 0 for people who could get it already. I’ve tried it for a while and it seemed quite easy to use, but if you have any improvement suggestions on how to streamline the prompt process I’m definitely open.

I'm on a mac currently, the string in my clipboard is "file:///Users/seagull/path/file.md". AFAIK there is no simple pasting in finder. only the "Go to" dialog. which can't handle the "file://" part... but anyway

I have an index.html with a link list of all my markdown files. opening one of the files via index.html and "Inject javascript directly in local markdown files"

not checked

parent process browser console - multiprocess

sendRemoveListener on closed conduit {7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}.157917357540505 [ConduitsChild.sys.mjs:108](resource://gre/modules/ConduitsChild.sys.mjs)
    _send resource://gre/modules/ConduitsChild.sys.mjs:108
    removeListener resource://gre/modules/ExtensionChild.sys.mjs:675
    removeListener resource://gre/modules/ExtensionChild.sys.mjs:940
    register chrome://extensions/content/child/ext-storage.js:175
    removeListener resource://gre/modules/ExtensionCommon.sys.mjs:2869
    revoke resource://gre/modules/ExtensionCommon.sys.mjs:2891
    close resource://gre/modules/ExtensionCommon.sys.mjs:2896
    unload resource://gre/modules/ExtensionCommon.sys.mjs:979
    close resource://gre/modules/ExtensionContent.sys.mjs:977
    destroyed resource://gre/modules/ExtensionContent.sys.mjs:1053
    observe resource://gre/modules/ExtensionContent.sys.mjs:1071
sendRemoveListener on closed conduit {93f81583-1fd4-45cc-bff4-abba952167bb}.157917357540507 8 [ConduitsChild.sys.mjs:108](resource://gre/modules/ConduitsChild.sys.mjs)
sendRemoveListener on closed conduit {d7742d87-e61d-4b78-b8a1-b469842139fa}.157917357540508 5 [ConduitsChild.sys.mjs:108](resource://gre/modules/ConduitsChild.sys.mjs)
Error: Please use $(ref:runtime.getURL). [utils.js:50](moz-extension://ab658d58-dde1-4115-b3b0-6842989de47f/lib/utils.js)
Content-Security-Policy warnings 2
sendRemoveListener on closed conduit {7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}.157917357540535 [ConduitsChild.sys.mjs:108](resource://gre/modules/ConduitsChild.sys.mjs)
sendRemoveListener on closed conduit {93f81583-1fd4-45cc-bff4-abba952167bb}.157917357540537 8 [ConduitsChild.sys.mjs:108](resource://gre/modules/ConduitsChild.sys.mjs)
sendRemoveListener on closed conduit {d7742d87-e61d-4b78-b8a1-b469842139fa}.157917357540538 5 [ConduitsChild.sys.mjs:108](resource://gre/modules/ConduitsChild.sys.mjs)
Content-Security-Policy warnings 2
Content-Security-Policy: Couldn’t process unknown directive ‘default-src:’ [view-md.html](moz-extension://f7cc7e63-ea86-4d59-98f5-4a96cf04e90d/ext/view-md.html?file=file%3A%2F%2F%2FUsers%2Fgg%2F_meins%2Fdocu%2Fasdf.md)
Content-Security-Policy: Couldn’t process unknown directive ‘style-src:’ [view-md.html](moz-extension://f7cc7e63-ea86-4d59-98f5-4a96cf04e90d/ext/view-md.html?file=file%3A%2F%2F%2FUsers%2Fgg%2F_meins%2Fdocu%2Fasdf.md)

checked

sendRemoveListener on closed conduit {7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}.157917357540685 [ConduitsChild.sys.mjs:108](resource://gre/modules/ConduitsChild.sys.mjs)
sendRemoveListener on closed conduit {93f81583-1fd4-45cc-bff4-abba952167bb}.157917357540687 8 [ConduitsChild.sys.mjs:108](resource://gre/modules/ConduitsChild.sys.mjs)
sendRemoveListener on closed conduit {d7742d87-e61d-4b78-b8a1-b469842139fa}.157917357540688 5 [ConduitsChild.sys.mjs:108](resource://gre/modules/ConduitsChild.sys.mjs)
Error: Please use $(ref:runtime.getURL). [utils.js:50](moz-extension://ab658d58-dde1-4115-b3b0-6842989de47f/lib/utils.js)
Content-Security-Policy warnings 2
Uncaught (in promise) Error: plugins is undefined undefined
Content-Security-Policy warnings 2
Error: redeclaration of let Renderer undefined
Content-Security-Policy warnings 2
Content-Security-Policy: Couldn’t process unknown directive ‘default-src:’ [worker.js](moz-extension://f7cc7e63-ea86-4d59-98f5-4a96cf04e90d/ext/worker.js)
Content-Security-Policy: Couldn’t p
[js:90](moz-extension://f7cc7e63-ea86-4d59-98f5-4a96cf04e90d/ext/builder.js)
Error: Please use $(ref:runtime.getURL). 7 [builder.js:157](moz-extension://f7cc7e63-ea86-4d59-98f5-4a96cf04e90d/ext/builder.js)

once again just for clarification the URLs are:

system

hope this helps

brian6932 commented 1 year ago

Disabling Use a sandboxed iframe to insert generated HTML in the page fixes this for me