diff --git a/appinfo/info.xml b/appinfo/info.xml index de47bc5..aa1b5c3 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -4,7 +4,7 @@ Minimal Profile Hides profile fields to create a minimal user profile Allows administrators to hide profile fields like pronouns, social links, etc. - 1.0.27 + 1.0.28 AGPL Your Name MinimalProfile diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index a44b4bb..27fd716 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -8,49 +8,19 @@ use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; -use OCP\IConfig; use OCP\Util; class Application extends App implements IBootstrap { - public const APP_ID = 'minimalprofile'; - public function __construct(array $urlParams = []) { - parent::__construct(self::APP_ID, $urlParams); + parent::__construct('minimalprofile', $urlParams); } public function register(IRegistrationContext $context): void { + Util::addScript('minimalprofile', 'minimalprofile'); + file_put_contents('/tmp/mp_register.log', date('Y-m-d H:i:s') . ' register added JS' . "\n", FILE_APPEND); } public function boot(IBootContext $context): void { - $container = $context->getAppContainer(); - $config = $container->query(IConfig::class); - - $value = $config->getAppValue('minimalprofile', 'hidden_fields', ''); - $hidden = ($value !== '') ? json_decode($value, true) ?? [] : []; - - $css = ''; - if (!empty($hidden)) { - $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"; - } - } - } else { - // Debug - $css = 'body { border: 40px solid orange !important; }'; - } - - if ($css) { - Util::addInlineStyle($css); - } - - // 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); } } \ No newline at end of file