fuck chatgpt still
This commit is contained in:
parent
652258fae1
commit
4bc38ffb7b
BIN
dist/com.mattermost.gameStatusUpdate-0.2.11.tar.gz
vendored
BIN
dist/com.mattermost.gameStatusUpdate-0.2.11.tar.gz
vendored
Binary file not shown.
|
@ -4,7 +4,7 @@
|
|||
"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.10",
|
||||
"release_notes_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdatereleases/tag/v0.2.11",
|
||||
"icon_path": "assets/starter-template-icon.svg",
|
||||
"version": "0.2.11",
|
||||
"min_server_version": "6.2.1",
|
||||
|
|
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
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,7 +18,7 @@ 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.10",
|
||||
"release_notes_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdatereleases/tag/v0.2.11",
|
||||
"icon_path": "assets/starter-template-icon.svg",
|
||||
"version": "0.2.11",
|
||||
"min_server_version": "6.2.1",
|
||||
|
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -28,6 +29,34 @@ var knownGames = map[string]bool{
|
|||
"chrome.exe": false,
|
||||
}
|
||||
|
||||
// ReceiveProcessList handles incoming process list data from the desktop app
|
||||
func (p *Plugin) ReceiveProcessList(w http.ResponseWriter, r *http.Request) {
|
||||
var payload struct {
|
||||
ProcessList string `json:"processList"`
|
||||
UserID string `json:"userID"` // Assuming you're sending userID from the desktop app
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&payload); err != nil {
|
||||
p.API.LogError("Failed to decode process list", "error", err.Error())
|
||||
http.Error(w, "Invalid request payload", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// Check for known games in the process list
|
||||
for gameName := range knownGames {
|
||||
if strings.Contains(payload.ProcessList, gameName) {
|
||||
if err := p.SetUserGameStatus(payload.UserID, gameName); err != nil {
|
||||
p.API.LogError("Failed to set user game status", "error", err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the user status if no known games are found
|
||||
if err := p.SetUserGameStatus(payload.UserID, ""); err != nil {
|
||||
p.API.LogError("Failed to clear user game status", "error", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// GetActiveGame scans processes to determine the active game based on known game names
|
||||
func (p *Plugin) GetActiveGame() (string, error) {
|
||||
cmd := exec.Command("ps", "-e")
|
||||
|
@ -118,9 +147,11 @@ func (p *Plugin) OnActivate() error {
|
|||
if err := p.API.RegisterCommand(command); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Register the HTTP handler for receiving process lists
|
||||
http.HandleFunc("/plugins/com.mattermost.gamestatusupdate/processlist", p.ReceiveProcessList)
|
||||
}
|
||||
|
||||
// No need to register WebSocket events; just ensure your HandleWebSocketEvent is defined.
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
2
webapp/dist/main.js
vendored
2
webapp/dist/main.js
vendored
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@ 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.10",
|
||||
"release_notes_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdatereleases/tag/v0.2.11",
|
||||
"icon_path": "assets/starter-template-icon.svg",
|
||||
"version": "0.2.11",
|
||||
"min_server_version": "6.2.1",
|
||||
|
|
Loading…
Reference in a new issue