Граф коммитов

386 Коммитов

Автор SHA1 Сообщение Дата
Julius Härtl ba427a632a
fix: Avoid throwing when a workspace file cannot be found due to a failed storage
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-04-11 12:38:29 +01:00
Max d0f59529ce
fix(lint): avoid risky truthy falsy comparison
Signed-off-by: Max <max@nextcloud.com>
2024-04-04 10:04:16 +02:00
Julius Härtl d2235d2a52
fix: Always return initial content when needed
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-03-31 08:58:03 +02:00
Julius Härtl df9984db82
fix: Catch exceptions on non existing files
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-03-26 15:50:01 +01:00
Christopher Ng 6814477eae feat: Add icon svg inline for New text file
Signed-off-by: Christopher Ng <chrng8@gmail.com>
2024-03-21 20:23:06 +01:00
Jonas ec4dc1687f
fix(response): Make sure JSONResponse returns valid data
Wrap error messages into an array when responding with `JSONResponse`.

Signed-off-by: Jonas <jonas@freesources.org>
2024-03-20 16:39:33 +01:00
Jonas f61fb6f69d
fix(Middleware): Response with 412 if `baseVersionEtag` doesn't match
Signed-off-by: Jonas <jonas@freesources.org>
2024-03-20 15:27:29 +01:00
Jonas 670d2f8cad
fix(sync): If `baseVersionEtag` changed, reset frontend
`baseVersionEtag` changes when a new document session got initialized,
e.g. after an old document session without session clients got cleaned
up, or because the markdown file got changed via webdav.

Detect this in the client and ask the user to reload the page for
resetting the session.

Signed-off-by: Jonas <jonas@freesources.org>
2024-03-20 15:27:28 +01:00
Julius Härtl a63daee740
fix: Set base version etag to a unique id per document creation
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-03-20 10:17:22 +01:00
Julius Härtl e268115e6c
fix: Clean up logic to return document state file or file content
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-03-20 10:17:22 +01:00
Julius Härtl e41c3f39f1
fix: catch expected exception in event handler
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-03-15 16:04:44 +01:00
Jonas eded54c951
fix(backend): Remove yjs file and all steps when resetting document session
Instead of just deleting the newest steps, always remove all session
data: document, sessions and steps from the database as well as the yjs
(document state) file.

Without the `--force` option, don't reset document sessions with unsaved
steps.

Signed-off-by: Jonas <jonas@freesources.org>
2024-03-14 08:14:41 +01:00
Jonas 57ed9997c7
fix(backend): Reset document session when updated from outside editor
When a text file is updated via other means than from the editor (e.g.
when uploaded/synced via webdav) and there is no unsaved steps in the
document session, reset the document session  This will prevent conflict
resolution dialogs in this case. Client frontends will have to reload
the document afterwards though.

Signed-off-by: Jonas <jonas@freesources.org>
2024-03-14 08:14:40 +01:00
Jonas 02c1e083c8
fix(backend): Reset document session and yjs file when file is deleted
Signed-off-by: Jonas <jonas@freesources.org>
2024-03-13 21:19:12 +01:00
Julius Härtl 9412ae1f2a
fix: Avoid race condition that may initialize a document twice on the clients
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-03-13 09:25:40 +01:00
Jonas a43d77c36b
fix(backend): Accept pushs with only step1 messages by read-only clients
This fixes read-only clients getting 403 responses on push requests that
only contain questions for updates.

Fixes: #5223
Fixes: #5366
Fixes: #5368

Signed-off-by: Jonas <jonas@freesources.org>
2024-03-12 22:43:59 +01:00
Luka Trovic 9d7db568df feat: handle assistant sync task
Signed-off-by: Luka Trovic <luka@nextcloud.com>
2024-02-26 21:06:04 +01:00
Julius Härtl f580f02989
fix: apply config flag for accessible features
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-02-21 11:30:48 +01:00
Julius Härtl 23bccbde40
style: Apply php-cs-fixer updates
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-02-14 08:01:32 +01:00
Julius Härtl a3536488eb
Merge pull request #5300 from nextcloud/automated/noid/main-update-nextcloud-ocp
[main] Update nextcloud/ocp dependency
2024-01-25 21:36:46 +01:00
Julius Härtl 22985c0f52
Merge pull request #5197 from nextcloud/bugfix/open-translate-on-mobile
fix: translate popup does not open in mobile apps
2024-01-25 14:32:27 +01:00
Julius Härtl 069787a65b chore: Move away from deprecated app config api
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-01-25 09:18:47 +01:00
Max fa145e85ad
fix(sync): keep yjs file during sync session cleanup
Even if all sessions have expired and been removed
there may still be disconnected clients
that hold state from the last editing session.

When they reconnect they will send their yjs updates
based on the old state they had.
Preserve the yjs state accross editing sessions
so updates send after a reconnect can still be processed.

Signed-off-by: Max <max@nextcloud.com>
2024-01-18 07:52:18 +01:00
Julius Härtl 7f98ab4298
Merge pull request #5271 from nextcloud/bugfix/noid/load-error-message
fix: Proper error message based on file permissions
2024-01-17 10:45:22 +01:00
Luka Trovic d12a5becb4 fix: translate popup does not open in mobile apps
Signed-off-by: Luka Trovic <luka@nextcloud.com>
2024-01-16 08:56:46 +01:00
Max 877df108cd
fix(psalm): getPassword may return null
Signed-off-by: Max <max@nextcloud.com>
2024-01-15 21:10:30 +01:00
Julius Härtl 594a16440d
fix: Proper error message based on file permissions
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-01-03 23:58:43 +01:00
Jonas c7e0cf07ca
fix(SessionMiddleware): Check if user/share have access to document
Signed-off-by: Jonas <jonas@freesources.org>
2023-11-29 11:48:14 +01:00
Jonas a1f8308f42
fix(attachments): use `getRelativePath` from userFolder for `davPath`
Also don't set any davPath at all in public share. We probably don't
have DAV access there anyway.

