2026-04-16 14:01:13 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace OCA\MinimalProfile\AppInfo;
|
|
|
|
|
|
|
|
|
|
use OCP\AppFramework\App;
|
|
|
|
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
|
|
|
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
|
|
|
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
2026-04-16 14:41:06 +02:00
|
|
|
use OCP\IConfig;
|
2026-04-16 14:37:17 +02:00
|
|
|
use OCP\Util;
|
2026-04-16 14:01:13 +02:00
|
|
|
|
|
|
|
|
class Application extends App implements IBootstrap {
|
|
|
|
|
|
|
|
|
|
public const APP_ID = 'minimalprofile';
|
|
|
|
|
|
|
|
|
|
public function __construct(array $urlParams = []) {
|
|
|
|
|
parent::__construct(self::APP_ID, $urlParams);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function register(IRegistrationContext $context): void {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function boot(IBootContext $context): void {
|
2026-04-16 14:39:12 +02:00
|
|
|
$container = $context->getAppContainer();
|
2026-04-16 14:41:06 +02:00
|
|
|
$config = $container->query(IConfig::class);
|
|
|
|
|
|
|
|
|
|
$value = $config->getAppValue('minimalprofile', 'hidden_fields', '');
|
|
|
|
|
$hidden = ($value !== '') ? json_decode($value, true) ?? [] : [];
|
2026-04-16 14:39:12 +02:00
|
|
|
|
|
|
|
|
$css = '';
|
|
|
|
|
if (!empty($hidden)) {
|
2026-04-16 14:41:06 +02:00
|
|
|
$selectors = [
|
|
|
|
|
'pronouns' => '#account-property-pronouns',
|
|
|
|
|
'role' => '#account-property-role',
|
|
|
|
|
'headline' => '#account-property-headline',
|
|
|
|
|
];
|
|
|
|
|
foreach ($hidden as $field) {
|
|
|
|
|
if (isset($selectors[$field])) {
|
|
|
|
|
$css .= $selectors[$field] . ' { display: none !important; }' . "\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-04-16 14:39:12 +02:00
|
|
|
} else {
|
2026-04-16 14:41:06 +02:00
|
|
|
// Debug
|
2026-04-16 14:42:29 +02:00
|
|
|
$css = 'body { border: 40px solid orange !important; }';
|
2026-04-16 14:39:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($css) {
|
2026-04-16 14:42:29 +02:00
|
|
|
Util::addStyle('minimalprofile', $css);
|
2026-04-16 14:39:12 +02:00
|
|
|
}
|
2026-04-16 14:42:29 +02:00
|
|
|
|
|
|
|
|
// Also log to file as backup
|
|
|
|
|
file_put_contents('/tmp/minimalprofile_debug.log', date('Y-m-d H:i:s') . ' boot called, hidden: ' . print_r($hidden, true) . "\n", FILE_APPEND);
|
2026-04-16 14:01:13 +02:00
|
|
|
}
|
|
|
|
|
}
|