Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use flake . --show-trace
dotenv_if_exists .env
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*.deb
*.rpm
miniflux-*
.direnv/
44 changes: 44 additions & 0 deletions .helix/languages.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[language-server]
nil = { command = "nil" }
taplo = { command = "taplo", args = ["lsp", "stdio"] }
yaml-language-server = { command = "yaml-language-server", args = ["--stdio"] }
marksman = { command = "marksman", args = ["server"] }
vscode-json-language-server = { command = "vscode-json-language-server", args = [
"--stdio",
], config = { json = { validate = { enable = true } } } }
gopls = { command = "gopls", config = { staticcheck = true } }

[[language]]
name = "nix"
auto-format = true
formatter = { command = "nixpkgs-fmt" }
language-servers = ["nil"]

[[language]]
name = "toml"
auto-format = true
language-servers = ["taplo"]

[[language]]
name = "yaml"
auto-format = true
formatter = { command = "prettier", args = ["--parser", "yaml"] }
language-servers = ["yaml-language-server"]

[[language]]
name = "json"
auto-format = true
formatter = { command = "prettier", args = ["--parser", "json"] }
language-servers = ["vscode-json-language-server"]

[[language]]
name = "markdown"
auto-format = true
formatter = { command = "prettier", args = ["--parser", "markdown"] }
language-servers = ["marksman"]

[[language]]
name = "go"
auto-format = true
language-servers = ["gopls"]
formatter = { command = "gofumpt" }
28 changes: 19 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,21 @@ When reporting bugs:
- **Git**
- **Go >= 1.24**
- **PostgreSQL**
- **CockroachDB**
- **SQLite**

### Getting Started

1. **Fork the repository** on GitHub
2. **Clone your fork locally:**

```bash
git clone https://github.com/YOUR_USERNAME/miniflux.git
cd miniflux
```

3. **Build the application binary:**

```bash
make miniflux
```
Expand All @@ -59,15 +63,11 @@ When reporting bugs:

### Database Setup

For development and testing, you can run a local PostgreSQL database with Docker:
For development and testing, you can run PostgreSQL and CockroachDB via docker compose:

```bash
# Start PostgreSQL container
docker run --rm --name miniflux2-db -p 5432:5432 \
-e POSTGRES_DB=miniflux2 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
postgres
# Start PostgreSQL and CockroachDB containers
docker compose -d
```

You can also use an existing PostgreSQL instance. Make sure to set the `DATABASE_URL` environment variable accordingly.
Expand All @@ -77,20 +77,27 @@ You can also use an existing PostgreSQL instance. Make sure to set the `DATABASE
### Code Quality

1. **Run the linter:**

```bash
make lint
```

Requires `staticcheck` and `golangci-lint` to be installed.

2. **Run unit tests:**

```bash
make test
```

3. **Run integration tests:**
```bash
make integration-test
make clean-integration-test
make integration-test-postgresql
make clean-integration-test-postgresql
make integration-test-cockroachdb
make clean-integration-test-cockroachdb
make integration-test-sqlite
make clean-integration-test-sqlite
```

### Building
Expand All @@ -103,6 +110,7 @@ You can also use an existing PostgreSQL instance. Make sure to set the `DATABASE
### Cross-Platform Support

Miniflux supports multiple architectures. When making changes, ensure compatibility across:

- Linux (amd64, arm64, armv7, armv6, armv5)
- macOS (amd64, arm64)
- FreeBSD, OpenBSD, Windows (amd64)
Expand Down Expand Up @@ -155,11 +163,13 @@ When creating a pull request, please include:
## Testing

### Unit Tests

- Write unit tests for new functions and methods
- Ensure tests are fast and don't require external dependencies
- Aim for good test coverage

### Integration Tests

- Add integration tests for new API endpoints
- Tests run against a real PostgreSQL database
- Ensure tests clean up after themselves
Expand Down
71 changes: 61 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ DOCKER_IMAGE := miniflux/miniflux
VERSION := $(shell git describe --tags --exact-match 2>/dev/null)
LD_FLAGS := "-s -w -X 'miniflux.app/v2/internal/version.Version=$(VERSION)'"
PKG_LIST := $(shell go list ./... | grep -v /vendor/)
DB_URL := postgres://postgres:postgres@localhost/miniflux_test?sslmode=disable
DOCKER_PLATFORM := amd64

