1
0
Fork 0

Compare commits

...

2 Commits

Author SHA1 Message Date
Wojciech Kwolek 1572a9d37b + true1 2024-03-13 13:06:20 +01:00
Wojciech Kwolek a1a55bf8d2
no longer require go-bindata, which was abandoned
however, go 1.16 is now required

(it is quite ancient anyway at this point)
2024-03-13 02:16:36 +01:00
8 changed files with 35 additions and 13 deletions

1
.gitignore vendored
View File

@ -1,2 +1 @@
dist
server/memelibrary/assets.go

View File

@ -26,10 +26,8 @@ In Mattermost 5.15 and earlier, follow these steps:
Read our documentation about the [Developer Workflow](https://developers.mattermost.com/extend/plugins/developer-workflow/) and [Developer Setup](https://developers.mattermost.com/extend/plugins/developer-setup/) for more information about developing and extending plugins.
Run `make memelibrary` to bundle up the meme assets (images, fonts, etc.).
For convenience, you can run the plugin from your terminal to preview an image for a given input. For example, on macOS, you can run the following to generate the above meme and open it in Preview:
`go run server/plugin.go -out demo.jpg 'memes. memes everywhere' && open demo.jpg`
This is especially useful when adding or modifying memes as you can quickly modify assets, `make memelibrary`, and preview the result using the above command. (See the files in ` memelibrary/assets` to get started with that.)
This is especially useful when adding or modifying memes as you can quickly modify assets, and preview the result using the above command. (See the files in ` memelibrary/assets` to get started with that.)

View File

@ -1,7 +0,0 @@
# Include custom targets and environment variables here
.DEFAULT_GOAL := all
memelibrary: $(shell find server/memelibrary/assets)
env GO111MODULE=off $(GO) get github.com/jteeuwen/go-bindata/...
$(GOPATH)/bin/go-bindata -o server/memelibrary/assets.go -pkg memelibrary -prefix server/memelibrary/assets/ -ignore '(^|/)\..*' server/memelibrary/assets/...

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/mattermost/mattermost-plugin-memes
go 1.12
go 1.16
require (
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0

View File

@ -0,0 +1,31 @@
package memelibrary
import (
"embed"
"path"
)
//go:embed assets
var content embed.FS
func AssetDir(name string) ([]string, error) {
entries, err := content.ReadDir(path.Join("assets", name))
if err != nil {
return nil, err
}
files := make([]string, len(entries))
for i, entry := range entries {
files[i] = entry.Name()
}
return files, nil
}
func MustAsset(name string) []byte {
data, err := content.ReadFile(path.Join("assets", name))
if err != nil {
panic(err)
}
return data
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

View File

@ -0,0 +1,2 @@
aliases:
- "true"

View File

@ -132,7 +132,6 @@ func serveTemplatePNG(w http.ResponseWriter, r *http.Request) {
}
}
type Plugin struct {
plugin.MattermostPlugin