commit 339a2969aa27b958a85443e1ad74960228dfb6ca Author: Guy Van Sanden Date: Thu Apr 16 14:01:13 2026 +0200 Initial commit: Minimal Profile app for Nextcloud 33 diff --git a/README.md b/README.md new file mode 100644 index 0000000..b90f596 --- /dev/null +++ b/README.md @@ -0,0 +1,78 @@ +# Minimal Profile + +A Nextcloud 33 app that hides profile fields to create a minimal user profile. + +## Features + +- Hide profile fields like pronouns, social links, and more +- Works on personal settings page + +## Installation + +1. Copy the `minimalprofile` folder to your Nextcloud `apps/` directory +2. Enable the app: + ```bash + occ app:enable minimalprofile + ``` + +## Usage + +### Set hidden fields using OCC config command + +Hide the pronouns field: +```bash +occ config:app:set minimalprofile hidden_fields --value='["pronouns"]' +``` + +Hide multiple fields: +```bash +occ config:app:set minimalprofile hidden_fields --value='["pronouns","role","headline"]' +``` + +### View hidden fields +```bash +occ config:app:get minimalprofile hidden_fields +``` + +### Show all fields (reset) +```bash +occ config:app:delete minimalprofile hidden_fields +``` + +## Available Fields + +| Field | Description | +|-------|-------------| +| `pronouns` | User pronouns (e.g., she/her) | +| `role` | Job title / role | +| `headline` | Personal tagline | +| `biography` | User bio | +| `organisation` | Organization | +| `phone` | Phone number | +| `address` | Physical address | +| `birthdate` | Birthdate | +| `website` | Website URL | +| `twitter` | Twitter handle | +| `fediverse` | Fediverse handle | +| `location` | Location | + +## Examples + +Hide just pronouns: +```bash +occ config:app:set minimalprofile hidden_fields --value='["pronouns"]' +``` + +Hide pronouns, role, and headline: +```bash +occ config:app:set minimalprofile hidden_fields --value='["pronouns","role","headline"]' +``` + +Hide all extra social fields: +```bash +occ config:app:set minimalprofile hidden_fields --value='["pronouns","role","headline","biography","website","twitter","fediverse"]' +``` + +## Compatibility + +- Nextcloud 33 \ No newline at end of file diff --git a/appinfo/info.xml b/appinfo/info.xml new file mode 100644 index 0000000..e941e33 --- /dev/null +++ b/appinfo/info.xml @@ -0,0 +1,20 @@ + + + minimalprofile + Minimal Profile + Hides profile fields to create a minimal user profile + Allows administrators to hide profile fields like pronouns, social links, etc. + 1.0.0 + AGPL + Your Name + MinimalProfile + + settings + + + + + + + + \ No newline at end of file diff --git a/appinfo/routes.xml b/appinfo/routes.xml new file mode 100644 index 0000000..8265282 --- /dev/null +++ b/appinfo/routes.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..44cd9a6 --- /dev/null +++ b/composer.json @@ -0,0 +1,21 @@ +{ + "name": "nextcloud/minimalprofile", + "description": "Hides profile fields to create a minimal user profile", + "type": "nextcloud-app", + "license": "AGPL-3.0-or-later", + "require": { + "nextcloud/ocp": "dev-master" + }, + "require-dev": { + "nextcloud/coding-standard": "^1.2.0" + }, + "autoload": { + "psr-4": { + "OCA\\MinimalProfile\\": "lib/" + } + }, + "scripts": { + "cs:check": "php-cs-fixer fix --dry-run --diff", + "cs:fix": "php-cs-fixer fix" + } +} \ No newline at end of file diff --git a/js/minimalprofile.js b/js/minimalprofile.js new file mode 100644 index 0000000..ab3e31e --- /dev/null +++ b/js/minimalprofile.js @@ -0,0 +1,53 @@ +(function() { + 'use strict'; + + var fieldSelectors = { + 'pronouns': 'input[id="account-property-pronouns"]', + 'role': 'input[id="account-property-role"]', + 'headline': 'input[id="account-property-headline"]', + 'biography': 'input[id="account-property-biography"]', + 'organisation': 'input[id="account-property-organisation"]', + 'phone': 'input[id="account-property-phone"]', + 'address': 'input[id="account-property-address"]', + 'birthdate': 'input[id="account-property-birthdate"]', + 'website': 'input[id="account-property-website"]', + 'twitter': 'input[id="account-property-twitter"]', + 'fediverse': 'input[id="account-property-fediverse"]', + 'location': 'input[id="account-property-location"]' + }; + + function hideFields(hiddenFields) { + hiddenFields.forEach(function(field) { + var selector = fieldSelectors[field]; + if (selector) { + var elements = document.querySelectorAll(selector); + elements.forEach(function(el) { + var parent = el.parentElement; + while (parent && !parent.classList.contains('personal-settings-setting-box')) { + parent = parent.parentElement; + if (!parent) return; + } + if (parent && parent.classList.contains('personal-settings-setting-box')) { + parent.style.display = 'none'; + } + }); + } + }); + } + + OCP.registerLoadEndpoint(function() { + var req = new XMLHttpRequest(); + req.onload = function() { + if (req.status === 200) { + try { + var data = JSON.parse(req.responseText); + if (data.hiddenFields && data.hiddenFields.length > 0) { + hideFields(data.hiddenFields); + } + } catch (e) {} + } + }; + req.open('GET', OC.generateUrl('/apps/minimalprofile/api/v1/hidden-fields')); + req.send(); + }); +})(); \ No newline at end of file diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php new file mode 100644 index 0000000..7c7d987 --- /dev/null +++ b/lib/AppInfo/Application.php @@ -0,0 +1,25 @@ +config->getAppValue('minimalprofile', 'hidden_fields', ''); + $hiddenFields = $value !== '' ? json_decode($value, true) ?? [] : []; + + return new JSONResponse([ + 'hiddenFields' => $hiddenFields, + ]); + } +} \ No newline at end of file