ferdium / ferdium-app

All your services in one place, built by the community
https://ferdium.org
Apache License 2.0
2.75k stars 163 forks source link

Slack: In "search results", clicking "Open-in-Channel" or any searched message opens it in an EXTERNAL web browser #1007

Open stormy1777 opened 2 years ago

stormy1777 commented 2 years ago

Avoid duplicates

Ferdium Version

6.0.0-nightly.34

What Operating System are you using?

Windows

Operating System Version

Windows 10

What arch are you using?

x64

Last Known Working Ferdium version

No response

Expected Behavior

After a search, the resulting found items have an issue that clicking on "view in channel" or any found message should open it within the Fredium framework/window (and not externally).

Actual Behavior

After a search, the resulting found items have an issue that clicking on "view in channel" or any found message attempts to open an EXTERNAL BROWSER at the OS level, not within the framework.

Steps to reproduce

search for any message text e.g. "test" in the resulting "hits", click "view in channel" if opens within Ferdium, that is fine, u have not reproduced the issue, if it attempts to open an EXTERNAL view, you've managed to reproduce the issue.

Debug link

No response

Screenshots

No response

Additional information

No response

vraravam commented 2 years ago

Duplicate of ferdium/ferdium-app#87

This is a known behavior - since many websites build up the underlying HTML differently (add to that the javascript-based click handling makes it more complex). Suffice to say that Ferdium won't be able to handle each and every combination from all websites. We are treating this as a feature enhancement for the future.

stormy1777 commented 2 years ago

I think there is a mis-communication on understanding the issue here.
The complaint is not on HTML generated in the message BODY, but rather in the messages HEADERS that is , internal slack-headers to the same message in channel, etc. let me explain again:

1) Search for any random text, say "TEST" 2) A list of messages will appear, from various channels/groups.. 3) On the TOP of each message is a HEADER line similar to:

# tl-workroup-testing-room  TestSlack-CORE - May 14th View in channel

Each of the words in that header only (not the BODY of the message), appears as a "clickable" item.

The expected behavior when clicking "View in channel" is for that same message to open up in Slack under Ferdium's control, however, instead an EXTERNAL browser it launched and a login attempt is made to slack on the external browser..

Hopefully this is clear, not talking about user generated html or URLs or message body, clicking on the HEADER field only as explained above.

vraravam commented 2 years ago

The rendering of the text as links is not something that Ferdium ever does. That seems to be something that's in the Slack web-ui (I dont use slack, and so can't check this by myself).

And for any link that appears, depending on whether the underlying html has a target="_blank" or target="top" or other choices (there is no w3 standard for this), the browsers will behave differently. Since Ferdium's webview is only a chromium browser tab, again the number of options for handling are too many for Ferdium to handle.

vraravam commented 2 years ago

Reopening to continue discussion. but most likely, if this is dealing with how links are opened in Ferdium, we don't have a solution for this at all since each website behaves differently

stormy1777 commented 2 years ago

Vijay, will try again.
1) The links at question are 100% that of app.slack.com, i.e. not just "each website", rather, the actual SLACK generated urls :) We're talking about the HEADER urls, not some user entered URL in the BODY. 2) These urls are not allowing to "copy link address", but with right-click it's possible to INSPECT, which shows this:

View in channel

on the right side bunch of "elements", "inherited from ..." but nothing that appears as a URL or a target=_blank or similar, not sure how the url is derived from this text, it seems some hidden url.

3) After few attempts on Firefox and Chrome on normal browser managed to reproduce same behavior there, it opens new TAB. These browsers have just one profile so workarounds like these are not relevant: https://bugs.launchpad.net/snapd/+bug/1835024/comments/13

4) wrote /feedback to @Slack (the company) and will update here as well.

vraravam commented 2 years ago

Can you please share some screenshots? Also, there was a different bug that was fixed in the latest nightly - please run the latest and then get back with further details.

stormy1777 commented 2 years ago

Thanks... Updated to nightly.36, same issues..

No worries about screenshots. Slack support responded..

