Files
ocis/services/web
David WalterandClaude Sonnet 5 4712c7c619 feat(web): add mermaid-editor app for standalone .mmd diagrams (#12676)
* feat(web): add mermaid-editor app for standalone .mmd diagrams

md-editor-v3's mermaid support only fires inside a Markdown fenced
code block, so there was no way to edit a Mermaid diagram on its own.
This adds a dedicated split-pane editor/preview app (mirroring
web-app-html-editor's shape) for the mmd/mermaid extensions, feeding
raw diagram source straight into mermaid.render() - no Markdown
wrapping involved. Invalid syntax surfaces an inline error instead of
crashing the preview pane, and the rendered SVG is sanitized with
DOMPurify the same way the embedded markdown-mermaid renderer already
does.

🤖 Generated with Claude Code
Signed-off-by: David Walter <david.walter@kiteworks.com>

* test(web): add e2e coverage and WCAG 2.2 checks for mermaid-editor

Wires the new 'mmdFile' resource type into the create/edit e2e
resource helpers (mirroring txtFile/mdFile) and adds a spec covering
diagram rendering, invalid-syntax error surfacing, and the view-mode
toggle. The new mermaidEditor.ts page-object asserts the existing
WCAG 2.1 a11y baseline every other e2e spec uses, plus an additional
WCAG 2.2 tag scan (target-size, focus-appearance, etc.) scoped to
this file only - the shared a11y helper used by every other spec
stays on its current WCAG 2.1 tag set, since widening it repo-wide is
a separate decision with its own pre-existing-violation triage cost.

🤖 Generated with Claude Code
Signed-off-by: David Walter <david.walter@kiteworks.com>

* fix(web): register mermaid-editor in the default enabled apps list

CI's e2e run for the new mermaid-editor app timed out waiting for the
"New > Mermaid diagram" menu entry: config.json.dist (a reference/dev
file) had "mermaid-editor" added, but the actual runtime default config
a packaged oCIS binary serves comes from services/web's Go defaults,
which didn't. Also runs Prettier over the 3 files check:format flagged.

🤖 Generated with Claude Code
Signed-off-by: David Walter <david.walter@kiteworks.com>

* fix(web): correct vue3-gettext version, add changelog entry

vue3-gettext was pinned to an exact "2.4.0" in web-app-mermaid-editor's
package.json (a copy-paste slip) instead of "^4.0.1" like every other
web app package, pulling in a stray v2 dependency tree with its own
deprecated transitives (glob@7.2.3, inflight@1.0.6). Also adds the
changelog/unreleased entry this PR was missing.

🤖 Generated with Claude Code
Signed-off-by: David Walter <david.walter@kiteworks.com>

* fix(web): resolve stale mermaid lockfile entry from merge conflict

web/pnpm-lock.yaml pinned mermaid to 11.16.0 for the new
web-app-mermaid-editor importer, left over from a badly-resolved merge
with master (which resolves mermaid to 11.16.1 in every other
importer and in the packages snapshot). pnpm install --frozen-lockfile
failed in CI with ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY since 11.16.0
had no corresponding packages entry.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: dj4oC <david.walter@kiteworks.com>

* test(web): register mermaid-editor in the e2e CI oCIS config

tests/config/ci/ocis-config.json is the WEB_UI_CONFIG_FILE the e2e
docker-compose stack (tests/acceptance/docker/src/ocis-base.yml) feeds
the oCIS instance under test. It keeps its own "apps" allowlist,
separate from services/web's Go defaults (already fixed) and
config.json.dist (also already fixed) - and it never got
"mermaid-editor" added. Without it, the running instance never
registers the app, so the "New > Mermaid diagram" menu entry the
mermaidEditor.spec.ts e2e test waits for never renders, and the click
times out after all retries.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: dj4oC <david.walter@kiteworks.com>

* fix(web): give the mermaid-editor CodeMirror pane an accessible name

The plain-text CodeMirror content div renders with role="textbox"
aria-multiline="true" but no aria-label/aria-labelledby/title, which
axe-core (and screen readers) flag as a serious WCAG violation - this
is exactly what the e2e a11y scan caught on the new mermaidEditor
spec. Fixed via EditorView.contentAttributes, the same mechanism
CodeMirror exposes for this. MermaidEditorPane.spec.ts is updated to
install defaultPlugins() like its sibling specs already do, since the
component now calls useGettext() for the label text.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: dj4oC <david.walter@kiteworks.com>

---------

Signed-off-by: David Walter <david.walter@kiteworks.com>
Signed-off-by: dj4oC <david.walter@kiteworks.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-17 22:00:47 +02:00
..

Web

The web service embeds and serves the static files for the Infinite Scale Web Client, whose source lives in-tree under web/. Note that clients will respond with a connection error if the web service is not available.

The web service also provides a minimal API for branding functionality like changing the logo shown.

Custom Compiled Web Assets

If you want to use your custom compiled web client assets instead of the embedded ones, then you can do that by setting the WEB_ASSET_PATH variable to point to your compiled files. See ownCloud Web / Getting Started and ownCloud Web / Setup with oCIS for more details.

Web UI Configuration

  • Single configuration settings of the embedded web UI can be defined via WEB_OPTION_xxx environment variables.
  • A json based configuration file can be used via the WEB_UI_CONFIG_FILE environment variable.
  • If a json based configuration file is used, these configurations take precedence over single options set.

Web UI Options

Besides theming, the behavior of the web UI can be configured via options. See the environment variables WEB_OPTION_xxx for more details.

Web UI Config File

When defined via the WEB_UI_CONFIG_FILE environment variable, the configuration of the web UI can be made with a json based file.

Embedding Web

Web can be consumed by another application in a stripped down version called “Embed mode”. This mode is supposed to be used in the context of selecting or sharing resources.

For more details see the developer documentation ownCloud Web / Embed Mode. See the environment variables: WEB_OPTION_MODE and WEB_OPTION_EMBED_TARGET to configure the embedded mode.

Web Apps

The administrator of the environment is capable of providing custom web applications to the users. This feature is useful for organizations that want to provide third party or custom apps to their users.

It's important to note that the feature at the moment is only capable of providing static (js, mjs, e.g.) web applications and does not support injection of dynamic web applications (custom dynamic backends).

Loading Themes

Web themes are loaded, if added in the Infinite Scale source code, at build-time from <ocis_repo>/services/web/assets/themes. This cannot be manipulated at runtime.

Additionally, the administrator can provide custom themes by storing it in the path defined by the environment variable WEB_ASSET_THEMES_PATH.

With the theme root directory defined, the system needs to know which theme to use. This can be done by setting the WEB_UI_THEME_PATH environment variable.

The final theme is composed of the built-in and the custom theme provided by the administrator via WEB_ASSET_THEMES_PATH and WEB_UI_THEME_PATH.

For example, Infinite Scale by default contains a built-in ownCloud theme. If the administrator provides a custom theme via the WEB_ASSET_THEMES_PATH directory like, WEB_ASSET_THEMES_PATH/owncloud/themes.json, this one will be used instead of the built-in one.

Some theme keys are mandatory, like the common.shareRoles settings. Such mandatory keys are injected automatically at runtime if not provided.

Loading Applications

Web applications are loaded, if added in the Infinite Scale source code, at build-time from <ocis_repo>/services/web/assets/apps. This cannot be manipulated at runtime.

Additionally, the administrator can provide custom applications by storing them in the path defined by the environment variable WEB_ASSET_APPS_PATH.

This environment variable defaults to the Infinite Scale base data directory $OCIS_BASE_DATA_PATH/web/assets/apps, but can be redefined with any path set manually.

The final list of available applications is composed of the built-in and the custom applications provided by the administrator via WEB_ASSET_APPS_PATH.

For example, if Infinite Scale contains a built-in extension named image-viewer-dfx and the administrator provides a custom application named image-viewer-obj via the WEB_ASSET_APPS_PATH directory, the user will be able to access both applications from the WebUI.

Application Structure

  • Applications always have to follow a strict structure.
    Everything else is skipped and not considered as an application.

    • Each application must be in its own directory accessed via WEB_ASSET_APPS_PATH.
    • Each application directory must contain a manifest.json file.
    • Each application directory can contain a config.json file.
  • The manifest.json file contains the following fields:

    • entrypoint - required
      The entrypoint of the application like index.js, the path is relative to the parent directory.
    • config - optional
      A list of key-value pairs that are passed to the global web application configuration apps.yaml.

Application Configuration

If a custom configuration is needed, the administrator must provide the required configuration inside the $OCIS_BASE_DATA_PATH/config/apps.yaml file.

NOTE: An application manifest should never be changed manually, see Using Custom Assets for customisation.

The apps.yaml file must contain a list of key-value pairs which gets merged with the config field. For example, if the image-viewer-obj application contains the following configuration:

{
  "entrypoint": "index.js",
  "config": {
    "maxWidth": 1280,
    "maxHeight": 1280
  }
}

The apps.yaml file contains the following configuration:

image-viewer-obj:
  config:
    maxHeight: 640
    maxSize: 512

optional each application can have its own configuration file, which will be loaded by the WEB service.

{
  "config": {
    "maxWidth": 320
  }
}

The Merge order is as follows: local.config overwrites > global.config overwrites > manifest.config. The result will be:

{
  "external_apps": [
    {
      "id": "image-viewer-obj",
      "path": "index.js",
      "config": {
        "maxWidth": 320,
        "maxHeight": 640,
        "maxSize": 512
      }
    }
  ]
}

Besides the configuration from the manifest.json file, the apps.yaml or the config.json file can also contain the following fields:

  • disabled - optional
    Defaults to false. If set to true, the application will not be loaded.

Using Custom Assets

Besides the configuration and application registration, in the process of loading the application assets, the system uses a mechanism to load custom assets.

This is useful for cases where just a single asset should be overwritten, like a logo or similar.

Consider the following: Infinite Scale is shipped with a default web app named image-viewer-dfx which contains a logo, but the administrator wants to provide a custom logo for that application.

This can be achieved using the path defined via WEB_ASSET_APPS_PATH and adding a custom structure like WEB_ASSET_APPS_PATH/image-viewer-dfx/. Here you can add all custom assets to load like logo.png. On loading the web app, custom assets defined overwrite default ones.

This also applies for the manifest.json file, if the administrator wants to provide a custom one.

Miscellaneous

Please note that Infinite Scale, in particular the web service, needs a restart to load new applications or changes to the apps.yaml file.