Skip to content

Commit

Permalink
0.0.364
Browse files Browse the repository at this point in the history
  • Loading branch information
ivansglazunov committed Jul 8, 2024
1 parent 7256334 commit 93387ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions imports/router/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export async function getJwt(handlerId: Id, useRunnerDebug: any) {
// }
const jwt = (await deep.jwt({ linkId: ownerId })).token;
useRunnerDebug('jwt', jwt);
return jwt;
return { token: jwt, linkId: ownerId };
}

export const useRunner = async ({
Expand All @@ -210,8 +210,13 @@ export const useRunner = async ({
const useRunnerDebug = Debug('deeplinks:eh:links:useRunner');
useRunnerDebug("handler4: ");

const jwt = await getJwt(handlerId, useRunnerDebug);
const secret = process.env.DEEPLINKS_HASURA_SECRET; // TODO: check jwt's permissions (unsafe permission must be granted)
const { token: jwt, linkId: ownerId } = await getJwt(handlerId, useRunnerDebug);
let secret;
try {
const Unsafe = await deep.id('@deep-foundation/unsafe', 'Unsafe');
const isUnsafe = await deep.can(ownerId, ownerId, Unsafe);
if (isUnsafe) secret = process.env.DEEPLINKS_HASURA_SECRET; // TODO: check jwt's permissions (unsafe permission must be granted)
} catch(error) {}
const container = await containerController.newContainer({ publish: +DOCKER ? false : true, forceRestart: true, handler: isolationProviderImageName});
useRunnerDebug('newContainerResult', container);
const initResult = await containerController.initHandler(container);
Expand Down
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ const handleRoutes = async () => {
const handlerId = handler?.id;
routesDebugLog(`handler id ${handlerId}`);

const jwt = await getJwt(handlerId, routesDebugLog);
const { token: jwt } = await getJwt(handlerId, routesDebugLog);
routesDebugLog(`jwt ${jwt}`);

// get container
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deep-foundation/deeplinks",
"version": "0.0.363",
"version": "0.0.364",
"license": "Unlicense",
"type": "module",
"scripts": {
Expand Down

0 comments on commit 93387ea

Please sign in to comment.