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}")
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

View File

@ -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...

View File

@ -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"
}