Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions src/services/vatsim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,29 @@ export class VatsimService {

return user;
}

private readonly IGNORED_CALLSIGN_SUFFIXES = new Set(["ATIS", "TV"]);
async getUserStatus(userId: string): Promise<{ cid: string; callsign: string; type: string } | null> {
try {
const text = await this.getUserConnectionsCsv(userId);
if (text === null) return null;
const trimmed = text.trim();
if (!trimmed) {
return null;
}

const parts = trimmed.split(',');
if (parts.length < 3) {
return null;
}

const [cid, callsign, type] = parts;
if (!cid || !callsign || !type) {
return null;
for (const line of text.split("\n")) {
const parts = line.trim().split(',');
if (parts.length < 3) {
return null;
}

const [cid, callsign, type] = parts;
if (
cid && callsign && type &&
!this.IGNORED_CALLSIGN_SUFFIXES.has(this.getCallsignSuffix(callsign)!)
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
) {
return { cid, callsign, type };
}
}

return { cid, callsign, type };
return null;
} catch {
return null;
}
Expand Down
Loading