Commit graph

25 commits

Author SHA1 Message Date
Martin Hebnes Pedersen
0f183d03d6 Fix incorrect time layout strings for UTC variants
The reference date is MST (seven hours west of GMT). This is a very
common mistake when constructing formatting strings to be used with
time.Format.

Since we converted all dates that includes zone information to UTC
*before* outputting in Z time, this bug did not affect the output
strings. But it's best to use the correct reference time anyway, in case
we later add a string representation including zone information that is
not UTC.
2023-10-16 13:55:02 +00:00
Martin Hebnes Pedersen
2f30d0f033 Refactor date parsing in forms and add tests 2023-10-16 13:55:02 +00:00
Martin Hebnes Pedersen
6b75f18b78 Only attach Forms XML if a viewer file is defined
Resolves #420
2023-09-22 20:26:17 +02:00
Martin Hebnes Pedersen
09460b59a1 internal/forms: Cleanup for improved readability 2023-04-17 07:59:50 +02:00
Martin Hebnes Pedersen
322113331a Minor cleanup 2023-04-16 14:03:50 +02:00
Emil Sit
b901f76a1a forms: better parse support for to/cc/body
Add support for parsing To/Cc fields and passing an array
of addresses back to the compose window.

Improve handling of Msg. As per the templates [spec][]:

> Msg: -- Start of message body. All text following Msg: is placed in the body of the message.

and a few templates have text and variables on the same line as the "Msg:".
Therefore, simply strip out the Msg: and use that to mark the rest of
the template as being part of the body.

[spec]: http://www.philsherrod.com/Winlink/RMS_Express_Message_Templates.pdf

[Changed "var inBody = true" to "inBody := true" per Martin's
 suggestion]
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2023-04-16 13:57:20 +02:00
richcannings
ebca544fe1 Extend case insensitivity to form file extensions
Form file extensions are case sensitive, issue #384.

This change allows for any case of .html and .txt form files.
2022-12-18 12:13:36 +01:00
Alan Crosswell
46a890059a Add several (some undocumented) insertion tags that are required for the Winlink Check In form. 2022-04-09 21:24:34 +02:00
Martin Hebnes Pedersen
441fda35c4 Graceful shutdown through context cancellation
By doing graceful shutdown, we're able to properly close all of the open
resources such as modem connections and ongoing sessions.

This will allow transport drivers controlling stateful TNCs (e.g.
ptc-go) to recover the initial TNC state before termination.

Resolves #314
2022-02-20 14:48:29 +01:00
Martin Hebnes Pedersen
f387b8e9a0 Use new self-hosted API for Forms updates
Closes #306
2021-12-06 00:53:39 +01:00
Martin Hebnes Pedersen
1ba06731db Cleanup and improve error handling of forms unzip 2021-12-02 18:24:19 +01:00
Martin Hebnes Pedersen
095f6d1cc5 Don't delete /tmp when updating forms
Resolves #300
2021-12-02 18:24:19 +01:00
Chris Keller
966d2b2a11 Include root errors 2021-10-24 22:42:46 +02:00
Chris Keller
5a6764bce1 Revamp customized file paths
* Deprecate `forms_path` in the config file and replace with `--forms` flag
* Clean up `optionsSet()` to show correct defaults
* Clean up places that detected when `forms_path` was not configured (before it had a default)

Resolves https://github.com/la5nta/pat/issues/287
2021-10-24 22:42:46 +02:00
Todd E Johnson
11d115ba03 Update the other MkdirAll to 0755 2021-09-18 18:42:48 +02:00
Todd E Johnson
97a2417266 When unziping forms and mkdir use 0755 2021-09-18 18:41:58 +02:00
Chris Keller
e68850056e Fix some Go linter errors
* Replace(..., -1) with ReplaceAll
* Variable names hiding packages
* Error messages start with lowercase and no end punctuation
* Don't `defer` in a loop
* Etc.
2021-08-20 21:35:21 +02:00
Chris Keller
a6f4bee6b7 Address many linter errors in forms.go 2021-07-30 09:25:38 +02:00
Chris Keller
3246c2e5ff Some forms only have one HTML template
When a form .txt file only specifies one HTML template, it's supposed to be used for both compose and view.

Also fix a Javascript error. Now that "RADIOGRAM & RRI Forms" is coming through, we can't have ampersand in an HTML element ID.
2021-07-16 11:39:05 +02:00
Chris Keller
3a8f8595f5 Configure a default forms path
This primes the user to run a forms update with zero configuration, but doesn't actually do it for them.  This could cause errors if they try to use forms before running the update. With some more work, we could make this more like the RMS list where the update happens proactively. For now, I think this is good enough.

Fixes #256
2021-06-30 20:56:23 +02:00
Chris Keller
cef588d96b Address bugs found in review
*  If forms_path isn't configured or doesn't exist, don't bother trying to update
*  Set no-cache HTTP header
2021-06-21 22:23:23 +02:00
Chris Keller
5c134a97d2 Addressed first round of comments
*  Call resp.Body.Close()
*  Don't log errors, return them to caller
*  More idiomatic variable names
*  Reuse single http.Client instance, and wrapper for Get call
*  Stop using ioutil
*  Don't Panic(TM)
*  Fetch latest version info over HTTPS

Still need to address bugs around caching and un-configured forms path.
2021-06-21 22:23:23 +02:00
Chris Keller
4acb48fde3 Add forms update via CLI 2021-06-21 22:23:23 +02:00
Chris Keller
1d415a2ffa Add forms update via web GUI 2021-06-21 22:23:23 +02:00
rainerg2000
c161d26171 added forms package, is not hooked up to any useful work yet 2021-06-16 20:08:41 +02:00