Browse Source

Merge of emoji + autolink + embed + etc (#108)

* Add an emoji picker to chat

* Update to the custom emoji picker and add first pass at using custom emoji in text box

* Add custom emoji endpoint and use it in the app

* Position the emoji picker

* Handle events from the text input

* pair down the number of party parrots

* Size emoji in chat and input

* Add new custom emoji

* Add OMQ stickers as custom emoji

* Show custom category for emoji picker by default

* update omq emojis

* Document basic supported markdown syntax. Closes #95

* Websocket refactor: Pull it out of the UI and support callbacks (#104)

* Websocket refactor: Pull it out of the UI and support listeners

* Changes required for Safari to be happy with modules

* Move to explicit ad-hoc callback registration

* Add an emoji picker to chat

* Update to the custom emoji picker and add first pass at using custom emoji in text box

* Handle events from the text input

* Rebuild autolinking + embed handling for #93

* Re-enable disabling chat

* Document basic supported markdown syntax. Closes #95

* Document basic supported markdown syntax. Closes #95

* Add an emoji picker to chat

* Merge emoji and embeds.

* Merge emoji + embed branches. Rework autolink +embeds. WIP for username
highlighting for #100

* More updates to chat text formatting/embedding/linking

* Fix username autocomplete to work with div instead of form elements

* Post-rebase fixes + tweaks

* Disable text input by setting contentEditable = false

* Remove test that hardcodes pointing to public test server

* Fix re-enable chat with the contentEditable input div

* Style and fix the fake placeholder text in the input div

* Missing file.  Were did it go?

* Set a height for instagram embeds

* Cleanup

Co-authored-by: Ginger Wong <omqmail@gmail.com>
pull/118/head
Gabe Kangas 5 years ago committed by GitHub
parent
commit
68ff9ff270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 42
      controllers/emoji.go
  2. 7
      models/emoji.go
  3. 3
      router/router.go
  4. BIN
      webroot/img/emoji/Reaper-gg.png
  5. BIN
      webroot/img/emoji/Reaper-hi.png
  6. BIN
      webroot/img/emoji/Reaper-hype.png
  7. BIN
      webroot/img/emoji/Reaper-lol.png
  8. BIN
      webroot/img/emoji/Reaper-love.png
  9. BIN
      webroot/img/emoji/Reaper-rage.png
  10. BIN
      webroot/img/emoji/Reaper-rip.png
  11. BIN
      webroot/img/emoji/Reaper-wtf.png
  12. BIN
      webroot/img/emoji/ac-box.png
  13. BIN
      webroot/img/emoji/ac-construction.png
  14. BIN
      webroot/img/emoji/ac-fossil.png
  15. BIN
      webroot/img/emoji/ac-item-leaf.png
  16. BIN
      webroot/img/emoji/ac-kkslider.png
  17. BIN
      webroot/img/emoji/ac-moneytree.png
  18. BIN
      webroot/img/emoji/ac-mosquito.png
  19. BIN
      webroot/img/emoji/ac-shirt.png
  20. BIN
      webroot/img/emoji/ac-song.png
  21. BIN
      webroot/img/emoji/ac-tree.png
  22. BIN
      webroot/img/emoji/ac-turnip.png
  23. BIN
      webroot/img/emoji/ac-weeds.png
  24. BIN
      webroot/img/emoji/alert.gif
  25. BIN
      webroot/img/emoji/bananadance.gif
  26. BIN
      webroot/img/emoji/bb8.png
  27. BIN
      webroot/img/emoji/beerparrot.gif
  28. BIN
      webroot/img/emoji/bells.png
  29. BIN
      webroot/img/emoji/birthdaypartyparrot.gif
  30. BIN
      webroot/img/emoji/blacklightsaber.png
  31. BIN
      webroot/img/emoji/bluelightsaber.png
  32. BIN
      webroot/img/emoji/bluntparrot.gif
  33. BIN
      webroot/img/emoji/bobaparrot.gif
  34. BIN
      webroot/img/emoji/cakeparrot.gif
  35. BIN
      webroot/img/emoji/chewbacca.png
  36. BIN
      webroot/img/emoji/chillparrot.gif
  37. BIN
      webroot/img/emoji/christmasparrot.gif
  38. BIN
      webroot/img/emoji/coffeeparrot.gif
  39. BIN
      webroot/img/emoji/confusedparrot.gif
  40. BIN
      webroot/img/emoji/copparrot.gif
  41. BIN
      webroot/img/emoji/coronavirus.png
  42. BIN
      webroot/img/emoji/covid19parrot.gif
  43. BIN
      webroot/img/emoji/cryptoparrot.gif
  44. BIN
      webroot/img/emoji/dabparrot.gif
  45. BIN
      webroot/img/emoji/dadparrot.gif
  46. BIN
      webroot/img/emoji/daftpunkparrot.gif
  47. BIN
      webroot/img/emoji/darkbeerparrot.gif
  48. BIN
      webroot/img/emoji/darkmodeparrot.gif
  49. BIN
      webroot/img/emoji/darth_vader.png
  50. BIN
      webroot/img/emoji/dealwithitparrot.gif
  51. BIN
      webroot/img/emoji/death_star.png
  52. BIN
      webroot/img/emoji/discoparrot.gif
  53. BIN
      webroot/img/emoji/division-gg.png
  54. BIN
      webroot/img/emoji/division-hi.png
  55. BIN
      webroot/img/emoji/division-hype.png
  56. BIN
      webroot/img/emoji/division-lol.png
  57. BIN
      webroot/img/emoji/division-omg.png
  58. BIN
      webroot/img/emoji/division-rage.png
  59. BIN
      webroot/img/emoji/division-rip.png
  60. BIN
      webroot/img/emoji/division-wtf.png
  61. BIN
      webroot/img/emoji/docparrot.gif
  62. BIN
      webroot/img/emoji/donutparrot.gif
  63. BIN
      webroot/img/emoji/doom_mad.gif
  64. BIN
      webroot/img/emoji/empire.png
  65. BIN
      webroot/img/emoji/everythingsfineparrot.gif
  66. BIN
      webroot/img/emoji/evilparrot.gif
  67. BIN
      webroot/img/emoji/explodyparrot.gif
  68. BIN
      webroot/img/emoji/fixparrot.gif
  69. BIN
      webroot/img/emoji/flyingmoneyparrot.gif
  70. BIN
      webroot/img/emoji/footballparrot.gif
  71. BIN
      webroot/img/emoji/gabe1.png
  72. BIN
      webroot/img/emoji/gabe2.png
  73. BIN
      webroot/img/emoji/gentlemanparrot.gif
  74. BIN
      webroot/img/emoji/githubparrot.gif
  75. BIN
      webroot/img/emoji/goomba.gif
  76. BIN
      webroot/img/emoji/gothparrot.gif
  77. BIN
      webroot/img/emoji/hamburgerparrot.gif
  78. BIN
      webroot/img/emoji/harrypotterparrot.gif
  79. BIN
      webroot/img/emoji/headbangingparrot.gif
  80. BIN
      webroot/img/emoji/headingparrot.gif
  81. BIN
      webroot/img/emoji/headsetparrot.gif
  82. BIN
      webroot/img/emoji/hmmparrot.gif
  83. BIN
      webroot/img/emoji/hypnoparrot.gif
  84. BIN
      webroot/img/emoji/icecreamparrot.gif
  85. BIN
      webroot/img/emoji/illuminatiparrot.gif
  86. BIN
      webroot/img/emoji/jediparrot.gif
  87. BIN
      webroot/img/emoji/keanu_thanks.gif
  88. BIN
      webroot/img/emoji/laptop_parrot.gif
  89. BIN
      webroot/img/emoji/loveparrot.gif
  90. BIN
      webroot/img/emoji/mandalorian.png
  91. BIN
      webroot/img/emoji/margaritaparrot.gif
  92. BIN
      webroot/img/emoji/mario.gif
  93. BIN
      webroot/img/emoji/matrixparrot.gif
  94. BIN
      webroot/img/emoji/meldparrot.gif
  95. BIN
      webroot/img/emoji/metalparrot.gif
  96. BIN
      webroot/img/emoji/michaeljacksonparrot.gif
  97. BIN
      webroot/img/emoji/moonparrot.gif
  98. BIN
      webroot/img/emoji/moonwalkingparrot.gif
  99. BIN
      webroot/img/emoji/mustacheparrot.gif
  100. BIN
      webroot/img/emoji/nicolas_cage_party.gif
  101. Some files were not shown because too many files have changed in this diff Show More

42
controllers/emoji.go

@ -0,0 +1,42 @@
package controllers
import (
"encoding/json"
"io/ioutil"
"net/http"
"path"
"path/filepath"
"strings"
"github.com/gabek/owncast/models"
log "github.com/sirupsen/logrus"
)
// Make this path configurable if somebody has a valid reason
// to need it to be. The config is getting a bit bloated.
const emojiPath = "/img/emoji" // Relative to webroot
//GetCustomEmoji returns a list of custom emoji via the API
func GetCustomEmoji(w http.ResponseWriter, r *http.Request) {
emojiList := make([]models.CustomEmoji, 0)
fullPath := filepath.Join("webroot", emojiPath)
files, err := ioutil.ReadDir(fullPath)
if err != nil {
log.Errorln(err)
// Throw HTTP 500
return
}
// Memoize this result somewhere? Right now it iterates through the
// filesystem every time the API is hit. Should you need to restart
// the server to add emoji?
for _, f := range files {
name := strings.TrimSuffix(f.Name(), path.Ext(f.Name()))
path := filepath.Join(emojiPath, f.Name())
singleEmoji := models.CustomEmoji{name, path}
emojiList = append(emojiList, singleEmoji)
}
json.NewEncoder(w).Encode(emojiList)
}

7
models/emoji.go

@ -0,0 +1,7 @@
package models
//CustomEmoji represents an image that can be used in chat as a custom emoji
type CustomEmoji struct {
Name string `json:"name"`
Emoji string `json:"emoji"`
}

3
router/router.go

@ -23,6 +23,9 @@ func Start() error {
// status of the system // status of the system
http.HandleFunc("/status", controllers.GetStatus) http.HandleFunc("/status", controllers.GetStatus)
// custom emoji supported in the chat
http.HandleFunc("/emoji", controllers.GetCustomEmoji)
if !config.Config.DisableWebFeatures { if !config.Config.DisableWebFeatures {
// websocket chat server // websocket chat server
go chat.Start() go chat.Start()

BIN
webroot/img/emoji/Reaper-gg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
webroot/img/emoji/Reaper-hi.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
webroot/img/emoji/Reaper-hype.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
webroot/img/emoji/Reaper-lol.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
webroot/img/emoji/Reaper-love.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
webroot/img/emoji/Reaper-rage.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
webroot/img/emoji/Reaper-rip.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
webroot/img/emoji/Reaper-wtf.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
webroot/img/emoji/ac-box.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
webroot/img/emoji/ac-construction.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
webroot/img/emoji/ac-fossil.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

BIN
webroot/img/emoji/ac-item-leaf.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
webroot/img/emoji/ac-kkslider.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
webroot/img/emoji/ac-moneytree.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
webroot/img/emoji/ac-mosquito.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
webroot/img/emoji/ac-shirt.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
webroot/img/emoji/ac-song.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
webroot/img/emoji/ac-tree.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

BIN
webroot/img/emoji/ac-turnip.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

BIN
webroot/img/emoji/ac-weeds.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
webroot/img/emoji/alert.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
webroot/img/emoji/bananadance.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
webroot/img/emoji/bb8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
webroot/img/emoji/beerparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
webroot/img/emoji/bells.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
webroot/img/emoji/birthdaypartyparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
webroot/img/emoji/blacklightsaber.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
webroot/img/emoji/bluelightsaber.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
webroot/img/emoji/bluntparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
webroot/img/emoji/bobaparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
webroot/img/emoji/cakeparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
webroot/img/emoji/chewbacca.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
webroot/img/emoji/chillparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
webroot/img/emoji/christmasparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
webroot/img/emoji/coffeeparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
webroot/img/emoji/confusedparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
webroot/img/emoji/copparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
webroot/img/emoji/coronavirus.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
webroot/img/emoji/covid19parrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

BIN
webroot/img/emoji/cryptoparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
webroot/img/emoji/dabparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

BIN
webroot/img/emoji/dadparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
webroot/img/emoji/daftpunkparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
webroot/img/emoji/darkbeerparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
webroot/img/emoji/darkmodeparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
webroot/img/emoji/darth_vader.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
webroot/img/emoji/dealwithitparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
webroot/img/emoji/death_star.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
webroot/img/emoji/discoparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
webroot/img/emoji/division-gg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
webroot/img/emoji/division-hi.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
webroot/img/emoji/division-hype.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
webroot/img/emoji/division-lol.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
webroot/img/emoji/division-omg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
webroot/img/emoji/division-rage.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
webroot/img/emoji/division-rip.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
webroot/img/emoji/division-wtf.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
webroot/img/emoji/docparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
webroot/img/emoji/donutparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
webroot/img/emoji/doom_mad.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
webroot/img/emoji/empire.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
webroot/img/emoji/everythingsfineparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
webroot/img/emoji/evilparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
webroot/img/emoji/explodyparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
webroot/img/emoji/fixparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
webroot/img/emoji/flyingmoneyparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
webroot/img/emoji/footballparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
webroot/img/emoji/gabe1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
webroot/img/emoji/gabe2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
webroot/img/emoji/gentlemanparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
webroot/img/emoji/githubparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
webroot/img/emoji/goomba.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

BIN
webroot/img/emoji/gothparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
webroot/img/emoji/hamburgerparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
webroot/img/emoji/harrypotterparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
webroot/img/emoji/headbangingparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
webroot/img/emoji/headingparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
webroot/img/emoji/headsetparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
webroot/img/emoji/hmmparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
webroot/img/emoji/hypnoparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
webroot/img/emoji/icecreamparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
webroot/img/emoji/illuminatiparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
webroot/img/emoji/jediparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
webroot/img/emoji/keanu_thanks.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

BIN
webroot/img/emoji/laptop_parrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
webroot/img/emoji/loveparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
webroot/img/emoji/mandalorian.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
webroot/img/emoji/margaritaparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
webroot/img/emoji/mario.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
webroot/img/emoji/matrixparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
webroot/img/emoji/meldparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
webroot/img/emoji/metalparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
webroot/img/emoji/michaeljacksonparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
webroot/img/emoji/moonparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
webroot/img/emoji/moonwalkingparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
webroot/img/emoji/mustacheparrot.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
webroot/img/emoji/nicolas_cage_party.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save