Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chat/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.25
require (
github.com/chromedp/chromedp v0.14.2
github.com/livetemplate/livetemplate v0.7.0
github.com/livetemplate/lvt v0.0.0-20251213063335-769e058d10cd
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version of github.com/livetemplate/lvt being added (v0.0.0-20251213063335-769e058d10cd) is newer than the versions used in most other examples. For consistency, consider using the same version that other examples use (v0.0.0-20251130141940-9b94cde94e9d as used in counter, avatar-upload, and todos examples), unless there's a specific reason this example requires a newer version. Version inconsistencies across examples can make maintenance more difficult and may lead to unexpected behavior differences.

Suggested change
github.com/livetemplate/lvt v0.0.0-20251213063335-769e058d10cd
github.com/livetemplate/lvt v0.0.0-20251130141940-9b94cde94e9d

Copilot uses AI. Check for mistakes.
)

require (
Expand Down
2 changes: 2 additions & 0 deletions chat/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/livetemplate/livetemplate v0.7.0 h1:ugpgI+MG/y3QV/moOLaL9A7wc7HVwFw3aeyN3OZ6e00=
github.com/livetemplate/livetemplate v0.7.0/go.mod h1:mTI76skBGEx4jD9pO52L9xBY4/ZDW4muAKWwXnupvtc=
github.com/livetemplate/lvt v0.0.0-20251213063335-769e058d10cd h1:3Ram0HdjMF1gVLvXNJMFw78c3pr9Qfp29W+yFhLVI9A=
github.com/livetemplate/lvt v0.0.0-20251213063335-769e058d10cd/go.mod h1:iqFfvhrJJ51XkGdEFsy5Ze0+nghSL1n6RFq+5EdUEFY=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE=
Expand Down
23 changes: 3 additions & 20 deletions chat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"github.com/livetemplate/livetemplate"
e2etest "github.com/livetemplate/lvt/testing"
)

// ChatController holds shared state (message store) with mutex protection.
Expand Down Expand Up @@ -205,8 +206,8 @@ func main() {
// Mount handler with Controller+State pattern
http.Handle("/", tmpl.Handle(controller, livetemplate.AsState(initialState)))

// Serve client library
http.HandleFunc("/livetemplate-client.js", serveClientLibrary)
// Serve client library (uses embedded client from lvt/testing)
http.HandleFunc("/livetemplate-client.js", e2etest.ServeClientLibrary)

port := os.Getenv("PORT")
if port == "" {
Expand All @@ -224,21 +225,3 @@ func main() {
}
}

func serveClientLibrary(w http.ResponseWriter, r *http.Request) {
paths := []string{
"livetemplate-client.js",
"../client/dist/livetemplate-client.browser.js",
"../../client/dist/livetemplate-client.browser.js",
}

for _, path := range paths {
content, err := os.ReadFile(path)
if err == nil {
w.Header().Set("Content-Type", "application/javascript")
w.Write(content)
return
}
}

http.Error(w, "Client library not found. For production, use CDN: https://cdn.jsdelivr.net/npm/@livefir/livetemplate-client/dist/livetemplate-client.browser.js", http.StatusNotFound)
}
Loading