added router functionality
This commit is contained in:
parent
3655c62c90
commit
079e4752a4
Binary file not shown.
|
@ -4,9 +4,9 @@
|
|||
"description": "this plugin will update statuses to show what game is being played - fuck discord",
|
||||
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
|
||||
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues",
|
||||
"release_notes_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdatereleases/tag/v0.2.6",
|
||||
"release_notes_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdatereleases/tag/v0.2.7",
|
||||
"icon_path": "assets/starter-template-icon.svg",
|
||||
"version": "0.2.7",
|
||||
"version": "0.2.8",
|
||||
"min_server_version": "6.2.1",
|
||||
"server": {
|
||||
"executables": {
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
8
go.mod
8
go.mod
|
@ -3,14 +3,14 @@ module gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate
|
|||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/gorilla/mux v1.8.1
|
||||
github.com/grafana/pyroscope-go/godeltaprof v0.1.8
|
||||
github.com/mattermost/mattermost/server/public v0.0.14
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/stretchr/testify v1.8.4
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/blang/semver/v4 v4.0.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dyatlov/go-opengraph/opengraph v0.0.0-20220524092352-606d7b1e5f8a // indirect
|
||||
github.com/fatih/color v1.16.0 // indirect
|
||||
github.com/francoispqt/gojay v1.2.13 // indirect
|
||||
|
@ -22,6 +22,7 @@ require (
|
|||
github.com/hashicorp/go-hclog v1.6.2 // indirect
|
||||
github.com/hashicorp/go-plugin v1.6.0 // indirect
|
||||
github.com/hashicorp/yamux v0.1.1 // indirect
|
||||
github.com/klauspost/compress v1.17.8 // indirect
|
||||
github.com/lib/pq v1.10.9 // indirect
|
||||
github.com/mattermost/go-i18n v1.11.1-0.20211013152124-5c415071e404 // indirect
|
||||
github.com/mattermost/ldap v0.0.0-20231116144001-0f480c025956 // indirect
|
||||
|
@ -33,8 +34,8 @@ require (
|
|||
github.com/pborman/uuid v1.2.1 // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
github.com/philhofer/fwd v1.1.2 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.11.0 // indirect
|
||||
github.com/stretchr/testify v1.9.0 // indirect
|
||||
github.com/tinylib/msgp v1.1.9 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
|
@ -49,5 +50,4 @@ require (
|
|||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
10
go.sum
10
go.sum
|
@ -63,8 +63,12 @@ github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
|
|||
github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY=
|
||||
github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||
github.com/grafana/pyroscope-go/godeltaprof v0.1.8 h1:iwOtYXeeVSAeYefJNaxDytgjKtUuKQbJqgAIjlnicKg=
|
||||
github.com/grafana/pyroscope-go/godeltaprof v0.1.8/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU=
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
|
||||
github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I=
|
||||
|
@ -79,6 +83,8 @@ github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gav
|
|||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU=
|
||||
github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
|
@ -166,8 +172,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
|||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
|
||||
github.com/tinylib/msgp v1.1.9 h1:SHf3yoO2sGA0veCJeCBYLHuttAVFHGm2RHgNodW7wQU=
|
||||
github.com/tinylib/msgp v1.1.9/go.mod h1:BCXGB54lDD8qUEPmiG0cQQUANC4IUQyB2ItS2UDlO/k=
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "com.mattermost.plugin-gameStatusUpdate",
|
||||
"name": "game status update",
|
||||
"version": "0.2.7",
|
||||
"version": "0.2.8",
|
||||
"description": "this plugin will update statuses to show what game is being played - fuck discord",
|
||||
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
|
||||
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues",
|
||||
|
|
BIN
server/dist/plugin-darwin-amd64
vendored
BIN
server/dist/plugin-darwin-amd64
vendored
Binary file not shown.
BIN
server/dist/plugin-darwin-arm64
vendored
BIN
server/dist/plugin-darwin-arm64
vendored
Binary file not shown.
BIN
server/dist/plugin-linux-amd64
vendored
BIN
server/dist/plugin-linux-amd64
vendored
Binary file not shown.
BIN
server/dist/plugin-linux-arm64
vendored
BIN
server/dist/plugin-linux-arm64
vendored
Binary file not shown.
BIN
server/dist/plugin-windows-amd64.exe
vendored
BIN
server/dist/plugin-windows-amd64.exe
vendored
Binary file not shown.
|
@ -18,9 +18,9 @@ const manifestStr = `
|
|||
"description": "this plugin will update statuses to show what game is being played - fuck discord",
|
||||
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
|
||||
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues",
|
||||
"release_notes_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdatereleases/tag/v0.2.6",
|
||||
"release_notes_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdatereleases/tag/v0.2.7",
|
||||
"icon_path": "assets/starter-template-icon.svg",
|
||||
"version": "0.2.7",
|
||||
"version": "0.2.8",
|
||||
"min_server_version": "6.2.1",
|
||||
"server": {
|
||||
"executables": {
|
||||
|
|
|
@ -20,8 +20,7 @@ type Plugin struct {
|
|||
// configurationLock synchronizes access to the configuration.
|
||||
configurationLock sync.RWMutex
|
||||
|
||||
// configuration is the active plugin configuration. Consult getConfiguration and
|
||||
// setConfiguration for usage.
|
||||
// configuration is the active plugin configuration.
|
||||
configuration *configuration
|
||||
|
||||
// stopChannel is used to stop the background process monitor when the plugin is deactivated.
|
||||
|
@ -109,7 +108,7 @@ func (p *Plugin) MonitorGameStatus(userID string) {
|
|||
}
|
||||
|
||||
// Sleep for a defined interval before scanning again
|
||||
time.Sleep(30 * time.Second) // Scan every 30 seconds (can be configurable)
|
||||
time.Sleep(30 * time.Second) // Scan every 30 seconds
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +117,7 @@ func (p *Plugin) MonitorGameStatus(userID string) {
|
|||
func (p *Plugin) handleProcessList(w http.ResponseWriter, r *http.Request) {
|
||||
var requestData struct {
|
||||
ProcessList string `json:"processList"`
|
||||
UserID string `json:"userID"` // Expecting the user ID in the request payload
|
||||
UserID string `json:"userID"`
|
||||
}
|
||||
|
||||
if err := json.NewDecoder(r.Body).Decode(&requestData); err != nil {
|
||||
|
@ -136,7 +135,7 @@ func (p *Plugin) handleProcessList(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
if game != "" {
|
||||
err := p.SetUserGameStatus(requestData.UserID, game) // Use the user ID from the request
|
||||
err := p.SetUserGameStatus(requestData.UserID, game)
|
||||
if err != nil {
|
||||
http.Error(w, "Failed to update user status", http.StatusInternalServerError)
|
||||
return
|
||||
|
@ -167,7 +166,7 @@ func (p *Plugin) OnActivate() error {
|
|||
|
||||
// Start the HTTP server
|
||||
go func() {
|
||||
if err := http.ListenAndServe(":8080", mux); err != nil {
|
||||
if err := http.ListenAndServe(":8780", mux); err != nil {
|
||||
p.API.LogError("Failed to start HTTP server", "error", err.Error())
|
||||
}
|
||||
}()
|
||||
|
|
2
webapp/dist/main.js
vendored
2
webapp/dist/main.js
vendored
File diff suppressed because one or more lines are too long
|
@ -7,9 +7,9 @@ const manifest = JSON.parse(`
|
|||
"description": "this plugin will update statuses to show what game is being played - fuck discord",
|
||||
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
|
||||
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues",
|
||||
"release_notes_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdatereleases/tag/v0.2.6",
|
||||
"release_notes_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdatereleases/tag/v0.2.7",
|
||||
"icon_path": "assets/starter-template-icon.svg",
|
||||
"version": "0.2.7",
|
||||
"version": "0.2.8",
|
||||
"min_server_version": "6.2.1",
|
||||
"server": {
|
||||
"executables": {
|
||||
|
|
Loading…
Reference in a new issue