This is so-called "expected" behavior when searching between multiple "workspaces", the slack/app-generated URL opens a NEW TAB on desktop browser, and even more ridiculously it offers to open a new BROWSER on an android phone with the slack APP... yes, that's right, in Android App, clicking that link, offers to open new browser on the android(?!@@), it does not offer to open that page in current Slack APP.. go figure.. After selecting which browser, it opens, then redirects to the Slack APP... boy..

If there's a way to TRAP all https://*.slack.com/client...* URLs and translate them into "Ferdium" slack framework, possibly this will be a very useful (optional) feature for slack plugin, that would make Ferdium favorable to use in such cases, again, only for system/slack.com urls, anything else remains as today.

vraravam commented 2 years ago

@stormy1777 - since I don't use Slack, could you please try with something similar to: https://github.com/vraravam/ferdium-recipes/blob/main/recipes/gmail/webview.js#L9-L15 (change the values for slack, and of course, it needs to be done within the slack configuration.

Please make the changes in your <FerdiumProfileFolder>/recipes/slack folder, test them out and create a PR for the same.

If you want, I can come and help on zoom to walk you through the changes and help take this further

vraravam commented 2 years ago

@stormy1777 - I have just merged an implementation in this PR: https://github.com/ferdium/ferdium-recipes/pull/29 - it should be available for you in the next nightly. Thanks

stormy1777 commented 2 years ago

Thanks for the effort, took the lines at tail of this https://github.com/ferdium/ferdium-recipes/pull/29/files#diff-652a57350b691a5ff250e4f3d675518d8736acef3ccba529a656d9f4dd59a470

added them to Webview.js in Ferdium/recpies/slack folder, and did not see any difference in behavior, urls still jump externally to browser, similar links:

https://app.slack.com/client/T0168MWKGG4/....

Thought it might be "http" vs "https", changed, restart Ferdium, but again, same behavior.. so, not sure what needs to take place to include such urls within the app, and not jump ship (to external browser) maybe need to specifically say contains: 'slack.com/client'.. Can test any other idea...

stormy1777 commented 2 years ago

Now noticed that "sign into another workspace" from the "add workspaces" menu option also jumps to external browser, url as:

https://app.slack.com/workspace-signin/.....

Similar tools-> Workflow builder jumps to external with this url: https://app.slack.com/workflow-builder/.....

not sure how this is supposed to work if these go to external browser :) :) the whole point of the dedicated app is to retain all within it, eliminating the need for external browser. (Not talking about user data that may contain random URLs, which may necessitate an external browser, the app itself i would think should be self-contained within Ferdium).

vraravam commented 2 years ago

the app itself i would think should be self-contained within Ferdium

That's the intent, but if the website authors do such special handling to explicitly open external browsers, there's only so much that Ferdium devs can do. I was able to test my same exact changes (with and without) on Ferdium's own discord channel - and they worked seamlessly as expected. Without those changes, link-clicks opened my external default browser, while with them, the link-clicks opened in Ferdium's same service (even for URLs of other websites eg github). Not sure how much more I can help here.

stormy1777 commented 2 years ago

Updated to nightly.37, see the changes in slack/webview.js; same as what I've typed the other day (with "http" not "https" as i've also attempted), still, when clicking a link in HEADER of message that belongs to another workspace it attempts to open up in a new BROWSER :) :)

URL in browser appears as: https://app.slack.com/client/T6Z090R.....

I may be wrong, but I think we're (still) talking about different things for some reason...

The links are NOT text that is written by users in a message., it is generated by the Slack "app" automatically. no way to control content/layout of that URL, it's just a clickable item, and it only happens after SEARCHING, and only when clicking on a message from ANOTHER workspace than the current one :)

If all these conditions exist, then it "jumps into an external browser".. the question is can these "clicks" be "trapped" by the engine/logic..

you say "website authors do ... special handling".. From what I see it's just a URL, no where do they launch Firefox or Chrome specifically via javascript or otherwise, or do you think that is what's happening here? Sorry, I just don't know enough... but can't see how they would know the path to launch an external program from.

vraravam commented 2 years ago

