mirror of
https://github.com/Dvorinka/Primora.git
synced 2026-10-28 15:51:23 +00:00
Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20b4ea6a07 | ||
|
|
0511e5754b | ||
|
|
3800e736d0 | ||
|
|
7548ea75d4 | ||
|
|
14d0762245 | ||
|
|
a990989d34 | ||
|
|
3b9ea333ad | ||
|
|
86d612ec93 | ||
|
|
0c5d4a72b2 | ||
|
|
61e8c696c9 | ||
|
|
f6751b70d4 | ||
|
|
207486a53d | ||
|
|
aab4dd3bfd |
No files matched your search
+5
-1
@@ -77,9 +77,13 @@ BACKEND_STORAGE_DRIVER=local
|
|||||||
|
|
||||||
# Mail defaults — each is overridable in-app (Settings → Instance). In-app
|
# Mail defaults — each is overridable in-app (Settings → Instance). In-app
|
||||||
# values win over these env vars; deleting the in-app value reverts here.
|
# values win over these env vars; deleting the in-app value reverts here.
|
||||||
|
# With no transport configured (no Resend key and no SMTP_HOST) accounts are
|
||||||
|
# verified automatically and no verification mail is attempted.
|
||||||
|
# The dev overlay (docker compose -f docker-compose.yml -f docker-compose.dev.yml)
|
||||||
|
# runs Mailpit — then SMTP_HOST=mailpit catches all outgoing mail at :8025.
|
||||||
RESEND_API_KEY=
|
RESEND_API_KEY=
|
||||||
MAIL_FROM=Primora <[email protected]>
|
MAIL_FROM=Primora <[email protected]>
|
||||||
SMTP_HOST=mailpit
|
SMTP_HOST=
|
||||||
SMTP_PORT=1025
|
SMTP_PORT=1025
|
||||||
SMTP_USER=
|
SMTP_USER=
|
||||||
SMTP_PASSWORD=
|
SMTP_PASSWORD=
|
||||||
|
|||||||
@@ -59,17 +59,20 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
images:
|
images:
|
||||||
name: Build + push ${{ matrix.app }}
|
name: Build + push ${{ matrix.app }} (${{ matrix.platform }})
|
||||||
needs: verify
|
needs: verify
|
||||||
if: needs.verify.outputs.needed == 'true'
|
if: needs.verify.outputs.needed == 'true'
|
||||||
runs-on: ubuntu-latest
|
# Native runners per arch — QEMU emulation SIGILLs on the current
|
||||||
|
# node:20-alpine arm64 layers (uncaught target signal 4) and wedges
|
||||||
|
# the build step indefinitely.
|
||||||
|
runs-on: ${{ matrix.platform == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
app: [backend, auth, frontend]
|
app: [backend, auth, frontend]
|
||||||
|
platform: [amd64, arm64]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: docker/setup-qemu-action@v3
|
|
||||||
- uses: docker/setup-buildx-action@v3
|
- uses: docker/setup-buildx-action@v3
|
||||||
# ghcr.io requires lowercase repo paths; the owner login may be mixed-case.
|
# ghcr.io requires lowercase repo paths; the owner login may be mixed-case.
|
||||||
- name: Compute lowercase GHCR owner
|
- name: Compute lowercase GHCR owner
|
||||||
@@ -84,13 +87,38 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: apps/${{ matrix.app }}/Dockerfile
|
file: apps/${{ matrix.app }}/Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/${{ matrix.platform }}
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: ghcr.io/${{ env.GHCR_OWNER }}/primora-${{ matrix.app }}:${{ needs.verify.outputs.version }}-${{ matrix.platform }}
|
||||||
ghcr.io/${{ env.GHCR_OWNER }}/primora-${{ matrix.app }}:${{ needs.verify.outputs.version }}
|
cache-from: type=gha,scope=${{ matrix.app }}-${{ matrix.platform }}
|
||||||
ghcr.io/${{ env.GHCR_OWNER }}/primora-${{ matrix.app }}:latest
|
cache-to: type=gha,mode=max,scope=${{ matrix.app }}-${{ matrix.platform }}
|
||||||
cache-from: type=gha,scope=${{ matrix.app }}
|
|
||||||
cache-to: type=gha,mode=max,scope=${{ matrix.app }}
|
# Joins the per-arch images into the real version + latest tags.
|
||||||
|
manifests:
|
||||||
|
name: Image manifests
|
||||||
|
needs: [verify, images]
|
||||||
|
if: needs.verify.outputs.needed == 'true'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Compute lowercase GHCR owner
|
||||||
|
run: echo "GHCR_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >> "$GITHUB_ENV"
|
||||||
|
- uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Create multi-arch manifests
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.verify.outputs.version }}
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
for app in backend auth frontend; do
|
||||||
|
img="ghcr.io/${GHCR_OWNER}/primora-${app}"
|
||||||
|
docker buildx imagetools create \
|
||||||
|
-t "$img:$VERSION" -t "$img:latest" \
|
||||||
|
"$img:$VERSION-amd64" "$img:$VERSION-arm64"
|
||||||
|
done
|
||||||
|
|
||||||
cli-binaries:
|
cli-binaries:
|
||||||
name: Compile ${{ matrix.name }}
|
name: Compile ${{ matrix.name }}
|
||||||
@@ -192,7 +220,7 @@ jobs:
|
|||||||
|
|
||||||
release:
|
release:
|
||||||
name: GitHub Release
|
name: GitHub Release
|
||||||
needs: [verify, images, cli-binaries, desktop, npm-packages]
|
needs: [verify, manifests, cli-binaries, desktop, npm-packages]
|
||||||
if: needs.verify.outputs.needed == 'true'
|
if: needs.verify.outputs.needed == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
@@ -303,6 +331,9 @@ jobs:
|
|||||||
VERSION: ${{ needs.verify.outputs.version }}
|
VERSION: ${{ needs.verify.outputs.version }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
# ghcr.io requires lowercase repo paths; the owner login may be mixed-case.
|
||||||
|
- name: Compute lowercase GHCR owner
|
||||||
|
run: echo "GHCR_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >> "$GITHUB_ENV"
|
||||||
- uses: docker/login-action@v3
|
- uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
@@ -310,17 +341,17 @@ jobs:
|
|||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- uses: anchore/sbom-action@v0
|
- uses: anchore/sbom-action@v0
|
||||||
with:
|
with:
|
||||||
image: ghcr.io/${{ github.repository_owner }}/primora-backend:${{ needs.verify.outputs.version }}
|
image: ghcr.io/${{ env.GHCR_OWNER }}/primora-backend:${{ needs.verify.outputs.version }}
|
||||||
format: cyclonedx-json
|
format: cyclonedx-json
|
||||||
output-file: dist-release/sbom-backend.cdx.json
|
output-file: dist-release/sbom-backend.cdx.json
|
||||||
- uses: anchore/sbom-action@v0
|
- uses: anchore/sbom-action@v0
|
||||||
with:
|
with:
|
||||||
image: ghcr.io/${{ github.repository_owner }}/primora-auth:${{ needs.verify.outputs.version }}
|
image: ghcr.io/${{ env.GHCR_OWNER }}/primora-auth:${{ needs.verify.outputs.version }}
|
||||||
format: cyclonedx-json
|
format: cyclonedx-json
|
||||||
output-file: dist-release/sbom-auth.cdx.json
|
output-file: dist-release/sbom-auth.cdx.json
|
||||||
- uses: anchore/sbom-action@v0
|
- uses: anchore/sbom-action@v0
|
||||||
with:
|
with:
|
||||||
image: ghcr.io/${{ github.repository_owner }}/primora-frontend:${{ needs.verify.outputs.version }}
|
image: ghcr.io/${{ env.GHCR_OWNER }}/primora-frontend:${{ needs.verify.outputs.version }}
|
||||||
format: cyclonedx-json
|
format: cyclonedx-json
|
||||||
output-file: dist-release/sbom-frontend.cdx.json
|
output-file: dist-release/sbom-frontend.cdx.json
|
||||||
- uses: anchore/sbom-action@v0
|
- uses: anchore/sbom-action@v0
|
||||||
|
|||||||
@@ -39,3 +39,5 @@ infra/mailpit
|
|||||||
# Generated code-graph artifacts
|
# Generated code-graph artifacts
|
||||||
graphify-out/
|
graphify-out/
|
||||||
.playwright-mcp/
|
.playwright-mcp/
|
||||||
|
# Local brag/launch-video output
|
||||||
|
brag-output/
|
||||||
@@ -4,6 +4,14 @@ All notable changes to Primora. Format follows [Keep a Changelog](https://keepac
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.8.1] - 2026-09-28
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **SMTP-less instances no longer involve email at all** — when no mail transport is configured (no Resend key, no `SMTP_HOST`), new accounts are created `emailVerified=true`, the verification send is skipped entirely, and existing unverified users are marked verified on startup. `.env.example` no longer defaults `SMTP_HOST` to the dev-only `mailpit` service, which left production deploys pointing at a transport that does not exist.
|
||||||
|
|
||||||
|
## [0.8.0] - 2026-09-28
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- **Agent setup prompt** — a "Set up with an AI agent" dialog that mints a fresh `write`-scoped API key (ingest + reads + non-admin mutations, never key-minting) and renders a copyable prompt handing a coding agent everything it needs: the deployment endpoint, project id, the key itself, plus tasks to instrument error/metric/log/heartbeat reporting per component (`POST /api/v1/ingest` — works from any language), register the app's databases via `db-connections` (postgres → cassandra), wire the MCP server / CLI for future agents, and verify with a test event + deploy marker. Opens at the end of the new-project onboarding and is re-reachable from the project dashboard and Projects page; keys are shown only inside the prompt (revoke under Settings → API keys).
|
- **Agent setup prompt** — a "Set up with an AI agent" dialog that mints a fresh `write`-scoped API key (ingest + reads + non-admin mutations, never key-minting) and renders a copyable prompt handing a coding agent everything it needs: the deployment endpoint, project id, the key itself, plus tasks to instrument error/metric/log/heartbeat reporting per component (`POST /api/v1/ingest` — works from any language), register the app's databases via `db-connections` (postgres → cassandra), wire the MCP server / CLI for future agents, and verify with a test event + deploy marker. Opens at the end of the new-project onboarding and is re-reachable from the project dashboard and Projects page; keys are shown only inside the prompt (revoke under Settings → API keys).
|
||||||
@@ -53,6 +61,7 @@ All notable changes to Primora. Format follows [Keep a Changelog](https://keepac
|
|||||||
- **`fetch failed` polish** — connection failures report the cause code and suggest `primora context` instead of bare undici errors.
|
- **`fetch failed` polish** — connection failures report the cause code and suggest `primora context` instead of bare undici errors.
|
||||||
- **`login --json`** — the flag now emits JSON on both the session and API-key paths.
|
- **`login --json`** — the flag now emits JSON on both the session and API-key paths.
|
||||||
- **Dashboard fonts vendored** — Geist/Geist Mono now ship via `@fontsource` inside the bundle instead of a Google Fonts `<link>` the nginx CSP blocked (`style-src 'self'`). Removes the runtime Google dependency, works airgapped, and eliminates the console CSP violation.
|
- **Dashboard fonts vendored** — Geist/Geist Mono now ship via `@fontsource` inside the bundle instead of a Google Fonts `<link>` the nginx CSP blocked (`style-src 'self'`). Removes the runtime Google dependency, works airgapped, and eliminates the console CSP violation.
|
||||||
|
- **Release image builds moved off QEMU** — arm64 `npm ci` under `docker/setup-qemu-action` SIGILLed on current `node:20-alpine` layers (`uncaught target signal 4`) and wedged the build step for over an hour. Images now build per-arch on native runners (`ubuntu-24.04-arm` for arm64) and a `manifests` job joins them into the multi-arch `:<version>`/`:latest` tags.
|
||||||
|
|
||||||
## [0.7.1] - 2026-09-23
|
## [0.7.1] - 2026-09-23
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { requestId } from "hono/request-id";
|
|||||||
import { HTTPException } from "hono/http-exception";
|
import { HTTPException } from "hono/http-exception";
|
||||||
import { createClient } from "redis";
|
import { createClient } from "redis";
|
||||||
|
|
||||||
import { auth, promoteAdminEmails, runAuthMigrations } from "./lib/auth.js";
|
import { auth, promoteAdminEmails, runAuthMigrations, verifyUsersWithoutMailTransport } from "./lib/auth.js";
|
||||||
import { authPool } from "./lib/db.js";
|
import { authPool } from "./lib/db.js";
|
||||||
import { env } from "./lib/env.js";
|
import { env } from "./lib/env.js";
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await retry("auth_migrations", runAuthMigrations);
|
await retry("auth_migrations", runAuthMigrations);
|
||||||
|
await verifyUsersWithoutMailTransport();
|
||||||
await promoteAdminEmails();
|
await promoteAdminEmails();
|
||||||
|
|
||||||
const app = new Hono();
|
const app = new Hono();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { admin, jwt } from "better-auth/plugins";
|
|||||||
import { getMigrations } from "better-auth/db/migration";
|
import { getMigrations } from "better-auth/db/migration";
|
||||||
|
|
||||||
import { authPool } from "./db.js";
|
import { authPool } from "./db.js";
|
||||||
import { sendTransactionalEmail } from "./mail.js";
|
import { hasMailTransport, sendTransactionalEmail } from "./mail.js";
|
||||||
import { getBoolSetting } from "./settings.js";
|
import { getBoolSetting } from "./settings.js";
|
||||||
import { env } from "./env.js";
|
import { env } from "./env.js";
|
||||||
|
|
||||||
@@ -72,13 +72,20 @@ export const auth = betterAuth({
|
|||||||
// Gates only the public sign-up endpoint. Users created through the
|
// Gates only the public sign-up endpoint. Users created through the
|
||||||
// admin plugin or OAuth callbacks take different paths and pass.
|
// admin plugin or OAuth callbacks take different paths and pass.
|
||||||
async before(user, ctx) {
|
async before(user, ctx) {
|
||||||
if (ctx?.path !== "/sign-up/email") return;
|
const data = { ...user };
|
||||||
|
// Without a mail transport the verification mail can never arrive —
|
||||||
|
// mark every created account verified so nothing downstream nags
|
||||||
|
// "unverified" on users nobody can verify.
|
||||||
|
if (!(await hasMailTransport())) {
|
||||||
|
data.emailVerified = true;
|
||||||
|
}
|
||||||
|
if (ctx?.path === "/sign-up/email") {
|
||||||
const { rows } = await authPool.query<{ n: number }>(
|
const { rows } = await authPool.query<{ n: number }>(
|
||||||
`select count(*)::int as n from "user"`,
|
`select count(*)::int as n from "user"`,
|
||||||
);
|
);
|
||||||
if (rows[0].n === 0) {
|
if (rows[0].n === 0) {
|
||||||
// Bootstrap: the first public signup becomes the instance admin.
|
// Bootstrap: the first public signup becomes the instance admin.
|
||||||
return { data: { ...user, role: "admin" } };
|
return { data: { ...data, role: "admin" } };
|
||||||
}
|
}
|
||||||
const enabled = await getBoolSetting("auth.signup_enabled", env.SIGNUP_ENABLED);
|
const enabled = await getBoolSetting("auth.signup_enabled", env.SIGNUP_ENABLED);
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
@@ -86,6 +93,8 @@ export const auth = betterAuth({
|
|||||||
message: "Sign-up is disabled on this instance.",
|
message: "Sign-up is disabled on this instance.",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return data.emailVerified === user.emailVerified ? undefined : { data };
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -94,6 +103,9 @@ export const auth = betterAuth({
|
|||||||
sendOnSignUp: true,
|
sendOnSignUp: true,
|
||||||
autoSignInAfterVerification: true,
|
autoSignInAfterVerification: true,
|
||||||
async sendVerificationEmail({ user, url }) {
|
async sendVerificationEmail({ user, url }) {
|
||||||
|
// No transport at all → the mail can never arrive; the user was already
|
||||||
|
// marked verified at creation.
|
||||||
|
if (!(await hasMailTransport())) return;
|
||||||
// Verification is optional — a misconfigured transport must not fail
|
// Verification is optional — a misconfigured transport must not fail
|
||||||
// sign-up or sign-in.
|
// sign-up or sign-in.
|
||||||
try {
|
try {
|
||||||
@@ -143,6 +155,12 @@ export async function runAuthMigrations() {
|
|||||||
await migrations.runMigrations();
|
await migrations.runMigrations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** No transport → existing unverified users can never resolve that state. */
|
||||||
|
export async function verifyUsersWithoutMailTransport() {
|
||||||
|
if (await hasMailTransport()) return;
|
||||||
|
await authPool.query(`update "user" set "emailVerified" = true where "emailVerified" = false`);
|
||||||
|
}
|
||||||
|
|
||||||
/** Bootstrap admins by email — run after migrations so the role column exists. */
|
/** Bootstrap admins by email — run after migrations so the role column exists. */
|
||||||
export async function promoteAdminEmails() {
|
export async function promoteAdminEmails() {
|
||||||
const emails = (env.AUTH_ADMIN_EMAILS ?? "")
|
const emails = (env.AUTH_ADMIN_EMAILS ?? "")
|
||||||
|
|||||||
@@ -30,6 +30,14 @@ async function resolveMailConfig() {
|
|||||||
} as const;
|
} as const;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// True when a mail transport exists (Resend key or SMTP host). Verification
|
||||||
|
// and reset mails only make sense when mail can actually leave the box.
|
||||||
|
export async function hasMailTransport(): Promise<boolean> {
|
||||||
|
const cfg = await resolveMailConfig();
|
||||||
|
if ("resendApiKey" in cfg && cfg.resendApiKey) return true;
|
||||||
|
return "smtp" in cfg && Boolean(cfg.smtp);
|
||||||
|
}
|
||||||
|
|
||||||
export async function sendTransactionalEmail(input: {
|
export async function sendTransactionalEmail(input: {
|
||||||
to: string;
|
to: string;
|
||||||
subject: string;
|
subject: string;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@primora/desktop",
|
"name": "@primora/desktop",
|
||||||
"version": "0.7.1",
|
"version": "0.8.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Primora desktop shell — thin Tauri client for a self-hosted deployment",
|
"description": "Primora desktop shell — thin Tauri client for a self-hosted deployment",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "Primora",
|
"productName": "Primora",
|
||||||
"version": "0.7.1",
|
"version": "0.8.1",
|
||||||
"identifier": "dev.tdvorak.primora",
|
"identifier": "dev.tdvorak.primora",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "../ui"
|
"frontendDist": "../ui"
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "primora",
|
"name": "primora",
|
||||||
"version": "0.7.1",
|
"version": "0.8.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "[email protected]",
|
"packageManager": "[email protected]",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
|
|||||||
Reference in new issue
Block a user