Macro recorder update, Macro service added (for the panels)

This commit is contained in:
Jesse Malotaux 2025-04-11 14:02:07 +02:00
parent d07b6eb820
commit 4ce03f7a4b
6 changed files with 48 additions and 24 deletions

View file

@ -48,17 +48,21 @@ func ListMacros(w http.ResponseWriter, r *http.Request) {
log.Println(err)
}
var fileNames []string
var macroList []structs.MacroInfo
for _, file := range files {
filename := filepath.Base(file.Name())
filename = strings.TrimSuffix(filename, filepath.Ext(filename))
filename = strings.Replace(filename, "_", " ", -1)
macroname := strings.TrimSuffix(filename, filepath.Ext(filename))
nicename := strings.Replace(macroname, "_", " ", -1)
fileNames = append(fileNames, filename)
log.Println(macroname, nicename)
macroList = append(macroList, structs.MacroInfo{
Name: nicename,
Macroname: macroname,
})
}
json.NewEncoder(w).Encode(fileNames)
json.NewEncoder(w).Encode(macroList)
}
func DeleteMacro(w http.ResponseWriter, r *http.Request) {}

View file

@ -17,3 +17,8 @@ type NewMacro struct {
Name string `json:"name"`
Steps []Step `json:"steps"`
}
type MacroInfo struct {
Name string `json:"name"`
Macroname string `json:"macroname"`
}