Skip to content
This repository was archived by the owner on Aug 4, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/Settings/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use OCA\DeskDesk\AppInfo\Application;
use OCP\App\IAppManager;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\Settings\ISettings;

/**
Expand All @@ -37,10 +38,12 @@ class AdminSettings implements ISettings
/**
* Constructor.
*
* @param IAppManager $appManager The app manager.
* @param IAppManager $appManager The app manager.
* @param IInitialState $initialState The initial state service.
*/
public function __construct(
private readonly IAppManager $appManager,
private readonly IInitialState $initialState,
) {
}//end __construct()

Expand All @@ -53,10 +56,12 @@ public function getForm(): TemplateResponse
{
$version = $this->appManager->getAppVersion(appId: Application::APP_ID);

$this->initialState->provideInitialState('version', $version);

return new TemplateResponse(
Application::APP_ID,
'settings/admin',
['version' => $version]
[]
);
}//end getForm()

Expand Down
6 changes: 2 additions & 4 deletions src/views/settings/AdminRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</template>

<script>
import { loadState } from '@nextcloud/initial-state'
import { CnVersionInfoCard } from '@conduction/nextcloud-vue'

export default {
Expand All @@ -28,10 +29,7 @@ export default {
},
data() {
return {
// ADR-004: "never read app state from DOM" exception — appVersion
// is a one-time boot parameter emitted by the PHP admin template,
// following Nextcloud's idiomatic settings-page bootstrap pattern.
appVersion: document.getElementById('deskdesk-settings')?.dataset?.version || 'Unknown',
appVersion: loadState('deskdesk', 'version', 'Unknown'),
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion templates/settings/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
$appId = OCA\DeskDesk\AppInfo\Application::APP_ID;
Util::addScript($appId, $appId . '-settings');
?>
<div id="deskdesk-settings" data-version="<?php p($_['version'] ?? ''); ?>"></div>
<div id="deskdesk-settings"></div>
Loading