Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/middleware/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const authMiddleware = createMiddleware(async (c, next) => {
c.req.path === "/"
) {
await next();
return;
}

const authHeader = c.req.header("Authorization");
Expand Down
4 changes: 2 additions & 2 deletions src/api/routes/account/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
},
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions src/api/routes/domains/records/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
);
Expand Down
1 change: 0 additions & 1 deletion src/api/utils/specHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions src/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof drizzle>;

Expand All @@ -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() {
Expand All @@ -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() {
Expand Down
3 changes: 2 additions & 1 deletion src/dns-server/recordStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
})

Expand Down