refactor foundry lib structure; add transport classes for db,http,websocket; add action interface instead of multiple function that accepts action classes; add changing foundry status on websocket responses

This commit is contained in:
lbenedar
2026-04-09 18:29:41 +03:00
parent 468e027418
commit fb4e371348
28 changed files with 900 additions and 791 deletions

View File

@@ -42,17 +42,17 @@ var PathToSetupState = map[string]db.StateType{
}
var PathToWorldState = map[string]db.StateType{
JoinPath: db.JoinState,
PlayersPath: db.PlayersState,
JoinPath: db.JoinState,
// PlayersPath: db.PlayersState,
}
type Config struct {
type FoundryHttpRequest struct {
Host string
Password string
SessionID string
}
func (conf *Config) SetSessionTokenFromHeader(resp http.Header) (bool, error) {
func (conf *FoundryHttpRequest) SetSessionTokenFromHeader(resp http.Header) (bool, error) {
setCookieHeader := resp.Get("Set-Cookie")
if setCookieHeader == "" {
return false, nil
@@ -73,7 +73,7 @@ func (conf *Config) SetSessionTokenFromHeader(resp http.Header) (bool, error) {
return false, nil
}
func (conf *Config) GetRequestHeader() *http.Header {
func (conf *FoundryHttpRequest) GetRequestHeader() *http.Header {
header := http.Header{}
header.Set("Cookie", fmt.Sprintf("session=%s", conf.SessionID))
header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")