You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
Hi, @dimaskiddo looks like you have updated this repository again, nice work !
anyway do you have an idea to restore all session when application restarted?
The text was updated successfully, but these errors were encountered:
It's really possible @rosseti has a good pull request about it, but i'am pending it for a long-long time until it's conflicting with my own update 😢 . Because i need to think about the pros and cons also in the security concern
"github.com/dimaskiddo/go-whatsapp-rest/internal"
"github.com/dimaskiddo/go-whatsapp-rest/pkg/router"
"github.com/dimaskiddo/go-whatsapp-rest/pkg/server"
wa "github.com/dimaskiddo/go-whatsapp-rest/pkg/whatsapp"
)
// Server Variable
var svr *server.Server
// Init Function
func init() {
// Set Go Log Flags
log.SetFlags(log.Flags() &^ (log.Ldate | log.Ltime))
// Load Routes
internal.LoadRoutes()
// Initialize Server
svr = server.NewServer(router.Router)
}
// Main Function
func main() {
var files []string
// Starting Server
svr.Start()
time.Sleep(5 * time.Second)
// reload all gob
gobpath := server.Config.GetString("SERVER_STORE_PATH")
a := server.Config.GetInt("WHATSAPP_CLIENT_VERSION_MAJOR")
b := server.Config.GetInt("WHATSAPP_CLIENT_VERSION_MINOR")
c := server.Config.GetInt("WHATSAPP_CLIENT_VERSION_BUILD")
err := filepath.Walk(gobpath, func(path string, info os.FileInfo, err error) error {
if filepath.Ext(path) == ".gob" {
files = append(files, filepath.Base(path))
}
return nil
})
if err!=nil {
log.Println(err)
}
for _, file := range files {
jid := file[0:len(file)-4]
gobfile := server.Config.GetString("SERVER_STORE_PATH") + "/" + jid + ".gob"
qrstr := make(chan string)
errmsg := make(chan error)
log.Println("Load "+jid)
go wa.WASessionConnect(jid,a,b,c,30,gobfile,10,qrstr,errmsg)
time.Sleep(1 * time.Second)
}
// Make Channel for OS Signal
sig := make(chan os.Signal, 1)
// Notify Any Signal to OS Signal Channel
signal.Notify(sig, os.Interrupt)
signal.Notify(sig, syscall.SIGTERM)
// Return OS Signal Channel
// As Exit Sign
<-sig
// Log Break Line
fmt.Println("")
// Stopping Server
defer svr.Stop()
Hi, @dimaskiddo looks like you have updated this repository again, nice work !
anyway do you have an idea to restore all session when application restarted?
The text was updated successfully, but these errors were encountered: