Switch the lab reflector to jayReflector and harden local station use.
Build DJ1JAY’s fork with an optional Satellite/Trunk stub, allow -c/--config, open capture and playback as separate devices, and add a lab start helper. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+6
-4
@@ -1,7 +1,9 @@
|
||||
package station
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -48,13 +50,13 @@ var callsignPattern = regexp.MustCompile(`^[A-Z0-9][A-Z]{0,2}\d[A-Z0-9]{0,3}[A-Z
|
||||
func loadConfig(path string) (loaded, error) {
|
||||
body, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
if err := writeTemplate(path); err != nil {
|
||||
return loaded{}, err
|
||||
}
|
||||
return loaded{}, fmt.Errorf("created %s", path)
|
||||
}
|
||||
return loaded{}, fmt.Errorf("could not be read")
|
||||
return loaded{}, fmt.Errorf("the file could not be read: %w", err)
|
||||
}
|
||||
return parseConfig(path, body)
|
||||
}
|
||||
@@ -83,7 +85,7 @@ func writeTemplate(path string) error {
|
||||
func parseConfig(path string, body []byte) (loaded, error) {
|
||||
var shape fileShape
|
||||
if err := jsonv2.Unmarshal(body, &shape); err != nil {
|
||||
return loaded{}, fmt.Errorf("could not be read")
|
||||
return loaded{}, fmt.Errorf("the file could not be read: %w", err)
|
||||
}
|
||||
if block, notice := blockedLog(shape); block {
|
||||
cfg, err := parseOperational(shape)
|
||||
@@ -99,7 +101,7 @@ func parseConfig(path string, body []byte) (loaded, error) {
|
||||
}
|
||||
shape = withLogDefaults(shape)
|
||||
if err := rewriteConfig(path, shape); err != nil {
|
||||
return loaded{}, fmt.Errorf("could not be read")
|
||||
return loaded{}, fmt.Errorf("the file could not be read: %w", err)
|
||||
}
|
||||
}
|
||||
cfg, err := parseOperational(shape)
|
||||
|
||||
Reference in New Issue
Block a user