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

Unable to share with Shaarlier for Android + [resolved] Shaarli UI is broken, CSS/JS not loading (Nginx issue ?) #75

Open
pp-r opened this issue Dec 2, 2021 · 27 comments

Comments

@pp-r
Copy link

pp-r commented Dec 2, 2021

Describe the bug

I can't share an article/link through the Shaarlier app for Android. No error is returned but after about 10 tries I am banned by fail2ban. I use the secret code of the API to configure the sharing with Shaarlier. Sharing an article is normally done by logging in on the Shaarli web page without using the Shaarlier application.

Context

  • Hardware : Raspberry Pi at home
  • YunoHost version : 4.3.4.1
  • I have access to my server: Through SSH & through the webadmin & direct access via keyboard / screen
  • Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: yes
    • If yes, please explain : exotic ssh port
  • Using, or trying to install package version/branch : master branch

Steps to reproduce

  • Shaarli's installation via webadmin with the public option is true
  • Shaarlier's installation on Android 10 phone
  • Get the secret API's code in Shaarli
  • Setting up Shaarlier on the phone
    1. URL eg : https://server.tld/shaarli/
    2. Enter the API's code retrieve
    3. Apply and testing connexion
    4. If it's OK share an article/link
    5. Link shared with no error message
    6. Problem nothing is shared
    7. After 10 more attempts you're ban

Expected behavior

Provided that the Shaarlier application is set up correctly, it should normally be possible to share an article/link and not be banned by fail2ban.

@lapineige
Copy link
Member

Hum, that's a pitty…

