From 0bc064b4ba66e0a9b90dc2edbf17bad156cc1413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sun, 31 Dec 2023 15:15:27 +0100 Subject: [PATCH] Update scnsend script: "bugfix for big files in --scnsend-read-body-from-file" --- scn_send.sh | 8 +++++++- scnserver/TODO.md | 4 +++- scnserver/cmd/dbhash/main.go | 13 ++++++------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/scn_send.sh b/scn_send.sh index f39545e..7d33595 100644 --- a/scn_send.sh +++ b/scn_send.sh @@ -87,6 +87,7 @@ title="${args[0]}" args=("${args[@]:1}") content="" +filecontent="" if [ ${#args[@]} -gt 0 ]; then content="${args[0]}" @@ -106,7 +107,8 @@ fi if [[ "$content" == --scnsend-read-body-from-file=* ]]; then path="$( awk '{ print substr($0, 31) }' <<< "$content" )" - content="$( cat "$path" )" + filecontent="$path" + content="" fi curlparams=() @@ -121,6 +123,10 @@ if [[ -n "$content" ]]; then curlparams+=("--data-urlencode" "content=$content") fi +if [[ -n "$filecontent" && -z "$content" ]]; then + curlparams+=("--data-urlencode" "content@$filecontent") +fi + if [[ -n "$priority" ]]; then curlparams+=("--data-urlencode" "priority=$priority") fi diff --git a/scnserver/TODO.md b/scnserver/TODO.md index dacc673..82ca82a 100644 --- a/scnserver/TODO.md +++ b/scnserver/TODO.md @@ -68,6 +68,8 @@ - cli app (?) + - Use "github.com/glebarez/go-sqlite" instead of mattn3 (see ai-sig alarmserver) + #### FUTURE - - Remove compat, especially do not create compat id for every new message... + - Remove compat, especially do not create compat id for every new message... \ No newline at end of file diff --git a/scnserver/cmd/dbhash/main.go b/scnserver/cmd/dbhash/main.go index a9afa1f..1e6748a 100644 --- a/scnserver/cmd/dbhash/main.go +++ b/scnserver/cmd/dbhash/main.go @@ -14,44 +14,43 @@ func main() { defer cancel() sqlite3.Version() // ensure slite3 loaded - { - h0, err := sq.HashSqliteSchema(ctx, schema.PrimarySchema1) + h0, err := sq.HashSqliteSchema(ctx, schema.PrimarySchema[1].SQL) if err != nil { h0 = "ERR" } fmt.Printf("PrimarySchema1 := %s\n", h0) } { - h0, err := sq.HashSqliteSchema(ctx, schema.PrimarySchema2) + h0, err := sq.HashSqliteSchema(ctx, schema.PrimarySchema[2].SQL) if err != nil { h0 = "ERR" } fmt.Printf("PrimarySchema2 := %s\n", h0) } { - h0, err := sq.HashSqliteSchema(ctx, schema.PrimarySchema3) + h0, err := sq.HashSqliteSchema(ctx, schema.PrimarySchema[3].SQL) if err != nil { h0 = "ERR" } fmt.Printf("PrimarySchema3 := %s\n", h0) } { - h0, err := sq.HashSqliteSchema(ctx, schema.PrimarySchema4) + h0, err := sq.HashSqliteSchema(ctx, schema.PrimarySchema[4].SQL) if err != nil { h0 = "ERR" } fmt.Printf("PrimarySchema4 := %s\n", h0) } { - h0, err := sq.HashSqliteSchema(ctx, schema.RequestsSchema1) + h0, err := sq.HashSqliteSchema(ctx, schema.RequestsSchema[1].SQL) if err != nil { h0 = "ERR" } fmt.Printf("RequestsSchema1 := %s\n", h0) } { - h0, err := sq.HashSqliteSchema(ctx, schema.LogsSchema1) + h0, err := sq.HashSqliteSchema(ctx, schema.LogsSchema[1].SQL) if err != nil { h0 = "ERR" }