mirror of
https://github.com/Dvorinka/Primora.git
synced 2026-10-28 15:51:23 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
361538aabc | ||
|
|
5eec80bbca | ||
|
|
40c189c431 | ||
|
|
bc8b165ad9 |
No files matched your search
@@ -4,6 +4,17 @@ All notable changes to Primora. Format follows [Keep a Changelog](https://keepac
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.8.4] - 2026-09-28
|
||||
|
||||
### Added
|
||||
|
||||
- **Slugs auto-derive from names** — typing an organization, project, bucket, or collection name now fills its slug (`TDvorak` → `tdvorak`); hand-editing the slug stops the derivation, and manual edits are sanitized as you type. Edit forms stay manual.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Installer URL prompt was invisible under `curl | bash`** — `exec 9</dev/tty 2>/dev/null` sent the whole shell's stderr to `/dev/null` permanently, so the `read` prompt rendered nowhere while the script blocked on input. The prompt now reads `/dev/tty` directly with a quiet probe; no-tty runs default silently.
|
||||
- **Installer fetches fail fast** — the compose-file and source-tarball `curl` calls now carry connect/max-time timeouts plus retries, so a stalled GitHub connection errors within seconds naming the file instead of hanging forever.
|
||||
|
||||
## [0.8.3] - 2026-09-28
|
||||
|
||||
### Added
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@primora/desktop",
|
||||
"version": "0.8.3",
|
||||
"version": "0.8.4",
|
||||
"private": true,
|
||||
"description": "Primora desktop shell — thin Tauri client for a self-hosted deployment",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "Primora",
|
||||
"version": "0.8.3",
|
||||
"version": "0.8.4",
|
||||
"identifier": "dev.tdvorak.primora",
|
||||
"build": {
|
||||
"frontendDist": "../ui"
|
||||
|
||||
@@ -28,6 +28,7 @@ import { Show, createEffect, createMemo, createResource, createSignal, onCleanup
|
||||
import { authClient, fetchApiToken } from "./lib/auth-client";
|
||||
import { configureApiToken, errorMessage } from "./lib/api";
|
||||
import { isDemoMode, disableDemoMode, enableDemoMode, demoSession, demoService } from "./lib/demo-mode";
|
||||
import { applySlugField } from "./lib/slug";
|
||||
import {
|
||||
AgentSetupModal,
|
||||
AppShell,
|
||||
@@ -1670,14 +1671,14 @@ export default function App() {
|
||||
label="Organization name"
|
||||
placeholder="Acme Corporation"
|
||||
value={organizationInput().name}
|
||||
onInput={(e) => setOrganizationInput((c) => ({ ...c, name: e.currentTarget.value }))}
|
||||
onInput={(e) => setOrganizationInput((c) => applySlugField(c, "name", e.currentTarget.value))}
|
||||
required
|
||||
/>
|
||||
<Input
|
||||
label="Slug"
|
||||
placeholder="acme"
|
||||
value={organizationInput().slug}
|
||||
onInput={(e) => setOrganizationInput((c) => ({ ...c, slug: e.currentTarget.value }))}
|
||||
onInput={(e) => setOrganizationInput((c) => applySlugField(c, "slug", e.currentTarget.value))}
|
||||
required
|
||||
/>
|
||||
<button type="submit" class="btn btn-primary w-full" disabled={workspacePending()}>
|
||||
@@ -1723,7 +1724,7 @@ export default function App() {
|
||||
projectMessage={projectMessage()}
|
||||
projectPending={projectPending()}
|
||||
canUpdateProject={canUpdateProject()}
|
||||
onProjectInputChange={(field, value) => setProjectInput((c) => ({ ...c, [field]: value }))}
|
||||
onProjectInputChange={(field, value) => setProjectInput((c) => applySlugField(c, field, value))}
|
||||
onProjectEditInputChange={(field, value) => setProjectEditInput((c) => ({ ...c, [field]: value }))}
|
||||
onCreateProject={createProject}
|
||||
onUpdateProject={updateActiveProject}
|
||||
@@ -1822,7 +1823,7 @@ export default function App() {
|
||||
previewLoading={objectPreview.loading}
|
||||
renameObjectKey={renameObjectKeyInput()}
|
||||
moveDestinationBucketID={moveDestinationBucketID()}
|
||||
onBucketInputChange={(field, value) => setBucketInput((c) => ({ ...c, [field]: value }))}
|
||||
onBucketInputChange={(field, value) => setBucketInput((c) => applySlugField(c, field, value))}
|
||||
onBucketEditInputChange={(field, value) => setBucketEditInput((c) => ({ ...c, [field]: value }))}
|
||||
onCreateBucket={createBucket}
|
||||
onUpdateBucket={updateSelectedBucket}
|
||||
@@ -1859,7 +1860,7 @@ export default function App() {
|
||||
collectionPending={collectionPending()}
|
||||
documentPending={documentPending()}
|
||||
canUpdate={canUpdateProject()}
|
||||
onCollectionInputChange={(field, value) => setCollectionInput((c) => ({ ...c, [field]: value }))}
|
||||
onCollectionInputChange={(field, value) => setCollectionInput((c) => applySlugField(c, field, value))}
|
||||
onCreateCollection={createCollection}
|
||||
onDeleteCollection={deleteCollection}
|
||||
onSelectCollection={setSelectedCollectionID}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { applySlugField, slugify } from "../slug";
|
||||
|
||||
describe("slugify", () => {
|
||||
it("derives lowercase hyphenated slugs", () => {
|
||||
expect(slugify("TDvorak")).toBe("tdvorak");
|
||||
expect(slugify("Acme Corporation")).toBe("acme-corporation");
|
||||
expect(slugify(" My_App!! v2 ")).toBe("my-app-v2");
|
||||
});
|
||||
|
||||
it("strips accents and non-ascii characters", () => {
|
||||
expect(slugify("Zürich — Héllo")).toBe("zurich-hello");
|
||||
expect(slugify("日本語")).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe("applySlugField", () => {
|
||||
const form = { name: "", slug: "", description: "" };
|
||||
|
||||
it("fills the slug while it is untouched", () => {
|
||||
const next = applySlugField(form, "name", "My Org");
|
||||
expect(next.slug).toBe("my-org");
|
||||
// keeps following name edits
|
||||
expect(applySlugField(next, "name", "Renamed Org").slug).toBe("renamed-org");
|
||||
});
|
||||
|
||||
it("stops deriving once the slug was hand-edited", () => {
|
||||
const custom = applySlugField(applySlugField(form, "name", "My Org"), "slug", "custom-slug");
|
||||
expect(applySlugField(custom, "name", "New Name").slug).toBe("custom-slug");
|
||||
});
|
||||
|
||||
it("resumes deriving if the slug is cleared", () => {
|
||||
const cleared = applySlugField(applySlugField(form, "name", "My Org"), "slug", "");
|
||||
expect(applySlugField(cleared, "name", "Other").slug).toBe("other");
|
||||
});
|
||||
|
||||
it("sanitizes manual slug edits", () => {
|
||||
expect(applySlugField(form, "slug", "Not A Slug!").slug).toBe("not-a-slug");
|
||||
});
|
||||
|
||||
it("passes through unrelated fields", () => {
|
||||
expect(applySlugField(form, "description", "hi").description).toBe("hi");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
export function slugify(value: string): string {
|
||||
return value
|
||||
.normalize("NFKD")
|
||||
.replace(/[\u0300-\u036f]/g, "")
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/^-+|-+$/g, "")
|
||||
.slice(0, 63);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a field edit to a {name, slug, ...} form. While the slug is
|
||||
* untouched — empty or still equal to the derived value — renaming the
|
||||
* entity re-derives its slug. Explicit slug edits are sanitized in place.
|
||||
*/
|
||||
export function applySlugField<T extends { name: string; slug: string }>(
|
||||
current: T,
|
||||
field: string,
|
||||
value: string,
|
||||
): T {
|
||||
if (field === "slug") return { ...current, slug: slugify(value) };
|
||||
if (field === "name" && (current.slug === "" || current.slug === slugify(current.name))) {
|
||||
return { ...current, name: value, slug: slugify(value) };
|
||||
}
|
||||
return { ...current, [field]: value };
|
||||
}
|
||||
+13
-7
@@ -38,9 +38,12 @@ mkdir -p "$DIR/infra/nginx"
|
||||
cd "$DIR"
|
||||
|
||||
# The compose stack needs exactly these three files from the repo.
|
||||
# Timeouts + retries: a stalled connection must fail loudly, not hang.
|
||||
info "Fetching compose files ($REF)"
|
||||
for f in docker-compose.yml .env.example infra/nginx/default.conf; do
|
||||
curl -fsSL "https://raw.githubusercontent.com/$REPO/$REF/$f" -o "$f"
|
||||
curl -fsSL --connect-timeout 10 --max-time 60 --retry 3 --retry-delay 1 --retry-all-errors \
|
||||
"https://raw.githubusercontent.com/$REPO/$REF/$f" -o "$f" \
|
||||
|| die "could not fetch $f — check connectivity to raw.githubusercontent.com"
|
||||
done
|
||||
|
||||
if [ -f .env ]; then
|
||||
@@ -57,11 +60,13 @@ else
|
||||
if [ -z "$PUBLIC_URL" ]; then
|
||||
DEFAULT_URL="http://localhost"
|
||||
[ "$NGINX_PORT" != "80" ] && DEFAULT_URL="http://localhost:$NGINX_PORT"
|
||||
# Under `curl | bash` stdin is the script pipe — prompt on the
|
||||
# controlling terminal instead. No tty (CI/cron) → default silently.
|
||||
if exec 9</dev/tty 2>/dev/null; then
|
||||
read -rp "URL where you'll open Primora (domain or IP, e.g. https://primora.example.com) [$DEFAULT_URL]: " PUBLIC_URL <&9 || true
|
||||
exec 9>&-
|
||||
# Under `curl | bash` stdin is the script pipe — ask on the controlling
|
||||
# terminal instead. `true </dev/tty` probes the open quietly; read's own
|
||||
# redirect fails non-fatally (default applies) where there is no tty.
|
||||
# Never `exec ... 2>/dev/null` here — exec redirections persist and would
|
||||
# silence stderr, including the read prompt below, for the whole script.
|
||||
if true 2>/dev/null </dev/tty; then
|
||||
read -rp "URL where you'll open Primora (domain or IP, e.g. https://primora.example.com) [$DEFAULT_URL]: " PUBLIC_URL </dev/tty || true
|
||||
fi
|
||||
PUBLIC_URL="${PUBLIC_URL:-$DEFAULT_URL}"
|
||||
fi
|
||||
@@ -129,7 +134,8 @@ if docker pull "ghcr.io/$GHCR_OWNER/primora-backend:latest" \
|
||||
else
|
||||
# GHCR packages are private until first published release — build from source.
|
||||
info "Prebuilt images unavailable; building from source"
|
||||
curl -fsSL "https://codeload.github.com/$REPO/tar.gz/refs/heads/$REF" | tar xz --strip-components=1
|
||||
curl -fsSL --connect-timeout 10 --max-time 120 --retry 3 --retry-delay 1 --retry-all-errors \
|
||||
"https://codeload.github.com/$REPO/tar.gz/refs/heads/$REF" | tar xz --strip-components=1
|
||||
docker compose up -d --build
|
||||
fi
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "primora",
|
||||
"version": "0.8.3",
|
||||
"version": "0.8.4",
|
||||
"private": true,
|
||||
"packageManager": "[email protected]",
|
||||
"workspaces": [
|
||||
|
||||
Reference in new issue
Block a user