fix(striker-ui-api): correct hex regexp pattern

main
Tsu-ba-me 2 years ago
parent a56a38f4e6
commit dc6eb4a6d2
  1. 2
      striker-ui-api/src/lib/consts/REG_EXP_PATTERNS.ts
  2. 13
      striker-ui-api/src/lib/request_handlers/server/getServerDetail.ts
  3. 9
      striker-ui-api/src/types/ApiServer.d.ts

@ -1,4 +1,4 @@
export const P_HEX = '[[:xdigit:]]';
export const P_HEX = '[a-f0-9]';
export const P_OCTET = '(?:25[0-5]|(?:2[0-4]|1[0-9]|[1-9]|)[0-9])';
export const P_ALPHANUM = '[a-z0-9]';
export const P_ALPHANUM_DASH = '[a-z0-9-]';

@ -17,9 +17,16 @@ const rmfifo = (path: string) => {
}
};
export const getServerDetail: RequestHandler = async (request, response) => {
const { serverUUID } = request.params;
const { ss, resize } = request.query;
export const getServerDetail: RequestHandler<
ServerDetailParamsDictionary,
unknown,
unknown,
ServerDetailParsedQs
> = async (request, response) => {
const {
params: { serverUUID },
query: { ss, resize },
} = request;
const epoch = Date.now();
const isScreenshot = sanitize(ss, 'boolean');

@ -6,3 +6,12 @@ type ServerOverview = {
serverState: string;
serverUUID: string;
};
type ServerDetailParamsDictionary = {
serverUUID: string;
};
type ServerDetailParsedQs = {
ss: boolean | number | string;
resize: string;
};

Loading…
Cancel
Save