Skip to content

Commit

Permalink
package updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mrosack committed Dec 26, 2024
1 parent 3de134f commit 9219c28
Show file tree
Hide file tree
Showing 10 changed files with 15,995 additions and 9,067 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,13 @@ module.exports = {
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }]
}
},
overrides: [
{
files: ['*.spec.ts'],
rules: {
'@typescript-eslint/no-unused-expressions': 'off'
}
}
]
};
7 changes: 3 additions & 4 deletions .github/workflows/deploy-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18'
# TODO: get this back in
# docker-compose -f testdata/docker-compose.yml up -d
# npm run integration-test
node-version: '20'
- run: |
npm install
npm run test
docker compose -f testdata/docker-compose.yml up -d
npm run integration-test
npm run deploy-${GITHUB_REF##*/}
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
Expand Down
2 changes: 1 addition & 1 deletion api/controllers/gameController/getTurn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class GameController_GetTurn {

try {
await this.s3.headObject(fileParams);
} catch (err) {
} catch {
fileParams.Key = file;
}
}
Expand Down
2 changes: 1 addition & 1 deletion api/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as AWSXRay from 'aws-xray-sdk';
import { Router } from 'express';
require('express-async-errors');
import 'express-async-errors';
import { ValidateError } from 'tsoa';
import { loggingHandler, pydtLogger } from '../lib/logging';
import {
Expand Down
10 changes: 5 additions & 5 deletions lib/auth/expressAuthentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { PrivateUserDataRepository } from '../dynamoose/privateUserDataRepositor
import { iocContainer } from '../ioc';
import { pydtLogger } from '../logging';
import { JwtData, JwtUtil } from './jwtUtil';
import { Request } from 'express';

export async function validateNonce(data: JwtData) {
const pudRepo = iocContainer.resolve(PrivateUserDataRepository);
Expand All @@ -16,22 +17,21 @@ export async function validateNonce(data: JwtData) {
}

export async function expressAuthentication(
request: HttpRequest,
req: Request,
securityName: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
scopes?: string[]
): Promise<string> {
const allowAnonymous = scopes?.includes('ALLOW_ANONYMOUS');

if (securityName === 'api_key') {
try {
if (request.headers && request.headers['authorization']) {
const data = JwtUtil.parseToken(request.headers['authorization']);
if (req.headers && req.headers['authorization']) {
const data = JwtUtil.parseToken(req.headers['authorization']);

await validateNonce(data);

if (!Config.runningLocal) {
request.subSegment.addAnnotation('user', data.steamId);
(req as unknown as HttpRequest).subSegment.addAnnotation('user', data.steamId);
}
return data.steamId;
}
Expand Down
5 changes: 3 additions & 2 deletions lib/ioc.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Container, inject, interfaces } from 'inversify';
import { Container, inject } from 'inversify';
import { buildProviderModule, fluentProvide, provide } from 'inversify-binding-decorators';
import { ServiceIdentifier } from 'tsoa';

const iocContainer = new Container();
let initialized = false;

// eslint-disable-next-line
const provideSingleton = (identifier: string | symbol | interfaces.Newable<any> | interfaces.Abstract<any>) => {
const provideSingleton = (identifier: ServiceIdentifier<any>) => {
return fluentProvide(identifier).inSingletonScope().done();
};

Expand Down
1 change: 1 addition & 0 deletions lib/models/miscData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface MiscData<T> {
data: T;
}

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface GlobalStats extends MiscData<GlobalStatsData> {}

export interface GlobalStatsData extends TurnData {
Expand Down
Loading

0 comments on commit 9219c28

Please sign in to comment.