Commit graph

34 commits

Author SHA1 Message Date
HB9HIL
e1385ebb5c
predefine array 2026-07-11 17:14:56 +02:00
Ronald de Heer
030004790e Switch to Personal Access Token (PAT) auth
Replaces the callsign+password → JWT flow with a single long-lived
Personal Access Token (pat_*), matching the GitHub/Stripe pattern.

User flow now:
  • Sign up on qrzcall.eu (Data or Extra subscription required)
  • Account → API Tokens → "Generate new token", label it
    (e.g. "Wavelog at home"), copy the pat_… string
  • Paste into Wavelog's "QRZCALL.EU API Token" config field

Why this is better than the previous credentials flow:
  • The user's QRZCALL.EU password never leaves the SPA
  • Each Wavelog install gets its own revocable token
  • A leaked Wavelog config exposes a single revocable token,
    not the password the user might reuse elsewhere
  • The library is simpler: no session cache, no retry-on-expiry,
    no /portable-aware re-auth dance — just Bearer on every call

Code changes:
  • application/libraries/Qrzcall.php  - drops session() and
    set_session(), keeps search() and sourcename(). ~30 LOC shorter.
  • application/libraries/Callbook.php - QRZCALL_SESSION_DURATION
    constant and qrzcall_session_cachekey property removed.
    _qrzcall() collapses from ~40 to ~20 LOC.
  • application/config/config.sample.php - qrzcall_username and
    qrzcall_password replaced with a single qrzcall_token.
  • install/config/config.php - same in the wizard's template.
  • install/index.php - the wizard now shows a single "API Token"
    field when QRZCALL.EU is selected (toggled via JS, no extra
    HTML page state machine). callbook_combination() validates
    the pat_ prefix when present.
  • install/includes/core/core_class.php - refactored to support
    both username/password-style providers (qrz/hamqth/qrzcq/qrzru)
    and token-style providers (qrzcall) cleanly. Drops the
    "all callbooks use the same shape" assumption.

End-to-end re-tested:
  ✓ Live PAT lookup PA4R via the new library                HTTP 200
  ✓ Unknown callsign XX9XX9XX                                error: "Callsign not found"
  ✓ Tampered token                                           error: "Invalid or revoked QRZCALL.EU API token"
  ✓ Subscription gate (Free user with revoked sub)          surfaces upstream 401
  ✓ php -l clean on all 6 files
  ✓ All 5 patches dry-run apply cleanly against fresh master

