Browse Source

feat: set chrome as default platform

feat: change port from setting
pull/13/head
Aldino Kemal 4 years ago
parent
commit
67da1b7dd9
  1. 13
      src/config/settings.go
  2. 2
      src/main.go
  3. 54
      src/structs/send_struct.go
  4. 48
      src/structs/user_struct.go
  5. 2
      src/utils/whatsapp.go

13
src/config/settings.go

@ -1,5 +1,12 @@
package config
const PathQrCode = "statics/images/qrcode"
const PathSendItems = "statics/images/senditems"
const DBName = "hydrogenWaCli.db"
type Browser string
const (
AppPort string = "3000"
PathQrCode string = "statics/images/qrcode"
PathSendItems string = "statics/images/senditems"
DBName string = "hydrogenWaCli.db"
)

2
src/main.go

@ -57,7 +57,7 @@ func main() {
return ctx.Render("index", fiber.Map{"AppHost": fmt.Sprintf("%s://%s", ctx.Protocol(), ctx.Hostname())})
})
err = app.Listen(":3000")
err = app.Listen(":" + config.AppPort)
if err != nil {
log.Fatalln("Failed to start: ", err.Error())
}

54
src/structs/send_struct.go

@ -1,61 +1,9 @@
package structs
import (
"go.mau.fi/whatsmeow/types"
"mime/multipart"
)
// ============================== USER ==============================
type UserInfoRequest struct {
Phone string `json:"phone" query:"phone"`
}
type UserInfoResponseDataDevice struct {
User string
Agent uint8
Device string
Server string
AD bool
}
type UserInfoResponseData struct {
VerifiedName string `json:"verified_name"`
Status string `json:"status"`
PictureID string `json:"picture_id"`
Devices []UserInfoResponseDataDevice `json:"devices"`
}
type UserInfoResponse struct {
Data []UserInfoResponseData `json:"data"`
}
type UserAvatarRequest struct {
Phone string `json:"phone" query:"phone"`
}
type UserAvatarResponse struct {
URL string `json:"url"`
ID string `json:"id"`
Type string `json:"type"`
}
type UserMyPrivacySettingResponse struct {
GroupAdd string `json:"group_add"`
LastSeen string `json:"last_seen"`
Status string `json:"status"`
Profile string `json:"profile"`
ReadReceipts string `json:"read_receipts"`
}
type UserMyListGroupsResponse struct {
Data []types.GroupInfo `json:"data"`
}
// ============================== END USER ==============================
// ============================== SEND ==============================
type SendType string
const TypeUser SendType = "user"
@ -92,5 +40,3 @@ type SendFileRequest struct {
type SendFileResponse struct {
Status string `json:"status"`
}
// ============================== END SEND ==============================

48
src/structs/user_struct.go

@ -0,0 +1,48 @@
package structs
import "go.mau.fi/whatsmeow/types"
type UserInfoRequest struct {
Phone string `json:"phone" query:"phone"`
}
type UserInfoResponseDataDevice struct {
User string
Agent uint8
Device string
Server string
AD bool
}
type UserInfoResponseData struct {
VerifiedName string `json:"verified_name"`
Status string `json:"status"`
PictureID string `json:"picture_id"`
Devices []UserInfoResponseDataDevice `json:"devices"`
}
type UserInfoResponse struct {
Data []UserInfoResponseData `json:"data"`
}
type UserAvatarRequest struct {
Phone string `json:"phone" query:"phone"`
}
type UserAvatarResponse struct {
URL string `json:"url"`
ID string `json:"id"`
Type string `json:"type"`
}
type UserMyPrivacySettingResponse struct {
GroupAdd string `json:"group_add"`
LastSeen string `json:"last_seen"`
Status string `json:"status"`
Profile string `json:"profile"`
ReadReceipts string `json:"read_receipts"`
}
type UserMyListGroupsResponse struct {
Data []types.GroupInfo `json:"data"`
}

2
src/utils/whatsapp.go

@ -97,7 +97,7 @@ func InitWaCLI(storeContainer *sqlstore.Container) *whatsmeow.Client {
panic(err)
}
store.CompanionProps.PlatformType = waProto.CompanionProps_UNKNOWN.Enum()
store.CompanionProps.PlatformType = waProto.CompanionProps_CHROME.Enum()
store.CompanionProps.Os = proto.String("AldinoKemal")
cli = whatsmeow.NewClient(device, waLog.Stdout("Client", logLevel, true))
cli.AddEventHandler(handler)

Loading…
Cancel
Save