Serve community products from local packs

The proxy serves products from local packs (t5de-api's format) under local IDs from 2,000,000,000: product
info and permission answers (with the parent's derivation chain from IMVU), the product's CFL, and the shop's
bundle lookup. Community products are taken out of outfit saves and outfit chat commands before IMVU sees
them, remembered per account with the outfit they belong to, and added back when the client loads that
outfit. Changed requests are re-signed with the session key from the login response.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-10-29 03:17:14 -07:00
1 parent b2eed27b99
commit 887e8a2364
7 files changed
+1177 -21

No files matched your search

+38 -3
View File
@@ -18,10 +18,13 @@ import (
"net"
"net/http"
"os"
"path/filepath"
"strings"
"time"
"git.t5de.dev/t5de/t5de-proxy/internal/buildinfo"
"git.t5de.dev/t5de/t5de-proxy/internal/parent"
"git.t5de.dev/t5de/t5de-proxy/internal/products"
"git.t5de.dev/t5de/t5de-proxy/internal/proxy"
)
@@ -31,6 +34,9 @@ func main() {
parentPID := flag.Int("parent", 0, "exit when this process exits")
logFile := flag.String("log", "", "log file (default: standard error)")
trace := flag.Bool("trace", false, "log full URLs and every IMQ frame")
packs := flag.String("packs", "", "community product packs: directories of packs, separated by "+string(filepath.ListSeparator)+
" (default: %APPDATA%/T5DE/packs and $T5DE_PACKS)")
data := flag.String("data", "", "where the proxy keeps its state (default: %APPDATA%/T5DE/proxy)")
version := flag.Bool("version", false, "print the version and exit")
flag.Parse()
if *version {
@@ -48,13 +54,35 @@ func main() {
out = f
}
logger := log.New(out, "", log.Ldate|log.Ltime|log.Lmicroseconds)
if err := run(logger, *listen, *ready, *parentPID, *trace); err != nil {
if err := run(logger, *listen, *ready, *parentPID, *trace, packDirs(*packs), dataDir(*data)); err != nil {
logger.Printf("t5de-proxy: %v", err)
os.Exit(1)
}
}
func run(logger *log.Logger, listen, ready string, parentPID int, trace bool) error {
// packDirs is where community product packs are: the -packs flag, else T5DE's packs folder and $T5DE_PACKS.
func packDirs(flagValue string) []string {
if flagValue != "" {
return filepath.SplitList(flagValue)
}
var dirs []string
if config, err := os.UserConfigDir(); err == nil {
dirs = append(dirs, filepath.Join(config, "T5DE", "packs"))
}
return append(dirs, filepath.SplitList(os.Getenv("T5DE_PACKS"))...)
}
func dataDir(flagValue string) string {
if flagValue != "" {
return flagValue
}
if config, err := os.UserConfigDir(); err == nil {
return filepath.Join(config, "T5DE", "proxy")
}
return "."
}
func run(logger *log.Logger, listen, ready string, parentPID int, trace bool, packs []string, data string) error {
secret := make([]byte, 24)
if _, err := rand.Read(secret); err != nil {
return err
@@ -78,8 +106,15 @@ func run(logger *log.Logger, listen, ready string, parentPID int, trace bool) er
os.Exit(0)
}()
}
handler := &proxy.Server{Token: token, Log: logger, Trace: trace}
if prods, err := products.New(packs, data, logger.Printf); err != nil {
logger.Printf("community products are off: %v", err)
} else {
handler.Interceptor, handler.IMQFilter = prods, prods
logger.Printf("community products from %s", strings.Join(packs, ", "))
}
server := &http.Server{
Handler: &proxy.Server{Token: token, Log: logger, Trace: trace},
Handler: handler,
ReadHeaderTimeout: 30 * time.Second,
IdleTimeout: 2 * time.Minute,
ErrorLog: logger,