diff --git a/.air.toml b/.air.toml
new file mode 100644
index 0000000..435a885
--- /dev/null
+++ b/.air.toml
@@ -0,0 +1,17 @@
+# Working directory
+root = "."
+
+# The main Go file
+main = "main.go"
+
+bin = "tmp/main.exe"
+
+# Watching all Go files, excluding certain directories
+[build]
+ cmd = "go build -o ./tmp/main.exe main.go"
+ include_ext = ["go"]
+ exclude_dir = ["fe", "panels", "builds"]
+
+# Restart on file changes
+[log]
+ time = true
diff --git a/.gitignore b/.gitignore
index b428472..345ff6f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,11 @@
.env
config.js
-be/devices/*
-be/tmp/
-be/log.txt
+devices/*
+tmp/
+log.txt
+
+Macrame.exe
public
macros/*
diff --git a/be/app/api.go b/app/api.go
similarity index 98%
rename from be/app/api.go
rename to app/api.go
index af6f3e7..e9c2f84 100644
--- a/be/app/api.go
+++ b/app/api.go
@@ -22,7 +22,7 @@ along with this program. If not, see .
package app
import (
- "be/app/helper"
+ "macrame/app/helper"
"mime"
"net/http"
"path/filepath"
@@ -45,7 +45,7 @@ func ApiCORS(w http.ResponseWriter, r *http.Request) (http.ResponseWriter, *http
}
func ApiGet(w http.ResponseWriter, r *http.Request) {
- root, err := filepath.Abs("../public")
+ root, err := filepath.Abs("public")
if err != nil {
MCRMLog("ApiGet Abs Error: ", err)
return
diff --git a/be/app/device.go b/app/device.go
similarity index 99%
rename from be/app/device.go
rename to app/device.go
index 9a906dd..6352e5f 100644
--- a/be/app/device.go
+++ b/app/device.go
@@ -22,10 +22,10 @@ along with this program. If not, see .
package app
import (
- "be/app/helper"
- "be/app/structs"
"encoding/json"
"fmt"
+ "macrame/app/helper"
+ "macrame/app/structs"
"math/rand"
"net"
"net/http"
diff --git a/be/app/helper/api-helper.go b/app/helper/api-helper.go
similarity index 90%
rename from be/app/helper/api-helper.go
rename to app/helper/api-helper.go
index 10f1bfb..f88106b 100644
--- a/be/app/helper/api-helper.go
+++ b/app/helper/api-helper.go
@@ -1,21 +1,21 @@
/*
-Macrame is a program that enables the user to create keyboard macros and button panels.
-The macros are saved as simple JSON files and can be linked to the button panels. The panels can
+Macrame is a program that enables the user to create keyboard macros and button panels.
+The macros are saved as simple JSON files and can be linked to the button panels. The panels can
be created with HTML and CSS.
Copyright (C) 2025 Jesse Malotaux
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
+You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
@@ -28,8 +28,8 @@ import (
"net/http"
"strings"
- "be/app/structs"
- . "be/app/structs"
+ "macrame/app/structs"
+ . "macrame/app/structs"
)
func EndpointAccess(w http.ResponseWriter, r *http.Request) (bool, string, error) {
diff --git a/be/app/helper/browser-helper.go b/app/helper/browser-helper.go
similarity index 100%
rename from be/app/helper/browser-helper.go
rename to app/helper/browser-helper.go
diff --git a/be/app/helper/device-helper.go b/app/helper/device-helper.go
similarity index 100%
rename from be/app/helper/device-helper.go
rename to app/helper/device-helper.go
diff --git a/be/app/helper/encrypt-helper.go b/app/helper/encrypt-helper.go
similarity index 100%
rename from be/app/helper/encrypt-helper.go
rename to app/helper/encrypt-helper.go
diff --git a/be/app/helper/env-helper.go b/app/helper/env-helper.go
similarity index 83%
rename from be/app/helper/env-helper.go
rename to app/helper/env-helper.go
index 848a78b..28af4d4 100644
--- a/be/app/helper/env-helper.go
+++ b/app/helper/env-helper.go
@@ -1,21 +1,21 @@
/*
-Macrame is a program that enables the user to create keyboard macros and button panels.
-The macros are saved as simple JSON files and can be linked to the button panels. The panels can
+Macrame is a program that enables the user to create keyboard macros and button panels.
+The macros are saved as simple JSON files and can be linked to the button panels. The panels can
be created with HTML and CSS.
Copyright (C) 2025 Jesse Malotaux
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
+You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
@@ -30,9 +30,10 @@ import (
"strings"
)
-var configPath = "../public/config.js"
+var configPath = "public/config.js"
func EnvGet(key string) string {
+
if !configFileExists() {
CreateConfigFile(configPath)
CheckFeDevDir()
@@ -64,9 +65,10 @@ func configFileExists() bool {
func CheckFeDevDir() {
log.Println("Checking FE dev directory...")
- _, err := os.Stat("../fe")
+ _, err := os.Stat("fe")
if err != nil {
+ log.Println("Error checking FE dev directory:", err)
return
}
@@ -74,14 +76,14 @@ func CheckFeDevDir() {
}
func copyConfigToFe() {
- data, err := os.ReadFile("../public/config.js")
+ data, err := os.ReadFile(configPath)
if err != nil {
log.Println("Error reading config.js:", err)
return
}
- if err := os.WriteFile("../fe/config.js", data, 0644); err != nil {
+ if err := os.WriteFile("fe/config.js", data, 0644); err != nil {
log.Println("Error writing config.js:", err)
}
}
diff --git a/be/app/helper/macro-helper.go b/app/helper/macro-helper.go
similarity index 100%
rename from be/app/helper/macro-helper.go
rename to app/helper/macro-helper.go
diff --git a/be/app/helper/translation-helper.go b/app/helper/translation-helper.go
similarity index 100%
rename from be/app/helper/translation-helper.go
rename to app/helper/translation-helper.go
diff --git a/be/app/log.go b/app/log.go
similarity index 100%
rename from be/app/log.go
rename to app/log.go
diff --git a/be/app/macro.go b/app/macro.go
similarity index 87%
rename from be/app/macro.go
rename to app/macro.go
index 0b9f254..5dff9e0 100644
--- a/be/app/macro.go
+++ b/app/macro.go
@@ -1,21 +1,21 @@
/*
-Macrame is a program that enables the user to create keyboard macros and button panels.
-The macros are saved as simple JSON files and can be linked to the button panels. The panels can
+Macrame is a program that enables the user to create keyboard macros and button panels.
+The macros are saved as simple JSON files and can be linked to the button panels. The panels can
be created with HTML and CSS.
Copyright (C) 2025 Jesse Malotaux
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
+You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
@@ -31,8 +31,8 @@ import (
"path/filepath"
"strings"
- "be/app/helper"
- "be/app/structs"
+ "macrame/app/helper"
+ "macrame/app/structs"
)
func CheckMacro(w http.ResponseWriter, r *http.Request) {
@@ -47,7 +47,7 @@ func CheckMacro(w http.ResponseWriter, r *http.Request) {
var filename = helper.FormatMacroFileName(req.Macro)
- macroFile, err := helper.ReadMacroFile(fmt.Sprintf("../macros/%s.json", filename))
+ macroFile, err := helper.ReadMacroFile(fmt.Sprintf("macros/%s.json", filename))
if macroFile != nil && err == nil {
json.NewEncoder(w).Encode(true)
@@ -85,7 +85,7 @@ func SaveMacro(w http.ResponseWriter, r *http.Request) {
return
}
- err = os.WriteFile("../macros/"+helper.FormatMacroFileName(newMacro.Name)+".json", stepsJSON, 0644)
+ err = os.WriteFile("macros/"+helper.FormatMacroFileName(newMacro.Name)+".json", stepsJSON, 0644)
if err != nil {
MCRMLog("SaveMacro WriteFile Error: ", err)
return
@@ -117,7 +117,7 @@ func simplifyMacro(step structs.Step) map[string]interface{} {
}
func ListMacros(w http.ResponseWriter, r *http.Request) {
- dir := "../macros"
+ dir := "macros"
files, err := os.ReadDir(dir)
if err != nil {
MCRMLog("ListMacros ReadDir Error: ", err)
@@ -154,7 +154,7 @@ func DeleteMacro(w http.ResponseWriter, r *http.Request) {
var filename = helper.FormatMacroFileName(req.Macro)
- err = os.Remove("../macros/" + filename + ".json")
+ err = os.Remove("macros/" + filename + ".json")
if err != nil {
MCRMLog("DeleteMacro Remove Error: ", err)
@@ -180,7 +180,7 @@ func PlayMacro(data string, w http.ResponseWriter, r *http.Request) {
MCRMLog("Playing Macro: ", macro)
var filename = helper.FormatMacroFileName(macro)
- var filepath = fmt.Sprintf("../macros/%s.json", filename)
+ var filepath = fmt.Sprintf("macros/%s.json", filename)
macroFile, err := helper.ReadMacroFile(filepath)
if err != nil {
@@ -208,7 +208,7 @@ func OpenMacro(w http.ResponseWriter, r *http.Request) {
return
}
- macroFile, err := helper.ReadMacroFile(fmt.Sprintf("../macros/%s.json", req.Macro))
+ macroFile, err := helper.ReadMacroFile(fmt.Sprintf("macros/%s.json", req.Macro))
if err != nil {
MCRMLog("OpenMacro ReadMacroFile Error: ", err)
diff --git a/be/app/panel.go b/app/panel.go
similarity index 85%
rename from be/app/panel.go
rename to app/panel.go
index e642ce4..9c4a15f 100644
--- a/be/app/panel.go
+++ b/app/panel.go
@@ -1,38 +1,38 @@
/*
-Macrame is a program that enables the user to create keyboard macros and button panels.
-The macros are saved as simple JSON files and can be linked to the button panels. The panels can
+Macrame is a program that enables the user to create keyboard macros and button panels.
+The macros are saved as simple JSON files and can be linked to the button panels. The panels can
be created with HTML and CSS.
Copyright (C) 2025 Jesse Malotaux
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
+You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
package app
import (
- "be/app/helper"
- "be/app/structs"
"encoding/base64"
"encoding/json"
+ "macrame/app/helper"
+ "macrame/app/structs"
"net/http"
"os"
"strings"
)
func PanelList(w http.ResponseWriter, r *http.Request) {
- panelDirs, err := os.ReadDir("../panels")
+ panelDirs, err := os.ReadDir("panels")
if err != nil {
MCRMLog("PanelList ReadDir Error: ", err)
json.NewEncoder(w).Encode(false)
@@ -59,7 +59,7 @@ func PanelList(w http.ResponseWriter, r *http.Request) {
func getPanelInfo(dirname string) structs.PanelInfo {
var panelInfo structs.PanelInfo
- jsonFile, err := os.ReadFile("../panels/" + dirname + "/panel.json")
+ jsonFile, err := os.ReadFile("panels/" + dirname + "/panel.json")
if err != nil {
panelInfo.Name = strings.Replace(dirname, "_", " ", -1)
@@ -86,7 +86,7 @@ func getPanelThumb(dirname string) string {
for _, ext := range extensions {
filename := "thumbnail" + ext
- file, err := os.Open("../panels/" + dirname + "/" + filename)
+ file, err := os.Open("panels/" + dirname + "/" + filename)
if err != nil {
MCRMLog("getPanelThumb Open Error: ", err)
continue
@@ -100,8 +100,8 @@ func getPanelThumb(dirname string) string {
}
func getPanelCode(dirname string) (html string, css string) {
- htmlBytes, _ := os.ReadFile("../panels/" + dirname + "/index.html")
- cssBytes, _ := os.ReadFile("../panels/" + dirname + "/output.css")
+ htmlBytes, _ := os.ReadFile("panels/" + dirname + "/index.html")
+ cssBytes, _ := os.ReadFile("panels/" + dirname + "/output.css")
return string(htmlBytes), string(cssBytes)
}
@@ -153,7 +153,7 @@ func SavePanelJSON(w http.ResponseWriter, r *http.Request) {
return
}
- filePath := "../panels/" + req.Dir + "/panel.json"
+ filePath := "panels/" + req.Dir + "/panel.json"
req.Dir = ""
diff --git a/be/app/structs/api-struct.go b/app/structs/api-struct.go
similarity index 100%
rename from be/app/structs/api-struct.go
rename to app/structs/api-struct.go
diff --git a/be/app/structs/device-struct.go b/app/structs/device-struct.go
similarity index 100%
rename from be/app/structs/device-struct.go
rename to app/structs/device-struct.go
diff --git a/be/app/structs/macro-struct.go b/app/structs/macro-struct.go
similarity index 100%
rename from be/app/structs/macro-struct.go
rename to app/structs/macro-struct.go
diff --git a/be/app/structs/panel-struct.go b/app/structs/panel-struct.go
similarity index 100%
rename from be/app/structs/panel-struct.go
rename to app/structs/panel-struct.go
diff --git a/be/app/systray.go b/app/systray.go
similarity index 97%
rename from be/app/systray.go
rename to app/systray.go
index edd88e9..2c4d819 100644
--- a/be/app/systray.go
+++ b/app/systray.go
@@ -1,7 +1,7 @@
package app
import (
- "be/app/helper"
+ "macrame/app/helper"
"os"
"github.com/getlantern/systray"
diff --git a/be/.air.toml b/be/.air.toml
deleted file mode 100644
index 6b2c951..0000000
--- a/be/.air.toml
+++ /dev/null
@@ -1,52 +0,0 @@
-root = "."
-testdata_dir = "testdata"
-tmp_dir = "tmp"
-
-[build]
- args_bin = []
- bin = "tmp\\main.exe"
- cmd = "go build -o ./tmp/main.exe ."
- delay = 1000
- exclude_dir = ["assets", "tmp", "vendor", "testdata"]
- exclude_file = []
- exclude_regex = ["_test.go"]
- exclude_unchanged = false
- follow_symlink = false
- full_bin = ""
- include_dir = []
- include_ext = ["go", "tpl", "tmpl", "html"]
- include_file = []
- kill_delay = "0s"
- log = "build-errors.log"
- poll = false
- poll_interval = 0
- post_cmd = []
- pre_cmd = []
- rerun = false
- rerun_delay = 500
- send_interrupt = false
- stop_on_error = false
-
-[color]
- app = ""
- build = "yellow"
- main = "magenta"
- runner = "green"
- watcher = "cyan"
-
-[log]
- main_only = false
- silent = false
- time = false
-
-[misc]
- clean_on_exit = false
-
-[proxy]
- app_port = 0
- enabled = false
- proxy_port = 0
-
-[screen]
- clear_on_rebuild = false
- keep_scroll = true
diff --git a/be/Macrame.exe b/be/Macrame.exe
deleted file mode 100644
index 297348f..0000000
Binary files a/be/Macrame.exe and /dev/null differ
diff --git a/be/Setup.exe b/be/Setup.exe
deleted file mode 100644
index bbc0315..0000000
Binary files a/be/Setup.exe and /dev/null differ
diff --git a/be/main.exe b/be/main.exe
deleted file mode 100644
index d0d3fe6..0000000
Binary files a/be/main.exe and /dev/null differ
diff --git a/be/setup/setup.go b/be/setup/setup.go
deleted file mode 100644
index 5ca5505..0000000
--- a/be/setup/setup.go
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-Macrame is a program that enables the user to create keyboard macros and button panels.
-The macros are saved as simple JSON files and can be linked to the button panels. The panels can
-be created with HTML and CSS.
-
-Copyright (C) 2025 Jesse Malotaux
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-*/
-
-package main
-
-import "be/app/helper"
-
-func main() {
- helper.CreateConfigFile("../public/config.js")
- helper.CheckFeDevDir()
-
- return
-}
diff --git a/be/favicon.ico b/favicon.ico
similarity index 100%
rename from be/favicon.ico
rename to favicon.ico
diff --git a/be/go.mod b/go.mod
similarity index 94%
rename from be/go.mod
rename to go.mod
index f911b3c..369a50c 100644
--- a/be/go.mod
+++ b/go.mod
@@ -1,8 +1,11 @@
-module be
+module macrame
-go 1.24.0
+go 1.24.1
-require github.com/go-vgo/robotgo v0.110.7
+require (
+ github.com/getlantern/systray v1.2.2
+ github.com/go-vgo/robotgo v0.110.7
+)
require (
github.com/dblohm7/wingoes v0.0.0-20240820181039-f2b84150679e // indirect
@@ -14,7 +17,6 @@ require (
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7 // indirect
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 // indirect
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f // indirect
- github.com/getlantern/systray v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
diff --git a/be/go.sum b/go.sum
similarity index 100%
rename from be/go.sum
rename to go.sum
diff --git a/be/main.go b/main.go
similarity index 89%
rename from be/main.go
rename to main.go
index ecbb126..fcbdd69 100644
--- a/be/main.go
+++ b/main.go
@@ -25,16 +25,15 @@ import (
"log"
"net/http"
"os"
- "strings"
- "be/app"
- "be/app/helper"
+ "macrame/app"
+ "macrame/app/helper"
)
func main() {
app.MCRMLogInit()
- switchToBeDir()
+ switchDir()
if helper.EnvGet("MCRM__PORT") == "" {
app.MCRMLog("Error: MCRM__PORT is not set")
@@ -53,17 +52,14 @@ func main() {
app.MCRMLog(http.ListenAndServe(":"+helper.EnvGet("MCRM__PORT"), nil))
}
-func switchToBeDir() {
+func switchDir() {
cwd, err := os.Getwd()
+
if err != nil {
log.Fatal(err)
}
- if !strings.HasSuffix(cwd, "be") {
- err := os.Chdir("be")
- if err != nil {
- log.Fatal(err)
- }
- }
+
+ log.Println(cwd)
}
func apiInit(w http.ResponseWriter, r *http.Request) {