Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdaa647923 | ||
|
|
d37f60bb3a | ||
|
|
a6d5ae606a | ||
|
|
a38a627f5a | ||
|
|
73ccc22fd5 | ||
|
|
e660f2ef9f | ||
|
|
937f91bbf6 | ||
|
|
bda1fd6f15 | ||
|
|
6f972d71ba | ||
|
|
9a2c1ea369 | ||
|
|
55b6f48314 | ||
|
|
442e8c2992 | ||
|
|
cf421e414c | ||
|
|
c1cdc6dc0c | ||
|
|
003388c847 | ||
|
|
800f14a355 | ||
|
|
a6ae4b9617 | ||
|
|
edf95d292a | ||
|
|
aeda3c3324 | ||
|
|
8f5ebecee8 | ||
|
|
84217c75e8 | ||
|
|
b2d97e6cef | ||
|
|
9cd01d0d10 |
@@ -3,7 +3,7 @@ package broker
|
||||
import (
|
||||
"fmt"
|
||||
"local/truckstop/config"
|
||||
"log"
|
||||
"local/truckstop/logtr"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -16,6 +16,7 @@ type Job struct {
|
||||
Weight int
|
||||
Miles int
|
||||
Meta string
|
||||
secrets func() interface{} `json:"-"`
|
||||
}
|
||||
|
||||
type JobLocation struct {
|
||||
@@ -24,6 +25,18 @@ type JobLocation struct {
|
||||
State string
|
||||
}
|
||||
|
||||
func (j *Job) Secrets() {
|
||||
if j.secrets == nil {
|
||||
return
|
||||
}
|
||||
v := j.secrets()
|
||||
j.secrets = nil
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
j.Meta = fmt.Sprintf("%s %+v", j.Meta, v)
|
||||
}
|
||||
|
||||
func (j Job) String() string {
|
||||
return fmt.Sprintf(
|
||||
`%s => %s (%d miles), Weight:%d, Notes:%s Link:%s`,
|
||||
@@ -52,7 +65,7 @@ func (j Job) FormatMultilineText() string {
|
||||
out := ""
|
||||
clients := config.Clients(j.Pickup.Date)
|
||||
for k := range clients {
|
||||
log.Printf("job multiline: %+v contains %s then use %v", clients[k].States, j.Pickup.State, k)
|
||||
logtr.Debugf("job multiline: %+v contains %s then use %v", clients[k].States, j.Pickup.State, k)
|
||||
if strings.Contains(fmt.Sprint(clients[k].States), j.Pickup.State) {
|
||||
if len(out) > 0 {
|
||||
out += "\n"
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"local/truckstop/config"
|
||||
"log"
|
||||
"local/truckstop/logtr"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
type NTGVision struct {
|
||||
searcher interface {
|
||||
search(states []config.State) (io.ReadCloser, error)
|
||||
searchJob(id int64) (io.ReadCloser, error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,64 +44,87 @@ type ntgVisionJobInfo struct {
|
||||
Instructions string `json:"instructions"`
|
||||
IsDropTrailer bool `json:"isDropTrailer"`
|
||||
} `json:"stopinfos"`
|
||||
PayUpTo float32 `json:"payUpTo"`
|
||||
LoadState string `json:"loadStatus"`
|
||||
CanBidNow bool `json:"canBidNow"`
|
||||
PayUpTo float32 `json:"payUpTo"`
|
||||
TotalCarrierRate float32 `json:"totalCarrierRate"`
|
||||
LoadState string `json:"loadStatus"`
|
||||
//CanBidNow bool `json:"canBidNow"`
|
||||
}
|
||||
|
||||
func (ji ntgVisionJobInfo) IsZero() bool {
|
||||
return len(ji.StopsInfo) == 0 && ji.TotalCarrierRate == 0 && ji.PayUpTo == 0 && ji.LoadState == ""
|
||||
}
|
||||
|
||||
func (ji ntgVisionJobInfo) String() string {
|
||||
if ji.IsZero() {
|
||||
return ""
|
||||
}
|
||||
out := ""
|
||||
if ji.PayUpTo != 0 {
|
||||
out = fmt.Sprintf("\nPAYS:%v\n%s", ji.PayUpTo, out)
|
||||
}
|
||||
if ji.TotalCarrierRate != 0 {
|
||||
out = fmt.Sprintf("%s Total_Carrier_Rate:%v", out, ji.TotalCarrierRate)
|
||||
}
|
||||
if ji.LoadState != "" {
|
||||
out = fmt.Sprintf("%s Auction:%s", out, ji.LoadState)
|
||||
}
|
||||
if len(ji.StopsInfo) != 2 {
|
||||
return out
|
||||
}
|
||||
return fmt.Sprintf(
|
||||
"%s Pickup:{Hours:%s Notes:%s, DropTrailer:%v} Dropoff:{Appointment:%s Notes:%s}",
|
||||
out,
|
||||
ji.StopsInfo[0].StopHours,
|
||||
ji.StopsInfo[0].Instructions,
|
||||
ji.StopsInfo[0].IsDropTrailer,
|
||||
ji.StopsInfo[1].AppointmentTime,
|
||||
ji.StopsInfo[1].Instructions,
|
||||
)
|
||||
}
|
||||
|
||||
func (ntgJob *ntgVisionJob) JobInfo() (ntgVisionJobInfo, error) {
|
||||
if !config.Get().Brokers.NTG.JobInfo {
|
||||
return ntgJob.jobinfo, nil
|
||||
}
|
||||
if fmt.Sprint(ntgJob.jobinfo) != fmt.Sprint(ntgVisionJobInfo{}) {
|
||||
if !ntgJob.jobinfo.IsZero() {
|
||||
return ntgJob.jobinfo, nil
|
||||
}
|
||||
ji, err := ntgJob.jobInfo()
|
||||
if err == ErrNoAuth {
|
||||
if err := NewNTGVision().refreshAuth(); err != nil {
|
||||
return ntgVisionJobInfo{}, err
|
||||
}
|
||||
ji, err = ntgJob.jobInfo()
|
||||
db := config.Get().DB()
|
||||
key := fmt.Sprintf("ntg_job_info_%v", ntgJob.ID)
|
||||
if b, err := db.Get(key); err != nil {
|
||||
} else if err := json.Unmarshal(b, &ntgJob.jobinfo); err == nil {
|
||||
return ntgJob.jobinfo, nil
|
||||
}
|
||||
ntg := NewNTGVision()
|
||||
ji, err := ntg.SearchJob(ntgJob.ID)
|
||||
if err == nil {
|
||||
ntgJob.jobinfo = ji
|
||||
b, err := json.Marshal(ntgJob.jobinfo)
|
||||
if err == nil {
|
||||
db.Set(key, b)
|
||||
}
|
||||
}
|
||||
ntgJob.jobinfo = ji
|
||||
return ji, err
|
||||
}
|
||||
|
||||
func (ntgJob *ntgVisionJob) jobInfo() (ntgVisionJobInfo, error) {
|
||||
func (ntg NTGVision) searchJob(id int64) (io.ReadCloser, error) {
|
||||
time.Sleep(config.Get().Interval.JobInfo.Get())
|
||||
request, err := http.NewRequest(http.MethodGet, fmt.Sprintf(`https://ntgvision.com/api/v1/load/LoadDetails?loadId=%v`, ntgJob.ID), nil)
|
||||
request, err := http.NewRequest(http.MethodGet, fmt.Sprintf(config.Get().Brokers.NTG.LoadPageURIFormat, id), nil)
|
||||
if err != nil {
|
||||
return ntgVisionJobInfo{}, err
|
||||
return nil, err
|
||||
}
|
||||
setNTGHeaders(request)
|
||||
request.Header.Set("Authorization", "Bearer "+config.Get().Brokers.NTG.Token)
|
||||
resp, err := do(request)
|
||||
if err != nil {
|
||||
return ntgVisionJobInfo{}, err
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
b, _ := ioutil.ReadAll(resp.Body)
|
||||
log.Printf("fetch ntg job info %+v: %d: %s", request, resp.StatusCode, b)
|
||||
if resp.StatusCode > 400 && resp.StatusCode < 500 && resp.StatusCode != 404 && resp.StatusCode != 410 {
|
||||
return ntgVisionJobInfo{}, ErrNoAuth
|
||||
}
|
||||
var result ntgVisionJobInfo
|
||||
err = json.Unmarshal(b, &result)
|
||||
return result, err
|
||||
logtr.Debugf("fetch ntg job info %+v: %d: %s", request, resp.StatusCode, b)
|
||||
return io.NopCloser(bytes.NewReader(b)), nil
|
||||
}
|
||||
|
||||
func (ntgJob *ntgVisionJob) Job(info ...bool) Job {
|
||||
if len(info) == 0 || !info[0] {
|
||||
return ntgJob.job(ntgVisionJobInfo{})
|
||||
}
|
||||
jobInfo, err := ntgJob.JobInfo()
|
||||
if err != nil {
|
||||
log.Printf("failed to get jobinfo: %v", err)
|
||||
}
|
||||
return ntgJob.job(jobInfo)
|
||||
}
|
||||
|
||||
func (ntgJob *ntgVisionJob) job(jobInfo ntgVisionJobInfo) Job {
|
||||
func (ntgJob *ntgVisionJob) Job() Job {
|
||||
pickup, _ := time.ParseInLocation("01/02/06", ntgJob.PickupDate, time.Local)
|
||||
dropoff, _ := time.ParseInLocation("01/02/06", ntgJob.DropoffDate, time.Local)
|
||||
return Job{
|
||||
@@ -118,13 +142,24 @@ func (ntgJob *ntgVisionJob) job(jobInfo ntgVisionJobInfo) Job {
|
||||
},
|
||||
Miles: ntgJob.Miles,
|
||||
Weight: ntgJob.Weight,
|
||||
Meta: fmt.Sprintf("equipment:%s, secrets:%+v", ntgJob.Equipment, jobInfo),
|
||||
Meta: fmt.Sprintf("equipment:%s", ntgJob.Equipment),
|
||||
secrets: func() interface{} {
|
||||
jobInfo, err := ntgJob.JobInfo()
|
||||
if err != nil {
|
||||
logtr.Errorf("failed to get jobinfo: %v", err)
|
||||
return nil
|
||||
}
|
||||
return jobInfo.String()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func NewNTGVision() NTGVision {
|
||||
ntgv := NTGVision{}
|
||||
ntgv.searcher = ntgv
|
||||
if config.Get().Brokers.NTG.Mock {
|
||||
ntgv = ntgv.WithMock()
|
||||
}
|
||||
return ntgv
|
||||
}
|
||||
|
||||
@@ -133,6 +168,17 @@ func (ntg NTGVision) WithMock() NTGVision {
|
||||
return ntg
|
||||
}
|
||||
|
||||
func (ntg NTGVision) SearchJob(id int64) (ntgVisionJobInfo, error) {
|
||||
rc, err := ntg.searcher.searchJob(id)
|
||||
if err != nil {
|
||||
return ntgVisionJobInfo{}, err
|
||||
}
|
||||
defer rc.Close()
|
||||
var result ntgVisionJobInfo
|
||||
err = json.NewDecoder(rc).Decode(&result)
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (ntg NTGVision) Search(states []config.State) ([]Job, error) {
|
||||
rc, err := ntg.searcher.search(states)
|
||||
if err != nil {
|
||||
@@ -145,20 +191,35 @@ func (ntg NTGVision) Search(states []config.State) ([]Job, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Printf("ntg search for %+v: %s", states, b)
|
||||
logtr.Debugf("ntg search for %+v: %s", states, b)
|
||||
|
||||
var ntgjobs []ntgVisionJob
|
||||
err = json.Unmarshal(b, &ntgjobs)
|
||||
|
||||
jobs := make([]Job, len(ntgjobs))
|
||||
for i := range jobs {
|
||||
jobs[i] = ntgjobs[i].Job(true)
|
||||
jobs[i] = ntgjobs[i].Job()
|
||||
}
|
||||
return jobs, err
|
||||
}
|
||||
|
||||
func getNTGTokenKey() string {
|
||||
return "brokers_ntg_token"
|
||||
}
|
||||
|
||||
func getNTGToken() string {
|
||||
db := config.Get().DB()
|
||||
b, _ := db.Get(getNTGTokenKey())
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func setNTGToken(token string) {
|
||||
db := config.Get().DB()
|
||||
db.Set(getNTGTokenKey(), []byte(token))
|
||||
}
|
||||
|
||||
func (ntg NTGVision) search(states []config.State) (io.ReadCloser, error) {
|
||||
if config.Get().Brokers.NTG.Token == "" {
|
||||
if getNTGToken() == "" {
|
||||
if err := ntg.refreshAuth(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -174,6 +235,15 @@ func (ntg NTGVision) search(states []config.State) (io.ReadCloser, error) {
|
||||
}
|
||||
|
||||
func (ntg NTGVision) refreshAuth() error {
|
||||
err := ntg._refreshAuth()
|
||||
if err != nil {
|
||||
logtr.SOSf("failed to refresh ntg auth: %v", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (ntg NTGVision) _refreshAuth() error {
|
||||
logtr.Infof("refreshing ntg auth...")
|
||||
b, _ := json.Marshal(map[string]string{
|
||||
"username": config.Get().Brokers.NTG.Username,
|
||||
"password": config.Get().Brokers.NTG.Password,
|
||||
@@ -201,9 +271,7 @@ func (ntg NTGVision) refreshAuth() error {
|
||||
if len(v.Token) == 0 {
|
||||
return errors.New("failed to get token from login call")
|
||||
}
|
||||
conf := config.Get()
|
||||
conf.Brokers.NTG.Token = v.Token
|
||||
config.Set(*conf)
|
||||
setNTGToken(v.Token)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -252,7 +320,7 @@ func (ntg NTGVision) newRequest(states []config.State) (*http.Request, error) {
|
||||
return nil, err
|
||||
}
|
||||
setNTGHeaders(request)
|
||||
request.Header.Set("Authorization", "Bearer "+config.Get().Brokers.NTG.Token)
|
||||
request.Header.Set("Authorization", "Bearer "+getNTGToken())
|
||||
|
||||
return request, nil
|
||||
}
|
||||
@@ -263,7 +331,7 @@ func setNTGHeaders(request *http.Request) {
|
||||
request.Header.Set("Accept-Language", "en-US,en;q=0.5")
|
||||
request.Header.Set("Accept-Encoding", "gzip, deflate, br")
|
||||
request.Header.Set("Content-Type", "application/json;charset=utf-8")
|
||||
//request.Header.Set("Authorization", "Bearer "+config.Get().Brokers.NTG.Token)
|
||||
//request.Header.Set("Authorization", "Bearer "+getNTGToken())
|
||||
request.Header.Set("Origin", "https://ntgvision.com")
|
||||
request.Header.Set("DNT", "1")
|
||||
request.Header.Set("Connection", "keep-alive")
|
||||
|
||||
@@ -20,3 +20,9 @@ func (ntgm NTGVisionMock) search(states []config.State) (io.ReadCloser, error) {
|
||||
b, err := ioutil.ReadFile(path)
|
||||
return io.NopCloser(bytes.NewReader(b)), err
|
||||
}
|
||||
|
||||
func (ntgm NTGVisionMock) searchJob(id int64) (io.ReadCloser, error) {
|
||||
path := path.Join(os.Getenv("GOPATH"), "src", "local", "truckstop", "broker", "testdata", "ntgvision_jobinfo_response.json")
|
||||
b, err := ioutil.ReadFile(path)
|
||||
return io.NopCloser(bytes.NewReader(b)), err
|
||||
}
|
||||
|
||||
84
broker/testdata/ntgvision_jobinfo_response.json
vendored
Normal file
84
broker/testdata/ntgvision_jobinfo_response.json
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"headerSummary": "A to B",
|
||||
"loadId": 123,
|
||||
"miles": 123,
|
||||
"weight": 123,
|
||||
"temp": null,
|
||||
"equipment": "equipment",
|
||||
"categoryName": "category",
|
||||
"categoryLabel": "category generic",
|
||||
"cargoInformation": [
|
||||
"carto info"
|
||||
],
|
||||
"loadRequirements": [
|
||||
"load requirements"
|
||||
],
|
||||
"stopInfos": [
|
||||
{
|
||||
"loadInfoIds": [
|
||||
123
|
||||
],
|
||||
"stopDateTime": "0001-01-01T00:00:00",
|
||||
"isPickup": true,
|
||||
"location": "A",
|
||||
"stopDate": "Friday, 01/14/22",
|
||||
"stopHours": "10:00 - 12:00",
|
||||
"appointmentTime": "",
|
||||
"appointmentType": "FCFS",
|
||||
"instructions": "instruction",
|
||||
"isDropTrailer": false,
|
||||
"shipperName": "client",
|
||||
"processedStopDate": ""
|
||||
},
|
||||
{
|
||||
"loadInfoIds": [
|
||||
123
|
||||
],
|
||||
"stopDateTime": "0001-01-01T00:00:00",
|
||||
"isPickup": false,
|
||||
"location": "B",
|
||||
"stopDate": "Monday, 01/17/22",
|
||||
"stopHours": "09:00 - 10:00",
|
||||
"appointmentTime": "09:00",
|
||||
"appointmentType": "APPT",
|
||||
"instructions": "instructions",
|
||||
"isDropTrailer": false,
|
||||
"shipperName": "client",
|
||||
"processedStopDate": ""
|
||||
}
|
||||
],
|
||||
"drayStopInfos": null,
|
||||
"rateInfo": null,
|
||||
"isDray": false,
|
||||
"equipmentGroupId": 8,
|
||||
"totalCarrierRate": 2600,
|
||||
"payUpTo": 2700,
|
||||
"firstLoadInfoId": 123,
|
||||
"loadStatus": "ACTIVE",
|
||||
"hasBlockingAlert": false,
|
||||
"customerLoadBlocked": false,
|
||||
"canSeeRate": false,
|
||||
"canBookNow": false,
|
||||
"canBidNow": true,
|
||||
"buttonData": {
|
||||
"useBidDialog": false,
|
||||
"lastBidAmount": null,
|
||||
"remainingBids": 1,
|
||||
"carrierPhoneNumber": null,
|
||||
"carrierPhoneExtension": null
|
||||
},
|
||||
"stopData": [
|
||||
{
|
||||
"addr": "IDX NORTH CAROLINA",
|
||||
"city": "Washington",
|
||||
"state": "NC",
|
||||
"zip": "27889"
|
||||
},
|
||||
{
|
||||
"addr": "hibbett sports",
|
||||
"city": "Abilene",
|
||||
"state": "TX",
|
||||
"zip": "79606"
|
||||
}
|
||||
]
|
||||
}
|
||||
12
broker/testdata/ntgvision_response.json
vendored
12
broker/testdata/ntgvision_response.json
vendored
@@ -2,12 +2,12 @@
|
||||
{
|
||||
"id": 4650337,
|
||||
"sDate": "01/12/22",
|
||||
"sCity": "Columbus",
|
||||
"sState": "OH",
|
||||
"sCity": "Advance",
|
||||
"sState": "NC",
|
||||
"sdh": null,
|
||||
"cDate": "01/13/22",
|
||||
"cCity": "Jamaica",
|
||||
"cState": "NY",
|
||||
"cCity": "Sacramento",
|
||||
"cState": "CA",
|
||||
"cdh": null,
|
||||
"stopCnt": 2,
|
||||
"miles": 578,
|
||||
@@ -23,8 +23,8 @@
|
||||
"sState": "NC",
|
||||
"sdh": null,
|
||||
"cDate": "01/13/22",
|
||||
"cCity": "Atlanta",
|
||||
"cState": "GA",
|
||||
"cCity": "Winston-Salem",
|
||||
"cState": "NC",
|
||||
"cdh": null,
|
||||
"stopCnt": 2,
|
||||
"miles": 378,
|
||||
|
||||
62
config.json
62
config.json
@@ -1,9 +1,22 @@
|
||||
{
|
||||
"Log": {
|
||||
"Path": "/tmp/truckstop.log",
|
||||
"Level": "error",
|
||||
"SOSMatrix": {
|
||||
"ReceiveEnabled": true,
|
||||
"Mock": false,
|
||||
"Homeserver": "https://m.bltrucks.top",
|
||||
"Username": "@bot.m.bltrucks.top",
|
||||
"Token": "mvDWB96KXMF8XhOam8EC5XVdQvSEw0CDeClcSWocBcYkwZX3FPNWZ5uOnQk2EmT1cjpzfeuD7gDYPPjOuyZlI3bE9TE35UjNOlZgi0Tugm25s91iVsbIF6kMZsCIhVMSmEf6w3jxX6wQYOWvmDZ4mu6f5c8wr221EMDcOpEzQV09d1zuBSWgKLBgjqAkYHJZ5dTRIWpEDpPgujhOFZa2ld1HiAOxrJKlIrlfDBN0CUsTlGOGplujDAr4VtpFzNRS",
|
||||
"Device": "TGNIOGKATZ",
|
||||
"Room": "!OYZqtInrBCn1cyz90D:m.bltrucks.top"
|
||||
}
|
||||
},
|
||||
"Interval": {
|
||||
"Input": "5s..10s",
|
||||
"OK": "6h0m0s..6h0m0s",
|
||||
"Error": "6h0m0s..6h0m0s",
|
||||
"JobInfo": "60s..90s"
|
||||
"JobInfo": "10s..20s"
|
||||
},
|
||||
"Images": {
|
||||
"ClientID": "d9ac7cabe813d10",
|
||||
@@ -17,41 +30,28 @@
|
||||
"UploadMethod": "POST"
|
||||
},
|
||||
"Maps": {
|
||||
"DirectionsURIFormat": "https://maps.googleapis.com/maps/api/directions/json?origin=%s\u0026destination=%s\u0026mode=driving\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg",
|
||||
"PathedURIFormat": "https://maps.googleapis.com/maps/api/staticmap?size=250x250\u0026path=%s\u0026format=jpeg\u0026maptype=roadmap\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg\u0026size=250x250\u0026markers=%s|%s\u0026zoom=5",
|
||||
"URIFormat": "https://maps.googleapis.com/maps/api/staticmap?center=%s\u0026markers=label=A|%s\u0026zoom=5\u0026size=250x250\u0026scale=1\u0026format=jpeg\u0026maptype=roadmap\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg",
|
||||
"Pathed": false,
|
||||
"Pickup": false,
|
||||
"Dropoff": false
|
||||
"Dropoff": false,
|
||||
"Pathed": {
|
||||
"Enabled": false,
|
||||
"DirectionsURIFormat": "https://maps.googleapis.com/maps/api/directions/json?origin=%s\u0026destination=%s\u0026mode=driving\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg",
|
||||
"PathedURIFormat": "https://maps.googleapis.com/maps/api/staticmap?size=250x250\u0026path=%s\u0026format=jpeg\u0026maptype=roadmap\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg\u0026size=250x250\u0026markers=%s|%s",
|
||||
"Zoom": {
|
||||
"AcceptableLatLngDelta": 2,
|
||||
"Override": 5
|
||||
}
|
||||
}
|
||||
},
|
||||
"Clients": {
|
||||
"bel": {
|
||||
"States": [
|
||||
"IL"
|
||||
"NC"
|
||||
],
|
||||
"IDs": {
|
||||
"Matrix": "@bel:m.bltrucks.top"
|
||||
},
|
||||
"Available": 1512328400
|
||||
},
|
||||
"broc": {
|
||||
"States": [
|
||||
"FL",
|
||||
"NC"
|
||||
],
|
||||
"IDs": {
|
||||
"Matrix": "@broc:m.bltrucks.top"
|
||||
},
|
||||
"Available": 5642452800
|
||||
},
|
||||
"pa": {
|
||||
"States": [
|
||||
"NC"
|
||||
],
|
||||
"IDs": {
|
||||
"Matrix": "@ron:m.bltrucks.top"
|
||||
},
|
||||
"Available": -62135596800
|
||||
}
|
||||
},
|
||||
"Storage": [
|
||||
@@ -62,7 +62,6 @@
|
||||
"Matrix": {
|
||||
"ReceiveEnabled": true,
|
||||
"Mock": false,
|
||||
"Continuation": "1510",
|
||||
"Homeserver": "https://m.bltrucks.top",
|
||||
"Username": "@bot.m.bltrucks.top",
|
||||
"Token": "mvDWB96KXMF8XhOam8EC5XVdQvSEw0CDeClcSWocBcYkwZX3FPNWZ5uOnQk2EmT1cjpzfeuD7gDYPPjOuyZlI3bE9TE35UjNOlZgi0Tugm25s91iVsbIF6kMZsCIhVMSmEf6w3jxX6wQYOWvmDZ4mu6f5c8wr221EMDcOpEzQV09d1zuBSWgKLBgjqAkYHJZ5dTRIWpEDpPgujhOFZa2ld1HiAOxrJKlIrlfDBN0CUsTlGOGplujDAr4VtpFzNRS",
|
||||
@@ -70,15 +69,14 @@
|
||||
"Room": "!OYZqtInrBCn1cyz90D:m.bltrucks.top"
|
||||
}
|
||||
},
|
||||
"Once": true,
|
||||
"Once": false,
|
||||
"Brokers": {
|
||||
"NTG": {
|
||||
"JobInfo": false,
|
||||
"Mock": true,
|
||||
"JobInfo": true,
|
||||
"Mock": false,
|
||||
"LoadPageURIFormat": "https://ntgvision.com/LoadDetails?loadId=%d",
|
||||
"Token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIzMTAyOSIsInVuaXF1ZV9uYW1lIjoibm9lYXN5cnVuc3RydWNraW5nQGdtYWlsLmNvbSIsImp0aSI6IjI3OTQ2YWRkLWFhYmQtNGFhYi1iODg2LTg5MWRkMWRlZjQwNCIsImlhdCI6IjEvMTQvMjAyMiA2OjAxOjIwIEFNIiwibnRndlJvbGUiOiJDYXJyaWVyQXBwcm92ZWQiLCJ1c2VyQ2FycmllcnMiOiIxNTM0MjMiLCJvdHJVc2VyIjoiRmFsc2UiLCJuYmYiOjE2NDIxNDAwODAsImV4cCI6MTY0MjIyMjg4MCwiaXNzIjoiTlRHIFNlY3VyaXR5IFRva2VuIFNlcnZpY2UiLCJhdWQiOiJOVEcifQ.ksvyfnoqvwYaG7HtBDX6iFUaVk9cPnJpf4Jga5YDz6CGEXk85Dk10oUiSx2SA25r3lYN9by5DZIcBbEMfk69kynC28n2Te3hOR03Q0t8p3scj9aTe99fXapVKgma2s7JG_AIdkElwg81VBgyPNo3Nvn2mPKdV3ueAOkyX2aAHK4VLMm_YcbbFxiv74mPtFgw2SwnRumtgpvlOQrW0b7SXhA0s78E3kiYAjCiSS5Y7jQE1-x3P-VOPpvfXx3c8E-nHNah210Ewp2cGFvnXEevIvB0LDGeT3_HxBocwRSVU_jCVFjWX6U96u91FQAyw3yjpgkeMhX_QU_n3Nt3uXXvew",
|
||||
"Username": "noeasyrunstrucking@gmail.com",
|
||||
"Password": "thumper123"
|
||||
"Password": "thumper1234"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,28 @@ import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"local/storage"
|
||||
"local/truckstop/logtr"
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Matrix struct {
|
||||
ReceiveEnabled bool
|
||||
Mock bool
|
||||
Homeserver string
|
||||
Username string
|
||||
Token string
|
||||
Device string
|
||||
Room string
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Log struct {
|
||||
Path string
|
||||
Level logtr.Level
|
||||
SOSMatrix Matrix
|
||||
}
|
||||
Interval struct {
|
||||
Input Duration
|
||||
OK Duration
|
||||
@@ -28,26 +44,23 @@ type Config struct {
|
||||
UploadMethod string
|
||||
}
|
||||
Maps struct {
|
||||
DirectionsURIFormat string
|
||||
PathedURIFormat string
|
||||
URIFormat string
|
||||
Pathed bool
|
||||
Pickup bool
|
||||
Dropoff bool
|
||||
URIFormat string
|
||||
Pickup bool
|
||||
Dropoff bool
|
||||
Pathed struct {
|
||||
Enabled bool
|
||||
DirectionsURIFormat string
|
||||
PathedURIFormat string
|
||||
Zoom struct {
|
||||
AcceptableLatLngDelta float32
|
||||
Override int
|
||||
}
|
||||
}
|
||||
}
|
||||
Clients map[string]Client
|
||||
Storage []string
|
||||
Message struct {
|
||||
Matrix struct {
|
||||
ReceiveEnabled bool
|
||||
Mock bool
|
||||
Continuation string
|
||||
Homeserver string
|
||||
Username string
|
||||
Token string
|
||||
Device string
|
||||
Room string
|
||||
}
|
||||
Matrix Matrix
|
||||
}
|
||||
Once bool
|
||||
Brokers struct {
|
||||
@@ -55,7 +68,6 @@ type Config struct {
|
||||
JobInfo bool
|
||||
Mock bool
|
||||
LoadPageURIFormat string
|
||||
Token string
|
||||
Username string
|
||||
Password string
|
||||
}
|
||||
@@ -108,7 +120,7 @@ func AllStates() []State {
|
||||
return states
|
||||
}
|
||||
|
||||
func Refresh() error {
|
||||
func Refresh(soser func() logtr.SOSer) error {
|
||||
b, err := ioutil.ReadFile(configPath())
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -117,10 +129,15 @@ func Refresh() error {
|
||||
if err := json.Unmarshal(b, &c); err != nil {
|
||||
return err
|
||||
}
|
||||
logtr.SetLogpath(c.Log.Path)
|
||||
logtr.SetLevel(c.Log.Level)
|
||||
if live.db != nil {
|
||||
live.db.Close()
|
||||
}
|
||||
live = c
|
||||
if soser != nil {
|
||||
logtr.SetSOSer(soser())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -134,7 +151,7 @@ func Set(other Config) {
|
||||
return
|
||||
}
|
||||
ioutil.WriteFile(configPath(), b, os.ModePerm)
|
||||
Refresh()
|
||||
Refresh(nil)
|
||||
}
|
||||
|
||||
func (c *Config) DB() storage.DB {
|
||||
|
||||
138
logtr/log.go
Normal file
138
logtr/log.go
Normal file
@@ -0,0 +1,138 @@
|
||||
package logtr
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Level int
|
||||
|
||||
const (
|
||||
VERBOSE = Level(7)
|
||||
DEBUG = Level(8)
|
||||
INFO = Level(9)
|
||||
ERROR = Level(10)
|
||||
SOS = Level(15)
|
||||
)
|
||||
|
||||
type SOSer interface {
|
||||
Send(string) error
|
||||
}
|
||||
|
||||
func (l Level) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(l.String())
|
||||
}
|
||||
|
||||
func (l *Level) UnmarshalJSON(b []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(b, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
s = strings.TrimSpace(s)
|
||||
s = strings.ToUpper(s)
|
||||
if len(s) > 3 {
|
||||
s = s[:3]
|
||||
}
|
||||
for i := 0; i < int(SOS)+5; i++ {
|
||||
l2 := Level(i)
|
||||
if l2.String() == s {
|
||||
*l = l2
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return errors.New("unknown log level: " + s)
|
||||
}
|
||||
|
||||
var logger io.Writer = os.Stderr
|
||||
var loggerPath string = ""
|
||||
var lock = &sync.Mutex{}
|
||||
var level Level = INFO
|
||||
var ansoser SOSer = nil
|
||||
|
||||
func SetLogpath(p string) {
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
if p == loggerPath {
|
||||
return
|
||||
}
|
||||
f, err := os.OpenFile(p, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
logger = f
|
||||
loggerPath = p
|
||||
}
|
||||
|
||||
func SetSOSer(another SOSer) {
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
ansoser = another
|
||||
}
|
||||
|
||||
func SetLevel(l Level) {
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
level = l
|
||||
}
|
||||
|
||||
func logf(l Level, format string, args []interface{}) {
|
||||
format = fmt.Sprintf("%v: %v: %s\n", time.Now().Format("15:04:05"), l.String(), strings.TrimSpace(format))
|
||||
cLevel := level
|
||||
cAnsoser := ansoser
|
||||
if l >= cLevel {
|
||||
fmt.Fprintf(os.Stderr, format, args...)
|
||||
}
|
||||
fmt.Fprintf(logger, format, args...)
|
||||
log.Printf("l==sos=%v, ansoser!=nil=%v", l == SOS, ansoser != nil)
|
||||
if l == SOS && cAnsoser != nil {
|
||||
cAnsoser.Send(fmt.Sprintf(format, args...))
|
||||
}
|
||||
}
|
||||
|
||||
func SOSf(format string, args ...interface{}) {
|
||||
logf(SOS, format, args)
|
||||
}
|
||||
|
||||
func Infof(format string, args ...interface{}) {
|
||||
logf(INFO, format, args)
|
||||
}
|
||||
|
||||
func Printf(format string, args ...interface{}) {
|
||||
Infof(format, args...)
|
||||
}
|
||||
|
||||
func Debugf(format string, args ...interface{}) {
|
||||
logf(DEBUG, format, args)
|
||||
}
|
||||
|
||||
func Verbosef(format string, args ...interface{}) {
|
||||
logf(VERBOSE, format, args)
|
||||
}
|
||||
|
||||
func Errorf(format string, args ...interface{}) {
|
||||
logf(ERROR, format, args)
|
||||
}
|
||||
|
||||
func (l Level) String() string {
|
||||
switch l {
|
||||
case ERROR:
|
||||
return "ERR"
|
||||
case INFO:
|
||||
return "INF"
|
||||
case DEBUG:
|
||||
return "DEB"
|
||||
case VERBOSE:
|
||||
return "VER"
|
||||
case SOS:
|
||||
return "SOS"
|
||||
default:
|
||||
return "?"
|
||||
}
|
||||
}
|
||||
111
main.go
111
main.go
@@ -7,8 +7,8 @@ import (
|
||||
"local/storage"
|
||||
"local/truckstop/broker"
|
||||
"local/truckstop/config"
|
||||
"local/truckstop/logtr"
|
||||
"local/truckstop/message"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
var stateFinder = regexp.MustCompile(`[A-Za-z]+`)
|
||||
|
||||
func main() {
|
||||
if err := config.Refresh(); err != nil {
|
||||
if err := config.Refresh(message.NewSOSMatrix); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if config.Get().Message.Matrix.ReceiveEnabled {
|
||||
@@ -33,13 +33,13 @@ func main() {
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(config.Get().Interval.Input.Get())
|
||||
if err := config.Refresh(); err != nil {
|
||||
log.Println(err)
|
||||
if err := config.Refresh(message.NewSOSMatrix); err != nil {
|
||||
logtr.Errorf("failed parsing config: %v", err)
|
||||
} else {
|
||||
if config.Get().Message.Matrix.ReceiveEnabled {
|
||||
lock.Lock()
|
||||
if err := matrixrecv(); err != nil {
|
||||
log.Print(err)
|
||||
logtr.Errorf("failed receiving and parsing matrix: %v", err)
|
||||
}
|
||||
lock.Unlock()
|
||||
}
|
||||
@@ -53,15 +53,15 @@ func main() {
|
||||
}
|
||||
|
||||
func matrixrecv() error {
|
||||
log.Printf("checking matrix...")
|
||||
defer log.Printf("/checking matrix...")
|
||||
logtr.Debugf("checking matrix...")
|
||||
defer logtr.Debugf("/checking matrix...")
|
||||
sender := message.NewMatrix()
|
||||
messages, err := sender.Receive()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
func() {
|
||||
log.Printf("looking for help")
|
||||
logtr.Debugf("looking for help")
|
||||
printed := false
|
||||
for _, msg := range messages {
|
||||
if !strings.HasPrefix(msg.Content, "!help") {
|
||||
@@ -71,26 +71,26 @@ func matrixrecv() error {
|
||||
db := config.Get().DB()
|
||||
if !printed {
|
||||
if _, err := db.Get(key); err == storage.ErrNotFound {
|
||||
log.Printf("sending help")
|
||||
help := fmt.Sprintf("commands:\n `!help` print this help\n `!state nc NC nC Nc` set states for self\n `!available 2022-12-31` set date self is available for work\n\nrun a command for someone else: `!state ga @caleb`")
|
||||
logtr.Debugf("sending help")
|
||||
help := fmt.Sprintf("commands:\n...`!help` print this help\n...`!state nc NC nC Nc` set states for self\n...`!available 2022-12-31` set date self is available for work\n\nrun a command for someone else: `!state ga @caleb`")
|
||||
if err := sender.Send(help); err != nil {
|
||||
log.Printf("failed to send help: %v", err)
|
||||
logtr.Errorf("failed to send help: %v", err)
|
||||
} else {
|
||||
printed = true
|
||||
if err := db.Set(key, []byte{'k'}); err != nil {
|
||||
log.Printf("failed to mark help given @%s: %v", key, err)
|
||||
logtr.Errorf("failed to mark help given @%s: %v", key, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if err := db.Set(key, []byte{'k'}); err != nil {
|
||||
log.Printf("failed to mark help given @%s: %v", key, err)
|
||||
logtr.Errorf("failed to mark help given @%s: %v", key, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
func() {
|
||||
log.Printf("looking for states")
|
||||
logtr.Debugf("looking for states")
|
||||
db := config.Get().DB()
|
||||
states := map[string]map[config.State]struct{}{}
|
||||
for _, msg := range messages {
|
||||
@@ -108,13 +108,13 @@ func matrixrecv() error {
|
||||
}
|
||||
}
|
||||
if err := db.Set(key, []byte{'k'}); err != nil {
|
||||
log.Printf("failed to mark state gathered @%s: %v", key, err)
|
||||
logtr.Errorf("failed to mark state gathered @%s: %v", key, err)
|
||||
}
|
||||
}
|
||||
setNewStates(states)
|
||||
}()
|
||||
func() {
|
||||
log.Printf("looking for pauses")
|
||||
logtr.Debugf("looking for pauses")
|
||||
db := config.Get().DB()
|
||||
pauses := map[string]time.Time{}
|
||||
for _, msg := range messages {
|
||||
@@ -136,16 +136,12 @@ func matrixrecv() error {
|
||||
}
|
||||
}
|
||||
if err := db.Set(key, []byte{'k'}); err != nil {
|
||||
log.Printf("failed to mark state gathered @%s: %v", key, err)
|
||||
logtr.Errorf("failed to mark state gathered @%s: %v", key, err)
|
||||
}
|
||||
}
|
||||
setNewPauses(pauses)
|
||||
}()
|
||||
conf := *config.Get()
|
||||
if conf.Message.Matrix.Continuation != sender.Continuation() {
|
||||
conf.Message.Matrix.Continuation = sender.Continuation()
|
||||
config.Set(conf)
|
||||
}
|
||||
message.SetMatrixContinuation(sender.Continuation())
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -153,7 +149,7 @@ func setNewPauses(pauses map[string]time.Time) {
|
||||
if len(pauses) == 0 {
|
||||
return
|
||||
}
|
||||
log.Printf("set new pauses: %+v", pauses)
|
||||
logtr.Debugf("set new pauses: %+v", pauses)
|
||||
conf := *config.Get()
|
||||
changed := map[string]time.Time{}
|
||||
for client, pause := range pauses {
|
||||
@@ -168,11 +164,11 @@ func setNewPauses(pauses map[string]time.Time) {
|
||||
if len(changed) == 0 {
|
||||
return
|
||||
}
|
||||
log.Printf("updating config new pauses: %+v", conf)
|
||||
logtr.Infof("updating config new pauses: %+v", conf)
|
||||
config.Set(conf)
|
||||
for client, pause := range changed {
|
||||
if err := sendNewPause(client, pause); err != nil {
|
||||
log.Printf("failed to send new pause %s/%+v: %v", client, pause, err)
|
||||
logtr.Errorf("failed to send new pause %s/%+v: %v", client, pause, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,11 +199,11 @@ func setNewStates(states map[string]map[config.State]struct{}) {
|
||||
if len(changed) == 0 {
|
||||
return
|
||||
}
|
||||
log.Printf("updating config new states: %+v", conf)
|
||||
logtr.Infof("updating config new states: %+v", conf)
|
||||
config.Set(conf)
|
||||
for client, states := range changed {
|
||||
if err := sendNewStates(client, states); err != nil {
|
||||
log.Printf("failed to send new states %s/%+v: %v", client, states, err)
|
||||
logtr.Errorf("failed to send new states %s/%+v: %v", client, states, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,7 +230,7 @@ func _main() error {
|
||||
for {
|
||||
err := _mainOne()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
logtr.Errorf("failed _main: %v", err)
|
||||
}
|
||||
if config.Get().Once {
|
||||
time.Sleep(time.Second)
|
||||
@@ -250,15 +246,17 @@ func _main() error {
|
||||
}
|
||||
|
||||
func _mainOne() error {
|
||||
log.Println("config.refreshing...")
|
||||
if err := config.Refresh(); err != nil {
|
||||
logtr.Debugf("config.refreshing...")
|
||||
if err := config.Refresh(message.NewSOSMatrix); err != nil {
|
||||
logtr.SOSf("bad config: %v", err)
|
||||
return err
|
||||
}
|
||||
log.Println("once...")
|
||||
logtr.Debugf("once...")
|
||||
if err := once(); err != nil {
|
||||
logtr.SOSf("failed once(): %v", err)
|
||||
return err
|
||||
}
|
||||
log.Println("/_mainOne")
|
||||
logtr.Debugf("/_mainOne")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -267,22 +265,26 @@ func once() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Printf("once: all jobs: %+v", alljobs)
|
||||
logtr.Debugf("once: all jobs: %+v", alljobs)
|
||||
newjobs, err := dropStaleJobs(alljobs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Printf("once: new jobs: %+v", newjobs)
|
||||
logtr.Debugf("once: new jobs: %+v", newjobs)
|
||||
jobs, err := dropBanlistJobs(newjobs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Printf("once: sending jobs: %+v", jobs)
|
||||
logtr.Debugf("once: loading job secrets: %+v", jobs)
|
||||
for i := range jobs {
|
||||
jobs[i].Secrets()
|
||||
}
|
||||
logtr.Infof("once: sending jobs: %+v", jobs)
|
||||
for i := range jobs {
|
||||
if ok, err := sendJob(jobs[i]); err != nil {
|
||||
return err
|
||||
} else if ok {
|
||||
log.Println("sent job", jobs[i])
|
||||
logtr.Debugf("sent job", jobs[i])
|
||||
if err := config.Get().DB().Set(jobs[i].ID, []byte(`sent`)); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -294,9 +296,6 @@ func once() error {
|
||||
func getJobs() ([]broker.Job, error) {
|
||||
states := config.AllStates()
|
||||
ntg := broker.NewNTGVision()
|
||||
if config.Get().Brokers.NTG.Mock {
|
||||
ntg = ntg.WithMock()
|
||||
}
|
||||
brokers := []broker.Broker{ntg}
|
||||
jobs := []broker.Job{}
|
||||
for _, broker := range brokers {
|
||||
@@ -330,7 +329,7 @@ func dropBanlistJobs(jobs []broker.Job) ([]broker.Job, error) {
|
||||
func sendJob(job broker.Job) (bool, error) {
|
||||
sender := message.NewMatrix()
|
||||
payload := job.FormatMultilineText()
|
||||
log.Printf("once: send job %s if nonzero: %s", job.String(), payload)
|
||||
logtr.Debugf("once: send job %s if nonzero: %s", job.String(), payload)
|
||||
if len(payload) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
@@ -340,8 +339,8 @@ func sendJob(job broker.Job) (bool, error) {
|
||||
maps := config.Get().Maps
|
||||
pickup := fmt.Sprintf("%s,%s", url.QueryEscape(job.Pickup.City), job.Pickup.State)
|
||||
dropoff := fmt.Sprintf("%s,%s", url.QueryEscape(job.Dropoff.City), job.Dropoff.State)
|
||||
if maps.Pathed {
|
||||
directionsURI := fmt.Sprintf(maps.DirectionsURIFormat, pickup, dropoff)
|
||||
if maps.Pathed.Enabled {
|
||||
directionsURI := fmt.Sprintf(maps.Pathed.DirectionsURIFormat, pickup, dropoff)
|
||||
resp, err := http.Get(directionsURI)
|
||||
if err != nil {
|
||||
return true, err
|
||||
@@ -368,12 +367,32 @@ func sendJob(job broker.Job) (bool, error) {
|
||||
if len(directionsResp.Routes) < 1 || len(directionsResp.Routes[0].Legs) < 1 || len(directionsResp.Routes[0].Legs[0].Steps) < 1 {
|
||||
} else {
|
||||
latLngPath := make([]string, 0)
|
||||
minLat := directionsResp.Routes[0].Legs[0].Steps[0].StartLocation.Lat
|
||||
maxLat := directionsResp.Routes[0].Legs[0].Steps[0].StartLocation.Lat
|
||||
minLng := directionsResp.Routes[0].Legs[0].Steps[0].StartLocation.Lng
|
||||
maxLng := directionsResp.Routes[0].Legs[0].Steps[0].StartLocation.Lng
|
||||
for _, v := range directionsResp.Routes[0].Legs[0].Steps {
|
||||
if v.StartLocation.Lng < minLng {
|
||||
minLng = v.StartLocation.Lng
|
||||
}
|
||||
if v.StartLocation.Lng > maxLng {
|
||||
maxLng = v.StartLocation.Lng
|
||||
}
|
||||
if v.StartLocation.Lat < minLat {
|
||||
minLat = v.StartLocation.Lat
|
||||
}
|
||||
if v.StartLocation.Lat > maxLat {
|
||||
maxLat = v.StartLocation.Lat
|
||||
}
|
||||
latLngPath = append(latLngPath, fmt.Sprintf("%.9f,%.9f", v.StartLocation.Lat, v.StartLocation.Lng))
|
||||
}
|
||||
pathQuery := strings.Join(latLngPath, "|")
|
||||
uri := fmt.Sprintf(maps.PathedURIFormat, pathQuery, pickup, dropoff)
|
||||
log.Printf("sending pathed image: %s", uri)
|
||||
uri := fmt.Sprintf(maps.Pathed.PathedURIFormat, pathQuery, pickup, dropoff)
|
||||
// if the bigger delta is <acceptable, override zoom
|
||||
if maxLat-minLat <= maps.Pathed.Zoom.AcceptableLatLngDelta && maxLng-minLng <= maps.Pathed.Zoom.AcceptableLatLngDelta {
|
||||
uri = fmt.Sprintf("%s&zoom=%d", uri, maps.Pathed.Zoom.Override)
|
||||
}
|
||||
logtr.Debugf("sending pathed image: %s", uri)
|
||||
if err := sender.SendImage(uri); err != nil {
|
||||
return true, err
|
||||
}
|
||||
@@ -381,14 +400,14 @@ func sendJob(job broker.Job) (bool, error) {
|
||||
}
|
||||
if maps.Pickup {
|
||||
uri := fmt.Sprintf(maps.URIFormat, pickup, pickup)
|
||||
log.Printf("sending pickup image: %s", uri)
|
||||
logtr.Debugf("sending pickup image: %s", uri)
|
||||
if err := sender.SendImage(uri); err != nil {
|
||||
return true, err
|
||||
}
|
||||
}
|
||||
if maps.Dropoff {
|
||||
uri := fmt.Sprintf(maps.URIFormat, dropoff, dropoff)
|
||||
log.Printf("sending dropoff image: %s", uri)
|
||||
logtr.Debugf("sending dropoff image: %s", uri)
|
||||
if err := sender.SendImage(uri); err != nil {
|
||||
return true, err
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"local/truckstop/config"
|
||||
"log"
|
||||
"local/truckstop/logtr"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -40,7 +40,7 @@ func uploadImage(b []byte) (string, error) {
|
||||
} else if s, ok := u.Query()["name"]; !ok {
|
||||
} else {
|
||||
name = s[0]
|
||||
log.Printf("found name in upload uri: %s", name)
|
||||
logtr.Debugf("found name in upload uri: %s", name)
|
||||
}
|
||||
part, err := writer.CreateFormFile("image", name)
|
||||
if err != nil {
|
||||
|
||||
@@ -16,7 +16,7 @@ func TestImageUpload(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := config.Refresh(); err != nil {
|
||||
if err := config.Refresh(nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got, err := UploadImage(b)
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"local/truckstop/config"
|
||||
"log"
|
||||
"local/truckstop/logtr"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -23,15 +23,24 @@ type Matrix struct {
|
||||
continuation string
|
||||
}
|
||||
|
||||
func NewSOSMatrix() logtr.SOSer {
|
||||
conf := config.Get().Log.SOSMatrix
|
||||
return newMatrix(conf, "0")
|
||||
}
|
||||
|
||||
func NewMatrix() Matrix {
|
||||
conf := config.Get().Message.Matrix
|
||||
return newMatrix(conf, GetMatrixContinuation())
|
||||
}
|
||||
|
||||
func newMatrix(conf config.Matrix, cont string) Matrix {
|
||||
return Matrix{
|
||||
homeserver: conf.Homeserver,
|
||||
username: conf.Username,
|
||||
token: conf.Token,
|
||||
room: conf.Room,
|
||||
mock: conf.Mock,
|
||||
continuation: conf.Continuation,
|
||||
continuation: cont,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,10 +54,10 @@ func (m Matrix) Continuation() string {
|
||||
|
||||
func (m *Matrix) Receive() ([]Message, error) {
|
||||
if m.mock {
|
||||
log.Printf("matrix.Receive()")
|
||||
logtr.Infof("matrix.Receive()")
|
||||
messages := make([]Message, 0)
|
||||
for k := range config.Get().Clients {
|
||||
messages = append(messages, Message{Timestamp: time.Now(), Sender: k, Content: "!state OH"})
|
||||
messages = append(messages, Message{Timestamp: time.Now(), Sender: k, Content: "!state nc"})
|
||||
if k == "bel" {
|
||||
messages = append(messages, Message{Timestamp: time.Now(), Sender: k, Content: "!help"})
|
||||
}
|
||||
@@ -71,14 +80,13 @@ func (m *Matrix) Receive() ([]Message, error) {
|
||||
return nil, err
|
||||
}
|
||||
messages := make([]Message, 0)
|
||||
result, err := c.Messages(m.room, "999999999999999999", m.continuation, 'b', 50)
|
||||
result, err := c.Messages(m.room, "999999999999999999", m.Continuation(), 'b', 50)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Printf("%s => {Start:%s End:%v};; %v, (%d)", m.continuation, result.Start, result.End, err, len(result.Chunk))
|
||||
logtr.Debugf("%s => {Start:%s End:%v};; %v, (%d)", m.Continuation(), result.Start, result.End, err, len(result.Chunk))
|
||||
m.continuation = result.End
|
||||
for _, event := range result.Chunk {
|
||||
//log.Printf("%+v", event)
|
||||
if _, ok := matrixIDs[event.Sender]; !ok {
|
||||
continue
|
||||
}
|
||||
@@ -91,7 +99,7 @@ func (m *Matrix) Receive() ([]Message, error) {
|
||||
}
|
||||
}
|
||||
clientChange := regexp.MustCompile("@[a-z]+$")
|
||||
log.Printf("rewriting messages based on @abc")
|
||||
logtr.Debugf("rewriting messages based on @abc")
|
||||
for i := range messages {
|
||||
if found := clientChange.FindString(messages[i].Content); found != "" {
|
||||
messages[i].Content = strings.TrimSpace(strings.ReplaceAll(messages[i].Content, found, ""))
|
||||
@@ -105,7 +113,7 @@ func (m *Matrix) Receive() ([]Message, error) {
|
||||
}
|
||||
messages[i].Content = strings.TrimSpace(messages[i].Content)
|
||||
}
|
||||
log.Printf("rewriting messages based on ! CoMmAnD ...")
|
||||
logtr.Debugf("rewriting messages based on ! CoMmAnD ...")
|
||||
for i := range messages {
|
||||
if strings.HasPrefix(messages[i].Content, "!") {
|
||||
messages[i].Content = "!" + strings.TrimSpace(messages[i].Content[1:])
|
||||
@@ -118,7 +126,7 @@ func (m *Matrix) Receive() ([]Message, error) {
|
||||
|
||||
func (m Matrix) Send(text string) error {
|
||||
if m.mock {
|
||||
log.Printf("matrix.Send(%s)", text)
|
||||
logtr.Infof("matrix.Send(%s)", text)
|
||||
return nil
|
||||
}
|
||||
c, err := m.getclient()
|
||||
@@ -131,7 +139,7 @@ func (m Matrix) Send(text string) error {
|
||||
|
||||
func (m Matrix) SendImage(uri string) error {
|
||||
if m.mock {
|
||||
log.Printf("matrix.SendImage(%s)", uri)
|
||||
logtr.Infof("matrix.SendImage(%s)", uri)
|
||||
return nil
|
||||
}
|
||||
response, err := http.Get(uri)
|
||||
@@ -158,6 +166,24 @@ func (m Matrix) SendImage(uri string) error {
|
||||
}
|
||||
publicURI := mediaUpload.ContentURI
|
||||
resp, err := c.SendImage(m.room, "img", publicURI)
|
||||
log.Printf("sent image %s => %s: %+v", uri, publicURI, resp)
|
||||
logtr.Debugf("sent image %s => %s: %+v", uri, publicURI, resp)
|
||||
return err
|
||||
}
|
||||
|
||||
func SetMatrixContinuation(continuation string) {
|
||||
db := config.Get().DB()
|
||||
db.Set(getMatrixContinuationKey(), []byte(continuation))
|
||||
}
|
||||
|
||||
func GetMatrixContinuation() string {
|
||||
db := config.Get().DB()
|
||||
b, _ := db.Get(getMatrixContinuationKey())
|
||||
if b == nil {
|
||||
return "0"
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func getMatrixContinuationKey() string {
|
||||
return "matrix_continuation"
|
||||
}
|
||||
|
||||
24
todo.yaml
24
todo.yaml
@@ -1,16 +1,10 @@
|
||||
todo:
|
||||
- help() log on truckstop for stuff like perma 403
|
||||
- TEST its falling apart
|
||||
- mark jobs no longer avail by modifying in matrix
|
||||
- write-as for clients so ma can write to pa by default
|
||||
- continuation is garbo, but I can still do better client side to avoid get-set high level
|
||||
- todo: details from ntg; stophours for pickup, appointmenttime/facitlyhours for dest
|
||||
details: |
|
||||
curl 'https://ntgvision.com/api/v1/load/LoadDetails?loadId=5088453' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzgyMSIsInVuaXF1ZV9uYW1lIjoiYmlyZGNvbXBhbnlsb2dpc3RpY3NAZ21haWwuY29tIiwianRpIjoiYTFiMjkxM2YtN2RjZS00ZDQ0LWEzMDYtMTRjMTBlYjQ2MmE1IiwiaWF0IjoiMS8xMy8yMDIyIDI6MTE6NTUgUE0iLCJudGd2Um9sZSI6IkNhcnJpZXJBcHByb3ZlZCIsImxvY2tVc2VyIjoiRmFsc2UiLCJvdmVycmlkZUJsYWNrbGlzdCI6IkZhbHNlIiwic2hvd1JhdGVzIjoiRmFsc2UiLCJ1c2VyQ2FycmllcnMiOiIxMTQxOTMiLCJvdHJVc2VyIjoiRmFsc2UiLCJuYmYiOjE2NDIwODMxMTUsImV4cCI6MTY0MjE2NTkxNSwiaXNzIjoiTlRHIFNlY3VyaXR5IFRva2VuIFNlcnZpY2UiLCJhdWQiOiJOVEcifQ.eDE2Jfok79b7oD1deP_00h9g8zZ3AnY60McnJ1hfS-8YJ12L3Bl-CJeN0eBos0aj2FXHv5MrqOJ6MFCaatqjIddPJl2MvtSByGUCLBzih67O20mkCowCmZfGjSnKvUu7DHFxjzo_y4_a3cjjGPYNc2LSCVJxV9NYzSXIuXG3WvXeE3dv8ml23bJFFhMWZzhSAfWBOW4kR61sibS6BpRD8dpkKoqUfXInq_7o8jz9_PsEhPBdJydqbXwg8ifQHkaPNAojsIr2rnJ3Tf_iQpom-6oAEUAOd2D3fK1XuWtRrysnD8s41YDthmqKpni2WOk72L-sKzRxD4KX2t_gyEb3Fw' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Cookie: cookiesession1=678A3E1398901234BCDEFGHIJKLMA492; _uiq_id.711119701.3d83=516d3e744ebe2d9a.1641792415.0.1642083653..; NTGAuthToken=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzgyMSIsInVuaXF1ZV9uYW1lIjoiYmlyZGNvbXBhbnlsb2dpc3RpY3NAZ21haWwuY29tIiwianRpIjoiYTFiMjkxM2YtN2RjZS00ZDQ0LWEzMDYtMTRjMTBlYjQ2MmE1IiwiaWF0IjoiMS8xMy8yMDIyIDI6MTE6NTUgUE0iLCJudGd2Um9sZSI6IkNhcnJpZXJBcHByb3ZlZCIsImxvY2tVc2VyIjoiRmFsc2UiLCJvdmVycmlkZUJsYWNrbGlzdCI6IkZhbHNlIiwic2hvd1JhdGVzIjoiRmFsc2UiLCJ1c2VyQ2FycmllcnMiOiIxMTQxOTMiLCJvdHJVc2VyIjoiRmFsc2UiLCJuYmYiOjE2NDIwODMxMTUsImV4cCI6MTY0MjE2NTkxNSwiaXNzIjoiTlRHIFNlY3VyaXR5IFRva2VuIFNlcnZpY2UiLCJhdWQiOiJOVEcifQ.eDE2Jfok79b7oD1deP_00h9g8zZ3AnY60McnJ1hfS-8YJ12L3Bl-CJeN0eBos0aj2FXHv5MrqOJ6MFCaatqjIddPJl2MvtSByGUCLBzih67O20mkCowCmZfGjSnKvUu7DHFxjzo_y4_a3cjjGPYNc2LSCVJxV9NYzSXIuXG3WvXeE3dv8ml23bJFFhMWZzhSAfWBOW4kR61sibS6BpRD8dpkKoqUfXInq_7o8jz9_PsEhPBdJydqbXwg8ifQHkaPNAojsIr2rnJ3Tf_iQpom-6oAEUAOd2D3fK1XuWtRrysnD8s41YDthmqKpni2WOk72L-sKzRxD4KX2t_gyEb3Fw' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-origin' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache'
|
||||
{"headerSummary":"Washington, NC to Abilene, TX","loadId":5088453,"miles":1481,"weight":6000,"temp":null,"equipment":"Str Truck W/ Lift Gate","categoryName":"Lighting / Lighting Fixtures","categoryLabel":"Product Category","cargoInformation":["Store Fixtures - 6000 lbs"],"loadRequirements":["Straight Truck with lift gate required"],"stopInfos":[{"loadInfoIds":[5431607],"stopDateTime":"0001-01-01T00:00:00","isPickup":true,"location":"Washington, NC","stopDate":"Friday, 01/14/22","stopHours":"10:00 - 12:00","appointmentTime":"","appointmentType":"FCFS","instructions":"***LIFTGATE, PALLET JACK, DRIVER ASSIST***--MUST DELIVER ONLY ON APPT TIME-- CANNOT DELIVER EARLY OR LATE \r\n","isDropTrailer":false,"shipperName":"IDX NORTH CAROLINA","processedStopDate":""},{"loadInfoIds":[5431607],"stopDateTime":"0001-01-01T00:00:00","isPickup":false,"location":"Abilene, TX","stopDate":"Monday, 01/17/22","stopHours":"09:00 - 10:00","appointmentTime":"09:00","appointmentType":"APPT","instructions":"***LIFTGATE, PALLET JACK, DRIVER ASSIST***--MUST DELIVER ONLY ON APPT TIME-- CANNOT DELIVER EARLY OR LATE \r\n","isDropTrailer":false,"shipperName":"hibbett sports","processedStopDate":""}],"drayStopInfos":null,"rateInfo":null,"isDray":false,"equipmentGroupId":8,"totalCarrierRate":2600.00,"payUpTo":2700.00,"firstLoadInfoId":5431607,"loadStatus":"ACTIVE","hasBlockingAlert":false,"customerLoadBlocked":false,"canSeeRate":false,"canBookNow":false,"canBidNow":true,"buttonData":{"useBidDialog":false,"lastBidAmount":null,"remainingBids":1,"carrierPhoneNumber":null,"carrierPhoneExtension":null},"stopData":[{"addr":"IDX NORTH CAROLINA","city":"Washington","state":"NC","zip":"27889"},{"addr":"hibbett sports","city":"Abilene","state":"TX","zip":"79606"}]}
|
||||
|
||||
- no hard code jpeg or have it in multiple places
|
||||
- todo: switch house to selfhosted for rate limit
|
||||
tags: now
|
||||
- mark consumed;; save scroll id for matrix
|
||||
- TEST its falling apart
|
||||
- test each !command callbacks to matrix
|
||||
- change matrix so I test my custom logic even if I dont fetch remote
|
||||
- warn/err/etc. on clobbering ids.matrix since clients can mess with one another
|
||||
@@ -21,6 +15,18 @@ todo:
|
||||
- banlist criteria like vendors, brokers, metadata
|
||||
- set up copy for caleb, broc
|
||||
done:
|
||||
- figure out zoom on maps;; is there like an auto-zoom I can leverage?
|
||||
- mock is nigh useless
|
||||
- mark consumed;; save scroll id for matrix
|
||||
- todo: switch house to selfhosted for rate limit
|
||||
tags: now
|
||||
- todo: details from ntg; stophours for pickup, appointmenttime/facitlyhours for dest
|
||||
details: |
|
||||
curl 'https://ntgvision.com/api/v1/load/LoadDetails?loadId=5088453' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzgyMSIsInVuaXF1ZV9uYW1lIjoiYmlyZGNvbXBhbnlsb2dpc3RpY3NAZ21haWwuY29tIiwianRpIjoiYTFiMjkxM2YtN2RjZS00ZDQ0LWEzMDYtMTRjMTBlYjQ2MmE1IiwiaWF0IjoiMS8xMy8yMDIyIDI6MTE6NTUgUE0iLCJudGd2Um9sZSI6IkNhcnJpZXJBcHByb3ZlZCIsImxvY2tVc2VyIjoiRmFsc2UiLCJvdmVycmlkZUJsYWNrbGlzdCI6IkZhbHNlIiwic2hvd1JhdGVzIjoiRmFsc2UiLCJ1c2VyQ2FycmllcnMiOiIxMTQxOTMiLCJvdHJVc2VyIjoiRmFsc2UiLCJuYmYiOjE2NDIwODMxMTUsImV4cCI6MTY0MjE2NTkxNSwiaXNzIjoiTlRHIFNlY3VyaXR5IFRva2VuIFNlcnZpY2UiLCJhdWQiOiJOVEcifQ.eDE2Jfok79b7oD1deP_00h9g8zZ3AnY60McnJ1hfS-8YJ12L3Bl-CJeN0eBos0aj2FXHv5MrqOJ6MFCaatqjIddPJl2MvtSByGUCLBzih67O20mkCowCmZfGjSnKvUu7DHFxjzo_y4_a3cjjGPYNc2LSCVJxV9NYzSXIuXG3WvXeE3dv8ml23bJFFhMWZzhSAfWBOW4kR61sibS6BpRD8dpkKoqUfXInq_7o8jz9_PsEhPBdJydqbXwg8ifQHkaPNAojsIr2rnJ3Tf_iQpom-6oAEUAOd2D3fK1XuWtRrysnD8s41YDthmqKpni2WOk72L-sKzRxD4KX2t_gyEb3Fw' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Cookie: cookiesession1=678A3E1398901234BCDEFGHIJKLMA492; _uiq_id.711119701.3d83=516d3e744ebe2d9a.1641792415.0.1642083653..; NTGAuthToken=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzgyMSIsInVuaXF1ZV9uYW1lIjoiYmlyZGNvbXBhbnlsb2dpc3RpY3NAZ21haWwuY29tIiwianRpIjoiYTFiMjkxM2YtN2RjZS00ZDQ0LWEzMDYtMTRjMTBlYjQ2MmE1IiwiaWF0IjoiMS8xMy8yMDIyIDI6MTE6NTUgUE0iLCJudGd2Um9sZSI6IkNhcnJpZXJBcHByb3ZlZCIsImxvY2tVc2VyIjoiRmFsc2UiLCJvdmVycmlkZUJsYWNrbGlzdCI6IkZhbHNlIiwic2hvd1JhdGVzIjoiRmFsc2UiLCJ1c2VyQ2FycmllcnMiOiIxMTQxOTMiLCJvdHJVc2VyIjoiRmFsc2UiLCJuYmYiOjE2NDIwODMxMTUsImV4cCI6MTY0MjE2NTkxNSwiaXNzIjoiTlRHIFNlY3VyaXR5IFRva2VuIFNlcnZpY2UiLCJhdWQiOiJOVEcifQ.eDE2Jfok79b7oD1deP_00h9g8zZ3AnY60McnJ1hfS-8YJ12L3Bl-CJeN0eBos0aj2FXHv5MrqOJ6MFCaatqjIddPJl2MvtSByGUCLBzih67O20mkCowCmZfGjSnKvUu7DHFxjzo_y4_a3cjjGPYNc2LSCVJxV9NYzSXIuXG3WvXeE3dv8ml23bJFFhMWZzhSAfWBOW4kR61sibS6BpRD8dpkKoqUfXInq_7o8jz9_PsEhPBdJydqbXwg8ifQHkaPNAojsIr2rnJ3Tf_iQpom-6oAEUAOd2D3fK1XuWtRrysnD8s41YDthmqKpni2WOk72L-sKzRxD4KX2t_gyEb3Fw' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-origin' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache'
|
||||
{"headerSummary":"Washington, NC to Abilene, TX","loadId":5088453,"miles":1481,"weight":6000,"temp":null,"equipment":"Str Truck W/ Lift Gate","categoryName":"Lighting / Lighting Fixtures","categoryLabel":"Product Category","cargoInformation":["Store Fixtures - 6000 lbs"],"loadRequirements":["Straight Truck with lift gate required"],"stopInfos":[{"loadInfoIds":[5431607],"stopDateTime":"0001-01-01T00:00:00","isPickup":true,"location":"Washington, NC","stopDate":"Friday, 01/14/22","stopHours":"10:00 - 12:00","appointmentTime":"","appointmentType":"FCFS","instructions":"***LIFTGATE, PALLET JACK, DRIVER ASSIST***--MUST DELIVER ONLY ON APPT TIME-- CANNOT DELIVER EARLY OR LATE \r\n","isDropTrailer":false,"shipperName":"IDX NORTH CAROLINA","processedStopDate":""},{"loadInfoIds":[5431607],"stopDateTime":"0001-01-01T00:00:00","isPickup":false,"location":"Abilene, TX","stopDate":"Monday, 01/17/22","stopHours":"09:00 - 10:00","appointmentTime":"09:00","appointmentType":"APPT","instructions":"***LIFTGATE, PALLET JACK, DRIVER ASSIST***--MUST DELIVER ONLY ON APPT TIME-- CANNOT DELIVER EARLY OR LATE \r\n","isDropTrailer":false,"shipperName":"hibbett sports","processedStopDate":""}],"drayStopInfos":null,"rateInfo":null,"isDray":false,"equipmentGroupId":8,"totalCarrierRate":2600.00,"payUpTo":2700.00,"firstLoadInfoId":5431607,"loadStatus":"ACTIVE","hasBlockingAlert":false,"customerLoadBlocked":false,"canSeeRate":false,"canBookNow":false,"canBidNow":true,"buttonData":{"useBidDialog":false,"lastBidAmount":null,"remainingBids":1,"carrierPhoneNumber":null,"carrierPhoneExtension":null},"stopData":[{"addr":"IDX NORTH CAROLINA","city":"Washington","state":"NC","zip":"27889"},{"addr":"hibbett sports","city":"Abilene","state":"TX","zip":"79606"}]}
|
||||
|
||||
- tokens in db, not in config
|
||||
- cache on disk jobinfo
|
||||
- link to view more
|
||||
- map with to-from line
|
||||
- TO CONFLUENT.RS OR W/E
|
||||
|
||||
Reference in New Issue
Block a user