godotengine / godot-asset-library

PHP frontend for Godot Engine's asset library
https://godotengine.org/asset-library
MIT License
285 stars 85 forks source link

No reliable Way to find Assets made with C# #262

Open jcommander opened 1 year ago

jcommander commented 1 year ago

Typing "C#" into the Search Box just displays all kinds of Assets, maybe the # gets filtered out of the search or its just too short. Maybe the Project's Github Statistic for used programming language could be pulled and those containing C# could get flagged so a Filter could also be added for it.

This would be useful for C# Users that want to find reference Code/Projects and would like to keep their Projects in C# entirely.

Calinou commented 1 year ago

Related to https://github.com/godotengine/godot-asset-library/issues/250.

The asset library rewrite features a tag system, but there's no ETA for deploying it.

jcommander commented 1 year ago

Great, I hope it's making progress.

But besides this, I've noticed the '#' does get escaped out of the search filter (just like dots, semicolons etc.) So if you search for "C#" (or even "C################" for that matter), you will still only get results for "C".

Would it be possible to ignore the Character '#' without security impediments or maybe just allow the Search Term "C#" so you can find it when it's put in the Title?

Calinou commented 1 year ago

Would it be possible to ignore the Character '#' without security impediments or maybe just allow the Search Term "C#" so you can find it when it's put in the Title?

The code is here:

https://github.com/godotengine/asset-library/blob/342e663d7902bbafcce71998567606ebc5fda662/src/routes/asset.php#L47-L49

It might be possible but it's not trivial. I don't have plans to work on it personally, so feel free to look into it.

LauraWebdev commented 8 months ago

Since the rewrite project has been discontinued, are there any plans for the AssetLib to enable filtering by language? I'd love to use as many C# tools as I can since it's easier to develop with a somewhat unified codebase.

Calinou commented 8 months ago

Since the rewrite project has been discontinued, are there any plans for the AssetLib to enable filtering by language? I'd love to use as many C# tools as I can since it's easier to develop with a somewhat unified codebase.

This is the same issue as adding tags to the asset library. It requires adding a tags system, which implies a database migration and changes to the editor frontend to be able to filter by tag instead of using categories.

Converting old categories to tags is easy, but doing all the work around tagging is nontrivial. Old assets will also be missing tags (other than the legacy category tag) unless their author edits the asset in question.

jcommander commented 8 months ago

The code is here:

https://github.com/godotengine/asset-library/blob/342e663d7902bbafcce71998567606ebc5fda662/src/routes/asset.php#L47-L49

It might be possible but it's not trivial. I don't have plans to work on it personally, so feel free to look into it.

Okay, so after looking into it again, the line of code seems to miss it's purpose to me. Looking at its git blame, #251 mentions it's to trim whitespaces. Not only does preg_replace('/[[:punct:]]+/', cut way more, testing it doesn't even trim whitespaces properly for me. Shouldn't trim() be used here? Running

$testStr = "  C# Script   ";
echo '%'.preg_replace('/[[:punct:]]+/', '%', $testStr).'%';
echo '%'.trim($testStr).'%';

returns

% C% Script %
%C# Script%

PHP Playground

Calinou commented 8 months ago

Shouldn't trim() be used here?

Both are used, as the output of trim() is passed to preg_replace(). I don't know why preg_replace() was originally used here though (there is nothing about it in git blame).