Files
IRC-kosmi-relay/cmd/test-image-upload/main.go
cottongin d314193540 Fix stale cmd/ scripts, export LoginWithChromedp, clean up vet warnings
Update 5 cmd/ test utilities that referenced APIs that drifted after
bridge refactors (NewBrowserAuthManager, bridge.NewConfig, changed
function signatures). Rewrite test-kosmi and test-native to use
NewGraphQLWSClient directly. Export LoginWithChromedp for use by cmd
scripts. Fix redundant-newline vet warnings across 5 cmd/ files.
Remove unreachable code and replace deprecated ioutil calls in
bridge/helper/lottie_convert.go.

Made-with: Cursor
2026-04-05 05:49:26 -04:00

39 lines
1.1 KiB
Go

package main
import (
"fmt"
"log"
bkosmi "github.com/42wim/matterbridge/bridge/kosmi"
"github.com/42wim/matterbridge/bridge/jackbox"
)
func main() {
fmt.Println("=== Kosmi Image Upload Test ===")
// Test 1: Generate a room code image
fmt.Println("1. Generating room code image for 'TEST'...")
imageData, err := jackbox.GenerateRoomCodeImage("TEST", "Test Game")
if err != nil {
log.Fatalf("Failed to generate image: %v", err)
}
fmt.Printf(" ✓ Generated image (%d bytes)\n\n", len(imageData))
// Test 2: Upload the image to Kosmi CDN
fmt.Println("2. Uploading image to Kosmi CDN (https://img.kosmi.io/)...")
imageURL, err := bkosmi.UploadImage(imageData, "roomcode_TEST.png")
if err != nil {
log.Fatalf("Failed to upload image: %v", err)
}
fmt.Printf(" ✓ Upload successful!\n\n")
// Test 3: Display the result
fmt.Println("=== RESULT ===")
fmt.Printf("Image URL: %s\n\n", imageURL)
fmt.Println("Next steps:")
fmt.Println("1. Open the URL in your browser to verify the image")
fmt.Println("2. Send this URL to Kosmi chat via WebSocket")
fmt.Println("3. Kosmi will display it as a thumbnail")
}