feat(collaboration): support mobileView and mobileEdit WOPI actions - #3292
Open
LetsDrinkSomeTea wants to merge 2 commits into
Open
feat(collaboration): support mobileView and mobileEdit WOPI actions#3292LetsDrinkSomeTea wants to merge 2 commits into
LetsDrinkSomeTea wants to merge 2 commits into
Conversation
Parse the mobileView and mobileEdit actions from the WOPI discovery and serve them to mobile browsers, so mobile users get the mobile optimized editor instead of the desktop one. Falls back to the previous desktop URL whenever the document server does not announce the mobile action. Only affects OnlyOffice compatible document servers, Collabora serves one URL per extension and adapts its UI on its own. Can be turned off with COLLABORATION_WOPI_ENABLE_MOBILE. opencloud-eu#3167 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
LetsDrinkSomeTea
force-pushed
the
add-wopi-mobile-actions
branch
from
August 12, 2026 11:09
87acfdc to
e865ad3
Compare
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 13 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The collaboration service ignored the
mobileViewandmobileEditactions from the/hosting/discoveryendpoint of OnlyOffice compatible document servers (OnlyOffice,Euro-Office). Mobile users were therefore always served the desktop editor.
Collabora is not affected: it serves one URL per file type and adapts its UI to the browser
user agent on its own. OnlyOffice compatible servers instead provide separate action URLs and
leave the choice to the WOPI host.
Changes
parseWopiDiscovery()now also stores themobileViewandmobileEditactions. The rest ofthe processing (malformed query parameter cleanup, storage layout) is unchanged.
getAppUrl()takes acontext.Contextand, for non-Collabora apps, prefersmobileEditfor read/write andmobileViewfor read-only requests coming from a mobilebrowser. Mobile detection uses
ctxpkg.ContextGetUserAgent()from reva, no custom UA parsing.COLLABORATION_WOPI_ENABLE_MOBILE(default enabled, this fixes brokenbehaviour rather than adding something new). Documented as applying to OnlyOffice compatible
backends only.
Fallback behaviour
Falling back is mandatory, not best effort. A user must never get an empty URL or an error
where the desktop editor worked before:
mobileEdit) → previous desktop URL.mobileEditfalls back to the desktop edit URL, never tomobileView— otherwise a user with write permission would silently be downgraded to a viewer.log noise.
Known limitation
iPadOS Safari identifies itself as desktop macOS and is therefore not detected as mobile. Not
addressed here.
Testing
Unit tests (Ginkgo/Gomega, existing setup):
pkg/helpers/discovery_test.go— discovery fixture extended withmobileView/mobileEdit,covering parsing and retrieval via
GetAppURLFor.pkg/service/grpc/v0/service_test.go— matrix of mobile/tablet/desktop UA ×VIEW_MODE_READ_ONLYand
VIEW_MODE_READ_WRITE, plus the fallback cases (mobile action missing, no UA in context,feature disabled) and two Collabora cases pinning the unchanged behaviour.
Verified manually against a running OpenCloud with a stub OnlyOffice discovery endpoint
(
POST /app/open, only theUser-Agentheader varied):write…/word/mobileeditwrite…/word/editread…/word/mobileviewread…/word/viewwriteCOLLABORATION_WOPI_ENABLE_MOBILE=false…/word/editreadCOLLABORATION_WOPI_ENABLE_MOBILE=false…/word/viewmake ci-golangci-lintreports no new findings for the changed files.#3167