userstyles-world / userstyles.world

⭐ Website to browse and share UserCSS userstyles. A modern replacement for UserStyles.org made by the userstyles community.
https://userstyles.world
GNU Affero General Public License v3.0
330 stars 15 forks source link

Problem after Import process for text formating and Edit function #32

Closed decembre closed 3 years ago

decembre commented 3 years ago

For by example. The original: Userstyles / Greasy Fork Enhancer Dark-Grey [USO] My import: Userstyles / Greasy Fork Enhancer Dark-Grey [Userstyles World]

The Description Section don't keep the original text formatting (but that's good in the Notes section): Normally it's BBcode format ...

When i want edit the userstyles:

It's too a problem to save a change (i wanted enable the "Mirror code updates"): It don't want save my choice, due this invalid image (the one which is present when i imported it...)

And in this field, we can only add one screenshot.

vednoc commented 3 years ago

The Description Section don't keep the original text formatting (but that's good in the Notes section):

That's a bug. I'll fix it for the next release.

https://raw.githubusercontent.com/33kk/uso-archive/flomaster/data/screenshots/56792_after.gif

It's because GIF format is not allowed. You can use jpg, jpeg, png, and WebP formats.

It's too a problem to save a change (i wanted enable the "Mirror code updates"):

That's by design. Technically we could put every input field as a separate form, but that would be end up being too messy and result in the same outcome. UX would also be questionable.

It don't want save my choice, due this invalid image (the one which is present when i imported it...)

Looks like I didn't take into account that this could happen. I'll add logic to check if an image has GIF extension and ignore it if it does, so we don't end up with animated images.

It's possible to support to BBcode too ?

Maybe, but I would rather keep it in Markdown. USo-archive stores HTML output, and USo also allowed some HTML tags. You can use tools like https://codebeautify.org/html-to-markdown to convert one format to another.

decembre commented 3 years ago

1 - GIF format is not allowed ? Why not... ?

2 - Sniff... BBcode is fine for me.... Less complicated and i don't want one other manipulation with an external tool. On greasyfork by example they are both supported.

3 - " It's too a problem to save a change (i wanted enable the "Mirror code updates")" That's by design? I don't understand...

vednoc commented 3 years ago

Why not... ?

There are many reasons: poor compression, fast-swapping colors/images can trigger various migraines and photosensitive epilepsy, easy to abuse in a handful of malicious ways.

On greasyfork by example they are both supported.

I can look into finding a parser for it, but I can't promise anything.

We might be able to convert HTML to Markdown, but at the same time I think it's best if the user does that themselves. It's not exactly 1:1 conversion for some things, and thus we would rather not break a system that is already working.

I don't understand...

Invalid fields make it so that we don't end up with "garbage" data. If you can't press save button because one of the input fields is invalid, your data doesn't even reach the server. That's client-side validation that's supposed to give you an idea of what data should go through and what will fail (in which case you'll see red border/shadow around inputs when that happens).

When you press save button on edit page, all fields are validated on server-side to prevent various attacks and garbage data, then they're inserted into database if the validation passes, or you'll get an error on the edit page that says what went wrong. For example, if your userstyle is missing one of the mandatory fields you'll get such error.

vednoc commented 3 years ago

Fixed all of the reported bugs and added BBcode to our public roadmap.

As for the invalid GIF image, you can replace it with another one from https://33kk.github.io/uso-archive/?style=56792. In the future, all GIF images will be automatically removed while importing.

Thank you for reporting all of the bugs. It's a huge help for making USw better! 🎉

decembre commented 3 years ago

Thanks! Just a note: The first scrennshot show an .gif extension, yes, but it's not a gif... It's a normal screenshot (not animated screenshot). In fact it is a .gif too on Userstyles.org...

I test to update it with the good .jpg extension to see if the update work fine on UW

vednoc commented 3 years ago

The first scrennshot show an .gif extension, yes, but it's not a gif...

It's invalid as long as it has the .gif extension. No clue why it's a singe-frame GIF; perhaps you saved it as GIF when you originally added it to USo.

By the way, feel free to ping me when you edit a comment because I probably won't see your edits, or just make a new comment and it will show up in my inbox.