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

Implement a version of "{{origin}}" that uses the whole URL and not just the domain #1281

Closed
5 of 8 tasks
DandelionSprout opened this issue Oct 6, 2020 · 5 comments
Closed
5 of 8 tasks
Labels
enhancement New feature or request fixed issue has been addressed

Comments

@DandelionSprout
Copy link

DandelionSprout commented Oct 6, 2020

Prerequisites

  • I verified that this is not a filter issue
  • This is not a support issue or a question
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue
    • Your issue may already be reported.
  • I tried to reproduce the issue when...
    • uBlock Origin is the only extension
    • uBlock Origin with default lists/settings
    • using a new, unmodified browser profile
  • I am running the latest version of uBlock Origin (1.30.1b5)
  • I checked the documentation to understand that the issue I report is not a normal behavior

Description

https://github.com/gorhill/uBlock/wiki/Advanced-settings#autocommentfiltertemplate shows that there are 3 options for which things that are shown in a comment above entries that are made with the element picker: the date, the time, and the site domain. However, Nano Adblocker also had a 4th option called {{nanoHref}} that showed the page's URL; and since I've decided to switch to uBlock Origin on my PC, I'm hoping that feature would be ported upstream to uBO under whichever name.

Specifically, for example, if an entry for whatever was created while on https://www.nrk.no/urix/politisk-kaos-i-kirgisistan-1.15188777, the proposed function would show:

! https://www.nrk.no/urix/politisk-kaos-i-kirgisistan-1.15188777
nrk.no##.example-entry

And not:

! https://www.nrk.no/
nrk.no##.example-entry

This would be of significant importance to (and would make work faster and easier for) people who contribute to lists that mandate source pages for all new entries. Nano Placeholder Buster used to be the biggest example, but it would also come in handy for many other lists like EasyList, AdGuard Filters, and just about any other list that require specific URLs in user-submitted issue reports and PRs.

A specific URL where the issue occurs

https://www.nrk.no/urix/politisk-kaos-i-kirgisistan-1.15188777

Steps to Reproduce

  1. Use {{origin}} as one of the settings for autocommentfiltertemplate
  2. Go to any page on almost any website that isn't its frontpage.
  3. Create a new entry with the element picker.
  4. See that the resulting comment does not show anything after the main domain of the site.

Expected behavior:

A way to make the auto-comment feature for element-picker entries show the full URL of the page.

Actual behavior:

There are no ways in uBO (that I know of) to make the auto-comment feature for element-picker entries show the full URL of the page.

Your environment

  • uBlock Origin version: 1.30.1b5 + uBlock Origin Extra 2.88
  • Browser Name and version: Chrome 85.0.4183.121 x64
  • Operating System and version: Windows 10 May 2020 Update
@uBlock-user uBlock-user added the enhancement New feature or request label Oct 6, 2020
@gorhill
Copy link
Member

gorhill commented Oct 6, 2020

Trivial to fix for the element picker, but the complication with this feature is that the full URL is not available when creating the filter from the logger.

I tried to create a filter from the logger in Nano using nanoHref and the URL in the resulting auto-generated comment was undefined.

gorhill added a commit to gorhill/uBlock that referenced this issue Oct 7, 2020
Related issue:
- uBlockOrigin/uBlock-issues#1281

New supported placeholder: `{{url}}`, which will be
replaced by the full URL of the page for which a filter
is created.
@gorhill
Copy link
Member

gorhill commented Oct 7, 2020

{{url}} is the placeholder to use to receive the full URL of the document for which a filter is being created.

@gwarser gwarser added the fixed issue has been addressed label Oct 7, 2020
@gwarser gwarser closed this as completed Oct 7, 2020
@gwarser gwarser reopened this Oct 7, 2020
@gwarser gwarser removed the fixed issue has been addressed label Oct 7, 2020
@gwarser
Copy link

gwarser commented Oct 7, 2020

When searching for last comment to append filter to, lastIndexOf is used [on whole text, without taking new lines into account], which means shorter URL can match in longer URL.

Don't know how much this is unexpected. I was confused for a while, because when testing template {{date}} {{origin}} {{url}} and adding second filter from the logger (first was from Picker), it looked like {{url}} was correctly expanded, but it's not.

@gorhill
Copy link
Member

gorhill commented Oct 7, 2020

What site to use as test case? Never mind, https://github.com/gorhill/uBlock works as test case.

gorhill added a commit to gorhill/uBlock that referenced this issue Oct 7, 2020
@gwarser gwarser added the fixed issue has been addressed label Oct 18, 2020
@gwarser gwarser closed this as completed Oct 18, 2020
@krystian3w
Copy link

{{url}} may have bug with behind-the-scene and extension "domain":

I can generate comment:

! http://behind-the-scene
! http://55cb5ae3-9a19-456c-9531-a31688b0f257.moz-extension-scheme

with use logger to create filters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed issue has been addressed
Projects
None yet
Development

No branches or pull requests

5 participants