How do I register a public asset in a plugin?

Forgive me if this has been asked before, but I am unable to find a previous topic on this.

I’m wondering how to register an asset as public (such as an image) through a discourse plugin - it seems currently after registering, I get a 404 or 302 response when installing under a private member’s only site.

This is in reference to the Discord oauth plugin I built - I am unable to retrieve the image either directly, or through a register_asset call.

How would I go about serving static plugin assets in this case?

Ciao, posso ricevere anch’io delle informazioni? Perché sto riscontrando lo stesso problema.

Certamente, quell’argomento è stato eliminato. L’argomento forniva un link a un vecchio plugin di Discourse che include un esempio su come registrare risorse pubbliche in un plugin: GitHub - eviltrout/trout_emoji: Adds an evil trout emoji to a discourse install · GitHub.

L’ultima volta che l’ho testato, aggiungere immagini a un plugin nella directory public/images le rende disponibili sul server in /plugins/nome_plugin/images/.

Il nome del plugin che usi nel percorso è il nome che assegni nei metadati in cima al file plugin.rb, ad esempio /plugins/trout_emoji/images/trout-square.jpg

Grazie mille. Ora funziona. Il problema era perché pensavo che il nome del plugin nel percorso fosse il nome della cartella :slight_smile: