feat(hamqth): QSO upload to the HamQTH logbook — the 8th external service
qso_realtime.php with the account's callbook credentials (which the external-services config falls back to when its own are blank), one ADIF record per QSO, prg=OpsLog. HTTP status IS the answer: 200 saved, 400 rejected (a duplicate counts as delivered, like HRDLog's insert 0), 403 credentials. Sent-state lives in APP_OPSLOG_HAMQTH_SENT extras like HAMLOG.online — ADIF names no HamQTH field. Auto-upload on log, on-close batch, right-click Send to, QSL Manager backlog, and a Test button that authenticates against the callbook login, which cannot touch the log. Fixes a real mis-route on the way: manual 'Send to HAMLOG.online' had no branch in runManualUpload and fell through to QRZ.com — the selection was uploaded to the wrong service with the QRZ key. Both extras-stamped services now have their own branch.
This commit is contained in:
@@ -140,6 +140,7 @@ func (m *Manager) SetConfig(cfg ExternalServices) {
|
||||
cfg.EQSL = cfg.EQSL.normalised()
|
||||
cfg.Cloudlog = cfg.Cloudlog.normalised()
|
||||
cfg.Hamlog = cfg.Hamlog.normalised()
|
||||
cfg.HamQTH = cfg.HamQTH.normalised()
|
||||
m.cfg = cfg
|
||||
|
||||
// Summary of what is armed, written at startup and on every settings save.
|
||||
@@ -153,7 +154,7 @@ func (m *Manager) SetConfig(cfg ExternalServices) {
|
||||
}{
|
||||
{"qrz", cfg.QRZ}, {"clublog", cfg.Clublog}, {"lotw", cfg.LoTW},
|
||||
{"hrdlog", cfg.HRDLog}, {"eqsl", cfg.EQSL}, {"cloudlog", cfg.Cloudlog},
|
||||
{"hamlog", cfg.Hamlog},
|
||||
{"hamlog", cfg.Hamlog}, {"hamqth", cfg.HamQTH},
|
||||
} {
|
||||
if s.cfg.AutoUpload {
|
||||
on = append(on, fmt.Sprintf("%s(%s)", s.name, s.cfg.UploadMode))
|
||||
@@ -237,6 +238,14 @@ func (m *Manager) OnQSOLogged(id int64) {
|
||||
m.route(ServiceHamlog, id, h)
|
||||
}
|
||||
}
|
||||
// HamQTH — the callbook credentials double as the logbook login.
|
||||
if h := cfg.HamQTH; h.AutoUpload {
|
||||
if h.Username == "" || h.Password == "" {
|
||||
m.logf("extsvc: hamqth auto-upload is ON but the username/password is not set (QSO %d not sent)", id)
|
||||
} else {
|
||||
m.route(ServiceHamQTH, id, h)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// route sends a logged QSO down the configured timing path: queue it for the
|
||||
@@ -290,6 +299,9 @@ func (m *Manager) onCloseServices() []Service {
|
||||
if h := cfg.Hamlog; h.AutoUpload && h.UploadMode == ModeOnClose && h.APIKey != "" {
|
||||
out = append(out, ServiceHamlog)
|
||||
}
|
||||
if h := cfg.HamQTH; h.AutoUpload && h.UploadMode == ModeOnClose && h.Username != "" && h.Password != "" {
|
||||
out = append(out, ServiceHamQTH)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -338,6 +350,8 @@ func (m *Manager) FlushOnClose() int {
|
||||
uploaded += m.flushOneByOne(svc, ids, cfg.Cloudlog)
|
||||
case ServiceHamlog:
|
||||
uploaded += m.flushOneByOne(svc, ids, cfg.Hamlog)
|
||||
case ServiceHamQTH:
|
||||
uploaded += m.flushOneByOne(svc, ids, cfg.HamQTH)
|
||||
}
|
||||
}
|
||||
return uploaded
|
||||
@@ -577,7 +591,7 @@ func (m *Manager) upload(svc Service, id int64, cfg ServiceConfig) (ok bool, ret
|
||||
switch svc {
|
||||
case ServiceQRZ, ServiceLoTW:
|
||||
owner = cfg.ForceStationCallsign
|
||||
case ServiceClublog, ServiceHRDLog:
|
||||
case ServiceClublog, ServiceHRDLog, ServiceHamQTH:
|
||||
owner = cfg.Callsign
|
||||
case ServiceEQSL:
|
||||
owner = cfg.Username
|
||||
@@ -669,6 +683,15 @@ func (m *Manager) upload(svc Service, id int64, cfg ServiceConfig) (ok bool, ret
|
||||
return false, false
|
||||
}
|
||||
res, err = UploadHamlog(ctx, m.deps.Client, cfg, record)
|
||||
case ServiceHamQTH:
|
||||
// The c parameter names the logbook when the account holds several;
|
||||
// the QSO keeps its own STATION_CALLSIGN in the ADIF.
|
||||
record, ok := m.deps.BuildADIF(id, "")
|
||||
if !ok {
|
||||
m.logf("extsvc: %s upload of QSO %d skipped (no record)", svc, id)
|
||||
return false, false
|
||||
}
|
||||
res, err = UploadHamQTH(ctx, m.deps.Client, cfg, record)
|
||||
default:
|
||||
return false, false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user