openstyles / stylus

Stylus - Userstyles Manager
https://add0n.com/stylus.html
GNU General Public License v3.0
5.44k stars 304 forks source link

[Bug] Does not install .user.css files in Kiwi Browser on Android #1367

Closed jesus2099 closed 2 years ago

jesus2099 commented 2 years ago

Bug Report

Bug Description

On desktop, I am used to install user CSS by clicking the Raw button on GitHub hosted .user.css files. It does trigger the Stylus install process.

But on Kiwi Browser on Android, where I have installed Stylus, clicking the View raw button of a .user.css file on GitHub, does not trigger the install process.

I'm therefore clueless as to how to install my user styles.

URL of an example .user.css file: https://github.com/jesus2099/konami-command/blob/master/metabrainz-discourse_EXPAND-ABBREVIATIONS.user.css (click RAW button on desktop or … (ellipsis) button on mobile, then View raw)

System Information

Additional information

For what it's worth:

tophf commented 2 years ago

Sounds like a bug in Kiwi.

jesus2099 commented 2 years ago

Do you know if Kiwi should send a mime type or something like that?

For what it's worth:

jesus2099 commented 2 years ago

I found a bug report, over there: https://github.com/kiwibrowser/src.next/issues/420

tophf commented 2 years ago

I don't have a device/emulator to try Kiwi myself so maybe someone could check if this works in e.g. Yandex Browser?

jesus2099 commented 2 years ago

Maybe I can? Can you paste a link? When I search for Yandex Browser, is not very clear. I find Yandex in Russian and also a Brave something.

tophf commented 2 years ago

Yandex Browser, Kiwi, Dolphin, and one more (I forgot its name) are the most well-known mobile browsers that support chrome extensions.

eight04 commented 2 years ago

Kiwi 95.0.4638.50 GitHub

Blocked script execution in 'https://raw.githubusercontent.com/jesus2099/konami-command/master/metabrainz-discourse_EXPAND-ABBREVIATIONS.user.css' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.

Userstyles.world

Unchecked runtime.lastError: Tabs cannot be edited right now (user may be dragging a tab).
eight04 commented 2 years ago

image https://github.com/openstyles/stylus/blob/f6e6a138db9b960cd04acfe8f3ea1276fc04e33d/background/usercss-install-helper.js#L120

BTW, we should start using promise and explicit catch otherwise there is no stack trace to help debugging.

According to https://stackoverflow.com/questions/67806779/im-getting-an-error-tabs-cannot-be-edited-right-now-user-may-be-dragging-a-ta, we may have to use a trial and error loop for this bug.

eight04 commented 2 years ago

According to https://stackoverflow.com/questions/67806779/im-getting-an-error-tabs-cannot-be-edited-right-now-user-may-be-dragging-a-ta, we may have to use a trial and error loop for this bug.

It doesn't work. Still get the same error.

Actually, I get this error while executing await browser.tabs.update(5, {}) in the background page at anytime. Maybe tabs.update just doesn't work in kiwi.

jesus2099 commented 2 years ago

Maybe you can compare how Stylus and how Violentmonkey do the trick? It's just a random idea because I don't have such knowledge:

In both cases I use a .user.css and any .user.js file from my repo, already linked in OP.

https://github.com/openstyles/stylus/search?q=%22tabs+update%22

Does not install .user.css:

Blocked script execution in '{…}.user.css' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.

https://github.com/violentmonkey/violentmonkey/search?q=%22tabs+update%22

Installs .user.js OK but maybe it's just thanks to mime type being different or file type being served (raw) differently by GitHub.

eight04 commented 2 years ago

Maybe you can compare how Stylus and how Violentmonkey do the trick?

Violentmonkey opens a new tab to display the installer.

Stylus updates the the current tab to display the installer, which doesn't work in kiwi.

tophf commented 2 years ago

So, either we wait for Kiwi to fix the underlying bug or we will simply open a new tab if chrome.tabs.update fails (just one failure, no retry loop).

jesus2099 commented 2 years ago

Yandex Browser, Kiwi, Dolphin, and one more (I forgot its name) are the most well-known mobile browsers that support chrome extensions.

So, Kiwi, com.kiwibrowser.browser, is the one with this bug but that works very well for user scripts.

I tried Dolphin, mobi.mgeek.TunnyBrowser strange package name?, it does not (no longer) support extensions, apparently.

Then I tried to find Yandex https://browser.yandex.com/mobile points to com.yandex.browser. I would not advise this app. You are submerged by adds and junk internet news and cannot even find the most important, where are the tabs that you have opened.

I had to install Violentmonkey first before being able to install Stylus with no errors (I tried 5 times before with errors), maybe a coincidence, like a network issue?

I managed to install a .user.js OK with Violentmonkey and a .user.css OK with Stylus, triggered by the raw file!

Yandex version 21.11.5 build 121 (2021-12-08), user agent string says Chrome/94.0.4606.85 Kiwi version 96.0.4664.46, user agent string says Chrome/96.0.4664.46

So it's indeed a Kiwi bug or maybe a Chromium bug, as Kiwi uses a more recent version.

jesus2099 commented 2 years ago

Thanks so much @eight04! It is not urgent but when can I expect a new version to be deployed, @tophf? I am still currently running 1.5.22 from 30 August 2021.

jesus2099 commented 2 years ago

@tophf @eight04

I tried updating my extension again but the public version is still 1.5.22.

Are you waiting for another big feature to publish a new version?

tophf commented 2 years ago

You can load Stylus from github as an unpacked extension in Kiwi.

jesus2099 commented 2 years ago

Thank you, I will try. Not sure if I manage. But don't forget the version, whenever possible (needs more tests, maybe), to provide the new stuff to all users.

I found the doc! https://github.com/openstyles/stylus/wiki/Install-Stylus-from-GitHub 😁

jesus2099 commented 2 years ago

I could install the downloaded zip without extracting it in Kiwi! It still says version 1.5.22 but now it works! I can install user styles!

The extension manager says there is an Unrecognized manifest key 'applications'. error:

https://github.com/openstyles/stylus/blob/d048c480c3321c4fff8175c143b74a5faa9f8ae8/manifest.json#L101-L106

tophf commented 2 years ago

It's not an error so just ignore it.