Skip to content

Commit

Permalink
💄 Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
SBrandeis committed Jan 25, 2024
1 parent 9a62f6c commit 34b7784
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion packages/inference/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@
"@types/node": "18.13.0"
},
"resolutions": {}
}
}
8 changes: 4 additions & 4 deletions packages/tasks/src/model-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ export interface ModelData {
*/
cardData?: {
inference?:
| boolean
| {
parameters?: Record<string, unknown>;
};
| boolean
| {
parameters?: Record<string, unknown>;
};
base_model?: string | string[];
};
/**
Expand Down
112 changes: 56 additions & 56 deletions packages/widgets/src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,65 +7,65 @@ import { sequence } from "@sveltejs/kit/hooks";
const handleSSO =
env.OAUTH_CLIENT_ID && env.OAUTH_CLIENT_SECRET
? SvelteKitAuth({
// Should be fine as long as your reverse proxy is configured to only accept traffic with the correct host header
trustHost: true,
/**
* SvelteKit has built-in CSRF protection, so we can skip the check
*/
skipCSRFCheck: skipCSRFCheck,
cookies: {
sessionToken: {
name: "session_token",
options: {
httpOnly: true,
sameSite: "lax",
secure: true,
path: "/",
maxAge: 3600, // The OAuth token's lifetime is 3600 seconds
// Should be fine as long as your reverse proxy is configured to only accept traffic with the correct host header
trustHost: true,
/**
* SvelteKit has built-in CSRF protection, so we can skip the check
*/
skipCSRFCheck: skipCSRFCheck,
cookies: {
sessionToken: {
name: "session_token",
options: {
httpOnly: true,
sameSite: "lax",
secure: true,
path: "/",
maxAge: 3600, // The OAuth token's lifetime is 3600 seconds
},
},
},
},
providers: [
{
name: "Hugging Face",
id: "huggingface",
type: "oidc",
clientId: env.OAUTH_CLIENT_ID,
clientSecret: env.OAUTH_CLIENT_SECRET,
issuer: "https://huggingface.co",
wellKnown: "https://huggingface.co/.well-known/openid-configuration",
/** Add "inference-api" scope and remove "email" scope */
authorization: { params: { scope: "openid profile inference-api" } },
checks: ["state" as never, "pkce" as never],
},
],
secret: env.OAUTH_CLIENT_SECRET,
/**
* Get the access_token without an account in DB, to make calls to Inference Endpoints
*/
callbacks: {
jwt({ token, account, profile }) {
return {
...token,
/**
* account & profile are undefined beyond the first login, in those
* cases `token.access_token` and `token.username` are defined
*/
...(account && { access_token: account.access_token }),
...(profile && { username: profile.preferred_username }),
};
},
session({ session, token }) {
return {
...session,
access_token: token.access_token,
user: Object.assign({}, session.user, {
username: token.username,
}),
};
providers: [
{
name: "Hugging Face",
id: "huggingface",
type: "oidc",
clientId: env.OAUTH_CLIENT_ID,
clientSecret: env.OAUTH_CLIENT_SECRET,
issuer: "https://huggingface.co",
wellKnown: "https://huggingface.co/.well-known/openid-configuration",
/** Add "inference-api" scope and remove "email" scope */
authorization: { params: { scope: "openid profile inference-api" } },
checks: ["state" as never, "pkce" as never],
},
],
secret: env.OAUTH_CLIENT_SECRET,
/**
* Get the access_token without an account in DB, to make calls to Inference Endpoints
*/
callbacks: {
jwt({ token, account, profile }) {
return {
...token,
/**
* account & profile are undefined beyond the first login, in those
* cases `token.access_token` and `token.username` are defined
*/
...(account && { access_token: account.access_token }),
...(profile && { username: profile.preferred_username }),
};
},
session({ session, token }) {
return {
...session,
access_token: token.access_token,
user: Object.assign({}, session.user, {
username: token.username,
}),
};
},
},
},
})
})
: null;

const handleGlobal: Handle = async ({ event, resolve }) => {
Expand Down

0 comments on commit 34b7784

Please sign in to comment.