Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix urls not open in new tab #769

Merged
merged 2 commits into from
May 25, 2022
Merged

Conversation

jacr13
Copy link
Contributor

@jacr13 jacr13 commented May 25, 2022

Simple fix to allow again urls to open in new tabs.

Fixes #761

@DUOLabs333
Copy link
Contributor

You should really be fixing 0f6226c

It appears that result links beginning with '/url' were mistakenly
commited with an inefficient filtering process in its place. With the
way the code is structured, this less effective '/url' link filter took
precedence over the previous link filter, and also caused users with the
"open link in new tab" config enabled to no longer have access to that
feature.

Fixes benbusby#769
Copy link
Owner

@benbusby benbusby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I looked into this a bit, and the cause of the problem is actually that this section of handling result links starting with /url shouldn't have been committed. These result links are already being filtered/handled later in the if-elif-else chain (which includes modifying the link to open in a new tab if configured that way), but since this block came before, it caused the proper filtering method to not get executed. So while your fix would've addressed the problem, I just pushed a change to just remove this section altogether, since it isn't actually needed.

Thanks!

@benbusby
Copy link
Owner

Also @DUOLabs333 the /window endpoint is only used for anonymous view links, whereas this bug that's being reported affects even non-anonymous view links, so I think that's a separate issue. Although I'll add that I'm not sure why there needs to be a leading slash for anonymous view links -- it seems to work in my deployments, and I was under the impression that introducing a leading slash breaks instances that are being hosted behind a subpath of a domain (i.e. mydomain.com/whoogle/ being the root level of the instance. In this case, if a leading slash were to be added for the window endpoint, it would redirect to mydomain.com/window, not mydomain.com/whoogle/window)

@benbusby benbusby merged commit fb6627a into benbusby:main May 25, 2022
TrueMysterious pushed a commit to TrueMysterious/whoogle-search that referenced this pull request May 26, 2022
* Render error message w/o `safe` filter

The error message shown in the error template does not need to be
rendered using the safe filter, and furthermore opens up an XSS
vulnerability.

* Only create ip card if main result div is found

The ip address card that is created for searches like "my ip" only needs
to be created/inserted if a main result div id is found.

Fixes benbusby#735

* Remove unused `/url` endpoint

The `/url` endpoint was previously used as a way of mirroring the
`/url?q=<result domain>` formatting of locations in search results from
Google. Rather than have this unnecessary intermediary step, the result
path was extracted and used as the immediate path for each result item
instead.

This endpoint hasn't been in use for many versions and has been in need
of removal for quite some time.

* Bump version to 0.7.2

* Fix pipx dependencies (benbusby#738)

Missing cssutils

* Remove "/" before endpoints & tags (benbusby#734)

Removes the leading slash before imgres and other endpoints

Fix benbusby#733

* Add `WHOOGLE_URL_PREFIX` to app.json (benbusby#737)

* Update zh-tw translation (benbusby#736)

* Fix german translation error (benbusby#742)

"Nachrichten" is the correct translation of "News"

* Replace public instance url

s.alefvanoon.xyz -> s.tokhmi.xyz

Fixes benbusby#743

* Use `window` from Endpoint enum for anon view (benbusby#748)

Removes previously hardcoded "/window" from anon view links

* Update and add instances [skip ci] (benbusby#750)

Updates Garudalinux instance
Add dr460nf1r3.org instance

* Use `lax` for session `SameSite` value (not `strict`)

SESSION_COOKIE_SAMESITE must be set to 'lax' to allow the user's
previous session to persist when accessing the instance from an external
link. Setting this value to 'strict' causes Whoogle to revalidate a new
session, and fail, resulting in cookies being disabled.

This could be re-evaluated if Whoogle ever switches to client side
configuration instead.

Fixes benbusby#749

* Improve G page distinction between footer and results

Pages in the Whoogle footer that by default route to Google pages were
previously being removed, but caused results that also routed to similar
pages to no longer be accessible. This was due to the removal of the
'/url' endpoint that Google uses for each result.

To fix this, the result link is now parsed so that the domain of the
result can be checked against the disallowed G page list. Since results
are delivered in a "/url?q=<domain>" format -- even for pages to
Google's own products -- and the footer links are formatted as
"<product>.google.com", footer links are removed and result links are
parsed correctly.

Fixes benbusby#747

* Replace leading slash for image links (benbusby#762)

The leading slash was previously removed without noticing it was part of a
string replacement in benbusby#734. This caused the href of "View Image" contain a
leading "/" which is wrong.

* Remove duplicated handling of /url result links (benbusby#769)

It appears that result links beginning with '/url' were mistakenly
commited with an inefficient filtering process in its place. With the
way the code is structured, this less effective '/url' link filter took
precedence over the previous link filter, and also caused users with the
"open link in new tab" config enabled to no longer have access to that
feature.

Fixes benbusby#769

Co-authored-by: Ben Busby <contact@benbusby.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: invis-z <22781620+invis-z@users.noreply.github.com>
Co-authored-by: xatier <xatierlike@gmail.com>
Co-authored-by: hoschi1337 <58056262+hoschi1337@users.noreply.github.com>
Co-authored-by: Nico <njcrypted@protonmail.com>
Co-authored-by: Joao A. Candido Ramos <joao.candido@etu.unige.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Open Links in New Tab" setting no longer working
3 participants