GOWA - WhatsApp REST API with support for UI, Multi Account, Webhooks, and MCP, and Chatwoot. Built with Golang for efficient memory use.
Go botgogolanggolang-whatsappgolang-whatsapp-apirestrest-apiwhatsappwhatsapp-apiwhatsapp-api-gowhatsapp-multi-devicewhatsapp-web-multi-device
feat: move file to storage folder (#26)
Aldino Kemalc01bd8d0c87b
diff --git a/.gitignore b/.gitignoreindex 4bb3c9e3..5c7040fe 100644--- a/.gitignore+++ b/.gitignore@@ -7,3 +7,4 @@ mainmain.exe*.jpesrc/pkged.go+storages\ No newline at end of filediff --git a/readme.md b/readme.mdindex f3f47de0..bd66f119 100644--- a/readme.md+++ b/readme.md@@ -67,7 +67,7 @@### Production Mode (docker)-- `docker run --publish=3000:3000 --name=whatsapp --restart=always --detach aldinokemal2104/go-whatsapp-web-multidevice --autoreply="Dont't reply this message please"`+- `docker run --detach --publish=3000:3000 --name=whatsapp --restart=always --volume=$(docker volume create --name=whatsapp):/app/storages aldinokemal2104/go-whatsapp-web-multidevice --autoreply="Dont't reply this message please"`### Production Mode (binary | not distributed again since v3.5.0)diff --git a/src/cmd/root.go b/src/cmd/root.goindex 87f4d024..3f4c7676 100644--- a/src/cmd/root.go+++ b/src/cmd/root.go@@ -47,7 +47,7 @@ func runRest(cmd *cobra.Command, args []string) {// TODO: Init Rest App//preparing folder if not exist- err := utils.CreateFolder(config.PathQrCode, config.PathSendItems)+ err := utils.CreateFolder(config.PathQrCode, config.PathSendItems, config.PathStorages)if err != nil {log.Fatalln(err)}diff --git a/src/config/settings.go b/src/config/settings.goindex 0de12b2c..73c431f7 100644--- a/src/config/settings.go+++ b/src/config/settings.go@@ -5,22 +5,21 @@ import (waProto "go.mau.fi/whatsmeow/binary/proto")-type Browser string-var (- AppVersion string = "v3.6.0"- AppPort string = "3000"- AppDebug bool = false- AppOs string = fmt.Sprintf("AldinoKemal")+ AppVersion = "v3.7.0"+ AppPort = "3000"+ AppDebug = false+ AppOs = fmt.Sprintf("AldinoKemal")+ AppPlatform = waProto.DeviceProps_PlatformType(1)AppBasicAuthCredential string- AppPlatform waProto.DeviceProps_PlatformType = waProto.DeviceProps_PlatformType(1)- PathQrCode string = "statics/qrcode"- PathSendItems string = "statics/senditems"+ PathQrCode = "statics/qrcode"+ PathSendItems = "statics/senditems"+ PathStorages = "storages"- DBName string = "hydrogenWaCli.db"+ DBName = "hydrogenWaCli.db"- WhatsappLogLevel string = "ERROR"+ WhatsappLogLevel = "ERROR"WhatsappAutoReplyMessage stringWhatsappAutoReplyWebhook stringWhatsappSettingMaxFileSize int64 = 30000000 // 10MBdiff --git a/src/utils/whatsapp.go b/src/utils/whatsapp.goindex a2be5b4d..97f06f17 100644--- a/src/utils/whatsapp.go+++ b/src/utils/whatsapp.go@@ -88,7 +88,7 @@ func InitWaDB() *sqlstore.Container {// Running Whatsapplog = waLog.Stdout("Main", config.WhatsappLogLevel, true)dbLog := waLog.Stdout("Database", config.WhatsappLogLevel, true)- storeContainer, err := sqlstore.New("sqlite3", fmt.Sprintf("file:%s?_foreign_keys=off", config.DBName), dbLog)+ storeContainer, err := sqlstore.New("sqlite3", fmt.Sprintf("file:%s/%s?_foreign_keys=off", config.PathStorages, config.DBName), dbLog)if err != nil {log.Errorf("Failed to connect to database: %v", err)panic(err)@@ -171,7 +171,7 @@ func handler(rawEvt interface{}) {return}exts, _ := mime.ExtensionsByType(img.GetMimetype())- path := fmt.Sprintf("%s%s", evt.Info.ID, exts[0])+ path := fmt.Sprintf("%s/%s%s", config.PathStorages, evt.Info.ID, exts[0])err = os.WriteFile(path, data, 0600)if err != nil {log.Errorf("Failed to save image: %v", err)@@ -207,7 +207,7 @@ func handler(rawEvt interface{}) {}case *events.HistorySync:id := atomic.AddInt32(&historySyncID, 1)- fileName := fmt.Sprintf("history-%d-%d.json", startupTime, id)+ fileName := fmt.Sprintf("%s/history-%d-%d.json", config.PathStorages, startupTime, id)file, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE, 0600)if err != nil {log.Errorf("Failed to open file to write history sync: %v", err)