22 Commits

Author SHA1 Message Date
Yumechi
5a36c8c42b chore: update go module path to github.com/gotify/server/v3 2026-08-16 17:01:00 +08:00
Yumechi
75bc19c111 fix: remove panic() and relay password hashing errors to UI 2026-08-06 12:32:23 +08:00
Osamaali313
883ca85a68 Fix unsynchronized map write in plugin Manager.RemoveUser
`Manager.RemoveUser` deletes from `m.instances` without holding `m.mutex`:

    delete(m.instances, pluginConf.ID)

Every other access to `m.instances` is synchronized — `Instance` reads it
under `m.mutex.RLock()`, and the writes in `InitializeForUserID` /
`initializeSingleUserPlugin` happen under `m.mutex.Lock()`. The adjacent
`inst.Disable()` call in this same loop is even wrapped in Lock/Unlock, so
only the map delete is left unguarded.

`RemoveUser` is registered as the `OnUserDeleted` callback (router.go), fired
when an admin deletes a user, while any authenticated request to the plugin
API (`GET /plugin`, `/plugin/:id/*`) concurrently reads `m.instances` via
`Instance`. A `RLock` reader is not protected against a writer that never
takes the mutex, so this races and triggers Go's runtime-fatal
"concurrent map read and map write", crashing the whole server (a fatal that
gin.Recovery cannot recover). Take the write lock around the delete, matching
every other access.
2026-07-18 23:34:59 +03:00
TowyTowy
074b822b4a fix(plugin): reject messenger messages without an internal application
Add a final safety net in redirectToChannel.SendMessage that refuses a
message when ApplicationID == 0, so it can never be stored as an orphaned
message (application_id = 0, not shown, not deletable). Requested in review.

Cover the previously untested error branches around internal-application
back-fill (create/update failures) so patch coverage no longer regresses.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-15 22:02:09 +02:00
TowyTowy
8c03d2692c fix: create internal application when plugin adds Messenger after init
When a plugin gains the Messenger capability after it was first
initialized for a user, its plugin conf already exists without an
associated internal application (ApplicationID == 0). Messages sent by
the plugin were then stored with application_id = 0, orphaning them:
they disappeared on reload and could not be deleted (#653).

Back-fill the internal application during initialization when a
Messenger plugin has none yet, mirroring the creation already done for
plugins that support Messenger from the start.

Fixes #653

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-12 22:36:16 +02:00
饺子w (Yumechi)
ad977d3d9c feat: EdDSA token for database leakage/index mitigation (#971)
* feat: EdDSA token for database leakage/index mitigation

* [skip ci]: remove token from api output

* fix: e2e tests

* fixup! fix: e2e tests

* doc: document tokens are now optional fields for app and aclient

* fixup(doc): swagger version again

* address review comments

* address review comments
2026-06-28 14:58:20 +00:00
Jannis Mattheis
925fce0bf9 fix: use zerolog 2026-05-20 17:16:35 +02:00
饺子w (Yumechi)
496c166981 chore: Migrate github.com/jinzhu/gorm to gorm.io/gorm (#863)
* chore: Migrate github.com/jinzhu/gorm to gorm.io/gorm

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* chore: drop singleton connection limit on sqlite3 backend

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* enhance: database logging

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* Revert "chore: drop singleton connection limit on sqlite3 backend"

This reverts commit b494a3bd1f.

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* typo

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* rename unique_index -> uniqueIndex

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* drop uniqueIndex on primary key

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* migrate fully to new gorm tag format

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* specify unique index name

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* remove pluginConf duplicate index

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* disable auto migrate FK

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

---------

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
2025-10-29 22:23:10 +00:00
饺子w (Yumechi)
bfcd1cb037 fix: skip dotfiles and directories in plugin loading (#811) (#812)
* fix: skip dotfiles and directories in plugin loading (#811)

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* fixup! fix: skip dotfiles and directories in plugin loading (#811)

---------

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
2025-07-09 19:05:40 +00:00
renovate[bot]
a0bad7bd5a chore(deps): update bump go dependencies (#751)
* chore(deps): update bump go dependencies

* Update golangci-lint

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* Update golangci config to reflect new format

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* remove deprecated ioutil package

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

---------

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: eternal-flame-AD <yume@yumechi.jp>
2025-01-17 05:51:08 +00:00
renovate[bot]
60bafd2b98 chore(deps): update module gopkg.in/yaml.v2 to v3 (#719)
* chore(deps): update module gopkg.in/yaml.v2 to v3

* fixup! chore(deps): update module gopkg.in/yaml.v2 to v3

---------

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: eternal-flame-AD <yume@yumechi.jp>
2024-11-07 17:34:22 -06:00
Jannis Mattheis
a2b2f856e0 test: don't run tests twice 2023-09-17 09:05:15 +02:00
chrispruitt
72bd8c8ba6 Add default message priority for applications
Co-authored-by: Jannis Mattheis <contact@jmattheis.de>
2023-07-19 18:15:01 +00:00
Jannis Mattheis
0250a48c2c Log loaded plugins
If a plugin was built for a different gotify version, then plugin.Open
may throw an unrecoverable error. This log statement should help
debugging which plugin is causing the error.

See #510
2022-09-11 17:29:31 +02:00
Jannis Mattheis
59b2ed17a6 Update linter 2022-05-29 19:45:45 +02:00
Jannis Mattheis
3454dcd602 Use golangci-lint 2020-11-01 10:47:02 +01:00
Richard Szolár
923030cf44 Update "github.com/go-yaml/yaml" import path to "gopkg.in/yaml.v2" as recommended per the project's documentation 2020-08-20 20:25:37 +02:00
Jannis Mattheis
7b90b8a8f5 Use v2 in package path 2020-05-08 10:43:17 +02:00
Noa Amran
44f4ff31cb Fix typos
Closes #197
2019-06-27 19:04:48 +02:00
饺子w
67493c643e Return 500 server error on database failures (#191) 2019-05-25 08:37:24 +02:00
饺子w
11165faa06 fixed plugin storage update during enable|disable (#188) 2019-05-05 19:33:56 +08:00
eternal-flame-AD
e5b24f4c92 Add plugin feature
Fixed database migration
Added a plugin system based on the go plugin package
2019-02-09 12:52:01 +01:00