Compare commits

..

26 Commits

Author SHA1 Message Date
Bel LaPointe
2102259ba4 todo 2022-01-13 16:47:58 -05:00
Bel LaPointe
9552df9281 update messages paging for conduit.rs, which in turn doesnt work but thats future work 2022-01-13 16:46:10 -05:00
Bel LaPointe
1cdb399dda to m.bltrucks.top staging 2022-01-13 16:35:24 -05:00
Bel LaPointe
6bc85d0ab7 experiment with moving cont between from and to and settle 2022-01-13 13:14:20 -05:00
Bel LaPointe
874de44a47 todo for momma 2022-01-13 13:09:55 -05:00
Bel LaPointe
a07a7d5a00 impl matrix continuation so i can get rid of per-msg get-set 2022-01-13 13:08:52 -05:00
Bel LaPointe
65e43f8d2a log 2022-01-13 09:16:03 -05:00
Bel LaPointe
e8b76d07e2 add logs 2022-01-13 09:10:18 -05:00
Bel LaPointe
63ef1f206b gitignore binary 2022-01-13 01:34:38 -05:00
Bel LaPointe
373e9ff3c3 todo 2022-01-13 01:12:26 -05:00
Bel LaPointe
d3fff1519b figured out image upload to matrix but now jpeg is hard coded 2022-01-13 01:12:12 -05:00
Bel LaPointe
2b6acc51fb try naming form for link to img, no dice 2022-01-13 01:08:13 -05:00
Bel LaPointe
fade4467d6 try png over jpeg for element, no dice 2022-01-13 00:55:40 -05:00
Bel LaPointe
c8800c010e todo 2022-01-13 00:29:24 -05:00
Bel LaPointe
266ccb5f98 mark state, pause msgs as processed 2022-01-13 00:22:59 -05:00
Bel LaPointe
1cc082083c check status on upload, query escape cities for formatting maps uri format 2022-01-13 00:17:41 -05:00
Bel LaPointe
5170e96f7e dont re-send help, mark all help as done if help has been sent, log noop for search 2022-01-12 23:51:16 -05:00
Bel LaPointe
826278fa78 todo 2022-01-12 23:40:10 -05:00
Bel LaPointe
111fe0ad6d change to selfhosted staging 2022-01-12 23:38:41 -05:00
Bel LaPointe
72a474b50a support !help, find clints change to end of string 2022-01-12 23:23:30 -05:00
Bel LaPointe
de80f11392 mock for matrix for !state, !available, and !help 2022-01-12 22:35:44 -05:00
Bel LaPointe
d26d043f2e add bel to config.json 2022-01-12 22:34:36 -05:00
Bel LaPointe
b6dbe25a48 add timestamp to matrix msg 2022-01-12 22:34:23 -05:00
Bel LaPointe
09e87c66d8 check msg prefix before parse for both new-!state, !available 2022-01-12 22:14:58 -05:00
Bel LaPointe
75409a11b9 todo 2022-01-12 22:11:19 -05:00
Bel LaPointe
3213c21c7e replace pause until with available 2022-01-12 22:09:58 -05:00
11 changed files with 213 additions and 87 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ todo-server-yaml
cmd/cmd
cmd/cli
cmd/pttodo/pttodo
/truckstop

View File

