marcelreppi / moodle-buddy

Moodle Buddy is a browser plugin that offers mass download and notification functionality to the Moodle learning management platform
https://moodlebuddy.com
GNU Affero General Public License v3.0
40 stars 3 forks source link

Infer file extension from icon #63

Open mirh opened 1 year ago

mirh commented 1 year ago

So, I'm not really sure if there aren't certain particular upload settings enabled, but the long story short is that most common file extensions are hidden from the resources name. This makes it difficult to filter them in the search box.

On the other hand, all files do get at least an icon on their side specific to their format (or I don't know then if there isn't a more elegant api or something). After inspecting the page (and putting aside the website domain) I could spot these in the img src:

../theme/image.php/boostcustom/core/1683807935/f/pdf-24
../theme/image.php/boostcustom/core/1683807935/f/spreadsheet-24
../theme/image.php/boostcustom/core/1683807935/f/jpeg-24
../theme/image.php/boostcustom/core/1683807935/f/powerpoint-24
../theme/image.php/boostcustom/core/1683807935/f/text-24

(the last one might or might not be used even for unknown formats, I couldn't cross-check)

MaxEtMoritz commented 10 months ago

On my University's Moodle this would not work. All resources have the same icon /theme/image.php/boost_union_ohm/resource/1697685389/monologo?filtericon=1, which is a generic file icon. don't know if this is due to our university custom style or due to Moodle 4. Our previous Moodle 3 did show different icons for different file types with a link similar to the already posted one.

mirh commented 10 months ago

https://github.com/moodle/moodle/tree/MOODLE_401_STABLE/pix/f It appears to be a moodle thing, and they slightly simplified it recently (though just separating between pdfs, spreadsheets and videos would still be totally good enough for me and my use case).

Anyway, mine was upgraded too, yet I could still spot at least a ../theme/image.php/unipd/core/1698929104/f/pdf-24 somewhere. On the other hand the older course I previously used as an example, has ../theme/image.php/unipd/resource/1698929104/monologo?filtericon=1 everywhere now.

My fear is that "fancy icons" may only be working if your are linking to something as an external link/resource... Though it seems so strange. When https://github.com/moodle/moodle/commit/ffc227c9d5152664e876ee4e4b48c1d05f8c4a2e introduced monologo it didn't seem like it was going to turn upside down everything.