Skip to content

Commit 7afa65e

Browse files
authored
Merge pull request #15 from gamosoft/features/authentication
Features/authentication - added authentication - possible breaking change. simplified data folder - creation of releases on tag - removed search_index for now
2 parents 3c373f4 + 248b54b commit 7afa65e

22 files changed

+794
-89
lines changed

.github/workflows/docker-publish.yml

Lines changed: 70 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
name: Build and Push Docker Image to GHCR
22

33
on:
4-
pull_request:
5-
types:
6-
- closed
7-
branches:
8-
- main
9-
- master
104
push:
115
tags:
126
- 'v*.*.*'
@@ -18,19 +12,16 @@ env:
1812

1913
jobs:
2014
build-and-push:
21-
# Only run if PR was merged (not just closed) or if triggered by tag/manual
22-
if: |
23-
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
24-
github.event_name == 'push' ||
25-
github.event_name == 'workflow_dispatch'
2615
runs-on: ubuntu-latest
2716
permissions:
28-
contents: read
17+
contents: write
2918
packages: write
3019

3120
steps:
3221
- name: Checkout repository
3322
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0 # Fetch all history for release notes
3425

3526
- name: Set up QEMU for multi-architecture builds
3627
uses: docker/setup-qemu-action@v3
@@ -73,3 +64,70 @@ jobs:
7364
- name: Image digest
7465
run: echo "Image pushed with digest ${{ steps.build-push.outputs.digest }}"
7566

67+
- name: Generate release notes
68+
id: release_notes
69+
run: |
70+
# Get the previous tag
71+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
72+
73+
# Generate commit log - extract PR descriptions from merge commits
74+
if [ -z "$PREVIOUS_TAG" ]; then
75+
# First release, get only merge commits (PR merges)
76+
RAW_COMMITS=$(git log --merges --pretty=format:"%s|||%b|||%h" --first-parent)
77+
else
78+
# Get merge commits since last tag
79+
RAW_COMMITS=$(git log ${PREVIOUS_TAG}..HEAD --merges --pretty=format:"%s|||%b|||%h" --first-parent)
80+
fi
81+
82+
# Process commits to extract meaningful messages
83+
COMMITS=""
84+
while IFS= read -r line; do
85+
if [ -n "$line" ]; then
86+
SUBJECT=$(echo "$line" | cut -d'|' -f1)
87+
BODY=$(echo "$line" | cut -d'|' -f4 | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
88+
HASH=$(echo "$line" | cut -d'|' -f7)
89+
90+
# If body exists and is not empty, use it; otherwise use subject
91+
if [ -n "$BODY" ] && [ "$BODY" != "" ]; then
92+
# Capitalize first letter of body
93+
MESSAGE=$(echo "$BODY" | sed 's/^./\U&/')
94+
COMMITS="${COMMITS}- ${MESSAGE} (${HASH})"$'\n'
95+
else
96+
COMMITS="${COMMITS}- ${SUBJECT} (${HASH})"$'\n'
97+
fi
98+
fi
99+
done <<< "$RAW_COMMITS"
100+
101+
# Create release notes
102+
echo "## What's Changed" > release_notes.md
103+
echo "" >> release_notes.md
104+
if [ -z "$COMMITS" ]; then
105+
echo "- Minor updates and improvements" >> release_notes.md
106+
else
107+
echo "$COMMITS" >> release_notes.md
108+
fi
109+
echo "" >> release_notes.md
110+
echo "## Docker Images" >> release_notes.md
111+
echo "" >> release_notes.md
112+
echo "This release is available as a Docker image:" >> release_notes.md
113+
echo '```bash' >> release_notes.md
114+
echo "docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF_NAME#v}" >> release_notes.md
115+
echo '```' >> release_notes.md
116+
echo "" >> release_notes.md
117+
if [ -z "$PREVIOUS_TAG" ]; then
118+
echo "**Full Changelog**: https://github.com/${{ github.repository }}/commits/${GITHUB_REF_NAME}" >> release_notes.md
119+
else
120+
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREVIOUS_TAG}...${GITHUB_REF_NAME}" >> release_notes.md
121+
fi
122+
123+
cat release_notes.md
124+
125+
- name: Create GitHub Release
126+
uses: softprops/action-gh-release@v1
127+
with:
128+
body_path: release_notes.md
129+
draft: false
130+
prerelease: false
131+
env:
132+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133+

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ env/
2828
.venv
2929

3030
# Data directories
31-
search_index/
31+
data/
3232
*.db
3333
*.sqlite
3434

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ COPY frontend ./frontend
2727
COPY config.yaml .
2828
COPY plugins ./plugins
2929
COPY themes ./themes
30+
COPY generate_password.py .
3031

31-
# Create data directories
32-
RUN mkdir -p data/notes data/search_index
32+
# Create data directory
33+
RUN mkdir -p data
3334

3435
# Expose port
3536
EXPOSE 8000

README.md

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ NoteDiscovery is a **lightweight, self-hosted note-taking application** that put
3232
### Key Benefits
3333

3434
- 🔒 **Total Privacy** - Your notes never leave your server
35+
- 🔐 **Optional Authentication** - Simple password protection for self-hosted deployments
3536
- 💰 **Zero Cost** - No subscriptions, no hidden fees
3637
- 🚀 **Fast & Lightweight** - Instant search and navigation
3738
- 🎨 **Beautiful Themes** - Multiple themes, easy to customize
@@ -47,20 +48,21 @@ NoteDiscovery is a **lightweight, self-hosted note-taking application** that put
4748

4849
Use the pre-built image directly from GHCR - no building required!
4950

50-
> **💡 Tip**: Always use `ghcr.io/gamosoft/notediscovery:latest` to get the newest features and fixes. Images are automatically built when PRs are merged to main.
51+
> **💡 Tip**: Always use `ghcr.io/gamosoft/notediscovery:latest` to get the newest features and fixes.
5152
5253
> **📁 Important - Volume Mapping**: The container needs local folders/files to work:
53-
> - **Required**: `data` folder (your notes will be stored here)
54-
> - **Required**: `themes` folder with theme `.css` files (at least light.css and dark.css)
54+
> - **Required**: `data` folder - **Your personal notes** will be stored here (create an empty folder)
55+
> - **Required**: `themes` folder with theme `.css` files (at least a single theme must exist)
5556
> - **Required**: `plugins` folder (can be empty for basic functionality)
5657
> - **Required**: `config.yaml` file (needed for the app to run)
58+
> - **Optional**: `documentation` folder - If you cloned the repo, mount this to view app docs inside NoteDiscovery
5759
>
5860
> **Setup Options:**
5961
>
6062
> 1. **Minimal** (quick test - download just the essentials):
6163
> ```bash
6264
> # Linux/macOS
63-
> mkdir -p data plugins themes
65+
> mkdir -p data plugins themes # data/ is for YOUR notes
6466
> curl -O https://raw.githubusercontent.com/gamosoft/notediscovery/main/config.yaml
6567
> # Download at least light and dark themes
6668
> curl -o themes/light.css https://raw.githubusercontent.com/gamosoft/notediscovery/main/themes/light.css
@@ -69,20 +71,23 @@ Use the pre-built image directly from GHCR - no building required!
6971
>
7072
> ```powershell
7173
> # Windows PowerShell
72-
> mkdir data, plugins, themes -Force
74+
> mkdir data, plugins, themes -Force # data\ is for YOUR notes
7375
> Invoke-WebRequest -Uri https://raw.githubusercontent.com/gamosoft/notediscovery/main/config.yaml -OutFile config.yaml
7476
> # Download at least light and dark themes
7577
> Invoke-WebRequest -Uri https://raw.githubusercontent.com/gamosoft/notediscovery/main/themes/light.css -OutFile themes/light.css
7678
> Invoke-WebRequest -Uri https://raw.githubusercontent.com/gamosoft/notediscovery/main/themes/dark.css -OutFile themes/dark.css
7779
> ```
7880
>
79-
> 2. **Full Setup** (recommended - includes all themes, plugins, sample notes):
81+
> 2. **Full Setup** (recommended - includes all themes, plugins, and documentation):
8082
> ```bash
8183
> git clone https://github.com/gamosoft/notediscovery.git
8284
> cd notediscovery
83-
> # Now you have everything - run docker-compose below
85+
> # The data/ folder is empty - for your personal notes
86+
> # The documentation/ folder has app docs you can optionally mount
8487
> ```
8588
89+
> **🔐 Security Note**: Authentication is **disabled by default** with password `admin`. For testing/local use, this is fine. If exposing to a network, **change the password immediately** - see [AUTHENTICATION.md](documentation/AUTHENTICATION.md) for instructions on how to enable it.
90+
8691
**Option 1: Docker Compose (Recommended)**
8792
8893
> 💡 **Multi-Architecture Support**: Docker images are available for both `x86_64` and `ARM64` (Raspberry Pi, Apple Silicon, etc.)
@@ -95,6 +100,7 @@ curl -O https://raw.githubusercontent.com/gamosoft/notediscovery/main/docker-com
95100
docker-compose -f docker-compose.ghcr.yml up -d
96101
97102
# Access at http://localhost:8000
103+
# Login with default password: admin
98104
99105
# View logs
100106
docker-compose -f docker-compose.ghcr.yml logs -f
@@ -197,15 +203,25 @@ python run.py
197203
Want to learn more? **The full documentation lives inside the app as interactive notes!**
198204

199205
Once you've started NoteDiscovery, you'll find comprehensive guides on:
200-
- 🎨 **THEMES.md** - Theme customization and creating custom themes
201-
-**FEATURES.md** - Complete feature list and keyboard shortcuts
202-
- 🧮 **MATHJAX.md** - LaTeX/Math notation examples and syntax reference
203-
- 🔌 **PLUGINS.md** - Plugin system and available plugins
204-
- 🌐 **API.md** - REST API documentation and examples
205-
206-
**Can't wait to start the app?** Browse the documentation notes directly on GitHub in the [`data/notes/`](data/notes/) folder!
206+
- 🎨 **[THEMES.md](documentation/THEMES.md)** - Theme customization and creating custom themes
207+
-**[FEATURES.md](documentation/FEATURES.md)** - Complete feature list and keyboard shortcuts
208+
- 🧮 **[MATHJAX.md](documentation/MATHJAX.md)** - LaTeX/Math notation examples and syntax reference
209+
- 🔌 **[PLUGINS.md](documentation/PLUGINS.md)** - Plugin system and available plugins
210+
- 🌐 **[API.md](documentation/API.md)** - REST API documentation and examples
211+
- 🔐 **[AUTHENTICATION.md](documentation/AUTHENTICATION.md)** - Enable password protection for your instance
212+
213+
**Can't wait to start the app?** Browse the documentation notes directly on GitHub in the [`documentation/`](documentation/) folder!
214+
215+
💡 **Pro Tip:** If you clone this repository, you can mount the `documentation/` folder to view these docs inside the app:
216+
217+
```yaml
218+
# In your docker-compose.yml
219+
volumes:
220+
- ./data:/app/data # Your personal notes
221+
- ./documentation:/app/data/docs:ro # Mount docs subfolder inside the data folder (read-only)
222+
```
207223
208-
💡 **Tip:** These documentation files are regular markdown notes—edit them, add your own notes, or use them as templates. It's your knowledge base!
224+
Then access them at `http://localhost:8000` - the docs will appear as a `docs/` folder in the file browser!
209225

