Skip to content

Commit

Permalink
Revert "fix: use explicit imports"
Browse files Browse the repository at this point in the history
This reverts commit cfff36b.
  • Loading branch information
NextFire committed Dec 2, 2024
1 parent cfff36b commit 52451b8
Show file tree
Hide file tree
Showing 15 changed files with 0 additions and 27 deletions.
2 changes: 0 additions & 2 deletions server/routes/[...].ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import { provider } from "~/utils/provider";

export default fromNodeMiddleware(provider.callback());
3 changes: 0 additions & 3 deletions server/routes/_oauth.get.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import assert from "node:assert/strict";
import { userConfig } from "~/utils/config";
import { exchangeCode, fetchUserinfo } from "~/utils/discord";
import { useTypedSession } from "~/utils/session";

export default eventHandler(async (event) => {
const session = await useTypedSession(event);
Expand Down
2 changes: 0 additions & 2 deletions server/routes/discord/auth.get.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import assert from "node:assert/strict";
import { getAuthorizationUrl } from "~/utils/discord";
import { useTypedSession } from "~/utils/session";

export default eventHandler(async (event) => {
const query = getQuery(event);
Expand Down
1 change: 0 additions & 1 deletion server/routes/discord/callback.get.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import assert from "node:assert/strict";
import { useTypedSession } from "~/utils/session";

export default eventHandler(async (event) => {
const query = getQuery(event);
Expand Down
2 changes: 0 additions & 2 deletions server/routes/interaction/[uid]/[...].get.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { provider } from "~/utils/provider";

export default eventHandler(async (event) => {
const { req, res } = event.node;
const interaction = await provider.interactionDetails(req, res);
Expand Down
3 changes: 0 additions & 3 deletions server/routes/interaction/[uid]/callback.get.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import assert from "node:assert/strict";
import type { InteractionResults } from "oidc-provider";
import { Account } from "~/utils/account";
import { exchangeCode, fetchUserinfo } from "~/utils/discord";
import { provider } from "~/utils/provider";

export default eventHandler(async (event) => {
const query = getQuery(event);
Expand Down
1 change: 0 additions & 1 deletion server/routes/interaction/[uid]/consent.get.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import assert from "node:assert/strict";
import type Provider from "oidc-provider";
import { provider } from "~/utils/provider";

/**
* Implicit consent
Expand Down
2 changes: 0 additions & 2 deletions server/routes/interaction/[uid]/index.get.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { provider } from "~/utils/provider";

export default eventHandler(async (event) => {
const { req, res } = event.node;
const interaction = await provider.interactionDetails(req, res);
Expand Down
1 change: 0 additions & 1 deletion server/routes/interaction/[uid]/login.get.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import assert from "node:assert/strict";
import { provider } from "~/utils/provider";

export default eventHandler(async (event) => {
const { req, res } = event.node;
Expand Down
3 changes: 0 additions & 3 deletions server/routes/traefik.get.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { userConfig } from "~/utils/config";
import { useTypedSession } from "~/utils/session";

export default eventHandler(async (event) => {
const headers = event.headers;
const proto = headers.get("x-forwarded-proto");
Expand Down
1 change: 0 additions & 1 deletion server/utils/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
type FindAccount,
type Account as OidcAccount,
} from "oidc-provider";
import { userConfig } from "./config";

export interface UserInfos {
user: RESTGetAPICurrentUserResult;
Expand Down
1 change: 0 additions & 1 deletion server/utils/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import Redis from "ioredis";
import { isEmpty } from "lodash-es";
import type { Adapter, AdapterPayload } from "oidc-provider";
import { userConfig } from "./config";

const client = new Redis(userConfig.redisUrl, { keyPrefix: "oidc:" });

Expand Down
1 change: 0 additions & 1 deletion server/utils/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
type RESTGetAPICurrentUserResult,
type RESTGetCurrentUserGuildMemberResult,
} from "discord-api-types/v10";
import { userConfig } from "./config";

export function getAuthorizationUrl(params: Record<string, string> = {}) {
const _params = new URLSearchParams({
Expand Down
3 changes: 0 additions & 3 deletions server/utils/provider.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import Provider, { errors, type Configuration } from "oidc-provider";
import psl from "psl";
import wildcard from "wildcard";
import { Account } from "./account";
import { RedisAdapter } from "./adapter";
import { userConfig } from "./config";

const config: Configuration = {
adapter: RedisAdapter,
Expand Down
1 change: 0 additions & 1 deletion server/utils/session.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type H3Event } from "h3";
import { userConfig } from "./config";

interface SessionData {
redirect: string;
Expand Down

0 comments on commit 52451b8

Please sign in to comment.