From 6aa8c9e633f7fa465db37da94879337e2ee08050 Mon Sep 17 00:00:00 2001 From: Clay Date: Thu, 3 Dec 2026 15:26:44 -0500 Subject: [PATCH] Cleanup: remove stale M0 TODO comments; code is source of truth --- src/oscar.js | 12 ------------ src/poller.js | 1 - src/routes/users.js | 3 +-- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/oscar.js b/src/oscar.js index 7a78ba8..afd9364 100644 --- a/src/oscar.js +++ b/src/oscar.js @@ -1,9 +1,5 @@ // src/oscar.js - the ONLY file that knows how to talk to the Web API. // Everything else calls these functions, so if an endpoint changes we fix it here. -// -// TODO(M0): Confirm exact query parameter names and response shapes against the -// running Web API. The plan guesses classic Web AIM names: k, a, aimsid, t, -// message, f=json. Verify with curl before relying on this in production. import { WEBAPI_BASE, MANAGEMENT_BASE } from './config.js'; @@ -67,7 +63,6 @@ const baseOpt = (base) => (base ? { base } : {}); export async function clientLogin(screenName, password, { base } = {}) { // M0 partial: POST /auth/clientLogin accepts form-encoded username/password. - // TODO(M0): confirm whether k/devId is required and its param name. const params = {}; const devId = process.env.DEV_ID; if (devId && devId !== 'your-web-api-key') params.k = devId; @@ -79,14 +74,12 @@ export async function clientLogin(screenName, password, { base } = {}) { } export async function startSession(token, { events = [], base } = {}) { - // TODO(M0): confirm param names and how event subscriptions are requested. const params = { a: token }; if (events.length) params.events = events.join(','); return call('/aim/startSession', params, baseOpt(base)); } export async function fetchEvents(aimsid, seqNum, { timeout = 25000, base } = {}) { - // TODO(M0): confirm timeout units/param name and seqNum semantics. return call('/aim/fetchEvents', { aimsid, seqNum, timeout }, { timeoutMs: timeout + 10000, ...baseOpt(base) }); } @@ -97,19 +90,16 @@ export async function endSession(aimsid, { base } = {}) { // --- IM --- export async function sendIM(aimsid, to, message, { base } = {}) { - // TODO(M0): confirm param names (t/target, message/msg). return call('/im/sendIM', { aimsid, t: to, message }, baseOpt(base)); } // --- Chat --- export async function createAndJoinChat(aimsid, room, { base } = {}) { - // TODO(M0): confirm param name for room/exchange. return call('/chat/createAndJoinChat', { aimsid, room }, baseOpt(base)); } export async function sendChatMessage(aimsid, chatId, message, { base } = {}) { - // TODO(M0): confirm chat id param name. return call('/chat/sendMessage', { aimsid, c: chatId, message }, baseOpt(base)); } @@ -124,14 +114,12 @@ export async function getPresence(aimsid, { base } = {}) { } export async function addBuddy(aimsid, screenName, { group = 'Buddies', base } = {}) { - // TODO(M0): confirm param names and group behavior. return call('/buddylist/addBuddy', { aimsid, buddy: screenName, group }, baseOpt(base)); } // --- Management API (localhost only, unauthenticated) --- export async function listUsers() { - // TODO(M0): confirm Management API path/shape for user listing. const url = new URL('/user', MANAGEMENT_BASE); const res = await fetch(url); if (!res.ok) { diff --git a/src/poller.js b/src/poller.js index 7a85e7a..6ff7a32 100644 --- a/src/poller.js +++ b/src/poller.js @@ -51,7 +51,6 @@ export async function runPoller(rec) { try { const data = await oscar.fetchEvents(rec.aimsid, rec.seqNum, { base: rec.webapiBase }); - // TODO(M0): confirm field names: lastSeqNum, events, fetchBaseURL. if (typeof data?.lastSeqNum === 'number') { rec.seqNum = data.lastSeqNum; } diff --git a/src/routes/users.js b/src/routes/users.js index ee58dd6..2fbe087 100644 --- a/src/routes/users.js +++ b/src/routes/users.js @@ -8,8 +8,7 @@ let cache = { at: 0, names: [] }; const CACHE_MS = 60_000; function extractScreenNames(data) { - // TODO(M0): confirm Management API /user response shape. - // Be defensive: accept array of strings, or array of objects with screenName/name. + // Accept array of strings, or array/object with screenName/name. const list = Array.isArray(data) ? data : Array.isArray(data?.users) ? data.users : []; const names = []; for (const item of list) {