nextcloud / nextcloud/android-library

Dashboard Widget API in broken state between V1 and V2, and missing endpoints

Open
#2,082 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. needs triage bug
Dominant language
Kotlin
Stars
105
Forks
99
Avg merge
2d 22h
Merged PRs (30d)
21

Description

How to use GitHub
  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

On Android:

  1. Have some 'Favorite Files' or 'Upcoming Tasks'
  2. Create a Widget and choose 'Favorite Files' or 'Upcoming Tasks'
Expected behaviour

Favorite Files or tasks should appear

Actual behaviour

No Favorite Files or tasks appear. Tried on Samsung S25, Pixel7 and Note 9.

But I did some investigating.

In the web browser, when you visit https://mynextclouddomain/apps/dashboard/
It will:

  1. Make a fetch to /ocs/v2.php/apps/dashboard/api/v1/widgets
  2. Depending on the Dashboard layout, it may make several fetches to:
    a. /ocs/v2.php/apps/dashboard/api/v2/widget-items?widgets[]=files-favorites or other widget types.
    b. /remote.php/dav/calendars/username/task-list-name/ for upcoming-tasks, for each list or other widget types.
    c. other endpoints, depends on widget types

For getting the possible list of widgets it uses .../dashboard/api/v1/widgets, and then for getting widget content it will use many endpoints such as:

  • .../dashboard/api/v2/widget-items?widgets%5B%5D=files-favorites
  • .../dashboard/api/v2/widget-items?widgets%5B%5D=calendar
  • .../calendars/username/personal/
  • .../calendars/username/movies/
  • .../calendars/username/holidays/
  • etc.

On Android, in this android-library, the app uses ../dashboard/api/v1 for both. This is seen in the following files, at the bottom of the files th const LIST_ENDPOINT:

  • nextcloud-android-library/library/src/main/java/com/nextcloud/android/lib/resources/dashboard/DashboardListWidgetsRemoteOperation.kt
  • nextcloud-android-library/library/src/main/java/com/nextcloud/android/lib/resources/dashboard/DashboardGetWidgetItemsRemoteOperation.kt.

The second file DashboardGetWidgetItemsRemoteOperation.kt uses api/v1, when the web browser uses multiple different endpoints including .../dashboard/api/v2/... or .../calendars/username/... or another.

I wrote a script you can test in the browser console to see the disparity between v1/widget-items and v2/widget-items:

async function testWidgetItems(v) {
   const resWidgets = await (await fetch(`/ocs/v2.php/apps/dashboard/api/v1/widgets?format=json`)).json()
   const widgetTypes = Object.keys(resWidgets.ocs.data)
   console.warn(v, widgetTypes)
   
   const widgetItems = await (await fetch(`/ocs/v2.php/apps/dashboard/api/${v}/widget-items?format=json&widgets[]=${widgetTypes.join('&widgets[]=')}`)).json()
   console.warn(v, widgetItems.ocs.data)
}
testWidgetItems('v1')
testWidgetItems('v2')

Console output:

v1
{calendar: Array(2), deck: Array(0), notes: Array(7), recommendations: Array(7), user_status: Array(0)}
  calendar: (2) [{…}, {…}]
  deck: []
  notes: (7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}]
  recommendations: (7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}]
  user_status: []
  [[Prototype]]: Object
v2
{files-favorites: {…}, calendar: {…}, collectives-recent-pages: {…}, user_status: {…}} i
  calendar: {items: Array(2), emptyContentMessage: '', halfEmptyContentMessage: 'No more events today'}
  collectives-recent-pages: {items: Array(2), emptyContentMessage: 'Add a collective', halfEmptyContentMessage: ''}
  files-favorites: {items: Array(2), emptyContentMessage: '', halfEmptyContentMessage: ''}
  user_status: {items: Array(0), emptyContentMessage: 'No recent status changes', halfEmptyContentMessage: ''}
  [[Prototype]]: Object

