Skip to content
New issue

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

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

Already on GitHub? # to your account

[Bug] Stylus taking over GitHub file URL tabs incorrectly #1862

Closed
uncenter opened this issue Dec 25, 2024 · 4 comments
Closed

[Bug] Stylus taking over GitHub file URL tabs incorrectly #1862

uncenter opened this issue Dec 25, 2024 · 4 comments
Labels
bug fixed-in-nightly-build See "Install Stylus from GitHub" in Wiki tab has-user-workaround

Comments

@uncenter
Copy link
Contributor

Bug Report

Bug Description

I love the Stylus feature where it detects tabs with raw CSS, such as local file URLs or GitHub raw URLs. However, the extension hasn't historically been taking over tabs like https://github.com/ashish0kumar/userstyles/blob/fix/youtube/description-howthiswasmade-section/styles/youtube/catppuccin.user.css, which are HTML pages and do not contain raw CSS. This seems to be a change that has been introduced in recent versions of the extension, I've been using Stylus extensively for over a year and never seen this.

Screenshots

CleanShot.2024-12-25.at.13.51.59.mp4

System Information

  • OS: macOS
  • Browser: Arc (Chromium) 131.0.6778.205 (Official Build) (arm64)
  • Stylus Version: v2.0.8

Additional Context

@tophf
Copy link
Member

tophf commented Dec 25, 2024

Until the bug is fixed you can disable Open installer when navigating to a .user.css URL in Options which limits the installer to a few known userstyle galleries.

@tophf tophf closed this as completed in 613dbd8 Dec 25, 2024
@tophf
Copy link
Member

tophf commented Dec 25, 2024

...or use the fixed test build as an unpacked extension.

@uncenter
Copy link
Contributor Author

Thanks for the quick fix! Really appreciate, we love Stylus over at https://github.com/catppuccin/userstyles :)

...or use the fixed test build as an unpacked extension.

Interestingly enough I was doing some testing as you were apparently already fixing it 😅 and I couldn't replicate the issue on a local unpacked version of v2.0.8 Stylus, only the marketplace v2.0.8. Anyway, I will be using that test build for now, thank you!

@tophf
Copy link
Member

tophf commented Dec 25, 2024

There's another way to keep using the web store version: open devtools console in the style manager tab and run this:

chrome.declarativeNetRequest.updateDynamicRules({
  removeRuleIds: [20],
  addRules: [{
    id: 20,
    condition: {
      regexFilter: /^.*\.user\.(?:css|less|styl)(?:\?.*)?$/.source,
      resourceTypes: ['main_frame'],
      responseHeaders: [{
        header: 'content-type',
        values: ['text/*'],
        excludedValues: ['text/html*'], // * excludes charset and whatnot
      }],
    },
    action: {
      type: 'redirect',
      redirect: {
        regexSubstitution: chrome.runtime.getURL('install-usercss.html#\\0'),
      },
    },
  }],
})

@tophf tophf added bug fixed-in-nightly-build See "Install Stylus from GitHub" in Wiki tab has-user-workaround labels Dec 25, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug fixed-in-nightly-build See "Install Stylus from GitHub" in Wiki tab has-user-workaround
Projects
None yet
Development

No branches or pull requests

2 participants