Commit graph

54 commits

Author SHA1 Message Date
Martin Hebnes Pedersen
f0df19a6af go fmt ./... 2023-10-21 13:10:19 +02:00
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
ae8ce001d3 Bump version (v0.15.0) 2023-06-10 13:15:41 +02:00
Martin Hebnes Pedersen
dd3d4576a7 Use gitrev from debug/buildinfo if available
Go 1.18+ embeds the vcs revision in binaries, meaning we can eventually
remove it from make.bash (we still support Go 1.16).
2023-05-18 21:01:03 +02:00
Martin Hebnes Pedersen
62ac29e8bd Bump version (v0.14.1) 2023-05-02 08:37:10 +02:00
Martin Hebnes Pedersen
17cb6d1dd4 Bump version (v0.14.0) 2023-04-19 21:42:43 +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
Martin Hebnes Pedersen
991d5e1398 Bump version (v0.13.1) 2022-09-17 09:51:20 +02:00
Martin Hebnes Pedersen
9af5b33bfe Bump version (v0.13.0) 2022-08-20 22:01:28 +02: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
Chris Keller
c6f3bfb2e6 Remove WINMOR support
Resolves #331.
2022-03-21 19:51:03 +01:00
Martin Hebnes Pedersen
f9332e806a go fmt (Go 1.17 build tags changes) 2022-03-15 22:42:15 +01: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
ccb493474d Bump version (v0.12.1) 2021-12-11 16:09:39 +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
Martin Hebnes Pedersen
ea4cfee299 Bump version (v0.12.0) 2021-10-31 17:29:54 +01:00
Martin Hebnes Pedersen
d7cc80b0d7 Remove paths from the 'pat version' output
They are all included in the debug log.
2021-10-25 19:49:55 +02:00
Chris Keller
df9d65e692 Address review comments
* Only migrate once
* ignore `forms_path` config if it's default
* warn user about non-default `forms_path` config

https://github.com/la5nta/pat/pull/288#issuecomment-950142964
2021-10-24 22:42:46 +02: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
e94f05f37c Move config, data and state files to XDG locations
Addressing https://github.com/la5nta/pat/issues/216. Includes migration of existing files, plus refactoring of directory access and build info.
2021-08-15 19:35:15 +02:00
Chris Keller
a6f4bee6b7 Address many linter errors in forms.go 2021-07-30 09:25:38 +02:00
Martin Hebnes Pedersen
37b0e490c5 Add debug logging capabilities
Enabled by setting the environment variable PAT_DEBUG=1.
2021-07-28 19:21:34 +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
Martin Hebnes Pedersen
8e003ac4fc Fix osutil build error on FreeBSD
Closes #240
2021-06-14 22:52:22 +02:00
Martin Hebnes Pedersen
45df4d520c Avoid truncating rmslist cache on refresh failure 2021-06-14 21:06:35 +02:00
Martin Hebnes Pedersen
69eaf70397 Check that account exists before posting version
This was requested by Lee in WDT due to errors on their end when a
version update is received for a callsign without a valid account.

Closes #213
2020-09-12 19:29:56 +02:00
Martin Hebnes Pedersen
dc53fb8dad Attempt to increase soft max open fs limit on unix
When watching directories with many files using fsnotify, we might end
up reaching the limit on max open file descriptors. The first limit
reached is often a soft limit, usually substantially lower than the hard
limit set by the OS.

This patch tries to raise the soft limit before starting fsnotify. This
is especially important on macOS which has a default soft limit of only
256.

Closes #176
2019-12-08 23:26:45 +01:00
blockmurder
971d7d95a7 throw error when timeout 2019-09-30 19:39:13 +02:00
Martin Hebnes Pedersen
19532a5efd Let user override default Service Codes via config
New config field service_codes takes an array of strings, each string
should be a valid service code that is used when updating rmslist.

I've extended the rmslist cache to support this. We now have multiple
cache files, one for each combination of service codes.

Closes #162
2019-09-26 18:45:21 +02:00
Martin Hebnes Pedersen
d9784241ee Switch to api.winlink.org (https)
Closes #110
2017-12-08 19:15:46 +01:00
Martin Hebnes Pedersen
5676710664 Move rmslist API wrapper into internal/cmsapi
The old duplication made me miss a server.winlink.org (deprecated
Winlink hostname) reference.

Issue #104
2017-12-06 20:25:13 +01:00
Martin Hebnes Pedersen
da2a11e183 Winlink CMS hostname changed to cms.winlink.org
This change was announced by the WDT after they migrated to the new
AWS 'cloud' CMS. The old hostname (server.winlink.org) is expected to
be operational for at least one year.

In addition to changing the config defaults, this commit includes a
(temporary) function that will rewrite user's config to replace the
old hostname.

Closes #104
2017-11-09 22:58:39 +01:00
Martin Hebnes Pedersen
f440cf38fa gpsd: Fix SignalStrength json struct tag 2016-05-11 18:58:37 +02:00