Skip to content

Commit 450a03e

Browse files
committed
chore: fix reload nginx on apply
1 parent 6b7639e commit 450a03e

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

api/src/unraid-api/graph/resolvers/customization/customization.service.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as ini from 'ini';
88

99
import { emcmd } from '@app/core/utils/clients/emcmd.js';
1010
import { fileExists } from '@app/core/utils/files/file-exists.js';
11+
import { reloadNginxAndUpdateDNS } from '@app/store/actions/reload-nginx-and-update-dns.js';
1112
import { getters } from '@app/store/index.js';
1213
import { ActivationCode } from '@app/unraid-api/graph/resolvers/customization/activation-code.model.js';
1314

@@ -24,10 +25,6 @@ export class CustomizationService implements OnModuleInit {
2425
private activationData: ActivationCode | null = null;
2526

2627
async createOrGetFirstBootSetupFlag(): Promise<boolean> {
27-
// Ensure directory exists first
28-
// Note: this.activationDir might not be initialized yet if called before onModuleInit
29-
// It relies on being called within or after onModuleInit workflow.
30-
// If called independently, it needs the path value passed or initialized differently.
3128
await fs.mkdir(this.activationDir, { recursive: true });
3229
if (await fileExists(this.hasRunFirstBootSetup)) {
3330
this.logger.log('First boot setup flag file already exists.');
@@ -153,7 +150,7 @@ export class CustomizationService implements OnModuleInit {
153150

154151
public convertWebGuiPathToAssetPath(webGuiPath: string): string {
155152
// Strip the leading /usr/local/emhttp/ from the path
156-
const assetPath = webGuiPath.replace('/usr/local/emhttp/', '');
153+
const assetPath = webGuiPath.replace('/usr/local/emhttp/', '/');
157154
return assetPath;
158155
}
159156

@@ -365,7 +362,7 @@ export class CustomizationService implements OnModuleInit {
365362
}
366363

367364
private async applyServerIdentity() {
368-
const { getters } = await import('@app/store/index.js');
365+
const { getters, store } = await import('@app/store/index.js');
369366
if (!this.activationData) {
370367
this.logger.warn('No activation data available for server identity setup.');
371368
return;
@@ -402,14 +399,18 @@ export class CustomizationService implements OnModuleInit {
402399

403400
try {
404401
// Update ident.cfg first
405-
await this.updateCfgFile(this.identCfg, null, paramsToUpdate); // Update keys directly in the file
402+
await this.updateCfgFile(this.identCfg, null, paramsToUpdate);
406403
this.logger.log(`Server identity updated in ${this.identCfg}`);
407404

408405
// Trigger emhttp update via emcmd
409-
const updateParams = { ...paramsToUpdate, changeNames: 'Apply' }; // Prepare params for emcmd
410-
this.logger.log(`Calling emcmd with params:`, updateParams); // Log the params
411-
await emcmd(updateParams); // Use emcmd utility
406+
const updateParams = { ...paramsToUpdate, changeNames: 'Apply' };
407+
this.logger.log(`Calling emcmd with params:`, updateParams);
408+
await emcmd(updateParams);
412409
this.logger.log('emcmd executed successfully.');
410+
411+
// Reload nginx and update DNS
412+
await store.dispatch(reloadNginxAndUpdateDNS());
413+
this.logger.log('Nginx reloaded and DNS updated successfully.');
413414
} catch (error) {
414415
this.logger.error('Error applying server identity:', error);
415416
}

web/components/Activation/WelcomeModal.ce.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<script setup lang="ts">
22
import { useI18n } from 'vue-i18n';
3+
import { storeToRefs } from 'pinia';
34
45
import { BrandButton } from '@unraid/ui';
56
67
import ActivationPartnerLogo from '~/components/Activation/ActivationPartnerLogo.vue';
78
import ActivationSteps from '~/components/Activation/ActivationSteps.vue';
89
import { useActivationCodeDataStore } from '~/components/Activation/store/activationCodeData';
910
import Modal from '~/components/Modal.vue';
10-
import { storeToRefs } from 'pinia';
11+
import { useThemeStore } from '~/store/theme';
1112
1213
const { t } = useI18n();
1314
1415
const { partnerInfo, loading } = storeToRefs(useActivationCodeDataStore());
1516
17+
useThemeStore();
18+
1619
const title = computed<string>(() =>
1720
partnerInfo.value?.partnerName
1821
? t(`Welcome to your new {0} system, powered by Unraid!`, [partnerInfo.value?.partnerName])

0 commit comments

Comments
 (0)