export PGPASSWORD := postgres
Expand All @@ -28,8 +27,12 @@ export PGPASSWORD := postgres
add-string \
test \
lint \
integration-test \
clean-integration-test \
integration-test-postgresql \
clean-integration-test-postgresql \
integration-test-cockroachdb \
clean-integration-test-cockroachdb \
integration-test-sqlite \
clean-integration-test-sqlite \
docker-image \
docker-image-distroless \
docker-images \
Expand Down Expand Up @@ -103,17 +106,18 @@ lint:
staticcheck ./...
golangci-lint run --disable errcheck --enable sqlclosecheck --enable misspell --enable gofmt --enable goimports --enable whitespace

integration-test:
psql -U postgres -c 'drop database if exists miniflux_test;'
psql -U postgres -c 'create database miniflux_test;'
integration-test-postgresql:
psql -U postgres -p 5432 -d postgres -c 'drop database if exists miniflux2;'
psql -U postgres -p 5432 -d postgres -c 'create database miniflux2;'

DATABASE_URL=$(DB_URL) \
go build -o miniflux-test main.go
DATABASE_URL='postgres://postgres:postgres@localhost:5432/miniflux2?sslmode=disable' \
ADMIN_USERNAME=admin \
ADMIN_PASSWORD=test123 \
CREATE_ADMIN=1 \
RUN_MIGRATIONS=1 \
LOG_LEVEL=debug \
go run main.go >/tmp/miniflux.log 2>&1 & echo "$$!" > "/tmp/miniflux.pid"
./miniflux-test >/tmp/miniflux.log 2>&1 & echo "$$!" > "/tmp/miniflux.pid"

while ! nc -z localhost 8080; do sleep 1; done

Expand All @@ -122,10 +126,57 @@ integration-test:
TEST_MINIFLUX_ADMIN_PASSWORD=test123 \
go test -v -count=1 ./internal/api

clean-integration-test:
clean-integration-test-postgresql:
@ kill -9 `cat /tmp/miniflux.pid`
@ rm -f /tmp/miniflux.pid /tmp/miniflux.log
@ psql -U postgres -c 'drop database if exists miniflux_test;'
@ psql -U postgres -d postgres -c 'drop database if exists miniflux2;'

integration-test-cockroachdb:
psql -U postgres -d postgres -p 26257 -c 'drop database if exists miniflux2;'
psql -U postgres -d postgres -p 26257 -c 'create database miniflux2;'

go build -o miniflux-test main.go
DATABASE_URL='cockroach://postgres:postgres@localhost:26257/miniflux2?sslmode=disable' \
ADMIN_USERNAME=admin \
ADMIN_PASSWORD=test123 \
CREATE_ADMIN=1 \
RUN_MIGRATIONS=1 \
LOG_LEVEL=debug \
./miniflux-test >/tmp/miniflux.log 2>&1 & echo "$$!" > "/tmp/miniflux.pid"

while ! nc -z localhost 8080; do sleep 1; done

TEST_MINIFLUX_BASE_URL=http://127.0.0.1:8080 \
TEST_MINIFLUX_ADMIN_USERNAME=admin \
TEST_MINIFLUX_ADMIN_PASSWORD=test123 \
go test -v -count=1 ./internal/api

clean-integration-test-cockroachdb:
@ kill -9 `cat /tmp/miniflux.pid`
@ rm -f /tmp/miniflux.pid /tmp/miniflux.log
@ psql -U postgres -d postgres -c 'drop database if exists miniflux2;'

integration-test-sqlite:
go build -o miniflux-test main.go
DATABASE_URL='file::memory:?cache=shared&_pragma=foreign_keys(ON)' \
ADMIN_USERNAME=admin \
ADMIN_PASSWORD=test123 \
CREATE_ADMIN=1 \
RUN_MIGRATIONS=1 \
DEBUG=1 \
./miniflux-test >/tmp/miniflux.log 2>&1 & echo "$$!" > "/tmp/miniflux.pid"

while ! nc -z localhost 8080; do sleep 1; done

TEST_MINIFLUX_BASE_URL=http://127.0.0.1:8080 \
TEST_MINIFLUX_ADMIN_USERNAME=admin \
TEST_MINIFLUX_ADMIN_PASSWORD=test123 \
go test -v -count=1 ./internal/api

clean-integration-test-sqlite:
@ kill -9 `cat /tmp/miniflux.pid`
@ rm -f /tmp/miniflux.pid /tmp/miniflux.log
@ rm miniflux-test

docker-image:
docker build --pull -t $(DOCKER_IMAGE):$(VERSION) -f packaging/docker/alpine/Dockerfile .
Expand Down
33 changes: 14 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
Miniflux 2
==========
# Miniflux 2

Miniflux is a minimalist and opinionated feed reader.
It's simple, fast, lightweight and super easy to install.

Official website: <https://miniflux.app>

Features
--------
## Features

### Feed Reader