Note: Each version returns some of the widget's data, but neither returns values from the /calendar endpoints that are needed to populate my upcoming tasks.

Since DashboardGetWidgetItemsRemoteOperation.kt will only look at one endpoint from LIST_ENDPOINT it cannot work to get data for all widget types. Some redesign is needed.

Server configuration

Nextcloud-AIO Docker

Web server: Apache

Database: PostgreSQL

PHP version: 8.3.31

Nextcloud version: Nextcloud Hub 26 Winter (33.0.6)

List of activated apps

Enabled:

  • admin_audit: 1.23.0
  • assistant: 3.4.3
  • bruteforcesettings: 6.0.0
  • calendar: 6.5.1
  • checksum: 2.1.2
  • circles: 33.0.0
  • cloud_federation_api: 1.17.0
  • collectives: 4.4.2
  • comments: 1.23.0
  • contacts: 8.7.3
  • contactsinteraction: 1.14.1
  • dashboard: 7.13.0
  • dav: 1.36.0
  • deck: 1.17.4
  • done: 1.7.0
  • federatedfilesharing: 1.23.0
  • federation: 1.23.0
  • files: 2.5.0
  • files_downloadlimit: 5.1.0
  • files_pdfviewer: 6.0.0
  • files_reminders: 1.6.0
  • files_sharing: 1.25.2
  • files_trashbin: 1.23.0
  • files_versions: 1.26.0
  • firstrunwizard: 6.0.0
  • flow_notifications: 4.0.0
  • forms: 5.3.2
  • integration_openai: 4.5.1
  • integration_openproject: 3.1.1
  • logreader: 6.0.0
  • lookup_server_connector: 1.21.0
  • maps: 1.7.1
  • nextcloud-aio: 0.8.0
  • nextcloud_announcements: 5.0.0
  • notes: 6.0.1
  • notifications: 6.0.0
  • notify_push: 1.3.3
  • oauth2: 1.21.0
  • onlyoffice: 10.1.2
  • password_policy: 5.0.0
  • previewgenerator: 5.14.0
  • privacy: 5.0.0
  • profile: 1.2.0
  • provisioning_api: 1.23.0
  • recommendations: 6.0.0
  • related_resources: 4.0.0
  • serverinfo: 5.0.0
  • settings: 1.16.0
  • sharebymail: 1.23.0
  • support: 5.0.0
  • survey_client: 5.0.0
  • systemtags: 1.23.0
  • tables: 2.2.0
  • tasks: 0.18.1
  • text: 7.0.1
  • theming: 2.8.0
  • twofactor_backupcodes: 1.22.0
  • twofactor_totp: 15.0.0
  • updatenotification: 1.23.0
  • user_status: 1.13.0
  • viewer: 6.0.0
  • weather_status: 1.13.0
  • webapppassword: 26.6.0
  • webhook_listeners: 1.5.0
  • workflowengine: 2.15.0
    Disabled:
  • activity: 6.0.0 (installed 4.0.0)
  • app_api: 33.0.0 (installed 4.0.5)
  • cookbook: 0.11.8 (installed 0.11.8)
  • encryption: 2.21.0
  • files_external: 1.25.1
  • integration_google: 4.4.0 (installed 4.4.0)
  • mail: 5.10.7 (installed 5.10.7)
  • multiboards: 1.0.4 (installed 1.0.4)
  • photos: 6.0.0 (installed 4.0.0-dev.1)
  • suspicious_login: 11.0.0
  • twofactor_nextcloud_notification: 7.0.0
  • twothousandandfortyeight: 1.0.3 (installed 1.0.3)
  • user_ldap: 1.24.0
  • welcome: 3.0.0 (installed 3.0.0)
Nextcloud configuration
{
    "system": {
        "one-click-instance": true,
        "one-click-instance.user-limit": 100,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "check_data_directory_permissions": false,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 3,
            "read_timeout": 10
        },
        "overwritehost": "myclouddomain.com",
        "overwriteprotocol": "https",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "33.0.6.2",
        "overwrite.cli.url": "https:\/\/myclouddomain.com\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "updatedirectory": "\/nc-updater",
        "loglevel": 2,
        "log_type": "file",
        "logfile": "\/var\/www\/html\/data\/nextcloud.log",
        "log_rotate_size": 10485760,
        "log.condition": {
            "apps": [
                "admin_audit"
            ]
        },
        "preview_max_x": 1024,
        "preview_max_y": 1024,
        "jpeg_quality": 60,
        "enabledPreviewProviders": {
            "1": "OC\\Preview\\Image",
            "2": "OC\\Preview\\MarkDown",
            "3": "OC\\Preview\\MP3",
            "4": "OC\\Preview\\TXT",
            "5": "OC\\Preview\\OpenDocument",
            "6": "OC\\Preview\\Movie",
            "7": "OC\\Preview\\Krita",
            "0": "OC\\Preview\\Imaginary",
            "23": "OC\\Preview\\ImaginaryPDF"
        },
        "enable_previews": true,
        "upgrade.disable-web": true,
        "mail_smtpmode": "smtp",
        "trashbin_retention_obligation": "auto, 30",
        "versions_retention_obligation": "auto, 30",
        "activity_expire_days": 30,
        "simpleSignUpLink.shown": false,
        "share_folder": "\/Shared",
        "one-click-instance.link": "https:\/\/nextcloud.com\/all-in-one\/",
        "upgrade.cli-upgrade-link": "https:\/\/github.com\/nextcloud\/all-in-one\/discussions\/2726",
        "maintenance_window_start": 100,
        "allow_local_remote_servers": true,
        "davstorage.request_timeout": 3600,
        "htaccess.RewriteBase": "\/",
        "dbpersistent": false,
        "auth.bruteforce.protection.enabled": true,
        "ratelimit.protection.enabled": true,
        "files_external_allow_create_new_local": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "preview_imaginary_url": "***REMOVED SENSITIVE VALUE***",
        "preview_imaginary_key": "***REMOVED SENSITIVE VALUE***",
        "memories.db.triggers.fcu": true,
        "memories.exiftool": "\/var\/www\/html\/custom_apps\/memories\/bin-ext\/exiftool-amd64-musl",
        "memories.vod.path": "\/var\/www\/html\/custom_apps\/memories\/bin-ext\/go-vod-amd64",
        "memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg",
        "memories.vod.ffprobe": "\/usr\/bin\/ffprobe",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpauth": true,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "memories.gis_type": 2,
        "default_phone_region": "CA",
        "documentation_url.server_logs": "https:\/\/github.com\/nextcloud\/all-in-one\/discussions\/5425",
        "defaultapp": "",
        "onlyoffice": {
            "jwt_secret": "***REMOVED SENSITIVE VALUE***",
            "jwt_header": "AuthorizationJwt",
            "editors_check_interval": 0
        },
        "mail_smtpsecure": "ssl",
        "updatechecker": false,
        "data-fingerprint": "ab068429ff58f45b3302de64028a3996",
        "update_channel": "stable",
        "serverid": 445,
        "log_type_audit": "file",
        "logfile_audit": "\/var\/www\/html\/data\/audit.log",
        "DOMAIN": "myclouddomain.com",
        "AIO_VERSION": "v13.3.1"
    }
}

Browser

Browser name: Helium

Browser version: Based off Chromium 150

Operating system: Linux/Android

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with DashboardListWidgetsRemoteOperation.kt and DashboardGetWidgetItemsRemoteOperation.kt, especially their LIST_ENDPOINT constants, and compare the Android requests with the v1, v2, and calendar endpoints described in the issue. Done means Favorite Files and Upcoming Tasks data can be retrieved and displayed by Android widgets across the supported widget types.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
api, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.