fuck chatgpt still

This commit is contained in:
aaron 2024-11-05 07:24:44 -08:00
parent 652258fae1
commit 4bc38ffb7b
17 changed files with 37 additions and 6 deletions

View file

@ -4,7 +4,7 @@
"description": "this plugin will update statuses to show what game is being played - fuck discord", "description": "this plugin will update statuses to show what game is being played - fuck discord",
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate", "homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues", "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", "icon_path": "assets/starter-template-icon.svg",
"version": "0.2.11", "version": "0.2.11",
"min_server_version": "6.2.1", "min_server_version": "6.2.1",

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -18,7 +18,7 @@ const manifestStr = `
"description": "this plugin will update statuses to show what game is being played - fuck discord", "description": "this plugin will update statuses to show what game is being played - fuck discord",
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate", "homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues", "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", "icon_path": "assets/starter-template-icon.svg",
"version": "0.2.11", "version": "0.2.11",
"min_server_version": "6.2.1", "min_server_version": "6.2.1",

View file

@ -3,6 +3,7 @@ package main
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"net/http"
"os/exec" "os/exec"
"strings" "strings"
"sync" "sync"
@ -28,6 +29,34 @@ var knownGames = map[string]bool{
"chrome.exe": false, "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 // GetActiveGame scans processes to determine the active game based on known game names
func (p *Plugin) GetActiveGame() (string, error) { func (p *Plugin) GetActiveGame() (string, error) {
cmd := exec.Command("ps", "-e") cmd := exec.Command("ps", "-e")
@ -118,9 +147,11 @@ func (p *Plugin) OnActivate() error {
if err := p.API.RegisterCommand(command); err != nil { if err := p.API.RegisterCommand(command); err != nil {
return err 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 return nil
} }

2
webapp/dist/main.js vendored

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@ const manifest = JSON.parse(`
"description": "this plugin will update statuses to show what game is being played - fuck discord", "description": "this plugin will update statuses to show what game is being played - fuck discord",
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate", "homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues", "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", "icon_path": "assets/starter-template-icon.svg",
"version": "0.2.11", "version": "0.2.11",
"min_server_version": "6.2.1", "min_server_version": "6.2.1",