Existing JWT flow on api.qrzcall.eu/v1/auth/login.php remains
available — this PR moves Wavelog to the recommended pattern but
doesn't break anyone who already wired up JWT.
2026-05-14 10:59:42 +02:00
Ronald de Heer
50bd9e6f1b Add QRZCALL.EU as a callbook provider
QRZCALL.EU is a QRZ-compatible amateur-radio callsign database
(https://qrzcall.eu/). This adds it as a new 'qrzcall' callbook source
alongside the existing qrz, qrzcq, hamqth, and qrzru providers.

* `application/libraries/Qrzcall.php` — new library, mirrors Qrz.php
* `application/libraries/Callbook.php` — adds case 'qrzcall', `_qrzcall()`
  private method, session-duration constant and session-cache key
* `application/config/config.sample.php` — adds `qrzcall_username` /
  `qrzcall_password` defaults
* `install/index.php` — adds QRZCALL.EU to the install-wizard callbook
  dropdown and extends the tooltip
* `install/config/config.php` — adds `%qrzcall_username%` /
  `%qrzcall_password%` placeholders so the wizard writes the credentials
  into the generated config
* `install/includes/core/core_class.php` — adds 'qrzcall' to the
  $callbooks whitelist

Auth: callsign + password → JWT (cached 7h). The bearer pattern is
hidden behind the existing "session key" abstraction so the Callbook
orchestrator's retry-on-expiry and /portable fallback paths work
unchanged.

Access tier: requires a Data or Extra subscription on QRZCALL.EU.

XML schema: identical field names to QRZ.com → no downstream changes
to the QSO entry form.
2026-05-12 17:29:56 +02:00
Andreas Kristiansen
1f247efad1 [Callbook] Fix null error for source 2026-03-04 19:13:31 +01:00
HB9HIL
46b2427914 just to make sure we invalidate a possible session key in cache 2026-02-20 09:27:48 +01:00
HB9HIL
7904e30625 add a simple validate sessionkey helper function 2026-02-20 09:23:42 +01:00
HB9HIL
b8a8e43a32 translated return message if no lookup is configured and used a variable for it as it is used multiple times 2026-02-20 08:50:00 +01:00
HB9HIL
959254f186 check config more explicit 2026-02-20 08:40:54 +01:00
HB9HIL
4cc348e56e single callbook functions don't need to be public, changed to private functions since we always need to call the main getCallbookData function 2026-02-20 08:34:34 +01:00
HB9HIL
a3c8aa5464 remove redundant sourcename calls 2026-02-20 08:31:06 +01:00
HB9HIL
fc0ae9f672 fix: cache only the qrzcq sessionkey instead the whole array 2026-02-20 07:56:15 +01:00
HB9HIL
53777b47e7 use cache and it's already built in timebased invalidation for the callbook session keys 2026-02-20 01:24:27 +01:00
phl0
076f73ebfd
Safeguard against empty vars 2026-01-28 07:44:55 +01:00
phl0
0df25b2a45
More detailed error messages for failed callbook lookups 2026-01-28 00:46:39 +01:00
phl0
0bd1f7b1ca
Skip callbook lookups if credentials are empty/not set 2026-01-26 09:55:19 +01:00
Luca
c52859f958
Merge branch 'dev' into dev-log-fallback 2025-12-11 17:44:00 +01:00
Luca
18813c2e31
Apply suggestions from code review
Co-authored-by: Florian (DF2ET) <github@florian-wolters.de>
2025-12-11 17:41:52 +01:00
phl0
710b4ab726
Catch (timeout) errors on communication with hamqth 2025-12-10 16:39:27 +01:00
Luca
dfe682b4bf Implementing callbook failover logic 2025-12-09 17:44:25 +01:00
phl0
cfa07bd33f
Only validate grid if existent 2025-11-12 15:33:40 +01:00
phl0
15a5640e79
Use validation function in Qra lib and extend by bogus grid detection 2025-11-10 00:11:17 +01:00
Andreas Kristiansen
1b7d721208 Fix get plaincall logic 2025-10-30 12:55:14 +01:00
phl0
c159b2fd2a
Display warning message in search result if grid is auto-detected by
qrz.com
2025-09-04 15:57:12 +02:00
Andreas Kristiansen
4a3a990309 Adjusted libraries to work with qrz.ru 2025-02-06 12:31:52 +01:00
Andreas Kristiansen
1f3cac256b Fixed typo 2025-02-06 11:32:53 +01:00
Andreas Kristiansen
bdf834fc84 Fixed a typo 2025-02-03 10:09:12 +01:00
Andreas Kristiansen
024f2e0aff [Callbook] Added qrz.ru support 2025-02-03 10:06:07 +01:00
Andreas Kristiansen
a4100a4149 Trying to fix reduce call problem 2024-11-25 18:42:41 +01:00
phl0
888f9c9743
Handle errors when querying qrzcq (i.e. non-premium) 2024-11-25 14:33:05 +01:00
Andreas Kristiansen
a522d3095c Added error if no callbook is entered in config 2024-11-25 12:41:34 +01:00
Andreas Kristiansen
0e4b17ce13 Implemented reduced call 2024-11-25 12:21:07 +01:00
Andreas Kristiansen
eb70e66b32 Fixed correct return of error 2024-11-25 10:34:11 +01:00
Andreas Kristiansen
b2542f6b72 Implemented username/password in config check 2024-11-24 17:23:37 +01:00
Andreas Kristiansen
5b3279d762 [Callbook] Refactor so it's easier to add new callbooks 2024-11-24 15:34:56 +01:00