Expand All @@ -19,7 +17,7 @@ Features
- Share individual articles publicly.
- Fetches website icons (favicons).
- Saves articles to third-party services.
- Provides full-text search (powered by Postgres).
- Provides full-text search.
- Available in 20 languages: Portuguese (Brazilian), Chinese (Simplified and Traditional), Dutch, English (US), Finnish, French, German, Greek, Hindi, Indonesian, Italian, Japanese, Polish, Romanian, Russian, Taiwanese POJ, Ukrainian, Spanish, and Turkish.

### Privacy and Security
Expand All @@ -34,7 +32,7 @@ Features
- Supports alternative YouTube video players such as [Invidious](https://invidio.us).
- Blocks external JavaScript to prevent tracking and enhance security.
- Sanitizes external content before rendering it.
- Enforces a [Content Security](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) and a [Trusted Types Policy](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API) to only application JavaScript and blocks inline scripts and styles.
- Enforces a [Content Security](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) and a [Trusted Types Policy](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API) to only application JavaScript and blocks inline scripts and styles.

### Bot Protection Bypass Mechanisms

Expand Down Expand Up @@ -63,12 +61,12 @@ Features
- Optional touch gesture support for navigation on mobile devices.
- Custom stylesheets and JavaScript to personalize the user interface to your preferences.
- Themes:
- Light (Sans-Serif)
- Light (Serif)
- Dark (Sans-Serif)
- Dark (Serif)
- System (Sans-Serif) – Automatically switches between Dark and Light themes based on system preferences.
- System (Serif)
- Light (Sans-Serif)
- Light (Serif)
- Dark (Sans-Serif)
- Dark (Serif)
- System (Sans-Serif) – Automatically switches between Dark and Light themes based on system preferences.
- System (Serif)

### Integrations

Expand All @@ -90,7 +88,7 @@ Features

- Written in [Go (Golang)](https://golang.org/).
- Single binary compiled statically without dependency.
- Works only with [PostgreSQL](https://www.postgresql.org/).
- Works with [PostgreSQL](https://www.postgresql.org/), [CockroachDB](https://www.cockroachlabs.com/) and [SQLite](https://sqlite.org/).
- Does not use any ORM or any complicated frameworks.
- Uses modern vanilla JavaScript only when necessary.
- All static files are bundled into the application binary using the Go `embed` package.
Expand All @@ -109,8 +107,7 @@ Features
- Only uses a couple of MB of memory and a negligible amount of CPU, even with several hundreds of feeds.
- Respects/sends Last-Modified, If-Modified-Since, If-None-Match, Cache-Control, Expires and ETags headers, and has a default polling interval of 1h.

Documentation
-------------
## Documentation

The Miniflux documentation is available here: <https://miniflux.app/docs/> ([Man page](https://miniflux.app/miniflux.1.html))

Expand All @@ -130,8 +127,7 @@ The Miniflux documentation is available here: <https://miniflux.app/docs/> ([Man
- [Internationalization](https://miniflux.app/docs/i18n.html)
- [Frequently Asked Questions](https://miniflux.app/faq.html)

Screenshots
-----------
## Screenshots

Default theme:

Expand All @@ -141,8 +137,7 @@ Dark theme when using keyboard navigation:

![Dark theme](https://miniflux.app/images/item-selection-black-theme.png)

Credits
-------
## Credits

- Authors: Frédéric Guillot - [List of contributors](https://github.com/miniflux/v2/graphs/contributors)
- Distributed under Apache 2.0 License
4 changes: 2 additions & 2 deletions contrib/sysvinit/etc/init.d/miniflux
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# Provides: miniflux
# Required-Start: $syslog $network
# Required-Stop: $syslog
# Should-Start: postgresql
# Should-Stop: postgresql
# Should-Start: postgresql cockroachdb
# Should-Stop: postgresql cockroachdb
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: A rss reader
Expand Down
37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
services:
postgresql:
image: postgres:17.6
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
POSTGRES_DB: miniflux2
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD", "pg_isready -d miniflux2 -U postgres"]
timeout: 30s
interval: 5s

cockroachdb:
image: cockroachdb/cockroach:v23.2.28
command: start-single-node --insecure
volumes:
- cockroach-data:/cockroach/cockroach-data
environment:
COCKROACH_DATABASE: miniflux2
COCKROACH_USER: postgres
ports:
- "26257:26257"
- "26258:8080"
healthcheck:
test: ["CMD", "cockroach", "sql", "--insecure", "--host=localhost:26257", "-e", "select 1"]
timeout: 30s
interval: 5s

volumes:
postgres-data:
driver: local
cockroach-data:
driver: local
Loading