Commit Graph
3047 Commits
Author SHA1 Message Date
kolaenteandTink 33142cd8e6 fix(saved-filters): delete by id instead of every loaded field
CanDelete loads the whole filter into the struct. xorm turns every non-empty
field into a delete condition, so a filters JSON that does not re-serialize
byte for byte silently matches nothing while still returning success.
2026-09-16 17:23:51 +02:00
kolaente 3a50cc1e5a fix(feeds): set target on task assigned notifications in atom feed
Target is not persisted, so rendering the title of a stored
TaskAssignedNotification dereferenced a nil pointer and the feed
returned a 500.

Fixes #3914
2026-09-16 15:33:11 +02:00
Frederick [Bot] 5f35048279 chore(i18n): update translations via Crowdin 2026-09-16 00:10:12 +00:00
kolaente 5b08e0486a test(web): catch ErrorCode-prefixed constants in error code uniqueness check
The regex only matched ErrCode..., so the 1025 and 1026 collisions with ErrorCodeInvalidTimezone and ErrorCodeUsernameReserved went unnoticed.
2026-09-15 18:38:59 +02:00
kolaente d727c61f54 fix(user)!: give ErrCodeAccountLocked a unique error code
1026 was already taken by ErrorCodeUsernameReserved, which is older, so a
locked account was reported as a reserved username in clients.

BREAKING CHANGE: a locked account now returns 1040 instead of 1026.
2026-09-15 18:38:59 +02:00
kolaente 0336497d94 fix(user)!: give ErrCodeTOTPPasscodeUsed a unique error code
1025 was already taken by ErrorCodeInvalidTimezone, which is older, so
reusing a TOTP passcode (e.g. logging in right after enabling 2FA) showed
"The timezone '' is invalid." in the frontend.

Refs #3900