Are you able to check fail2ban logs ?
And Shaarli ones ? (I don't remember if the is any log…)
Maybe the one from the app too.

If you enter a wrong password for instance, does it behaves differently ?

I wonder at which steps it fails (client side, server side, fail2ban side…)

@pp-r
Copy link
Author

pp-r commented Dec 2, 2021

hello,
So for the Android application, there is no indication that there is an error: no misconfiguration message or sharing error.
If i try to login with wrong ID on the web page https://server.tld/shaarli/login fail2ban works and appears here : cat /var/log/fail2ban.log
Maybe something into the install script to add as chmod -R g+rwX $final_path/{cache/,data/,pagecache/,tmp/}
I'll uninstall all and try to install this version https://github.com/lapineige/shaarli_ynh
edit : this version of Shaarli is to old to be associated with Android app Shaarlier.
edit 2 : it works with Shaarlier version 1.6.0 to 1.8.0 using password but not with API code.
edit 3 : i've upgrade to last version but the layout crashed and even with a refresh and a browser restart it doesn't works. So i've uninstalled and reinstalled the latest version from the master branch but the layout is always broken.
ppr

@lapineige
Copy link
Member

I'll uninstall all and try to install this version https://github.com/lapineige/shaarli_ynh

Yeah that version is probably here since the last (or first 🤔) patch I made… and not usable anymore.

I'm a bit lost about where you finally ended up… your current Shaarli UI is broken, that the issue ?

@pp-r
Copy link
Author

pp-r commented Dec 3, 2021

To summarise, Shaarlier does not work with the API code but only with the ID/password.
Elsewhere than on my test instance, I tried to install Shaarli from the master branch on a VPS without having installed it before. Here is the rendering of the web page (0.12.1~ynh2) when i speak about the broken layout :
2021-12-03_10-20-30
)
Edit : It works well with the API code and the layout is ok when i use Shaarli with the Custom Webapp and the last release (https://github.com/shaarli/Shaarli/releases/tag/v0.12.1)

@lapineige
Copy link
Member

Ok, thank you.

To summarise, Shaarlier does not work with the API code but only with the ID/password.
It works well with the API code and the layout is ok when i use Shaarli with the Custom Webapp and the last release

Ok, then it's definitely something that is Yunohost specific. Thank you for testing this !
I don't know if it's related to fail2ban… based on https://github.com/YunoHost-Apps/shaarli_ynh/blob/master/scripts/install#L151, we only filter failed logins… Except if it does try to connect with password using API code …
Hum wait : is you Shaarli publicly accessible (do you need to connect to Yunohost before accessing it) ?

About the broken layout : it appeared after an upgrade ? It sounds like some CSS is not working/loaded… I don't have it on a 0.12.1~ynh2 version, so I wonder what specific… thing made it fail on your side… 🤔
Could you have a look at the web console (F12 on Firefox) and see if it is reporting an error about any "something.css" ?
Could you try to force an upgrade ? (yunohost app upgrade shaarli -u https://github.com/YunoHost-Apps/shaarli_ynh)

@pp-r
Copy link
Author

pp-r commented Dec 3, 2021

So i try to install Shaarli 0.12.1~ynh2 and i chose the "public" mode.
When i F12 in Firefox or Chromium, i've a lot of errors about "Refused to apply style from '' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled." and some others .js with "Failed to load resource: the server responded with a status of 404 ()"
Edit : Even though with this version (https://github.com/YunoHost-Apps/shaarli_ynh/tree/5b0271a6d4dc63c9c177f801a35795bf152451db) I can't use Shaarlier to share via ID/password or API code but it installs correctly and the upgrade to the last version in branch master is ok even if sharing via Shaarlier is broken.
Edit 2 : uninstall and reinstall from the master branch makes layout broken again.

@lapineige
Copy link
Member

Thank you for the feedback.

I have to say I am lost… maybe someone from @YunoHost-Apps/apps-group will have some clue…

@ericgaspar
Copy link
Member

what about allowing access to the API part (I am just guessing here)
https://github.com/YunoHost/example_ynh/blob/a118dac5dc5a285833b52d6b7fd8ccd664f7508b/scripts/install#L394-L397

@lapineige
Copy link
Member

That's what I first thought, be @pp-r tried in public mode, so the API shouldn't be blocked 🤔

@ericgaspar
Copy link
Member

Well just for the sack of testing I made a branch with API permission : https://github.com/YunoHost-Apps/shaarli_ynh/tree/API

@lapineige
Copy link
Member

@pp-r : yunohost app upgrade shaarli -u https://github.com/YunoHost-Apps/shaarli_ynh/tree/API to test it (or install with yunohost app install https://github.com/YunoHost-Apps/shaarli_ynh/tree/API)

@pp-r
Copy link
Author

pp-r commented Dec 4, 2021

Hello,
So in order to have a non-broken layout, i've had to sudo yunohost app install https://github.com/YunoHost-Apps/shaarli_ynh/tree/5b0271a6d4dc63c9c177f801a35795bf152451db.
If i sudo yunohost app install https://github.com/YunoHost-Apps/shaarli_ynh/tree/API i've got the layout broken as in the screenshot.
The sudo yunohost app upgrade shaarli -u https://github.com/YunoHost-Apps/shaarli_ynh/tree/API don't show errors but i can't share via Shaarlier with API code, even if i switch on API in the tile and refresh the Shaarli web page.
Edit : I've always opt for public option during installation. I've an other Shaarli in the Custom Webapp that works even the sharing with API code works too.

@lapineige
Copy link
Member

lapineige commented Dec 4, 2021

So in order to have a non-broken layout, i've had to sudo yunohost app install https://github.com/YunoHost-Apps/shaarli_ynh/tree/5b0271a6d4dc63c9c177f801a35795bf152451db.

That would mean this is broken since January… 😱

So that has something to do with this commit bb64f6820c701f0dbcec4c72176141618b0a6c24…

How long have you been using this Shaarli ? Before January 2021 ?

That would mean that there is an issue with the template used.
Can you maybe share the content of /var/www/shaarli/tpl/ ? (ls /var/www/shaarli/tpl/* -l )

I'll try to compare it with mine, to see if there is any difference…


Also, maybe you can try to copy that /tlp folder from your Custom WebApp Shaarli to Yunohost one (you might need to change the owner after that, I believe the command is chown shaarli /var/www/shaarli/tpl/).

@pp-r
Copy link
Author

pp-r commented Dec 4, 2021

I don't use Shaarli but i just want to try it.

  • So, before i'll uninstall and reinstall :

cd /var/www/shaarli/tpl
ls -l
drwxrwxr-x 6 shaarli shaarli 4096 Nov 12 2020 default
drwxrwxr-x 5 shaarli shaarli 4096 Nov 12 2020 vintage

ls /var/www/shaarli/tpl/* -l
/var/www/shaarli/tpl/default:
total 196
-rw-rw-r-- 1 shaarli shaarli ........
/var/www/shaarli/tpl/vintage:
total 144
-rw-rw-r-- 1 shaarli shaarli ........

  • So, after uninstall and reinstall from the master branch :

cd /var/www/shaarli/tpl/
-bash: cd: /var/www/shaarli/tpl/: Permission denied

ls /var/www/shaarli/tpl/* -l
ls: cannot access '/var/www/shaarli/tpl/*': Permission denied

Edit :
/var/www$ ls -l
...
drwxr-x--- 13 shaarli shaarli 4096 Dec 4 16:32 shaarli
...

@lapineige
Copy link
Member

In fact I needed the file list, to 1) check if all permissions where good 2) check if all files had the same size as mines (a quick & dirty wait to check if they are the same) 😅

Ok so I installed latest version on a test server… same CSS issue.

Hey @YunoHost-Apps/apps-group : have you any idea how to fix that issue (without creating a security flaws) ? 🙏

The resource from “https://yunohostDomain.tld/shaarli/tpl/default/css/shaarli.min.css?v=0d52a7c805d9c06b081072c7ff849ab9e776734b167eb199924d90169dbfbe3a” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
The resource from “https://yunohostDomain.tld/shaarli/tpl/default/css/markdown.min.css?v=0d52a7c805d9c06b081072c7ff849ab9e776734b167eb199924d90169dbfbe3a” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
The resource from “https://yunohostDomain.tld/shaarli/tpl/default/js/shaarli.min.js?v=0d52a7c805d9c06b081072c7ff849ab9e776734b167eb199924d90169dbfbe3a” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
Loading failed for the <script> with source “https://yunohostDomain.tld/shaarli/tpl/default/js/shaarli.min.js?v=0d52a7c805d9c06b081072c7ff849ab9e776734b167eb199924d90169dbfbe3a”.

@lapineige lapineige changed the title Unable to share with Shaarlier for Android : apparently no error but banned by fail2ban Unable to share with Shaarlier for Android /// Shaarli UI is broken, CSS/JS not loading (Nginx issue ?) Dec 4, 2021
@pp-r
Copy link
Author

pp-r commented Dec 4, 2021

So, i've reinstall in 2 times ("old" install + upgrade API branch) in order to have not broken css layout.
ls /var/www/shaarli/tpl/* -l
/var/www/shaarli/tpl/default:
total 196
-rw-rw-r-- 1 shaarli shaarli 395 Nov 5 2020 404.html
-rw-rw-r-- 1 shaarli shaarli 2911 Nov 12 2020 addlink.html
-rw-rw-r-- 1 shaarli shaarli 977 Nov 5 2020 changepassword.html
-rw-rw-r-- 1 shaarli shaarli 2576 Nov 12 2020 changetag.html
-rw-rw-r-- 1 shaarli shaarli 12406 Nov 5 2020 configure.html
drwxrwxr-x 2 shaarli shaarli 4096 Sep 23 2020 css
-rw-rw-r-- 1 shaarli shaarli 4231 Nov 12 2020 daily.html
-rw-rw-r-- 1 shaarli shaarli 1366 Nov 12 2020 dailyrss.html
-rw-rw-r-- 1 shaarli shaarli 881 Nov 12 2020 editlink.batch.html
-rw-rw-r-- 1 shaarli shaarli 4259 Nov 12 2020 editlink.html
-rw-rw-r-- 1 shaarli shaarli 481 Nov 12 2020 error.html
-rw-rw-r-- 1 shaarli shaarli 605 Aug 27 2020 export.bookmarks.html
-rw-rw-r-- 1 shaarli shaarli 2060 Nov 5 2020 export.html
-rw-rw-r-- 1 shaarli shaarli 1298 Nov 5 2020 feed.atom.html
-rw-rw-r-- 1 shaarli shaarli 1418 Nov 5 2020 feed.rss.html
drwxrwxr-x 2 shaarli shaarli 4096 Sep 23 2020 fonts
drwxrwxr-x 2 shaarli shaarli 4096 Sep 23 2020 img
-rw-rw-r-- 1 shaarli shaarli 2906 Nov 5 2020 import.html
-rw-rw-r-- 1 shaarli shaarli 2269 Nov 12 2020 includes.html
-rw-rw-r-- 1 shaarli shaarli 5468 Nov 12 2020 install.html
drwxrwxr-x 2 shaarli shaarli 4096 Oct 6 2020 js
-rw-rw-r-- 1 shaarli shaarli 13950 Nov 12 2020 linklist.html
-rw-rw-r-- 1 shaarli shaarli 3362 Nov 5 2020 linklist.paging.html
-rw-rw-r-- 1 shaarli shaarli 1376 Nov 5 2020 loginform.html
-rw-rw-r-- 1 shaarli shaarli 3599 Nov 5 2020 opensearch.html
-rw-rw-r-- 1 shaarli shaarli 1757 Nov 12 2020 page.footer.html
-rw-rw-r-- 1 shaarli shaarli 9328 Nov 5 2020 page.header.html
-rw-rw-r-- 1 shaarli shaarli 1839 Nov 12 2020 picwall.html
-rw-rw-r-- 1 shaarli shaarli 6837 Nov 12 2020 pluginsadmin.html
-rw-rw-r-- 1 shaarli shaarli 3530 Nov 12 2020 server.html
-rw-rw-r-- 1 shaarli shaarli 1855 Nov 12 2020 server.requirements.html
-rw-rw-r-- 1 shaarli shaarli 2256 Nov 12 2020 tag.cloud.html
-rw-rw-r-- 1 shaarli shaarli 3215 Nov 8 2020 tag.list.html
-rw-rw-r-- 1 shaarli shaarli 313 Nov 8 2020 tag.sort.html
-rw-rw-r-- 1 shaarli shaarli 1401 Nov 5 2020 thumbnails.html
-rw-rw-r-- 1 shaarli shaarli 6395 Nov 12 2020 tools.html

/var/www/shaarli/tpl/vintage:
total 144
-rw-rw-r-- 1 shaarli shaarli 352 Nov 5 2020 404.html
-rw-rw-r-- 1 shaarli shaarli 438 Nov 5 2020 addlink.html
-rw-rw-r-- 1 shaarli shaarli 589 Nov 5 2020 changepassword.html
-rw-rw-r-- 1 shaarli shaarli 1267 Nov 5 2020 changetag.html
-rw-rw-r-- 1 shaarli shaarli 6338 Nov 5 2020 configure.html
drwxrwxr-x 2 shaarli shaarli 4096 Nov 5 2020 css
-rw-rw-r-- 1 shaarli shaarli 4336 Nov 12 2020 daily.html
-rw-rw-r-- 1 shaarli shaarli 1107 Nov 5 2020 dailyrss.html
-rw-rw-r-- 1 shaarli shaarli 3674 Nov 12 2020 editlink.html
-rw-rw-r-- 1 shaarli shaarli 425 Nov 5 2020 error.html
-rw-rw-r-- 1 shaarli shaarli 606 Aug 27 2020 export.bookmarks.html
-rw-rw-r-- 1 shaarli shaarli 980 Nov 5 2020 export.html
-rw-rw-r-- 1 shaarli shaarli 1298 Nov 5 2020 feed.atom.html
-rw-rw-r-- 1 shaarli shaarli 1419 Nov 5 2020 feed.rss.html
drwxrwxr-x 2 shaarli shaarli 4096 Nov 5 2020 img
-rw-rw-r-- 1 shaarli shaarli 1441 Nov 5 2020 import.html
-rw-rw-r-- 1 shaarli shaarli 2141 Nov 12 2020 includes.html
-rw-rw-r-- 1 shaarli shaarli 2614 Nov 5 2020 install.html
drwxrwxr-x 2 shaarli shaarli 4096 Nov 5 2020 js
-rw-rw-r-- 1 shaarli shaarli 6275 Nov 12 2020 linklist.html
-rw-rw-r-- 1 shaarli shaarli 1444 Nov 8 2020 linklist.paging.html
-rw-rw-r-- 1 shaarli shaarli 1189 Nov 5 2020 loginform.html
-rw-rw-r-- 1 shaarli shaarli 3599 Nov 5 2020 opensearch.html
-rw-rw-r-- 1 shaarli shaarli 1228 Nov 12 2020 page.footer.html
-rw-rw-r-- 1 shaarli shaarli 2308 Nov 12 2020 page.header.html
-rw-rw-r-- 1 shaarli shaarli 185 Aug 27 2020 page.html
-rw-rw-r-- 1 shaarli shaarli 1188 Nov 5 2020 picwall.html
-rw-rw-r-- 1 shaarli shaarli 5966 Nov 5 2020 pluginsadmin.html
-rw-rw-r-- 1 shaarli shaarli 1083 Aug 27 2020 readme.txt
-rw-rw-r-- 1 shaarli shaarli 838 Nov 5 2020 tag.cloud.html
-rw-rw-r-- 1 shaarli shaarli 726 Nov 5 2020 thumbnails.html
-rw-rw-r-- 1 shaarli shaarli 3016 Nov 5 2020 tools.html

@lapineige
Copy link
Member

Thank you for sharing the full result.

I don't see anything special. Maybe I need the content of default/css too 🤔 (and default/js while we are doing this, just in case). Could you share that with us please ?

So, i've reinstall in 2 times ("old" install + upgrade API branch) in order to have not broken css layout.

So in that case it works ?!
I'm even more confused…
The only difference I can see, is that with older version we could have some files that are no longer present in newer version…

@pp-r
Copy link
Author

pp-r commented Dec 4, 2021

In the case of it works :
/var/www/shaarli/tpl/default/css$ ls -l
total 112
-rw-rw-r-- 1 shaarli shaarli 3184 Nov 12 2020 markdown.min.css
-rw-rw-r-- 1 shaarli shaarli 109575 Nov 12 2020 shaarli.min.css

/var/www/shaarli/tpl/default/js$ ls -l
total 212
-rw-rw-r-- 1 shaarli shaarli 936 Nov 12 2020 markdown.min.js
-rw-rw-r-- 1 shaarli shaarli 78791 Nov 12 2020 metadata.min.js
-rw-rw-r-- 1 shaarli shaarli 59 Nov 12 2020 metadata.min.js.LICENSE.txt
-rw-rw-r-- 1 shaarli shaarli 2670 Nov 12 2020 pluginsadmin.min.js
-rw-rw-r-- 1 shaarli shaarli 3996 Nov 12 2020 shaare_batch.min.js
-rw-rw-r-- 1 shaarli shaarli 97205 Nov 12 2020 shaarli.min.js
-rw-rw-r-- 1 shaarli shaarli 59 Nov 12 2020 shaarli.min.js.LICENSE.txt
-rw-rw-r-- 1 shaarli shaarli 6095 Nov 12 2020 thumbnails.min.js
-rw-rw-r-- 1 shaarli shaarli 201 Nov 12 2020 thumbnails.min.js.LICENSE.txt
-rw-rw-r-- 1 shaarli shaarli 1846 Nov 12 2020 thumbnails_update.min.js

I can only make it work by this command sudo yunohost app install https://github.com/YunoHost-Apps/shaarli_ynh/tree/5b0271a6d4dc63c9c177f801a35795bf152451db before upgrading.
The native master branch broke the layout.

@lapineige
Copy link
Member

Ok, so we have the some content in those folders.

Then I have no clue. I don't see what changed since that version (the particular commit) you're pointing… Are you sure the next commit (https://github.com/YunoHost-Apps/shaarli_ynh/tree/bb64f6820c701f0dbcec4c72176141618b0a6c24) don't work ?
Because if that's the case, the only change that was made concerns the upgrade script, not the install one. And I don't see why it does impact it…

@pp-r
Copy link
Author

pp-r commented Dec 4, 2021

So i've uninstall then reinstall from your link sudo yunohost app install https://github.com/YunoHost-Apps/shaarli_ynh/tree/bb64f6820c701f0dbcec4c72176141618b0a6c24 and the css layout is ok but the share with API via Shaarlier don't.

@lapineige
Copy link
Member

Great, so we're making progress :)

About the API, I have no idea, sorry :/

But by testing each commit one by one, we may find where was the issue… don't do it, I'll handle that :)

@lapineige
Copy link
Member

lapineige commented Dec 4, 2021

I found that this particular PR #73 introduced that regression.
I am reverting it as soon as possible (already done in the testing branch, waiting for validation for master #77).

We will need to investigate to find what broke Shaarli CSS…

@lapineige lapineige changed the title Unable to share with Shaarlier for Android /// Shaarli UI is broken, CSS/JS not loading (Nginx issue ?) Unable to share with Shaarlier for Android + [resolved] Shaarli UI is broken, CSS/JS not loading (Nginx issue ?) Jan 5, 2022
@lapineige
Copy link
Member

#77 should fix the broken User Interface problem :)

@lapineige
Copy link
Member

Can you confirm that this change fix that broken UI issue ?

@pp-r
Copy link
Author

pp-r commented Feb 20, 2022

Hello,

I confirm that now installation work and the UI is now ok.

Sharing with Shaarlier don't work with REST API enable in Shaarli (Tools/Configure).
Manually "+Shaare" works well.

ppr

@lapineige
Copy link
Member

Thank you for your feedback. So at least one issue is fixed :)

For the other one, I have no clue 😅

Manually "+Shaare" works well.

What do you mean ?

@pp-r
Copy link
Author

pp-r commented Feb 20, 2022

The copy/paste of an URL in the Shaarli web panel by clic on the "+Shaare" button is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants