mirror of
https://github.com/Macrame-App/Macrame
synced 2025-12-29 07:19:26 +00:00
commit
38fc8ee387
34 changed files with 369 additions and 451 deletions
17
.air.toml
Normal file
17
.air.toml
Normal file
|
|
@ -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
|
||||||
8
.gitignore
vendored
8
.gitignore
vendored
|
|
@ -1,9 +1,11 @@
|
||||||
.env
|
.env
|
||||||
config.js
|
config.js
|
||||||
|
|
||||||
be/devices/*
|
devices/*
|
||||||
be/tmp/
|
tmp/
|
||||||
be/log.txt
|
log.txt
|
||||||
|
|
||||||
|
Macrame.exe
|
||||||
|
|
||||||
public
|
public
|
||||||
macros/*
|
macros/*
|
||||||
|
|
|
||||||
BIN
Macrame.lnk
BIN
Macrame.lnk
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 100 KiB |
|
|
@ -22,7 +22,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"be/app/helper"
|
"macrame/app/helper"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"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) {
|
func ApiGet(w http.ResponseWriter, r *http.Request) {
|
||||||
root, err := filepath.Abs("../public")
|
root, err := filepath.Abs("public")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
MCRMLog("ApiGet Abs Error: ", err)
|
MCRMLog("ApiGet Abs Error: ", err)
|
||||||
return
|
return
|
||||||
|
|
@ -96,7 +96,7 @@ func ApiPost(w http.ResponseWriter, r *http.Request) {
|
||||||
case "/macro/play":
|
case "/macro/play":
|
||||||
PlayMacro("", w, r)
|
PlayMacro("", w, r)
|
||||||
case "/device/server/ip":
|
case "/device/server/ip":
|
||||||
GetServerIP(w, r)
|
ListServerIP(w)
|
||||||
case "/device/list":
|
case "/device/list":
|
||||||
DeviceList(w, r)
|
DeviceList(w, r)
|
||||||
case "/device/access/check":
|
case "/device/access/check":
|
||||||
|
|
@ -22,10 +22,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"be/app/helper"
|
|
||||||
"be/app/structs"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"macrame/app/helper"
|
||||||
|
"macrame/app/structs"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
@ -35,11 +35,22 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetServerIP(w http.ResponseWriter, r *http.Request) {
|
func ListServerIP(w http.ResponseWriter) {
|
||||||
|
ip, err := GetServerIp()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
MCRMLog("GetServerIP err: ", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
json.NewEncoder(w).Encode(ip)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetServerIp() (string, error) {
|
||||||
ifs, err := net.Interfaces()
|
ifs, err := net.Interfaces()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
MCRMLog(err)
|
MCRMLog(err)
|
||||||
return
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, ifi := range ifs {
|
for _, ifi := range ifs {
|
||||||
|
|
@ -78,10 +89,11 @@ func GetServerIP(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Found a good IP, return it
|
// Found a good IP, return it
|
||||||
json.NewEncoder(w).Encode(ip.String())
|
return ip.String(), nil
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return "", fmt.Errorf("No IP found")
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeviceList(w http.ResponseWriter, r *http.Request) {
|
func DeviceList(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
@ -28,8 +28,8 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"be/app/structs"
|
"macrame/app/structs"
|
||||||
. "be/app/structs"
|
. "macrame/app/structs"
|
||||||
)
|
)
|
||||||
|
|
||||||
func EndpointAccess(w http.ResponseWriter, r *http.Request) (bool, string, error) {
|
func EndpointAccess(w http.ResponseWriter, r *http.Request) (bool, string, error) {
|
||||||
|
|
@ -30,9 +30,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var configPath = "../public/config.js"
|
var configPath = "public/config.js"
|
||||||
|
|
||||||
func EnvGet(key string) string {
|
func EnvGet(key string) string {
|
||||||
|
|
||||||
if !configFileExists() {
|
if !configFileExists() {
|
||||||
CreateConfigFile(configPath)
|
CreateConfigFile(configPath)
|
||||||
CheckFeDevDir()
|
CheckFeDevDir()
|
||||||
|
|
@ -64,9 +65,10 @@ func configFileExists() bool {
|
||||||
|
|
||||||
func CheckFeDevDir() {
|
func CheckFeDevDir() {
|
||||||
log.Println("Checking FE dev directory...")
|
log.Println("Checking FE dev directory...")
|
||||||
_, err := os.Stat("../fe")
|
_, err := os.Stat("fe")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println("Error checking FE dev directory:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,14 +76,14 @@ func CheckFeDevDir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyConfigToFe() {
|
func copyConfigToFe() {
|
||||||
data, err := os.ReadFile("../public/config.js")
|
data, err := os.ReadFile(configPath)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error reading config.js:", err)
|
log.Println("Error reading config.js:", err)
|
||||||
return
|
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)
|
log.Println("Error writing config.js:", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
101
app/helper/translation-helper.go
Normal file
101
app/helper/translation-helper.go
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*
|
||||||
|
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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package helper
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var translations = map[string]string{
|
||||||
|
"ArrowUp": "up",
|
||||||
|
"ArrowDown": "down",
|
||||||
|
"ArrowRight": "right",
|
||||||
|
"ArrowLeft": "left",
|
||||||
|
"Meta": "cmd",
|
||||||
|
"MetaLeft": "lcmd",
|
||||||
|
"MetaRight": "rcmd",
|
||||||
|
"Alt": "alt",
|
||||||
|
"AltLeft": "lalt",
|
||||||
|
"AltRight": "ralt",
|
||||||
|
"Control": "ctrl",
|
||||||
|
"ControlLeft": "lctrl",
|
||||||
|
"ControlRight": "rctrl",
|
||||||
|
"Shift": "shift",
|
||||||
|
"ShiftLeft": "lshift",
|
||||||
|
"ShiftRight": "rshift",
|
||||||
|
"AudioVolumeMute": "audio_mute",
|
||||||
|
"AudioVolumeDown": "audio_vol_down",
|
||||||
|
"AudioVolumeUp": "audio_vol_up",
|
||||||
|
"MediaTrackPrevious": "audio_prev",
|
||||||
|
"MediaTrackNext": "audio_next",
|
||||||
|
"MediaPlayPause": "audio_play|audio_pause",
|
||||||
|
"Numpad0": "num0",
|
||||||
|
"Numpad1": "num1",
|
||||||
|
"Numpad2": "num2",
|
||||||
|
"Numpad3": "num3",
|
||||||
|
"Numpad4": "num4",
|
||||||
|
"Numpad5": "num5",
|
||||||
|
"Numpad6": "num6",
|
||||||
|
"Numpad7": "num7",
|
||||||
|
"Numpad8": "num8",
|
||||||
|
"Numpad9": "num9",
|
||||||
|
"NumLock": "num_lock",
|
||||||
|
"NumpadDecimal": "num.",
|
||||||
|
"NumpadAdd": "num+",
|
||||||
|
"NumpadSubtract": "num-",
|
||||||
|
"NumpadMultiply": "num*",
|
||||||
|
"NumpadDivide": "num/",
|
||||||
|
"NumpadEnter": "num_enter",
|
||||||
|
"Clear": "num_clear",
|
||||||
|
"BracketLeft": "[",
|
||||||
|
"BracketRight": "]",
|
||||||
|
"Quote": "'",
|
||||||
|
"Semicolon": ";",
|
||||||
|
"Backquote": "`",
|
||||||
|
"Backslash": "\\",
|
||||||
|
"IntlBackslash": "\\",
|
||||||
|
"Slash": "/",
|
||||||
|
"Comma": ",",
|
||||||
|
"Period": ".",
|
||||||
|
"Equal": "=",
|
||||||
|
"Minus": "-",
|
||||||
|
}
|
||||||
|
|
||||||
|
func Translate(code string) string {
|
||||||
|
if val, ok := translations[code]; ok {
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
return strings.ToLower(code)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ReverseTranslate(name string) string {
|
||||||
|
if name == "\\" {
|
||||||
|
return "Backslash"
|
||||||
|
}
|
||||||
|
|
||||||
|
for key, value := range translations {
|
||||||
|
if value == name {
|
||||||
|
return key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
|
@ -31,8 +31,8 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"be/app/helper"
|
"macrame/app/helper"
|
||||||
"be/app/structs"
|
"macrame/app/structs"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CheckMacro(w http.ResponseWriter, r *http.Request) {
|
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)
|
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 {
|
if macroFile != nil && err == nil {
|
||||||
json.NewEncoder(w).Encode(true)
|
json.NewEncoder(w).Encode(true)
|
||||||
|
|
@ -85,7 +85,7 @@ func SaveMacro(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
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 {
|
if err != nil {
|
||||||
MCRMLog("SaveMacro WriteFile Error: ", err)
|
MCRMLog("SaveMacro WriteFile Error: ", err)
|
||||||
return
|
return
|
||||||
|
|
@ -117,7 +117,7 @@ func simplifyMacro(step structs.Step) map[string]interface{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ListMacros(w http.ResponseWriter, r *http.Request) {
|
func ListMacros(w http.ResponseWriter, r *http.Request) {
|
||||||
dir := "../macros"
|
dir := "macros"
|
||||||
files, err := os.ReadDir(dir)
|
files, err := os.ReadDir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
MCRMLog("ListMacros ReadDir Error: ", err)
|
MCRMLog("ListMacros ReadDir Error: ", err)
|
||||||
|
|
@ -154,7 +154,7 @@ func DeleteMacro(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
var filename = helper.FormatMacroFileName(req.Macro)
|
var filename = helper.FormatMacroFileName(req.Macro)
|
||||||
|
|
||||||
err = os.Remove("../macros/" + filename + ".json")
|
err = os.Remove("macros/" + filename + ".json")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
MCRMLog("DeleteMacro Remove Error: ", err)
|
MCRMLog("DeleteMacro Remove Error: ", err)
|
||||||
|
|
@ -180,7 +180,7 @@ func PlayMacro(data string, w http.ResponseWriter, r *http.Request) {
|
||||||
MCRMLog("Playing Macro: ", macro)
|
MCRMLog("Playing Macro: ", macro)
|
||||||
|
|
||||||
var filename = helper.FormatMacroFileName(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)
|
macroFile, err := helper.ReadMacroFile(filepath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -208,7 +208,7 @@ func OpenMacro(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
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 {
|
if err != nil {
|
||||||
MCRMLog("OpenMacro ReadMacroFile Error: ", err)
|
MCRMLog("OpenMacro ReadMacroFile Error: ", err)
|
||||||
|
|
@ -22,17 +22,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"be/app/helper"
|
|
||||||
"be/app/structs"
|
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"macrame/app/helper"
|
||||||
|
"macrame/app/structs"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func PanelList(w http.ResponseWriter, r *http.Request) {
|
func PanelList(w http.ResponseWriter, r *http.Request) {
|
||||||
panelDirs, err := os.ReadDir("../panels")
|
panelDirs, err := os.ReadDir("panels")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
MCRMLog("PanelList ReadDir Error: ", err)
|
MCRMLog("PanelList ReadDir Error: ", err)
|
||||||
json.NewEncoder(w).Encode(false)
|
json.NewEncoder(w).Encode(false)
|
||||||
|
|
@ -59,7 +59,7 @@ func PanelList(w http.ResponseWriter, r *http.Request) {
|
||||||
func getPanelInfo(dirname string) structs.PanelInfo {
|
func getPanelInfo(dirname string) structs.PanelInfo {
|
||||||
var panelInfo 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 {
|
if err != nil {
|
||||||
panelInfo.Name = strings.Replace(dirname, "_", " ", -1)
|
panelInfo.Name = strings.Replace(dirname, "_", " ", -1)
|
||||||
|
|
@ -86,7 +86,7 @@ func getPanelThumb(dirname string) string {
|
||||||
|
|
||||||
for _, ext := range extensions {
|
for _, ext := range extensions {
|
||||||
filename := "thumbnail" + ext
|
filename := "thumbnail" + ext
|
||||||
file, err := os.Open("../panels/" + dirname + "/" + filename)
|
file, err := os.Open("panels/" + dirname + "/" + filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
MCRMLog("getPanelThumb Open Error: ", err)
|
MCRMLog("getPanelThumb Open Error: ", err)
|
||||||
continue
|
continue
|
||||||
|
|
@ -100,8 +100,8 @@ func getPanelThumb(dirname string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPanelCode(dirname string) (html string, css string) {
|
func getPanelCode(dirname string) (html string, css string) {
|
||||||
htmlBytes, _ := os.ReadFile("../panels/" + dirname + "/index.html")
|
htmlBytes, _ := os.ReadFile("panels/" + dirname + "/index.html")
|
||||||
cssBytes, _ := os.ReadFile("../panels/" + dirname + "/output.css")
|
cssBytes, _ := os.ReadFile("panels/" + dirname + "/output.css")
|
||||||
|
|
||||||
return string(htmlBytes), string(cssBytes)
|
return string(htmlBytes), string(cssBytes)
|
||||||
}
|
}
|
||||||
|
|
@ -153,7 +153,7 @@ func SavePanelJSON(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
filePath := "../panels/" + req.Dir + "/panel.json"
|
filePath := "panels/" + req.Dir + "/panel.json"
|
||||||
|
|
||||||
req.Dir = ""
|
req.Dir = ""
|
||||||
|
|
||||||
64
app/systray.go
Normal file
64
app/systray.go
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"macrame/app/helper"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/getlantern/systray"
|
||||||
|
)
|
||||||
|
|
||||||
|
func InitSystray() {
|
||||||
|
go func() {
|
||||||
|
systray.Run(OnReady, OnExit)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func OnReady() {
|
||||||
|
systray.SetIcon(getIcon("favicon.ico"))
|
||||||
|
systray.SetTitle("Macrame")
|
||||||
|
systray.SetTooltip("Macrame - Server")
|
||||||
|
|
||||||
|
ip, err := GetServerIp()
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
systray.AddMenuItem("IP: "+ip+":"+helper.EnvGet("MCRM__PORT"), "Server IP")
|
||||||
|
}
|
||||||
|
|
||||||
|
systray.AddSeparator()
|
||||||
|
|
||||||
|
addMCRMItem("Dashboard", "/")
|
||||||
|
addMCRMItem("Panels", "/panels")
|
||||||
|
addMCRMItem("Macros", "/macros")
|
||||||
|
addMCRMItem("Devices", "/devices")
|
||||||
|
|
||||||
|
systray.AddSeparator()
|
||||||
|
|
||||||
|
mQuit := systray.AddMenuItem("Quit Macrame", "Quit Macrame")
|
||||||
|
go func() {
|
||||||
|
<-mQuit.ClickedCh
|
||||||
|
os.Exit(0)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func addMCRMItem(name, urlPath string) {
|
||||||
|
m := systray.AddMenuItem(name, name)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
<-m.ClickedCh
|
||||||
|
helper.OpenBrowser("http://localhost:" + helper.EnvGet("MCRM__PORT") + urlPath)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func OnExit() {
|
||||||
|
systray.Quit()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getIcon(path string) []byte {
|
||||||
|
icon, err := os.ReadFile(path)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
MCRMLog("getIcon Error: ", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return icon
|
||||||
|
}
|
||||||
52
be/.air.toml
52
be/.air.toml
|
|
@ -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
|
|
||||||
BIN
be/Macrame.exe
BIN
be/Macrame.exe
Binary file not shown.
BIN
be/Setup.exe
BIN
be/Setup.exe
Binary file not shown.
|
|
@ -1,203 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package helper
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
var translations = map[string]string{
|
|
||||||
"ArrowUp": "up",
|
|
||||||
"ArrowDown": "down",
|
|
||||||
"ArrowRight": "right",
|
|
||||||
"ArrowLeft": "left",
|
|
||||||
"Meta": "cmd",
|
|
||||||
"MetaLeft": "lcmd",
|
|
||||||
"MetaRight": "rcmd",
|
|
||||||
"Alt": "alt",
|
|
||||||
"AltLeft": "lalt",
|
|
||||||
"AltRight": "ralt",
|
|
||||||
"Control": "ctrl",
|
|
||||||
"ControlLeft": "lctrl",
|
|
||||||
"ControlRight": "rctrl",
|
|
||||||
"Shift": "shift",
|
|
||||||
"ShiftLeft": "lshift",
|
|
||||||
"ShiftRight": "rshift",
|
|
||||||
"AudioVolumeMute": "audio_mute",
|
|
||||||
"AudioVolumeDown": "audio_vol_down",
|
|
||||||
"AudioVolumeUp": "audio_vol_up",
|
|
||||||
"MediaTrackPrevious": "audio_prev",
|
|
||||||
"MediaTrackNext": "audio_next",
|
|
||||||
"MediaPlayPause": "audio_play|audio_pause",
|
|
||||||
"Numpad0": "num0",
|
|
||||||
"Numpad1": "num1",
|
|
||||||
"Numpad2": "num2",
|
|
||||||
"Numpad3": "num3",
|
|
||||||
"Numpad4": "num4",
|
|
||||||
"Numpad5": "num5",
|
|
||||||
"Numpad6": "num6",
|
|
||||||
"Numpad7": "num7",
|
|
||||||
"Numpad8": "num8",
|
|
||||||
"Numpad9": "num9",
|
|
||||||
"NumLock": "num_lock",
|
|
||||||
"NumpadDecimal": "num.",
|
|
||||||
"NumpadAdd": "num+",
|
|
||||||
"NumpadSubtract": "num-",
|
|
||||||
"NumpadMultiply": "num*",
|
|
||||||
"NumpadDivide": "num/",
|
|
||||||
"NumpadEnter": "num_enter",
|
|
||||||
"Clear": "num_clear",
|
|
||||||
"BracketLeft": "[",
|
|
||||||
"BracketRight": "]",
|
|
||||||
"Quote": "'",
|
|
||||||
"Semicolon": ";",
|
|
||||||
"Backquote": "`",
|
|
||||||
"Backslash": "\",
|
|
||||||
"IntlBackslash": "\",
|
|
||||||
"Slash": "/",
|
|
||||||
"Comma": ",",
|
|
||||||
"Period": ".",
|
|
||||||
"Equal": "=",
|
|
||||||
"Minus": "-",
|
|
||||||
}
|
|
||||||
|
|
||||||
func Translate(code string) string {
|
|
||||||
if val, ok := translations[code]; ok {
|
|
||||||
return val
|
|
||||||
}
|
|
||||||
return strings.ToLower(code)
|
|
||||||
}
|
|
||||||
|
|
||||||
func ReverseTranslate(name string) string {
|
|
||||||
if name == "\" {
|
|
||||||
return "Backslash"
|
|
||||||
}
|
|
||||||
|
|
||||||
for key, value := range translations {
|
|
||||||
if value == name {
|
|
||||||
return key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return name
|
|
||||||
}
|
|
||||||
|
|
||||||
// func Translate(code string) string {
|
|
||||||
// translations := map[string]string{
|
|
||||||
// "ArrowUp": "up",
|
|
||||||
// "ArrowDown": "down",
|
|
||||||
// "ArrowRight": "right",
|
|
||||||
// "ArrowLeft": "left",
|
|
||||||
// "Meta": "cmd",
|
|
||||||
// "MetaLeft": "lcmd",
|
|
||||||
// "MetaRight": "rcmd",
|
|
||||||
// "Alt": "alt",
|
|
||||||
// "AltLeft": "lalt",
|
|
||||||
// "AltRight": "ralt",
|
|
||||||
// "Control": "ctrl",
|
|
||||||
// "ControlLeft": "lctrl",
|
|
||||||
// "ControlRight": "rctrl",
|
|
||||||
// "Shift": "shift",
|
|
||||||
// "ShiftLeft": "lshift",
|
|
||||||
// "ShiftRight": "rshift",
|
|
||||||
// "AudioVolumeMute": "audio_mute",
|
|
||||||
// "AudioVolumeDown": "audio_vol_down",
|
|
||||||
// "AudioVolumeUp": "audio_vol_up",
|
|
||||||
// "MediaTrackPrevious": "audio_prev",
|
|
||||||
// "MediaTrackNext": "audio_next",
|
|
||||||
// "MediaPlayPause": "audio_play|audio_pause",
|
|
||||||
// "Numpad0": "num0",
|
|
||||||
// "Numpad1": "num1",
|
|
||||||
// "Numpad2": "num2",
|
|
||||||
// "Numpad3": "num3",
|
|
||||||
// "Numpad4": "num4",
|
|
||||||
// "Numpad5": "num5",
|
|
||||||
// "Numpad6": "num6",
|
|
||||||
// "Numpad7": "num7",
|
|
||||||
// "Numpad8": "num8",
|
|
||||||
// "Numpad9": "num9",
|
|
||||||
// "NumLock": "num_lock",
|
|
||||||
// "NumpadDecimal": "num.",
|
|
||||||
// "NumpadAdd": "num+",
|
|
||||||
// "NumpadSubtract": "num-",
|
|
||||||
// "NumpadMultiply": "num*",
|
|
||||||
// "NumpadDivide": "num/",
|
|
||||||
// "NumpadEnter": "num_enter",
|
|
||||||
// "Clear": "num_clear",
|
|
||||||
// "BracketLeft": "[",
|
|
||||||
// "BracketRight": "]",
|
|
||||||
// "Quote": "'",
|
|
||||||
// "Semicolon": ";",
|
|
||||||
// "Backquote": "`",
|
|
||||||
// "Backslash": "\",
|
|
||||||
// "IntlBackslash": "\",
|
|
||||||
// "Slash": "/",
|
|
||||||
// "Comma": ",",
|
|
||||||
// "Period": ".",
|
|
||||||
// "Equal": "=",
|
|
||||||
// "Minus": "-",
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if translations[code] == "" {
|
|
||||||
// return strings.ToLower(code)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return translations[code]
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Redundant translation because tolower can be used
|
|
||||||
// "Backspace": "backspace",
|
|
||||||
// "Delete": "delete",
|
|
||||||
// "Enter": "enter",
|
|
||||||
// "Tab": "tab",
|
|
||||||
// "Escape": "esc",
|
|
||||||
// "Home": "home",
|
|
||||||
// "End": "end",
|
|
||||||
// "PageUp": "pageup",
|
|
||||||
// "PageDown": "pagedown",
|
|
||||||
// "F1": "f1",
|
|
||||||
// "F2": "f2",
|
|
||||||
// "F3": "f3",
|
|
||||||
// "F4": "f4",
|
|
||||||
// "F5": "f5",
|
|
||||||
// "F6": "f6",
|
|
||||||
// "F7": "f7",
|
|
||||||
// "F8": "f8",
|
|
||||||
// "F9": "f9",
|
|
||||||
// "F10": "f10",
|
|
||||||
// "F11": "f11",
|
|
||||||
// "F12": "f12",
|
|
||||||
// "F13": "f13",
|
|
||||||
// "F14": "f14",
|
|
||||||
// "F15": "f15",
|
|
||||||
// "F16": "f16",
|
|
||||||
// "F17": "f17",
|
|
||||||
// "F18": "f18",
|
|
||||||
// "F19": "f19",
|
|
||||||
// "F20": "f20",
|
|
||||||
// "F21": "f21",
|
|
||||||
// "F22": "f22",
|
|
||||||
// "F23": "f23",
|
|
||||||
// "F24": "f24",
|
|
||||||
// "CapsLock": "capslock",
|
|
||||||
// "Space": "space",
|
|
||||||
// "PrintScreen": "printscreen",
|
|
||||||
// "Insert": "insert",
|
|
||||||
BIN
be/main.exe
BIN
be/main.exe
Binary file not shown.
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import "be/app/helper"
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
helper.CreateConfigFile("../public/config.js")
|
|
||||||
helper.CheckFeDevDir()
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
20
build.sh
20
build.sh
|
|
@ -4,32 +4,30 @@
|
||||||
BUILD_DIR="Macrame_$(date +'%m%d%H%M%S')"
|
BUILD_DIR="Macrame_$(date +'%m%d%H%M%S')"
|
||||||
|
|
||||||
# Build the Go application
|
# Build the Go application
|
||||||
cd be
|
go build -ldflags "-H=windowsgui" -o Macrame.exe main.go
|
||||||
go build -o Macrame.exe main.go
|
|
||||||
go build -o Setup.exe setup/setup.go
|
|
||||||
|
|
||||||
# Build the frontend
|
# Build the frontend
|
||||||
cd ../fe
|
cd fe
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
cd ../builds
|
cd ../builds
|
||||||
|
|
||||||
# Create the new build directory
|
# Create the new build directory
|
||||||
mkdir $BUILD_DIR
|
mkdir $BUILD_DIR
|
||||||
mkdir $BUILD_DIR/be
|
|
||||||
mkdir $BUILD_DIR/macros
|
mkdir $BUILD_DIR/macros
|
||||||
mkdir $BUILD_DIR/panels
|
mkdir $BUILD_DIR/panels
|
||||||
|
mkdir $BUILD_DIR/panels/test_panel
|
||||||
mkdir $BUILD_DIR/public
|
mkdir $BUILD_DIR/public
|
||||||
|
mkdir $BUILD_DIR/public/assets
|
||||||
|
|
||||||
# Move the generated files to the new build directory
|
# Move the generated files to the new build directory
|
||||||
cp ../be/Macrame.exe $BUILD_DIR/be/Macrame.exe
|
cp ../Macrame.exe $BUILD_DIR/Macrame.exe
|
||||||
cp ../be/Setup.exe $BUILD_DIR/be/Setup.exe
|
cp ../favicon.ico $BUILD_DIR/favicon.ico
|
||||||
cp -r ../macros/* $BUILD_DIR/macros/
|
find ../macros -type f ! -name 'ED-*' -exec cp --parents {} "$BUILD_DIR/macros/" \;
|
||||||
cp -r ../panels/* $BUILD_DIR/panels/
|
cp -r ../panels/test_panel/* $BUILD_DIR/panels/test_panel/
|
||||||
mv ../public/* $BUILD_DIR/public/
|
mv ../public/* $BUILD_DIR/public/
|
||||||
|
|
||||||
cp ../install.bat $BUILD_DIR/install.bat
|
# cp ../install.bat $BUILD_DIR/install.bat
|
||||||
cp ../Macrame.lnk $BUILD_DIR/Macrame.lnk
|
|
||||||
|
|
||||||
powershell -Command "Compress-Archive -Path $BUILD_DIR/* -DestinationPath $BUILD_DIR.zip -Force"
|
powershell -Command "Compress-Archive -Path $BUILD_DIR/* -DestinationPath $BUILD_DIR.zip -Force"
|
||||||
|
|
||||||
|
|
|
||||||
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 191 KiB |
|
|
@ -34,8 +34,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
<RemoteView v-else />
|
<RemoteView v-else />
|
||||||
<div class="grid gap-2 text-slate-300">
|
<div class="grid gap-2 text-slate-300">
|
||||||
<h3>About Macrame</h3>
|
<h3>About Macrame</h3>
|
||||||
<p>Macrame is an open-source application designed to turn any device into a customizable button panel. Whether you're optimizing your workflow or enhancing your gaming experience, Macrame makes it simple to create and link macros to your button panels.</p>
|
<p>
|
||||||
<p>For more information, including details on licensing, visit <a href="https://macrame.github.io" target="_blank">https://macrame.github.io</a></p>
|
Macrame is an open-source application designed to turn any device into a customizable
|
||||||
|
button panel. Whether you're optimizing your workflow or enhancing your gaming experience,
|
||||||
|
Macrame makes it simple to create and link macros to your button panels.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
For more information, including details on licensing, visit
|
||||||
|
<a href="https://macrame.github.io" target="_blank">https://macrame.github.io</a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,24 @@
|
||||||
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 (
|
require (
|
||||||
github.com/dblohm7/wingoes v0.0.0-20240820181039-f2b84150679e // indirect
|
github.com/dblohm7/wingoes v0.0.0-20240820181039-f2b84150679e // indirect
|
||||||
github.com/ebitengine/purego v0.8.2 // indirect
|
github.com/ebitengine/purego v0.8.2 // indirect
|
||||||
github.com/gen2brain/shm v0.1.1 // indirect
|
github.com/gen2brain/shm v0.1.1 // indirect
|
||||||
|
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 // indirect
|
||||||
|
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 // indirect
|
||||||
|
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7 // indirect
|
||||||
|
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/go-ole/go-ole v1.3.0 // 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
|
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||||
github.com/jezek/xgb v1.1.1 // indirect
|
github.com/jezek/xgb v1.1.1 // indirect
|
||||||
github.com/kbinani/screenshot v0.0.0-20250118074034-a3924b7bbc8c // indirect
|
github.com/kbinani/screenshot v0.0.0-20250118074034-a3924b7bbc8c // indirect
|
||||||
|
|
@ -16,6 +26,7 @@ require (
|
||||||
github.com/lxn/win v0.0.0-20210218163916-a377121e959e // indirect
|
github.com/lxn/win v0.0.0-20210218163916-a377121e959e // indirect
|
||||||
github.com/otiai10/gosseract v2.2.1+incompatible // indirect
|
github.com/otiai10/gosseract v2.2.1+incompatible // indirect
|
||||||
github.com/otiai10/mint v1.6.3 // indirect
|
github.com/otiai10/mint v1.6.3 // indirect
|
||||||
|
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
|
||||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
||||||
github.com/robotn/xgb v0.10.0 // indirect
|
github.com/robotn/xgb v0.10.0 // indirect
|
||||||
github.com/robotn/xgbutil v0.10.0 // indirect
|
github.com/robotn/xgbutil v0.10.0 // indirect
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298/go.mod h1:D+QujdIlUNfa0igpNMk6UIvlb6C252URs4yupRUV4lQ=
|
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298/go.mod h1:D+QujdIlUNfa0igpNMk6UIvlb6C252URs4yupRUV4lQ=
|
||||||
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966/go.mod h1:Mid70uvE93zn9wgF92A/r5ixgnvX8Lh68fxp9KQBaI0=
|
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966/go.mod h1:Mid70uvE93zn9wgF92A/r5ixgnvX8Lh68fxp9KQBaI0=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dblohm7/wingoes v0.0.0-20240820181039-f2b84150679e h1:L+XrFvD0vBIBm+Wf9sFN6aU395t7JROoai0qXZraA4U=
|
github.com/dblohm7/wingoes v0.0.0-20240820181039-f2b84150679e h1:L+XrFvD0vBIBm+Wf9sFN6aU395t7JROoai0qXZraA4U=
|
||||||
|
|
@ -8,9 +9,25 @@ github.com/ebitengine/purego v0.8.2 h1:jPPGWs2sZ1UgOSgD2bClL0MJIqu58nOmIcBuXr62z
|
||||||
github.com/ebitengine/purego v0.8.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
github.com/ebitengine/purego v0.8.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
||||||
github.com/gen2brain/shm v0.1.1 h1:1cTVA5qcsUFixnDHl14TmRoxgfWEEZlTezpUj1vm5uQ=
|
github.com/gen2brain/shm v0.1.1 h1:1cTVA5qcsUFixnDHl14TmRoxgfWEEZlTezpUj1vm5uQ=
|
||||||
github.com/gen2brain/shm v0.1.1/go.mod h1:UgIcVtvmOu+aCJpqJX7GOtiN7X2ct+TKLg4RTxwPIUA=
|
github.com/gen2brain/shm v0.1.1/go.mod h1:UgIcVtvmOu+aCJpqJX7GOtiN7X2ct+TKLg4RTxwPIUA=
|
||||||
|
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4=
|
||||||
|
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520/go.mod h1:L+mq6/vvYHKjCX2oez0CgEAJmbq1fbb/oNJIWQkBybY=
|
||||||
|
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 h1:6uJ+sZ/e03gkbqZ0kUG6mfKoqDb4XMAzMIwlajq19So=
|
||||||
|
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7/go.mod h1:l+xpFBrCtDLpK9qNjxs+cHU6+BAdlBaxHqikB6Lku3A=
|
||||||
|
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7 h1:guBYzEaLz0Vfc/jv0czrr2z7qyzTOGC9hiQ0VC+hKjk=
|
||||||
|
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7/go.mod h1:zx/1xUUeYPy3Pcmet8OSXLbF47l+3y6hIPpyLWoR9oc=
|
||||||
|
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7 h1:micT5vkcr9tOVk1FiH8SWKID8ultN44Z+yzd2y/Vyb0=
|
||||||
|
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7/go.mod h1:dD3CgOrwlzca8ed61CsZouQS5h5jIzkK9ZWrTcf0s+o=
|
||||||
|
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 h1:XYzSdCbkzOC0FDNrgJqGRo8PCMFOBFL9py72DRs7bmc=
|
||||||
|
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55/go.mod h1:6mmzY2kW1TOOrVy+r41Za2MxXM+hhqTtY3oBKd2AgFA=
|
||||||
|
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f h1:wrYrQttPS8FHIRSlsrcuKazukx/xqO/PpLZzZXsF+EA=
|
||||||
|
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA=
|
||||||
|
github.com/getlantern/systray v1.2.2 h1:dCEHtfmvkJG7HZ8lS/sLklTH4RKUcIsKrAD9sThoEBE=
|
||||||
|
github.com/getlantern/systray v1.2.2/go.mod h1:pXFOI1wwqwYXEhLPm9ZGjS2u/vVELeIgNMY5HvhHhcE=
|
||||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||||
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||||
|
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
||||||
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
github.com/go-vgo/robotgo v0.110.7 h1:4scqQrJOBHoFCfcMROYEVFBxHvB3nF/UN6DWoRIFzBE=
|
github.com/go-vgo/robotgo v0.110.7 h1:4scqQrJOBHoFCfcMROYEVFBxHvB3nF/UN6DWoRIFzBE=
|
||||||
github.com/go-vgo/robotgo v0.110.7/go.mod h1:eBUjTHY1HYjzdi1+UWJUbxB+b9gE+l4Ei7vQU/9SnLw=
|
github.com/go-vgo/robotgo v0.110.7/go.mod h1:eBUjTHY1HYjzdi1+UWJUbxB+b9gE+l4Ei7vQU/9SnLw=
|
||||||
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
||||||
|
|
@ -23,6 +40,7 @@ github.com/kbinani/screenshot v0.0.0-20250118074034-a3924b7bbc8c h1:1IlzDla/ZATV
|
||||||
github.com/kbinani/screenshot v0.0.0-20250118074034-a3924b7bbc8c/go.mod h1:Pmpz2BLf55auQZ67u3rvyI2vAQvNetkK/4zYUmpauZQ=
|
github.com/kbinani/screenshot v0.0.0-20250118074034-a3924b7bbc8c/go.mod h1:Pmpz2BLf55auQZ67u3rvyI2vAQvNetkK/4zYUmpauZQ=
|
||||||
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 h1:7UMa6KCCMjZEMDtTVdcGu0B1GmmC7QJKiCCjyTAWQy0=
|
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 h1:7UMa6KCCMjZEMDtTVdcGu0B1GmmC7QJKiCCjyTAWQy0=
|
||||||
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k=
|
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k=
|
||||||
|
github.com/lxn/walk v0.0.0-20210112085537-c389da54e794/go.mod h1:E23UucZGqpuUANJooIbHWCufXvOcT6E7Stq81gU+CSQ=
|
||||||
github.com/lxn/win v0.0.0-20210218163916-a377121e959e h1:H+t6A/QJMbhCSEH5rAuRxh+CtW96g0Or0Fxa9IKr4uc=
|
github.com/lxn/win v0.0.0-20210218163916-a377121e959e h1:H+t6A/QJMbhCSEH5rAuRxh+CtW96g0Or0Fxa9IKr4uc=
|
||||||
github.com/lxn/win v0.0.0-20210218163916-a377121e959e/go.mod h1:KxxjdtRkfNoYDCUP5ryK7XJJNTnpC8atvtmTheChOtk=
|
github.com/lxn/win v0.0.0-20210218163916-a377121e959e/go.mod h1:KxxjdtRkfNoYDCUP5ryK7XJJNTnpC8atvtmTheChOtk=
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||||
|
|
@ -31,6 +49,8 @@ github.com/otiai10/gosseract v2.2.1+incompatible h1:Ry5ltVdpdp4LAa2bMjsSJH34XHVO
|
||||||
github.com/otiai10/gosseract v2.2.1+incompatible/go.mod h1:XrzWItCzCpFRZ35n3YtVTgq5bLAhFIkascoRo8G32QE=
|
github.com/otiai10/gosseract v2.2.1+incompatible/go.mod h1:XrzWItCzCpFRZ35n3YtVTgq5bLAhFIkascoRo8G32QE=
|
||||||
github.com/otiai10/mint v1.6.3 h1:87qsV/aw1F5as1eH1zS/yqHY85ANKVMgkDrf9rcxbQs=
|
github.com/otiai10/mint v1.6.3 h1:87qsV/aw1F5as1eH1zS/yqHY85ANKVMgkDrf9rcxbQs=
|
||||||
github.com/otiai10/mint v1.6.3/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM=
|
github.com/otiai10/mint v1.6.3/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM=
|
||||||
|
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
|
||||||
|
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
|
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
|
||||||
|
|
@ -42,6 +62,9 @@ github.com/robotn/xgbutil v0.10.0 h1:gvf7mGQqCWQ68aHRtCxgdewRk+/KAJui6l3MJQQRCKw
|
||||||
github.com/robotn/xgbutil v0.10.0/go.mod h1:svkDXUDQjUiWzLrA0OZgHc4lbOts3C+uRfP6/yjwYnU=
|
github.com/robotn/xgbutil v0.10.0/go.mod h1:svkDXUDQjUiWzLrA0OZgHc4lbOts3C+uRfP6/yjwYnU=
|
||||||
github.com/shirou/gopsutil/v4 v4.25.1 h1:QSWkTc+fu9LTAWfkZwZ6j8MSUk4A2LV7rbH0ZqmLjXs=
|
github.com/shirou/gopsutil/v4 v4.25.1 h1:QSWkTc+fu9LTAWfkZwZ6j8MSUk4A2LV7rbH0ZqmLjXs=
|
||||||
github.com/shirou/gopsutil/v4 v4.25.1/go.mod h1:RoUCUpndaJFtT+2zsZzzmhvbfGoDCJ7nFXKJf8GqJbI=
|
github.com/shirou/gopsutil/v4 v4.25.1/go.mod h1:RoUCUpndaJFtT+2zsZzzmhvbfGoDCJ7nFXKJf8GqJbI=
|
||||||
|
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/tailscale/win v0.0.0-20250213223159-5992cb43ca35 h1:wAZbkTZkqDzWsqxPh2qkBd3KvFU7tcxV0BP0Rnhkxog=
|
github.com/tailscale/win v0.0.0-20250213223159-5992cb43ca35 h1:wAZbkTZkqDzWsqxPh2qkBd3KvFU7tcxV0BP0Rnhkxog=
|
||||||
|
|
@ -74,5 +97,6 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
|
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
|
||||||
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
|
gopkg.in/Knetic/govaluate.v3 v3.0.0/go.mod h1:csKLBORsPbafmSCGTEh3U7Ozmsuq8ZSIlKk1bcqph0E=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
32
install.bat
32
install.bat
|
|
@ -1,32 +0,0 @@
|
||||||
@echo off
|
|
||||||
|
|
||||||
set ruleName="Macrame LAN Access"
|
|
||||||
set exePath=%~dp0be\Macrame.exe
|
|
||||||
|
|
||||||
:: Check if rule exists
|
|
||||||
netsh advfirewall firewall show rule name=%ruleName% >nul 2>&1
|
|
||||||
if %errorlevel%==1 (
|
|
||||||
netsh advfirewall firewall add rule name=%ruleName% dir=in action=allow program=%exePath% protocol=tcp profile=private enabled=true
|
|
||||||
echo Firewall rule '%ruleName%' added for %exePath%
|
|
||||||
) else (
|
|
||||||
echo Firewall rule '%ruleName%' already exists
|
|
||||||
)
|
|
||||||
|
|
||||||
:: Navigate to the "be" directory
|
|
||||||
cd /d "%~dp0be"
|
|
||||||
|
|
||||||
echo Moved to Backend directory
|
|
||||||
|
|
||||||
:: Run setup.exe to generate configuration and necessary files
|
|
||||||
start /wait Setup.exe
|
|
||||||
|
|
||||||
:: Run Caddy to generate certificates and serve content
|
|
||||||
:: start /wait caddy.exe start --config CaddyFile
|
|
||||||
|
|
||||||
:: taskkill /f /im caddy.exe
|
|
||||||
|
|
||||||
:: Now start macrame.exe
|
|
||||||
start Macrame.exe
|
|
||||||
|
|
||||||
:: End of script
|
|
||||||
exit
|
|
||||||
|
|
@ -25,16 +25,15 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"be/app"
|
"macrame/app"
|
||||||
"be/app/helper"
|
"macrame/app/helper"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app.MCRMLogInit()
|
app.MCRMLogInit()
|
||||||
|
|
||||||
switchToBeDir()
|
switchDir()
|
||||||
|
|
||||||
if helper.EnvGet("MCRM__PORT") == "" {
|
if helper.EnvGet("MCRM__PORT") == "" {
|
||||||
app.MCRMLog("Error: MCRM__PORT is not set")
|
app.MCRMLog("Error: MCRM__PORT is not set")
|
||||||
|
|
@ -48,20 +47,19 @@ func main() {
|
||||||
|
|
||||||
app.MCRMLog("Listening on http://localhost:" + helper.EnvGet("MCRM__PORT"))
|
app.MCRMLog("Listening on http://localhost:" + helper.EnvGet("MCRM__PORT"))
|
||||||
|
|
||||||
|
app.InitSystray()
|
||||||
|
|
||||||
app.MCRMLog(http.ListenAndServe(":"+helper.EnvGet("MCRM__PORT"), nil))
|
app.MCRMLog(http.ListenAndServe(":"+helper.EnvGet("MCRM__PORT"), nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
func switchToBeDir() {
|
func switchDir() {
|
||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if !strings.HasSuffix(cwd, "be") {
|
|
||||||
err := os.Chdir("be")
|
log.Println(cwd)
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func apiInit(w http.ResponseWriter, r *http.Request) {
|
func apiInit(w http.ResponseWriter, r *http.Request) {
|
||||||
Loading…
Add table
Add a link
Reference in a new issue