BREAKING CHANGE: a reused TOTP passcode now returns 1039 instead of 1025.
2026-09-15 18:38:59 +02:00
Anand HegdeandGitHub b3e9580e23 fix(caldav): parse Z-suffixed timestamps as UTC (#3883)
Credit to @jnsvgt for the root-cause analysis and suggested fix in
#3871. This PR implements that fix and adds regression tests.

`caldavTimeToTimestamp()` used the `Z` suffix only to pick the layout,
where it matches as a literal character. The value was then parsed in
the server timezone. With a non-UTC `service.timezone`, every UTC value
without a `TZID` was shifted by the server's offset. Absolute VALARM
triggers are always UTC, so reminders were stored hours early.

Fix: when the value ends in `Z`, parse it in UTC and ignore any `TZID`
(RFC 5545 doesn't allow combining the two). Floating values and `TZID`
values work as before. DTSTART, DUE, DTEND, DTSTAMP and COMPLETED all go
through the same helper, so they get the fix too.

Tests, with the server timezone set to Europe/Berlin:
- `TestCaldavTimeToTimestamp_NonUTCServerTimezone`: covers UTC,
floating, TZID, and UTC combined with TZID
- `TestParseTaskFromVTODO_UTCAlarmNonUTCServerTimezone`: the VTODO from
the issue; the reminder should match the due date

Before the fix, the UTC cases and the alarm test fail (`05:00 CEST`
instead of `05:00 UTC`). After the fix, they pass. `go test
./pkg/caldav`, `mage test:caldav` and `mage lint` also pass.

I wrote this with help from Claude Code, then reviewed and tested it
myself.

Note on #1068: that change made floating times (no `Z`, no `TZID`) use
the configured timezone, which this PR keeps. It also routed
`Z`-suffixed UTC times through the same path; this PR only restores UTC
parsing for those.

Fixes #3871
2026-09-15 16:25:31 +00:00
kolaenteandTink 80a9f31cb3 fix(migration): remove the partial blob of a failed import upload write
The files row is inserted before the blob is written, and the local backend creates the file before copying into it, so a failed copy left a partial blob behind once the row was rolled back.
2026-09-15 17:57:00 +02:00
kolaenteandTink c5685e6130 fix(migration): keep a queued import upload out of the storage quota
The vikunja-file import checks the user's stored files against
migration.vikunjafile.maxuserstorage. The upload is now one of those
files, so an import counted its own zip against the quota. Exclude files
referenced as a migration upload.
2026-09-15 17:57:00 +02:00
kolaenteandTink fa9fc4e06f feat(migration): keep queued import uploads in the file storage
The upload was spooled to the receiving instance's temp dir and only its
name travelled with the event. That holds while events stay in-process,
but it ties the job to the instance that accepted the upload.

Store it through the files package on the configured backend and record
its id on the migration status, so the event carries only the status id
and any instance can run the import. The job copies it to a local temp
file first: the zip importer needs random access, which an S3 object body
cannot give.

The upload is removed once the import is over. An hourly cron deletes
leftovers from events lost on restart or instances that died mid-import.
2026-09-15 17:57:00 +02:00
Frederick [Bot] 6696e2419a [skip ci] Updated swagger docs 2026-09-15 15:39:27 +00:00
kolaenteandTink 9c374843af refactor(migration): tidy the ticktick, wekan and csv read paths
Drop comments restating the code and inline single-use variables. No
behaviour change.
2026-09-15 16:59:37 +02:00
kolaenteandTink 3dc5c72904 refactor(migration): parse the csv import config once per request
The config was unmarshalled up front purely to produce a 400, then parsed
again by SetOptions, and a third time in the background job. Drop the
throwaway parse and give SetOptions a domain error that maps to 400 on
its own.
2026-09-15 16:59:37 +02:00
kolaenteandTink e06345e2d3 fix(migration): run file imports in the background
A file import ran inside the upload request. A big export takes minutes,
far longer than a reverse proxy holds a request open, so the client got a
502 while the import kept running and kept the user's migration slot, and
there was no way to cancel or retry it.

The upload request now only validates what is cheap to validate, claims
the slot, spools the upload into a per-process temp directory and queues a
FileMigrationRequestedEvent. FileMigrationListener runs the import through
the lifecycle it now shares with the OAuth migrations: stale event skip,
panic recovery, heartbeat, outcome and notifications. The vikunja-file
migrator rejects a non-zip or structurally broken export before queueing;
ticktick, wekan and csv would have to parse the whole upload, so they fail
in the job and report through the status and failure mail. The csv
migrator receives its column mapping as options carried with the event.
2026-09-15 16:59:37 +02:00
kolaenteandTink c7b37b0af8 refactor(migration): scan the vikunja-file archive once before importing
Split opening the zip and indexing its entries out of Migrate, so every
structural check that doesn't need entry contents runs in one place before
anything is imported. The missing VERSION check moves into that scan.
2026-09-15 16:59:37 +02:00
kolaenteandTink 84804e71f5 feat(migration): record whether a migration succeeded
A finished migration_status row looked the same whether the import worked
or failed, so the client could only guess. Rows now carry error_kind, a
closed set the client translates (reported, interrupted, credentials,
queue, upload, detail), and error_message, set only for "detail": the
error caused by the user's own data, the same text the failure mail sends.
A failure we report to Sentry stores just the kind, so server internals
never reach the status.
2026-09-15 16:59:37 +02:00
kolaenteandTink b5a235b0fd fix(migration): don't report a failed success mail as a failed migration
The migration was already finished and its claim released when the done
notification failed, yet the error was returned and the listener then sent
a failure mail and overwrote the finished row. Log it instead. The failure
mail's own log line also printed the migration error instead of the
notification error.
2026-09-15 16:59:37 +02:00
kolaenteandTink 7f9f3e091f fix(migration): log migration start and completion at info level
A background import that never finished left no trace in a default log
setup, since start and completion were only logged at debug.
2026-09-15 16:59:37 +02:00
kolaenteandTink 68ac9eaa99 fix(migration): judge an abandoned claim by a heartbeat, not by start time
The claim timeout was measured from started_at, so a long import either
kept a dead claim for a day (the old 24h default) or had its slot taken
over while still running. A running migration now refreshes heartbeat_at
at a tenth of the timeout, clamped to 1s..30s, and a claim only counts as
stale once its last beat is older than the timeout. Rows that never beat
fall back to started_at. The default timeout drops to 5m accordingly.

Also bind the stale cutoff in the configured timezone: xorm writes times in
the engine's zone but binds query args as-is, which broke the comparison on
SQLite.
2026-09-15 16:59:37 +02:00
kolaenteandTink 86289e36e3 fix(migration): answer 412 instead of 500 when a migration claim collides
A second import sent while the first claim was still being written could
fail the insert with whatever the driver reports under contention, which
surfaced as a 500. The claim now reads the running row before writing so a
losing request stays read-only, re-reads the live claim whenever the insert
fails, retries lock collisions a few times, and probes for a stale claim
before taking a write lock to release it.
2026-09-15 16:59:37 +02:00
kolaenteandTink 8bf29a1e98 fix(api/v2): bound the body read on upload routes instead of huma's 5s default
Huma's default BodyReadTimeout is a 5s socket read deadline spanning the
whole body, so any upload slower than that is cut off and a reverse proxy
answers 502. Every multipart route now goes through withUploadLimits, which
sets the existing max body size and a finite 15 minute read bound.
2026-09-15 16:59:37 +02:00
kolaenteandTink 308c057618 fix(restore): convert numeric bools when restoring into postgres
SQLite and MySQL dumps store bools as 0/1. Since switching to pgx, restoring
such a dump into PostgreSQL fails with "unable to encode 0 into binary format
for bool".
2026-09-15 14:25:44 +02:00
kolaenteandTink d1ca12f3e0 fix(restore): restore empty json column values as NULL
SQLite dumps can contain empty strings in json columns (e.g. project_views.filter),
which PostgreSQL rejects with "invalid input syntax for type json".

Fixes #3895
2026-09-15 14:25:43 +02:00
kolaente 5cb2838024 feat: add /.well-known/change-password redirect
Implements https://www.w3.org/TR/change-password-url/ so password managers can link users to the password settings page.
2026-09-15 14:12:54 +02:00
Frederick [Bot] 3f924eb78b [skip ci] Updated yaegi symbols 2026-09-15 10:50:55 +00:00
kolaenteandTink d390a7c374 feat(mcp): expose connection settings and token presets
(cherry picked from commit a796db73475469bba18e3c20c8d7d1b818abcc5a)
(cherry picked from commit 0e47ccb001b8bf385f2688126bef8f4918917b45)
2026-09-15 11:41:34 +02:00
kolaenteandTink 84e5d2cd62 feat(routes): serve the MCP endpoint at /api/v2/mcp
Registered after apiv2.RegisterAll so the tool index sees the AutoPatch
operations. Routes under the prefix skip the token route check: the
endpoint checks mcp:access itself and every loopback call is checked on
its own route.
2026-09-15 11:41:34 +02:00
kolaenteandTink bba48e40bc feat(mcp): add the module and streamable-http transport
mcp.New builds the tool index from the v2 document and serves a stateless
per-request server: JWTs are rejected, mcp:access is required, tools/list is
filtered by the caller's token, and cross-origin browser requests are
refused unless the CORS configuration trusts the origin.
2026-09-15 11:41:34 +02:00
kolaenteandTink 4ccf95bf83 feat(mcp): add catalog discovery and execution meta-tools
find_action lists the catalog actions the token authorizes, with a
description generated per request; do_action invokes one.
2026-09-15 11:41:34 +02:00
kolaenteandTink 9d57de26d0 feat(mcp): dispatch tool calls through the v2 handlers
Each call is replayed as an internal HTTP request with the caller's API
token, so route scopes, expand scopes and the audit trail are the real ones.
2026-09-15 11:41:34 +02:00
kolaenteandTink e115c375f2 feat(mcp): derive tool specs from the v2 OpenAPI document
Tools are built from the finished document: path and query parameters plus
the JSON body become one input schema, update tools take their schema from
the sibling PUT because AutoPatch strips $ref, and an explicit allow-list
decides which operations are typed tools, catalog actions, or hidden.
2026-09-15 11:41:34 +02:00
kolaenteandTink 902c8018a0 feat(api-v2): export the rich-text format header
The MCP update tools send it to get Markdown through AutoPatch.
2026-09-15 11:41:34 +02:00
kolaenteandTink 92f7edf0a0 refactor(humabridge): export the echo-context accessor
Five packages carried their own copy of the EchoContextKey lookup.
2026-09-15 11:41:34 +02:00
kolaenteandTink 88ac0edb82 refactor(api-tokens): share the bearer selection and usage audit
The MCP loopback needs the same rules the token middleware applies, so both
now call models.APITokenAuthorization and models.RecordAPITokenUse.
2026-09-15 11:41:34 +02:00
kolaenteandTink 0bb5a01845 feat(api-tokens): add the mcp:access scope and permission helpers 2026-09-15 11:41:34 +02:00
kolaenteandTink d9e581d62b refactor(api-v2): rename the projecttask path parameter to task
The v1 name leaked into the v2 OpenAPI document and everything derived from
it. Every other /tasks/... route already uses {task}. The expand-scope check
is keyed by echo path template, so its entry moves too, and a webtest now
fails if any of its keys stops naming a registered route.
2026-09-15 11:41:34 +02:00
Frederick [Bot] d3266c304d chore(i18n): update translations via Crowdin 2026-09-15 00:10:40 +00:00
kolaente 9b99897843 fix(caldav): report home sets as non-calendars through caldav-go
Replaces the response body rewrite with the adapter opt-out added in
go-vikunja/caldav-go#5, and moves the replace directive to the
go-vikunja/caldav-go fork.
2026-09-14 18:11:30 +02:00
kolaente 2822de95ef fix(caldav): stop reporting home sets as calendars
caldav-go renders every collection's resourcetype as collection+calendar.
/dav, /dav/projects and the principal's home-set response only contain
calendars, so Apple Calendar tried to sync them directly and failed with
"the calendar could not be found".

Fixes #3884
2026-09-14 18:11:30 +02:00
kolaente 98ca0175a2 refactor(notifications): rename local that shadowed the mail package 2026-09-14 17:50:28 +02:00
kolaente 1e37dfb7ca fix(reminders): skip inactive assignees when collecting task users 2026-09-14 17:50:28 +02:00
kolaente 5888756cd8 test(reminders): exercise the subscriber pass in the IsAssignee test 2026-09-14 17:50:28 +02:00
kolaente 99f0dbe1c3 feat(reminders): split overdue mail into assigned and followed sections
Users subscribed to busy projects got every overdue task in one flat list.
Tasks the user is assigned to now appear under "Assigned to you", tasks
they merely created or follow under "Tasks you follow". A task appears
once; assignee wins over follower.

Resolves https://github.com/go-vikunja/vikunja/issues/3612
2026-09-14 17:50:28 +02:00
kolaente 1504b8c6e2 feat(i18n): add section headings for the overdue tasks mail 2026-09-14 17:50:28 +02:00
kolaente f846d87e66 feat(reminders): track whether a task user is an assignee 2026-09-14 17:50:28 +02:00
kolaente a10b98f8e4 fix(migration): leave subscriptions unique index to its dedupe migration
Upgrades from before v2.5.0 ran 20260720120000 before 20260829190000, so the
index recovery tried to create the unique subscriptions index from the current
model while duplicate rows still existed and aborted the upgrade.

Fixes #3882
2026-09-14 17:13:30 +02:00
Frederick [Bot] 11e414f07d [skip ci] Updated yaegi symbols 2026-09-12 16:42:56 +00:00
Frederick [Bot] 86be326816 [skip ci] Updated swagger docs 2026-09-12 16:42:56 +00:00
kolaente 27ccdba7a0 feat(invites): add admin-managed user invite links 2026-09-12 18:21:35 +02:00
kolaente 3d9d643df9 feat(license): add user_invites feature 2026-09-12 18:21:35 +02:00