mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-09-28 17:58:10 +03:00
send idm with card in requests
This commit is contained in:
@@ -10,6 +10,7 @@ export const MIN_AMNET_API_VERSION = 1;
|
||||
|
||||
export interface AMCardInRequest {
|
||||
cardId: string;
|
||||
physicalCardIDm?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,14 +37,10 @@ export interface AMServerInstanceMetrics {
|
||||
sessionUptime?: number;
|
||||
}
|
||||
|
||||
export interface AMServerPhysicalCardPreferences {
|
||||
preferredCardIdFormat?: "idm" | "access" | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The response from an AMNet server's info endpoint
|
||||
*/
|
||||
export type AMServerInfo = AMServerMetadata & AMServerConnectionInfo & AMServerInstanceMetrics & AMServerPhysicalCardPreferences;
|
||||
export type AMServerInfo = AMServerMetadata & AMServerConnectionInfo & AMServerInstanceMetrics;
|
||||
|
||||
/**
|
||||
* Performs the card-in request to the specified server
|
||||
@@ -55,7 +52,7 @@ export async function performCardIn(server: AMServerConnectionInfo, request: AMC
|
||||
if (server.apiVersion < MIN_AMNET_API_VERSION || server.apiVersion > AMNET_API_VERSION) {
|
||||
throw new Error("Unsupported server API version");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
const response = await fetch(`${new URL(server.serverAddress).origin}/amnet/signin`, {
|
||||
method: "POST",
|
||||
@@ -82,7 +79,7 @@ export async function fetchServerInfo(serverAddress: string, abort: AbortSignal)
|
||||
const response = await fetch(`${new URL(serverAddress).origin}/amnet/info`, {
|
||||
signal: abort
|
||||
});
|
||||
|
||||
|
||||
if (!response.ok) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user