Update scnsend script: "bugfix for big files in --scnsend-read-body-from-file"

This commit is contained in:
Mike Schwörer 2023-12-31 15:15:27 +01:00
parent 35a97be4c4
commit 0bc064b4ba
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
3 changed files with 16 additions and 9 deletions

View File

@ -87,6 +87,7 @@ title="${args[0]}"
args=("${args[@]:1}") args=("${args[@]:1}")
content="" content=""
filecontent=""
if [ ${#args[@]} -gt 0 ]; then if [ ${#args[@]} -gt 0 ]; then
content="${args[0]}" content="${args[0]}"
@ -106,7 +107,8 @@ fi
if [[ "$content" == --scnsend-read-body-from-file=* ]]; then if [[ "$content" == --scnsend-read-body-from-file=* ]]; then
path="$( awk '{ print substr($0, 31) }' <<< "$content" )" path="$( awk '{ print substr($0, 31) }' <<< "$content" )"
content="$( cat "$path" )" filecontent="$path"
content=""
fi fi
curlparams=() curlparams=()
@ -121,6 +123,10 @@ if [[ -n "$content" ]]; then
curlparams+=("--data-urlencode" "content=$content") curlparams+=("--data-urlencode" "content=$content")
fi fi
if [[ -n "$filecontent" && -z "$content" ]]; then
curlparams+=("--data-urlencode" "content@$filecontent")
fi
if [[ -n "$priority" ]]; then if [[ -n "$priority" ]]; then
curlparams+=("--data-urlencode" "priority=$priority") curlparams+=("--data-urlencode" "priority=$priority")
fi fi

View File

@ -68,6 +68,8 @@
- cli app (?) - cli app (?)
- Use "github.com/glebarez/go-sqlite" instead of mattn3 (see ai-sig alarmserver)
#### FUTURE #### 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...

View File

@ -14,44 +14,43 @@ func main() {
defer cancel() defer cancel()
sqlite3.Version() // ensure slite3 loaded sqlite3.Version() // ensure slite3 loaded
{ {
h0, err := sq.HashSqliteSchema(ctx, schema.PrimarySchema1) h0, err := sq.HashSqliteSchema(ctx, schema.PrimarySchema[1].SQL)
if err != nil { if err != nil {
h0 = "ERR" h0 = "ERR"
} }
fmt.Printf("PrimarySchema1 := %s\n", h0) 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 { if err != nil {
h0 = "ERR" h0 = "ERR"
} }
fmt.Printf("PrimarySchema2 := %s\n", h0) 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 { if err != nil {
h0 = "ERR" h0 = "ERR"
} }
fmt.Printf("PrimarySchema3 := %s\n", h0) 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 { if err != nil {
h0 = "ERR" h0 = "ERR"
} }
fmt.Printf("PrimarySchema4 := %s\n", h0) 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 { if err != nil {
h0 = "ERR" h0 = "ERR"
} }
fmt.Printf("RequestsSchema1 := %s\n", h0) 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 { if err != nil {
h0 = "ERR" h0 = "ERR"
} }