Unfortunately, as I have stated before, I dont use slack, and I can't visualize/reproduce/experiment with the scenario that you describe. I thought a screenshot wold be helpful - but, that's also not there. I will let someone else try to help out on this one.

stormy1777 commented 2 years ago

Here is how general purpose Slack Search result look like:

image

the "header" of each message has a line as follows:

channel-name-slk Workspace-name – May 16th View in channel

So, 4 "clickable" fields [ sometimes only 2 are visible, as in photo above]

What I've observed is that when clicking on hits WITH a Workspace NAME printed (meaning the hit is from a DIFFERENT workspace than our current one), then (on Ferdium) an external browser is launched by the act of clicking the link. On a PC Browser, it launches a new TAB within the same browser, with that hit highlighted..

If further questions, feel free to ping in private if that is possible/desirable. Stormy.

vraravam commented 2 years ago

I have reverted the changes to the slack recipe since that didn't seem to fix your problem. In fact, it brought up more issues ferdium/ferdium-app#158 as an example. Please try with the next nightly, and we can try to find a proper solution for this.

MagicLegend commented 2 years ago

Honestly the way you describe it @stormy1777 (opening browser with the different workspace) sounds like how I'd want it to behave. How else am I supposed to get back to the original workspace I was in?

But I don't really use cross-workspace Slack :) So it's not really an issue for me.

stormy1777 commented 2 years ago

@MagicLegend how does one go "back" in any browser context environment? Maybe BACK button ? :) :) Slack has: ALT-LEFTARROW as "Back", which one can map to mouse or whatever..
Not expecting a solution overnight.. just reporting what "user experience" in such a case :) :)

Ran nightly.38, and same as before, at least we didn't break anything else :) :) I use slack, but do not know enough how to or what to translate these urls into for it to remain in same window/tab (Ferdium)...

vraravam commented 2 years ago

how does one go "back" in any browser context environment?

The answer is in your comment: Since Ferdium's services are just chromium tabs, a simple keyboard shortcut to go back is Cmd+leftArrow on macos. I suspect the equivalent to work in other OSes. Or else, you can also enable the navigation bar in the Settings > Appearance, and then use the back button there.

stormy1777 commented 2 years ago

Thanks @vraravam was just joking a bit :) Thanks for full explanation, i think nav bar is in Settings -> General (not Appearance)

MagicLegend commented 2 years ago

@MagicLegend how does one go "back" in any browser context environment? Maybe BACK button ? :) :)

Have you tried it in Slack? It will work, but it'll go through all your previous actions first (i.e. channel switches). Not very ideal if you ask me.

But why wouldn't the Open link in Ferdium context menu option suffice for your usecase?

stormy1777 commented 2 years ago

Friends, sorry, I was just responding (sarcastically) to the question @MagicLegend posed as "How else am I supposed to get back to the original workspace I was in?" by saying/asking maybe BACK button? Yeah, use the back button all the time in Slack, works fine. The issue at hand is that URLs that "jump workspace" are also jumping to an external program at the OS level, and attempt to open the default browser...

You wrote "have you tried it in slack?" Tried what? Lets stay focused, this thread does not talk about going BACK to previous pages, it's an attempt to avoid opening an EXTERNAL browser :) :)

I'm not sure what "Open link in Ferdium context menu option" entails/will bring/change, but will be: a) Glad to test any .nightly build with proposed fix b) As much as possibly, manually apply changes thus avoiding making unconfirmed changes into .nightly..

MagicLegend commented 2 years ago

@stormy1777 Well, the context option already exists: image

stormy1777 commented 2 years ago

@MagicLegend Oh, wow, was NOT aware of that... however, from looking/trying a bit, seems we're back to square one again, as the URLs in questions are NOT user/generated, they are NOT URLs someone is typing, rather these are in the HEADER of each message from the search result, i.e. auto-generated by Slack program/logic.. the long-rightclick does not offer open in Ferdium...

Now, another interesting "plot twist".. went to Android phone which have not used a while, and there, these links JUMP OUTSIDE of Slack app, and make you even choose a browser of choice, it launches the browser then does a redirect and Launches Slack again!!! into, the new workspace :) :) so possibly the app does not have a means/ways to switch workspaces only via a Browser URL :) not sure, but that JUMP ship is there on Android/slack/app....