210226
## 💖 Support Development
211227

@@ -217,18 +233,21 @@ NoteDiscovery is designed for **self-hosted, private use**. Please keep these se
217233

218234
### Network Security
219235
- ⚠️ **Do NOT expose directly to the internet** without additional security measures
220-
- Run behind a reverse proxy (nginx, Caddy) with HTTPS and authentication if needed
236+
- Run behind a reverse proxy (nginx, Caddy) with HTTPS for production use
221237
- Keep it on your local network or use a VPN for remote access
222238
- By default, the app listens on `0.0.0.0:8000` (all network interfaces)
223239

224-
### No Built-in Authentication
225-
- The app has **no authentication by design** (single-user, self-hosted)
226-
- Anyone with network access can read and modify your notes
227-
- Use network-level security (firewall, VPN) for access control
228-
- Consider adding authentication via reverse proxy if needed
240+
### Authentication
241+
- **Password protection is ENABLED by default** with password: `admin`
242+
- ⚠️ **CHANGE THE DEFAULT PASSWORD IMMEDIATELY** if exposing to a network!
243+
- See **[AUTHENTICATION.md](documentation/AUTHENTICATION.md)** for complete setup instructions
244+
- To disable auth, set `security.enabled: false` in `config.yaml`
245+
- Change password with Docker: `docker-compose exec notediscovery python generate_password.py`
246+
- Perfect for single-user or small team deployments
247+
- For multi-user setups, consider a reverse proxy with OAuth/SSO
229248

230249
### Data Privacy
231-
- Your notes are stored as **plain text markdown files** in `data/notes/`
250+
- Your notes are stored as **plain text markdown files** in the `data/` folder
232251
- No data is sent to external services
233252
- Regular backups are recommended
234253

@@ -239,7 +258,7 @@ NoteDiscovery is designed for **self-hosted, private use**. Please keep these se
239258
- Review and audit any plugins you install
240259
- Set appropriate file permissions on the `data/` directory
241260

242-
**TL;DR**: Perfect for personal use on your local machine or home network. Add a reverse proxy with authentication if exposing to wider networks.
261+
**TL;DR**: Perfect for personal use on your local machine or home network. Enable built-in password protection if needed, or use a reverse proxy with authentication if exposing to wider networks.
243262

244263
## 📄 License
245264

0 commit comments

Comments
 (0)