Signed-off-by: Jonas <jonas@freesources.org>
2023-11-29 11:48:13 +01:00
Jonas b01c547340
chore(middleware): Rename to RequireDocumentSessionOrUserOrShareToken
Signed-off-by: Jonas <jonas@freesources.org>
2023-11-29 11:48:13 +01:00
Jonas 7743591e24
fix(attachments): Fix encoding of attachment URI component
Signed-off-by: Jonas <jonas@freesources.org>
2023-11-29 11:48:13 +01:00
Jonas 98ba0def7e
fix(AttachmentController): Set fileName of returned attachments
Signed-off-by: Jonas <jonas@freesources.org>
2023-11-29 11:48:13 +01:00
Jonas e4108d4322
fix(attachments): Open non-image attachments in viewer or download
When viewer is available, not in use and supports the mimetype, and
we're not in a public share, open the attachment in viewer. Otherwise,
download the attachment.

Fixes: #3849
Fixes: #4723
Fixes: #5030

Signed-off-by: Jonas <jonas@freesources.org>
2023-11-29 11:48:13 +01:00
Jonas bd54a689a9
feat(attachments): Allow to get attachments without document session
For all read-only attachments API endpoints, add support to authorize
with user session or share token when no document session is available.

Allows to get the attachments list and attachment files from
MarkdownContentEditor.vue without a document session.

Signed-off-by: Jonas <jonas@freesources.org>
2023-11-29 11:48:13 +01:00
Jonas 73cb49b617
chore(attachments): Remove obsolete metadata API endpoint
Signed-off-by: Jonas <jonas@freesources.org>
2023-11-29 10:42:03 +01:00
Jonas 8c1c6e8b36
feat(attachments): API endpoint to get list of attachments for a document
Signed-off-by: Jonas <jonas@freesources.org>
2023-11-29 10:42:03 +01:00
Jonas df3e4dff7e
chore(attachments): Remove support for obsolete `text://` format
This format was only used from 03.01.2022 to 23.05.2022.

Signed-off-by: Jonas <jonas@freesources.org>
2023-11-29 10:42:03 +01:00
Jonas 271a59a192
refactor(AttachmentService): Some code style cleanup
Signed-off-by: Jonas <jonas@freesources.org>
2023-11-29 10:42:02 +01:00
Joas Schilling 1d93eb4be7
Fix typo in author comment
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-11-28 05:53:55 +01:00
Julius Härtl 5173c0121c
fix: Get file from share link instead of user directory in case of no access
If a user opens a public share link but does not have access to the file
in question on their filesystem, text failed to render the public share
link as we always tried to get the file directly.

Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-11-20 12:31:03 +01:00
Julius Härtl 53f8fbf791
fix: Add migration to drop conflicting index ts_session
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-11-14 20:12:15 +01:00
Jonas 308d64069f fix(Step): Use largest possible 32-bit int value for transition
The value used before (largest possible MySQL BIGINT value) was too big
for PHP int. Since we still support 32-bit platforms on Nextcloud, let's
stick to the largest possible 32-bit PHP integer value.

Besides, setting the value as default for `Step::version` doesn't work
as `QBMapper->insert()` doesn't recognize the `version` field as changed
in that case. So let's default to `0` again and set it using
`Step->setVersion()` later.

Signed-off-by: Jonas <jonas@freesources.org>
2023-11-02 22:46:43 +01:00
Max ea208ee0d6 fix(sync): prevent race condition by relying on autoincrement
Prevent a possible race condition when two clients add steps at the same time.

See #4600.

Rely on the autoincrementing id in order to provide a canonical order
that steps can be retrieved in.

When two clients push steps at the same time
the entries receive destinct ids that increment.
So if another client fetches steps in between
it will see the smaller id as the version of the fetched step
and fetch the other step later on.

Transition:
In the future we can drop the version column entirely
but currently there are still steps stored in the database
that make use of the old column.
So we need to transition away from that.

In order to find entries that are newer than version x
we select those that have both a version and an id larger than x.

Entries of the new format are newer than any entry of the old format.
So we set their version to the largest possible value.
This way they will always fulfill the version condition
and the condition on the id is more strict and therefore effective.

For the old format the version will be smaller than the id
as it's incremented per document while the id is unique accross documents.
Therefore the version condition is the more strict one and effective.

The only scenario where the version might be larger than the id
would be if there's very few documents in the database
and they have had a lot of steps stored in single database entries.

Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Jonas <jonas@freesources.org>
2023-11-02 22:46:43 +01:00
Jonas 8b32b1d7a6
chore(DocumentService): Several code style fixes
Signed-off-by: Jonas <jonas@freesources.org>
2023-10-31 12:58:44 +01:00
Julius Härtl 2341059142 chore: Basic backend y.js message decoder
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-09-13 12:59:01 +02:00
John Molakvoæ bbd5d6d797
fix: move to addInitScript
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
2023-09-08 11:15:50 +02:00
Julius Härtl 130a4ec5fe
feat: Text processing assistant integration
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-08-09 14:06:49 +02:00
Julius Härtl 526302d056
feat: Expose text processing API in text
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-08-09 14:06:49 +02:00
Arthur Schiwon a6afd1d710
fix(backend): conflicts were not detected on sync anymore
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-31 23:21:44 +02:00
Arthur Schiwon 2c52b83047
refactor(api): split sync into sync and save endpoints
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-31 18:04:17 +02:00