diff --git a/src/api/middleware/auth.ts b/src/api/middleware/auth.ts index ef416e9..828d357 100644 --- a/src/api/middleware/auth.ts +++ b/src/api/middleware/auth.ts @@ -13,6 +13,7 @@ export const authMiddleware = createMiddleware(async (c, next) => { c.req.path === "/" ) { await next(); + return; } const authHeader = c.req.header("Authorization"); diff --git a/src/api/routes/account/index.ts b/src/api/routes/account/index.ts index 960f176..bed666f 100644 --- a/src/api/routes/account/index.ts +++ b/src/api/routes/account/index.ts @@ -108,7 +108,7 @@ router.put('/password', eq(DB.Schema.users.id, session.user_id) ).run(); - SessionHandler.inValidateAllSessionsForUser(session.user_id); + await SessionHandler.inValidateAllSessionsForUser(session.user_id); return APIResponse.successNoData(c, "Password changed successfully"); }, @@ -154,7 +154,7 @@ router.delete('/', // @ts-ignore const session = c.get("session") as DB.Models.Session; - SessionHandler.inValidateAllSessionsForUser(session.user_id); + await SessionHandler.inValidateAllSessionsForUser(session.user_id); DB.instance().delete(DB.Schema.users).where( eq(DB.Schema.users.id, session.user_id) diff --git a/src/api/routes/domains/records/index.ts b/src/api/routes/domains/records/index.ts index af46709..31a04b4 100644 --- a/src/api/routes/domains/records/index.ts +++ b/src/api/routes/domains/records/index.ts @@ -129,8 +129,6 @@ router.get('/:recordID', // @ts-ignore const record = c.get("record") as DB.Models.AdditionalDNSRecord; - console.log(record); - return APIResponse.success(c, "Record retrieved successfully", record); } ); diff --git a/src/api/utils/specHelpers.ts b/src/api/utils/specHelpers.ts index 92bd9d2..d8c667d 100644 --- a/src/api/utils/specHelpers.ts +++ b/src/api/utils/specHelpers.ts @@ -2,7 +2,6 @@ import { describeRoute, DescribeRouteOptions, resolver } from "hono-openapi"; import { type MiddlewareHandler } from "hono"; import { APIResponse } from "./api-res"; import { z } from "zod"; -import { de } from "zod/v4/locales"; import { Utils } from "../../utils"; export class APIRouteSpec { diff --git a/src/db/index.ts b/src/db/index.ts index 79fab74..83eb476 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -2,6 +2,7 @@ import { drizzle } from 'drizzle-orm/bun-sqlite'; import { Database } from 'bun:sqlite'; import * as TableSchema from './schema'; import { randomBytes as crypto_randomBytes } from 'crypto'; +import { Logger } from '../utils/logger'; export type DrizzleDB = ReturnType; @@ -15,7 +16,7 @@ export class DB { await this.createInitialSystemConfigsIfNeeded(); await this.createInitialAdminUserIfNeeded(); - console.log('Database initialized at'); + Logger.log('Database initialized'); } static async createInitialAdminUserIfNeeded() { @@ -33,7 +34,7 @@ export class DB { Bun.file('./data/initial_admin_credentials.txt').write(`Username: ${username}\nPassword: ${randomPassword}\n`); - console.log(`Initial admin user created with username: ${username} and password: ${randomPassword} (also saved to ./data/initial_admin_credentials.txt)`); + Logger.log(`Initial admin user created with username: ${username} and password: ${randomPassword} (also saved to ./data/initial_admin_credentials.txt)`); } static async createInitialSystemConfigsIfNeeded() { diff --git a/src/dns-server/recordStore.ts b/src/dns-server/recordStore.ts index 244e2fd..9ce873a 100644 --- a/src/dns-server/recordStore.ts +++ b/src/dns-server/recordStore.ts @@ -3,6 +3,7 @@ import { DB } from "../db"; import { eq, and } from "drizzle-orm"; import { DNSRecordDataSchemas } from "./utils"; import { Utils } from "../utils"; +import { Logger } from "../utils/logger"; export interface DNSHybridRecordStoreSettings { readonly baseDomain: string; @@ -177,7 +178,7 @@ export class DNSHybridRecordStore extends AbstractDNSRecordStore { const recordTypeStr = Object.keys(DNSRecords.TYPE).find(key => DNSRecords.TYPE[key as keyof typeof DNSRecords.TYPE] === type); - console.log(`Looking for additional DNS records for domain ${apexSubdomain}, subdomain ${subSubdomain}, type ${recordTypeStr}`); + Logger.debug(`Looking for additional DNS records for domain ${apexSubdomain}, subdomain ${subSubdomain}, type ${recordTypeStr}`); const additionalRecords = await DB.instance().select() .from(DB.Schema.additionalDnsRecords) diff --git a/tests/api.test.ts b/tests/api.test.ts index fdcb5cd..fa369e6 100644 --- a/tests/api.test.ts +++ b/tests/api.test.ts @@ -22,7 +22,7 @@ describe('Search Endpoint', () => { } }).then(res => res.json()).then(data => data.token); - const res = await client..$get({ + const res = await client.$get({ query: { q: 'hono' }, })