logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

custom_emoji.md (2965B)


  1. # Custom Emoji
  2. Before you add your own custom emoji, check if they are available in an existing pack.
  3. See `Mix.Tasks.Pleroma.Emoji` for information about emoji packs.
  4. To add custom emoji:
  5. * Create the `STATIC-DIR/emoji/` directory if it doesn't exist
  6. (`STATIC-DIR` is configurable, `instance/static/` by default)
  7. * Create a directory with whatever name you want (custom is a good name to show the purpose of it).
  8. This will create a local emoji pack.
  9. * Put your `.png` emoji files in that directory. In case of conflicts, you can create an `emoji.txt`
  10. file in that directory and specify a custom shortcode using the following format:
  11. `shortcode, file-path, tag1, tag2, etc`. One emoji per line. Note that if you do so,
  12. you'll have to list all other emojis in the pack too.
  13. * Either restart pleroma or connect to the iex session pleroma's running and
  14. run `Pleroma.Emoji.reload/0` in it.
  15. Example:
  16. image files (in `instance/static/emoji/custom`): `happy.png` and `sad.png`
  17. content of `emoji.txt`:
  18. ```
  19. happy, /emoji/custom/happy.png, Tag1,Tag2
  20. sad, /emoji/custom/sad.png, Tag1
  21. foo, /emoji/custom/foo.png
  22. ```
  23. The files should be PNG (APNG is okay with `.png` for `image/png` Content-type) and under 50kb for compatibility with mastodon.
  24. Default file extensions and locations for emojis are set in `config.exs`. To use different locations or file-extensions, add the `shortcode_globs` to your secrets file (`prod.secret.exs` or `dev.secret.exs`) and edit it. Note that not all fediverse-software will show emojis with other file extensions:
  25. ```elixir
  26. config :pleroma, :emoji, shortcode_globs: ["/emoji/custom/**/*.png", "/emoji/custom/**/*.gif"]
  27. ```
  28. ## Emoji tags (groups)
  29. Default tags are set in `config.exs`. To set your own tags, copy the structure to your secrets file (`prod.secret.exs` or `dev.secret.exs`) and edit it.
  30. ```elixir
  31. config :pleroma, :emoji,
  32. shortcode_globs: ["/emoji/custom/**/*.png"],
  33. groups: [
  34. Finmoji: "/finmoji/128px/*-128.png",
  35. Custom: ["/emoji/*.png", "/emoji/custom/*.png"]
  36. ]
  37. ```
  38. Order of the `groups` matters, so to override default tags just put your group on top of the list. E.g:
  39. ```elixir
  40. config :pleroma, :emoji,
  41. shortcode_globs: ["/emoji/custom/**/*.png"],
  42. groups: [
  43. "Finmoji special": "/finmoji/128px/a_trusted_friend-128.png", # special file
  44. "Cirno": "/emoji/custom/cirno*.png", # png files in /emoji/custom/ which start with `cirno`
  45. "Special group": "/emoji/custom/special_folder/*.png", # png files in /emoji/custom/special_folder/
  46. "Another group": "/emoji/custom/special_folder/*/.png", # png files in /emoji/custom/special_folder/ subfolders
  47. Finmoji: "/finmoji/128px/*-128.png",
  48. Custom: ["/emoji/*.png", "/emoji/custom/*.png"]
  49. ]
  50. ```
  51. Priority of tags assigns in emoji.txt and custom.txt:
  52. `tag in file > special group setting in config.exs > default setting in config.exs`
  53. Priority for globs:
  54. `special group setting in config.exs > default setting in config.exs`