vraravam commented 2 years ago

Oh, wow, was NOT aware of that... however, from looking/trying a bit, seems we're back to square one again, as the URLs in questions are NOT user/generated, they are NOT URLs someone is typing, rather these are in the HEADER of each message from the search result, i.e. auto-generated by Slack program/logic.. the long-rightclick does not offer open in Ferdium...

I dont understand what you mean by "long click". The context menu opens up on right-click.

vraravam commented 2 years ago

Now, another interesting "plot twist".. went to Android phone which have not used a while, and there, these links JUMP OUTSIDE of Slack app, and make you even choose a browser of choice, it launches the browser then does a redirect and Launches Slack again!!! into, the new workspace :) :) so possibly the app does not have a means/ways to switch workspaces only via a Browser URL :) not sure, but that JUMP ship is there on Android/slack/app....

Are you performing this action within Ferdium on an android phone? We are not even targetting a mobile form-factor usage for Ferdium!

stormy1777 commented 2 years ago

I dont understand what you mean by "long click". The context menu opens up on right-click.

sorry, it appears that even a short-right click opens, either way, the links in questions (header) open up a different context menu thank for links embedded in messages...

vraravam commented 2 years ago

sorry, it appears that even a short-right click opens, either way, the links in questions (header) open up a different context menu thank for links embedded in messages...

did you mean right-click and selecting the "Open link in Ferdium" option?

stormy1777 commented 2 years ago

Now, another interesting "plot twist".. went to Android phone which have not used a while, and there, these links JUMP OUTSIDE of Slack app, and make you even choose a browser of choice, it launches the browser then does a redirect and Launches Slack again!!! into, the new workspace :) :) so possibly the app does not have a means/ways to switch workspaces only via a Browser URL :) not sure, but that JUMP ship is there on Android/slack/app....

Are you performing this action within Ferdium on an android phone? We are not even targetting a mobile form-factor usage for Ferdium!

No, all the Ferdium work is on Windows 10, the android/slack was given as a comparison, how that situation is handled on an Android platform completely 100% by Slack/native app there, it seems they JUMP SHIP to a browser, then redirect into Slack app, into the new workspace :) :) funny.. all that just to switch workspace.

I do not know if Ferdium can switch workspaces using a URL... maybe that's a limitation of slack, not sure... just gave that as a baseline to compare with.

vraravam commented 2 years ago

I do not know if Ferdium can switch workspaces using a URL... maybe that's a limitation of slack, not sure... just gave that as a baseline to compare with.

No - that's not possible in Ferdium (if you are referring to "workspace" feature of Ferdium. Are you?

stormy1777 commented 2 years ago

did you mean right-click and selecting the "Open link in Ferdium" option?

Please carefully review this post: https://github.com/ferdium/ferdium-app/issues/1007 where the HEADER of a Slack message is explained.. those 3 or 4 links open up a DIFFERENT context menu in Ferdium which does not have the "open in Ferdium" option :) That option only appears in URLs that are part of a user generated text, inside a MESSAGE, not the HEADER of a message.

stormy1777 commented 2 years ago

I do not know if Ferdium can switch workspaces using a URL... maybe that's a limitation of slack, not sure... just gave that as a baseline to compare with.

No - that's not possible in Ferdium (if you are referring to "workspace" feature of Ferdium. Are you?

no, Slack also has a "workspace", please review this post: https://github.com/ferdium/ferdium-app/issues/1007 it explains the header format, one of the fields is Slack Workspace, which is different than Ferdium.. it's different channels in slack belonging to diff workspaces, however, often users get access to multiple workspaces, and search can easily span them...

vraravam commented 2 years ago

can you please annotate that figure? For a person who doesn't use slack, i can't fathom which "those 3 or 4 links" you are referring to!

vraravam commented 2 years ago

it explains the header format, one of the fields is Slack Workspace, which is different than Ferdium.. it's different channels in slack belonging to diff workspaces, however, often users get access to multiple workspaces, and search can easily span them...

ok - if you are referring to "slack workspaces", then yes, any change in the url (which can include a change in the slack workspace) can be handled by Ferdium.

stormy1777 commented 2 years ago

Funny... it's written in that OP, here is an improved version :)

channel-name-slk Workspace-name – May 16th View in channel

<FIELD 1> < FIELD 2> < FIELD 3> < FIELD 4>

please read the text description in: https://github.com/ferdium/ferdium-app/issues/1007
for each field (field 2 is optional, and field 4 is invisible until mouse hovers over it)

vraravam commented 2 years ago

Sorry @stormy1777 - I'm unable to help any further. as I have stated earlier, I dont use slack at all. I am not able to correlate where you say "#channel-name-slk" with the appropriate part of the image that you have attached. I have requested you to annotate the image so that this correlation is visually indicated. If that's not possible, then I wont be able to help any further

vraravam commented 2 years ago

If you come on discord, we can do screen sharing and you can explain the problem, and maybe I can help with possible solution or a workaround. Conversing in this manner of a synchronous dialog in GH doesnt help to move forward

MagicLegend commented 2 years ago

@stormy1777 Can you please use actual screenshots? I do use Slack every day, and I don't get what you're referring to either :smile:

stormy1777 commented 2 years ago

@MagicLegend Please see title of ticket " IN SEARCH RESULTS" one must SEARCH in order to get results (with headers)... these headers have 3 or 4 links based on if the hit is from "same" or different slack-workspace...

Here is that image/with the header region highlighted:

168631756-4f8c6c51-eda7-412e-978f-057a3757265f

these headers only appear to show 2 links, since they are all from SAME slack workspace..

The "view in channel" (FIELD 4 in header) only becomes visible when mouse is moved closer to one of the search hits/messages.

PS: Tried to connect on discord, got lost from too much noise/links, can't figure that platform yet..

MagicLegend commented 2 years ago

But when I search in Slack in Ferdi it looks like this. Is the highlighted View in channel hover (marked in green here) the button you're referring to?

image

Because you are correct that that link does not have the Open Link in Ferdium action. Which I'm assuming is because it's not an actual <a> you're clicking, it's done with JS and CSS.

stormy1777 commented 2 years ago

yes, that is the "view in channel", if it so happens that channel is in SAME slack-workspace, then it will open in Ferdium, otherwise, it will "jump ship" and launch an external browser..

btw, from what i see, clicking any of the 3-4 fields in the header does the same thing, either opens the message in same workspace, OR, launches a browser, if hit is from diff workspace :) :)

I suspect if that "jump ship" could be intercepted and url "modified" to "feed" back into Slack, it would just show the message regardless of the workspace....

cino commented 1 year ago

@stormy1777 Is this issue resolved as expected? For myself I can't seem to reproduce the original issue and all clickable fields will open inside the ferdium instance.

stormy1777 commented 1 year ago

I'm using v6.2.0 on win10, entered search term in slacks, it found few gits, clicked the "view in channel", it immediately opens the default browser attempting to authenticate in the browser the slack workspace, so it seems still an issue on that version. Stormy.

On Thursday, November 10, 2022 at 09:46:20 PM GMT+2, Ricardo Cino ***@***.***> wrote:  

@stormy1777 Is this issue resolved as expected? For myself I can't seem to reproduce the original issue and all clickable fields will open inside the ferdium instance.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

MagicLegend commented 1 year ago

@cino Keep in mind that this issue appears to be limited to links that go to a different Slack workspace. I personally don't use this feature, and all other links work as intended.

@stormy1777 Could you please confirm that the link goes to a workspace outside of the current one? Is it correct that you are the external one in those channels? Personally I'm always the internal person, so I don't have easy access to that scenario for testing. Internally (so in a channel in our workspace, with third party people) it does work correctly, so I'm thinking this might only be if you're the external person?

cino commented 1 year ago

@MagicLegend Thanks for making that clear, in that case I'm moving this issue to the ferdium-recipes repository as this is not related to the app itself and more like a feature in slack. (housekeeping 🧹 )