Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

631 B
Raw Blame
import type { Context, Next } from "hono";
import { requireWorkspaceEntitlement } from "./controllers/require-entitlement";

/**
 * Blocks the request when the workspace has no active Kaneo Cloud entitlement
 * (expired trial, canceled or expired subscription). Must run after a
 * workspace-access middleware that sets `c.get("workspaceId")`. No-ops when
 * billing is disabled, so self-hosted installs are unaffected.
 */
export async function requireEntitlement(c: Context, next: Next) {
  const workspaceId = c.get("workspaceId");
  if (workspaceId) {
    await requireWorkspaceEntitlement(workspaceId);
  }
  return next();
}