@@ -53,7 +53,7 @@ func (j Job) FormatMultilineText() string {
)
}
out := ""
clients := config.Clients()
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)
if strings.Contains(fmt.Sprint(clients[k].States), j.Pickup.State) {

View File

@@ -8,6 +8,7 @@ import (
"io"
"io/ioutil"
"local/truckstop/config"
"log"
"net/http"
"time"
)
@@ -73,8 +74,15 @@ func (ntg NTGVision) Search(states []config.State) ([]Job, error) {
}
defer rc.Close()
b, err := ioutil.ReadAll(rc)
if err != nil {
return nil, err
}
log.Printf("ntg search for %+v: %s", states, b)
var ntgjobs []ntgVisionJob
err = json.NewDecoder(rc).Decode(&ntgjobs)
err = json.Unmarshal(b, &ntgjobs)
jobs := make([]Job, len(ntgjobs))
for i := range jobs {

View File

@@ -1,6 +1,6 @@
{
"Interval": {
"Input": "10s..30s",
"Input": "5s..10s",
"OK": "6h0m0s..6h0m0s",
"Error": "6h0m0s..6h0m0s"
},
@@ -10,58 +10,58 @@
"RefreshToken": "171417741bf762b99b0b9f9137491b7a69874a77",
"AccessToken": "e63db98f92d2db7ac7f56914a2030c889b378e9b",
"RefreshURI": "https://api.imgur.com/oauth2/token",
"RefreshFormat": "refresh_token=%s&client_id=%s&client_secret=%s&grant_type=refresh_token",
"RefreshFormat": "refresh_token=%s\u0026client_id=%s\u0026client_secret=%s\u0026grant_type=refresh_token",
"RefreshMethod": "POST",
"UploadURI": "https://api.imgur.com/3/image",
"UploadURI": "https://api.imgur.com/3/image?name=something.jpeg",
"UploadMethod": "POST"
},
"Maps": {
"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",
"Pickup": true,
"Dropoff": true
"Dropoff": false
},
"Clients": {
"bel": {
"States": [],
"IDs": {
"Matrix": "@bel:m.bltrucks.top"
},
"Available": 1512328400
},
"broc": {
"States": [
"FL",
"NC"
],
"IDs": {
"Matrix": "@belandbroc:matrix.org"
"Matrix": "@broc:m.bltrucks.top"
},
"PauseUntil": 5642107200
},
"caleb": {
"States": [
"FL"
],
"IDs": {
"Matrix": "@belandbroc:matrix.org"
},
"PauseUntil": -62135596800
"Available": 5642452800
},
"pa": {
"States": [
"OH"
"NC"
],
"IDs": {
"Matrix": "@belandbroc:matrix.org"
"Matrix": "@ron:m.bltrucks.top"
},
"PauseUntil": -62135596800
"Available": -62135596800
}
},
"Storage": [
"map"
"files",
"/tmp/play"
],
"Message": {
"Matrix": {
"ReceiveEnabled": true,
"Mock": false,
"Homeserver": "https://matrix-client.matrix.org",
"Username": "@breellocaldev:matrix.org",
"Token": "syt_YnJlZWxsb2NhbGRldg_HTewKMMePdEcLvceAKEz_2fHsHa",
"Continuation": "190",
"Homeserver": "https://m.bltrucks.top",
"Username": "@bot.m.bltrucks.top",
"Token": "mvDWB96KXMF8XhOam8EC5XVdQvSEw0CDeClcSWocBcYkwZX3FPNWZ5uOnQk2EmT1cjpzfeuD7gDYPPjOuyZlI3bE9TE35UjNOlZgi0Tugm25s91iVsbIF6kMZsCIhVMSmEf6w3jxX6wQYOWvmDZ4mu6f5c8wr221EMDcOpEzQV09d1zuBSWgKLBgjqAkYHJZ5dTRIWpEDpPgujhOFZa2ld1HiAOxrJKlIrlfDBN0CUsTlGOGplujDAr4VtpFzNRS",
"Device": "TGNIOGKATZ",
"Room": "!ySKxwGHQPzPfVAldfJ:matrix.org"
"Room": "!OYZqtInrBCn1cyz90D:m.bltrucks.top"
}
},
"Once": true,

View File

@@ -37,6 +37,7 @@ type Config struct {
Matrix struct {
ReceiveEnabled bool
Mock bool
Continuation string
Homeserver string
Username string
Token string
@@ -63,7 +64,7 @@ type Client struct {
IDs struct {
Matrix string
}
PauseUntil Time
Available Time
}
var live Config
@@ -76,11 +77,11 @@ func configPath() string {
return p
}
func Clients() map[string]Client {
func Clients(t time.Time) map[string]Client {
clients := Get().Clients
result := map[string]Client{}
for k := range clients {
if clients[k].PauseUntil.Get().IsZero() || time.Now().After(clients[k].PauseUntil.Get()) {
if clients[k].Available.Get().IsZero() || t.After(clients[k].Available.Get()) {
result[k] = clients[k]
}
}
@@ -89,7 +90,7 @@ func Clients() map[string]Client {
func AllStates() []State {
statem := map[State]struct{}{}
for _, v := range Clients() {
for _, v := range Clients(time.Now().Add(time.Hour * 24 * 365)) {
for _, state := range v.States {
statem[state] = struct{}{}
}

97
main.go
View File

@@ -9,6 +9,7 @@ import (
"local/truckstop/config"
"local/truckstop/message"
"log"
"net/url"
"regexp"
"sort"
"strings"
@@ -22,8 +23,10 @@ func main() {
if err := config.Refresh(); err != nil {
panic(err)
}
if err := matrixrecv(); err != nil {
panic(err)
if config.Get().Message.Matrix.ReceiveEnabled {
if err := matrixrecv(); err != nil {
panic(err)
}
}
lock := &sync.Mutex{}
go func() {
@@ -56,57 +59,108 @@ func matrixrecv() error {
if err != nil {
return err
}
func() {
log.Printf("looking for help")
printed := false
for _, msg := range messages {
if !strings.HasPrefix(msg.Content, "!help") {
continue
}
key := fmt.Sprintf("help_%d", msg.Timestamp.Unix())
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`")
if err := sender.Send(help); err != nil {
log.Printf("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)
}
}
}
} else {
if err := db.Set(key, []byte{'k'}); err != nil {
log.Printf("failed to mark help given @%s: %v", key, err)
}
}
}
}()
func() {
log.Printf("looking for states")
db := config.Get().DB()
states := map[string]map[config.State]struct{}{}
for _, msg := range messages {
key := fmt.Sprintf("states_%d", msg.Timestamp.Unix())
if !strings.HasPrefix(msg.Content, "!state") {
continue
}
if _, ok := states[msg.Sender]; ok {
continue
}
states[msg.Sender] = map[config.State]struct{}{}
for _, state := range parseOutStates([]byte(msg.Content)) {
states[msg.Sender][state] = struct{}{}
if _, err := db.Get(key); err == storage.ErrNotFound {
states[msg.Sender] = map[config.State]struct{}{}
for _, state := range parseOutStates([]byte(msg.Content)) {
states[msg.Sender][state] = struct{}{}
}
}
if err := db.Set(key, []byte{'k'}); err != nil {
log.Printf("failed to mark state gathered @%s: %v", key, err)
}
}
setNewStates(states)
}()
func() {
log.Printf("looking for pauses")
db := config.Get().DB()
pauses := map[string]time.Time{}
for _, msg := range messages {
key := fmt.Sprintf("pauses_%d", msg.Timestamp.Unix())
if !strings.HasPrefix(msg.Content, "!available ") {
continue
}
if _, ok := pauses[msg.Sender]; ok {
continue
}
if !strings.HasPrefix(msg.Content, "pause until") {
continue
if _, err := db.Get(key); err == storage.ErrNotFound {
t, err := time.ParseInLocation(
"2006-01-02",
strings.TrimSpace(strings.TrimPrefix(msg.Content, "!available ")),
time.Local,
)
if err == nil {
pauses[msg.Sender] = t
}
}
t, err := time.ParseInLocation(
"2006-01-02",
strings.TrimSpace(strings.TrimPrefix(msg.Content, "pause until")),
time.Local,
)
if err == nil {
pauses[msg.Sender] = t
if err := db.Set(key, []byte{'k'}); err != nil {
log.Printf("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)
}
return nil
}
func setNewPauses(pauses map[string]time.Time) {
log.Printf("set new pauses: %+v", pauses)
if len(pauses) == 0 {
return
}
log.Printf("set new pauses: %+v", pauses)
conf := *config.Get()
changed := map[string]time.Time{}
for client, pause := range pauses {
clientconf := conf.Clients[client]
if clientconf.PauseUntil.Get().Unix() == pause.Unix() {
if clientconf.Available.Get().Unix() == pause.Unix() {
continue
}
clientconf.PauseUntil = config.Time(pause)
clientconf.Available = config.Time(pause)
conf.Clients[client] = clientconf
changed[client] = pause
}
@@ -138,6 +192,7 @@ func setNewStates(states map[string]map[config.State]struct{}) {
})
clientconf := conf.Clients[client]
if fmt.Sprint(newstates) == fmt.Sprint(clientconf.States) {
message.NewMatrix().Send(fmt.Sprintf("%s: still searching for %+v", client, newstates))
continue
}
clientconf.States = newstates
@@ -211,14 +266,17 @@ func once() error {
if err != nil {
return err
}
log.Printf("once: all jobs: %+v", alljobs)
newjobs, err := dropStaleJobs(alljobs)
if err != nil {
return err
}
log.Printf("once: new jobs: %+v", newjobs)
jobs, err := dropBanlistJobs(newjobs)
if err != nil {
return err
}
log.Printf("once: sending jobs: %+v", jobs)
for i := range jobs {
if err := sendJob(jobs[i]); err != nil {
return err
@@ -270,6 +328,7 @@ func dropBanlistJobs(jobs []broker.Job) ([]broker.Job, error) {
func sendJob(job broker.Job) error {
sender := message.NewMatrix()
payload := job.FormatMultilineText()
log.Printf("once: send job %s if nonzero: %s", job.String(), payload)
if len(payload) == 0 {
return nil
}
@@ -278,7 +337,7 @@ func sendJob(job broker.Job) error {
}
maps := config.Get().Maps
if maps.Pickup {
pickup := fmt.Sprintf("%s,%s", job.Pickup.City, job.Pickup.State)
pickup := fmt.Sprintf("%s,%s", url.QueryEscape(job.Pickup.City), job.Pickup.State)
uri := fmt.Sprintf(maps.URIFormat, pickup, pickup)
log.Printf("sending pickup image: %s", uri)
if err := sender.SendImage(uri); err != nil {
@@ -286,7 +345,7 @@ func sendJob(job broker.Job) error {
}
}
if maps.Dropoff {
dropoff := fmt.Sprintf("%s,%s", job.Dropoff.City, job.Dropoff.State)
dropoff := fmt.Sprintf("%s,%s", url.QueryEscape(job.Dropoff.City), job.Dropoff.State)
uri := fmt.Sprintf(maps.URIFormat, dropoff, dropoff)
log.Printf("sending dropoff image: %s", uri)
if err := sender.SendImage(uri); err != nil {

View File

@@ -7,8 +7,10 @@ import (
"fmt"
"io/ioutil"
"local/truckstop/config"
"log"
"mime/multipart"
"net/http"
"net/url"
"time"
)
@@ -30,9 +32,17 @@ func refreshToken() error {
}
func uploadImage(b []byte) (string, error) {
images := config.Get().Images
buff := bytes.NewBuffer(nil)
writer := multipart.NewWriter(buff)
part, err := writer.CreateFormFile("image", "name")
name := "name"
if u, err := url.Parse(images.UploadURI); err != nil {
} else if s, ok := u.Query()["name"]; !ok {
} else {
name = s[0]
log.Printf("found name in upload uri: %s", name)
}
part, err := writer.CreateFormFile("image", name)
if err != nil {
return "", err
}
@@ -43,7 +53,6 @@ func uploadImage(b []byte) (string, error) {
}
writer.Close()
images := config.Get().Images
request, err := http.NewRequest(
images.UploadMethod,
images.UploadURI,

View File

@@ -1,6 +1,7 @@
package message
import (
"bytes"
"fmt"
"io/ioutil"
"local/truckstop/config"
@@ -14,21 +15,23 @@ import (
)
type Matrix struct {
mock bool
homeserver string
username string
token string
room string
mock bool
homeserver string
username string
token string
room string
continuation string
}
func NewMatrix() Matrix {
conf := config.Get().Message.Matrix
return Matrix{
homeserver: conf.Homeserver,
username: conf.Username,
token: conf.Token,
room: conf.Room,
mock: conf.Mock,
homeserver: conf.Homeserver,
username: conf.Username,
token: conf.Token,
room: conf.Room,
mock: conf.Mock,
continuation: conf.Continuation,
}
}
@@ -36,14 +39,21 @@ func (m Matrix) getclient() (*gomatrix.Client, error) {
return gomatrix.NewClient(m.homeserver, m.username, m.token)
}
func (m Matrix) Receive() ([]Message, error) {
func (m Matrix) Continuation() string {
return m.continuation
}
func (m *Matrix) Receive() ([]Message, error) {
if m.mock {
log.Printf("matrix.Receive()")
messages := make([]Message, 0)
for k := range config.Get().Clients {
messages = append(messages, Message{Sender: k, Content: "OH"})
messages = append(messages, Message{Timestamp: time.Now(), Sender: k, Content: "!state OH"})
if k == "bel" {
messages = append(messages, Message{Timestamp: time.Now(), Sender: k, Content: "!help"})
}
if k == "broc" {
messages = append(messages, Message{Sender: k, Content: "pause until 2148-10-" + fmt.Sprint(time.Now().Unix()%28)})
messages = append(messages, Message{Timestamp: time.Now(), Sender: k, Content: "!available 2148-10-" + fmt.Sprint(time.Now().Unix()%28)})
}
}
return messages, nil
@@ -61,8 +71,14 @@ func (m Matrix) Receive() ([]Message, error) {
return nil, err
}
messages := make([]Message, 0)
result, err := c.Messages(m.room, "", "", '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))
m.continuation = result.End
for _, event := range result.Chunk {
//log.Printf("%+v", event)
if _, ok := matrixIDs[event.Sender]; !ok {
continue
}
@@ -70,14 +86,12 @@ func (m Matrix) Receive() ([]Message, error) {
case "m.room.message":
b, ok := event.Body()
if ok {
messages = append(messages, Message{Sender: event.Sender, Content: strings.TrimSpace(b)})
messages = append(messages, Message{Timestamp: time.Unix(0, event.Timestamp*int64(time.Millisecond)), Sender: event.Sender, Content: strings.TrimSpace(b)})
}
}
}
if err != nil {
return nil, err
}
clientChange := regexp.MustCompile("^@[a-z]+")
clientChange := regexp.MustCompile("@[a-z]+$")
log.Printf("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, ""))
@@ -89,6 +103,15 @@ func (m Matrix) Receive() ([]Message, error) {
}
}
}
messages[i].Content = strings.TrimSpace(messages[i].Content)
}
log.Printf("rewriting messages based on ! CoMmAnD ...")
for i := range messages {
if strings.HasPrefix(messages[i].Content, "!") {
messages[i].Content = "!" + strings.TrimSpace(messages[i].Content[1:])
splits := strings.Split(messages[i].Content, " ")
messages[i].Content = strings.ToLower(splits[0]) + " " + strings.Join(splits, " ")
}
}
return messages, nil
}
@@ -115,19 +138,25 @@ func (m Matrix) SendImage(uri string) error {
if err != nil {
return err
}
if response.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(response.Body)
response.Body.Close()
return fmt.Errorf("failed to get %s: (%d) %s", uri, response.StatusCode, b)
}
b, err := ioutil.ReadAll(response.Body)
response.Body.Close()
if err != nil {
return err
}
publicURI, err := UploadImage(b)
if err != nil {
return err
}
c, err := m.getclient()
if err != nil {
return err
}
mediaUpload, err := c.UploadToContentRepo(bytes.NewReader(b), "image/jpeg", int64(len(b)))
if err != nil {
return err
}
publicURI := mediaUpload.ContentURI
resp, err := c.SendImage(m.room, "img", publicURI)
log.Printf("sent image %s => %s: %+v", uri, publicURI, resp)
return err

View File

@@ -20,7 +20,7 @@ func TestMatrixSend(t *testing.T) {
if err := json.Unmarshal(b, &c); err != nil {
t.Fatal(err)
}
var sender Sender = Matrix{
var sender Sender = &Matrix{
homeserver: c.Message.Matrix.Homeserver,
username: c.Message.Matrix.Username,
token: c.Message.Matrix.Token,
@@ -43,7 +43,7 @@ func TestMatrixReceive(t *testing.T) {
if err := json.Unmarshal(b, &c); err != nil {
t.Fatal(err)
}
var sender Sender = Matrix{
var sender Sender = &Matrix{
homeserver: c.Message.Matrix.Homeserver,
username: c.Message.Matrix.Username,
token: c.Message.Matrix.Token,

View File

@@ -1,11 +1,14 @@
package message
import "time"
type Sender interface {
Send(string) error
Receive() ([]Message, error)
}
type Message struct {
Sender string
Content string
Sender string
Content string
Timestamp time.Time
}

View File

@@ -1,14 +1,18 @@
todo:
- convert pauseuntil to search results only on and after target date
- todo: maps of to+from to get location within state via api
- link to view more
- map with to-from line
- 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://maps.googleapis.com/maps/api/staticmap?center=Advance,NC&markers=label=A|Advance,NC&zoom=5&size=250x250&scale=2&format=jpeg&maptype=roadmap&key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' -H 'Accept: image/avif,image/webp,*/*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'DNT: 1' -H 'Alt-Used: maps.googleapis.com' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: image' -H 'Sec-Fetch-Mode: no-cors' -H 'Sec-Fetch-Site: cross-site' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'TE: trailers' > whatever.jpg; open whatever.jpg~/Go/src/local/truckstop
subtasks:
- DONE; yandex; key 9baa3e42-c6e5-4eb5-a891-05ffcede6a25 yandex maps
- google; key AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg
- !help,
- !states optional but explicit option
- pause until => !busy until
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
- modify old items once no longer available; drop stale jobs good candidate but requires new matrix interaction
@@ -16,9 +20,21 @@ todo:
- todo: filter out jobs like CA
subtasks:
- banlist criteria like vendors, brokers, metadata
- setup ma on element !!fluffychat
- set up copy for caleb, broc
done:
- TO CONFLUENT.RS OR W/E
- rm get-set stuff for matrix now that it has continuation
- setup ma on element !!fluffychat
- !help,
- !states optional but explicit option
- TEST; convert pauseuntil to search results only on and after target date
- pause until => !busy until
- todo: maps of to+from to get location within state via api
details: |
curl 'https://maps.googleapis.com/maps/api/staticmap?center=Advance,NC&markers=label=A|Advance,NC&zoom=5&size=250x250&scale=2&format=jpeg&maptype=roadmap&key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' -H 'Accept: image/avif,image/webp,*/*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'DNT: 1' -H 'Alt-Used: maps.googleapis.com' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: image' -H 'Sec-Fetch-Mode: no-cors' -H 'Sec-Fetch-Site: cross-site' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'TE: trailers' > whatever.jpg; open whatever.jpg~/Go/src/local/truckstop
subtasks:
- DONE; yandex; key 9baa3e42-c6e5-4eb5-a891-05ffcede6a25 yandex maps
- google; key AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg
- todo: upload g map to imgur
details: |
w oath d9ac7cabe813d10 9d0b3d82800b30ca88f595d3bcd6985f627d7d82