mirror of
https://github.com/bretzel-app/crumbs.git
synced 2026-10-12 20:06:57 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb83ee4cc5 | ||
|
|
a0f663d9d6 | ||
|
|
9cf0c0285b | ||
|
|
faf926c081 | ||
|
|
04088819cd | ||
|
|
31732e8144 | ||
|
|
d71dbe0f4a | ||
|
|
effe7e3e72 | ||
|
|
0eb2572e89 | ||
|
|
6f4938180a |
@@ -125,5 +125,21 @@ jobs:
|
||||
push: false
|
||||
provenance: false
|
||||
tags: crumbs:ci
|
||||
load: true
|
||||
cache-from: type=gha,scope=ci-docker
|
||||
cache-to: type=gha,scope=ci-docker,mode=max
|
||||
|
||||
# Regression for #93: a host folder bind-mounted at /data is owned by the
|
||||
# host user (the runner, uid 1001), not the container's node user (1000)
|
||||
- name: Start with a host-owned bind mount
|
||||
run: |
|
||||
mkdir -p "$RUNNER_TEMP/crumbs-data"
|
||||
docker run -d --name crumbs -p 3000:3000 -v "$RUNNER_TEMP/crumbs-data:/data" crumbs:ci
|
||||
for i in $(seq 1 30); do
|
||||
if curl -fsS -o /dev/null http://localhost:3000/login; then
|
||||
test -f "$RUNNER_TEMP/crumbs-data/crumbs.db" && exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
docker logs crumbs
|
||||
exit 1
|
||||
|
||||
+4
-2
@@ -37,8 +37,10 @@ COPY --from=build /app/package.json ./
|
||||
# Create data directory
|
||||
RUN mkdir -p /data && chown -R node:node /data
|
||||
|
||||
# Use non-root user
|
||||
USER node
|
||||
# Runs as root only long enough to hand the data folder (often a host bind
|
||||
# mount) to the node user, then drops privileges — see crumbs-entrypoint.sh
|
||||
COPY crumbs-entrypoint.sh /usr/local/bin/crumbs-entrypoint.sh
|
||||
ENTRYPOINT ["crumbs-entrypoint.sh"]
|
||||
|
||||
# Configuration
|
||||
ENV NODE_ENV=production
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
<img src="static/favicon-96x96.png" alt="Crumbs logo" width="96" height="96">
|
||||
</p>
|
||||
|
||||
# Crumbs by Bretzel
|
||||
# Crumbs by Bretzel (fork)
|
||||
|
||||
Original: https://github.com/bretzel-app/crumbs
|
||||
|
||||
A self-hostable, offline-first note-taking app that respects your privacy. Part of the [Bretzel](https://bretzel.app) app universe.
|
||||
|
||||
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# Starts as root so a bind-mounted data folder owned by the host user can be
|
||||
# handed to the unprivileged `node` user, then drops privileges before running
|
||||
# the app. Without this, a host folder mounted at /data is not writable by
|
||||
# uid 1000 and SQLite fails with SQLITE_CANTOPEN.
|
||||
set -e
|
||||
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
for dir in "${DATA_DIR:-/data}" "$(dirname "${DATABASE_URL:-/data/crumbs.db}")"; do
|
||||
mkdir -p "$dir"
|
||||
# Only touch entries not already owned by node, so restarts on a large
|
||||
# attachment folder stay fast.
|
||||
find "$dir" \! -user node -exec chown node:node {} + ||
|
||||
echo "warning: could not change ownership of $dir; it must be writable by uid 1000" >&2
|
||||
done
|
||||
exec setpriv --reuid=node --regid=node --init-groups "$@"
|
||||
fi
|
||||
|
||||
# Started with an explicit non-root user (e.g. `user:` in compose): run as-is.
|
||||
exec "$@"
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
crumbs:
|
||||
image: ghcr.io/bretzel-app/crumbs:0.34.2
|
||||
image: ghcr.io/bretzel-app/crumbs:0.35.2
|
||||
container_name: crumbs
|
||||
ports:
|
||||
- "3000:3000"
|
||||
|
||||
@@ -26,6 +26,10 @@ services:
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
The app runs as the image's `node` user (uid 1000). On startup the container hands ownership of a
|
||||
bind-mounted data folder to uid 1000, so a folder created by any host user works as-is. If you set
|
||||
`user:` in compose, that step is skipped and the folder must already be writable by that user.
|
||||
|
||||
### Reverse Proxy (nginx)
|
||||
|
||||
```nginx
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "crumbs",
|
||||
"private": true,
|
||||
"version": "0.35.0",
|
||||
"version": "0.35.2",
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@9.15.9",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
let showColorPicker = $state(false);
|
||||
let showImageUpload = $state(false);
|
||||
// svelte-ignore state_referenced_locally
|
||||
let rawMarkdownMode = $state(note ? (note.checklistMode ?? false) : prefs.defaultNoteMode === 'markdown');
|
||||
let rawMarkdownMode = $state(prefs.defaultNoteMode === 'markdown');
|
||||
let textareaEl: HTMLTextAreaElement | undefined = $state();
|
||||
let tiptapEditor: Editor | undefined = $state();
|
||||
let editorTick = $state(0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { test, expect } from './helpers/fixtures.js';
|
||||
import { test, expect, noteCard } from './helpers/fixtures.js';
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
const DEFAULT_PREFS = {
|
||||
@@ -81,6 +81,30 @@ test.describe('Settings — Preferences', () => {
|
||||
await expect(page.getByTestId('note-content-input')).toBeVisible();
|
||||
});
|
||||
|
||||
test('Scenario: Default note mode applies when reopening an existing note', async ({
|
||||
authenticatedPage: page
|
||||
}) => {
|
||||
await resetPreferences(page);
|
||||
|
||||
// Given a note titled "Existing Markdown Note" exists
|
||||
const title = `Existing Markdown Note ${Date.now()}`;
|
||||
await page.request.post('/api/notes', { data: { title, content: 'Some **bold** text' } });
|
||||
|
||||
// And the user's default note mode is Markdown
|
||||
await gotoWithStablePrefs(page, '/settings/preferences');
|
||||
const putResponse = page.waitForResponse((res) => res.url().includes('/api/preferences') && res.request().method() === 'PUT');
|
||||
await page.getByTestId('pref-mode-markdown').click();
|
||||
await putResponse;
|
||||
|
||||
// When the user opens the note
|
||||
await gotoWithStablePrefs(page, '/');
|
||||
await noteCard(page, title).click();
|
||||
|
||||
// Then the note editor opens in markdown mode showing the raw source
|
||||
await expect(page.getByTestId('note-content-input')).toBeVisible();
|
||||
await expect(page.getByTestId('note-content-input')).toHaveValue('Some **bold** text');
|
||||
});
|
||||
|
||||
test('Scenario: Footer toggle hides and shows footer', async ({
|
||||
authenticatedPage: page
|
||||
}) => {
|
||||
|
||||
+1
-1
@@ -292,7 +292,7 @@
|
||||
<li><a href="https://github.com/bretzel-app/crumbs/blob/main/docs/DEPLOYMENT.md" target="_blank" rel="noopener">Docs</a></li>
|
||||
<li><a href="https://github.com/bretzel-app/crumbs/blob/main/LICENSE" target="_blank" rel="noopener">License</a></li>
|
||||
</ul>
|
||||
<span class="footer-version">v0.35.0</span>
|
||||
<span class="footer-version">v0.35.2</span>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user