Skip to content

Commit

Permalink
fix: disable session check for billboard
Browse files Browse the repository at this point in the history
  • Loading branch information
hai-ko committed Nov 8, 2023
1 parent 3726417 commit d08eb5b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy-billboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
echo "RPC=${{ secrets.STAGING_RPC }}" >> ./.env
echo "BILLBOARD_PRIVATE_KEY=${{ secrets.BILLBOARD_PRIVATE_KEY}}" >> ./.env
echo "interceptor=${{ secrets.INTERCEPTOR}}" >> ./.env
echo "DISABLE_SESSION_CHECK='true'" >> ./.env
envsubst '${SSL_CERTIFICATE_BASE_LOC} ${TLS_CERTIFICATE_LOCATION} ${TARGET_HOST}' < ./docker/nginx.conf > ./nginx.conf
cat ./.env
- name: Build docker image
Expand Down
1 change: 1 addition & 0 deletions docker/billboard/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ services:
SIGNING_PRIVATE_KEY: ${SIGNING_PRIVATE_KEY}
ENCRYPTION_PUBLIC_KEY: ${ENCRYPTION_PUBLIC_KEY}
ENCRYPTION_PRIVATE_KEY: ${ENCRYPTION_PRIVATE_KEY}
DISABLE_SESSION_CHECK: ${DISABLE_SESSION_CHECK}
RPC: ${RPC}
PORT: 8081
LOG_LEVEL: 'debug'
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Profile from './profile';
import RpcProxy from './rpc/rpc-proxy';
import Storage from './storage';
import { logInfo } from 'dm3-lib-shared';
import 'dotenv/config';

import {
errorHandler,
Expand Down
6 changes: 6 additions & 0 deletions packages/backend/src/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export default () => {
method: 'POST',
url: req.url,
ensName,
disableSessionCheck:
process.env.DISABLE_SESSION_CHECK === 'true',
});

const data = await submitUserProfile(
Expand All @@ -69,6 +71,10 @@ export default () => {

res.json(data);
} catch (e) {
global.logger.warn({
message: 'POST profile',
error: JSON.stringify(e),
});
res.status(400).send({
message: `Couldn't store profile`,
error: JSON.stringify(e),
Expand Down
10 changes: 7 additions & 3 deletions packages/lib/delivery/src/UserProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,35 +38,39 @@ export async function submitUserProfile(
send: (socketId: string) => void,
): Promise<string> {
const account = normalizeEnsName(ensName);
console.log('1', account, signedUserProfile);

Check failure on line 41 in packages/lib/delivery/src/UserProfile.ts

View workflow job for this annotation

GitHub Actions / code-quality

Unexpected console statement

if (!(await checkUserProfile(provider, signedUserProfile, account))) {
throw Error('Signature invalid.');
}
//TODO: remvoe DISABLE_SESSION_CHECK
console.log('2', process.env.DISABLE_SESSION_CHECK);

Check failure on line 46 in packages/lib/delivery/src/UserProfile.ts

View workflow job for this annotation

GitHub Actions / code-quality

Unexpected console statement
//TODO: remvoe DISABLE_SESSION_CHECK
// DISABLE_SESSION_CHECK is a special solution for ETH Prague
if (
process.env.DISABLE_SESSION_CHECK !== 'true' &&
(await getSession(account))
) {
throw Error('Profile exists already');
}
console.log('3');

Check failure on line 55 in packages/lib/delivery/src/UserProfile.ts

View workflow job for this annotation

GitHub Actions / code-quality

Unexpected console statement
const session: Session = {
account,
signedUserProfile,
token: uuidv4(),
createdAt: new Date().getTime(),
profileExtension: getDefaultProfileExtension(),
};
console.log('4', session);

Check failure on line 63 in packages/lib/delivery/src/UserProfile.ts

View workflow job for this annotation

GitHub Actions / code-quality

Unexpected console statement

await setSession(account.toLocaleLowerCase(), session);

console.log('5');

Check failure on line 66 in packages/lib/delivery/src/UserProfile.ts

View workflow job for this annotation

GitHub Actions / code-quality

Unexpected console statement
await handlePendingConversations(
account,
getSession,
getPendingConversations,
send,
);

console.log('6');

Check failure on line 73 in packages/lib/delivery/src/UserProfile.ts

View workflow job for this annotation

GitHub Actions / code-quality

Unexpected console statement
return session.token;
}

Expand Down

0 comments on commit d08eb5b

Please sign in to comment.