fix: bug while creating a new profile
This commit is contained in:
@@ -608,7 +608,8 @@ func (a *App) startup(ctx context.Context) {
|
||||
// Route CAT/OmniRig debug lines into the unified app log (they used to go
|
||||
// to a separate cat.log in the old HamLog folder, which users couldn't find).
|
||||
cat.LogSink = applog.Printf
|
||||
audio.LogSink = applog.Printf // capture audio-goroutine panics in the app log
|
||||
audio.LogSink = applog.Printf // capture audio-goroutine panics in the app log
|
||||
extsvc.LogSink = applog.Printf // log raw QRZ (and other) service responses for diagnosis
|
||||
applog.Printf("startup: data dir = %s", dataDir)
|
||||
// The local SQLite file ALWAYS holds per-operator configuration — settings,
|
||||
// station profiles, rigs/antennas, cluster nodes, UDP, QSL templates, award
|
||||
|
||||
@@ -133,8 +133,10 @@ const emptyProfile = (): Profile => ({
|
||||
is_active: false,
|
||||
sort_order: 0,
|
||||
db: { backend: '', host: '', port: 3306, user: '', password: '', database: '' },
|
||||
created_at: '' as any,
|
||||
updated_at: '' as any,
|
||||
// Server-managed timestamps — send null (NOT "") so Go's time.Time unmarshal
|
||||
// leaves the zero value instead of failing to parse an empty RFC3339 string.
|
||||
created_at: null as any,
|
||||
updated_at: null as any,
|
||||
});
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -16,6 +16,10 @@ import (
|
||||
// subscription used elsewhere for callsign data — they're different keys.
|
||||
const qrzAPIURL = "https://logbook.qrz.com/api"
|
||||
|
||||
// LogSink receives diagnostics such as raw QRZ responses. Set to applog.Printf
|
||||
// at startup; defaults to a no-op so the package is usable without wiring.
|
||||
var LogSink = func(string, ...any) {}
|
||||
|
||||
// UploadQRZ pushes one ADIF record to the QRZ.com logbook identified by
|
||||
// apiKey. It returns OK when the QSO is inserted or already present
|
||||
// (QRZ reports a duplicate as a FAIL with a "duplicate" reason, which we
|
||||
@@ -67,6 +71,7 @@ func UploadQRZ(ctx context.Context, client *http.Client, apiKey, adifRecord stri
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return UploadResult{}, fmt.Errorf("qrz: http %d: %s", resp.StatusCode, strings.TrimSpace(string(body)))
|
||||
}
|
||||
LogSink("qrz: INSERT raw response: %s", strings.TrimSpace(string(body)))
|
||||
|
||||
return parseQRZResponse(string(body))
|
||||
}
|
||||
@@ -171,6 +176,7 @@ func TestQRZ(ctx context.Context, client *http.Client, apiKey string) (string, e
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, _ := io.ReadAll(io.LimitReader(resp.Body, 64*1024))
|
||||
LogSink("qrz: STATUS raw response: %s", strings.TrimSpace(string(body)))
|
||||
vals, err := url.ParseQuery(strings.TrimSpace(string(body)))
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("qrz: bad response: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user