11const { rest } = window . MockServiceWorker ;
22import {
3- type ServerStatusResponseModel ,
4- type ServerInformationResponseModel ,
5- type ServerTroubleshootingResponseModel ,
63 RuntimeLevelModel ,
74 RuntimeModeModel ,
5+ type GetServerUpgradeCheckResponse ,
6+ type GetServerTroubleshootingResponse ,
7+ type GetServerInformationResponse ,
8+ type GetServerConfigurationResponse ,
9+ type GetServerStatusResponse ,
810} from '@umbraco-cms/backoffice/external/backend-api' ;
911import { umbracoPath } from '@umbraco-cms/backoffice/utils' ;
1012
1113export const serverRunningHandler = rest . get ( umbracoPath ( '/server/status' ) , ( _req , res , ctx ) => {
1214 return res (
1315 // Respond with a 200 status code
1416 ctx . status ( 200 ) ,
15- ctx . json < ServerStatusResponseModel > ( {
17+ ctx . json < GetServerStatusResponse > ( {
1618 serverStatus : RuntimeLevelModel . RUN ,
1719 } ) ,
1820 ) ;
@@ -22,7 +24,7 @@ export const serverMustInstallHandler = rest.get(umbracoPath('/server/status'),
2224 return res (
2325 // Respond with a 200 status code
2426 ctx . status ( 200 ) ,
25- ctx . json < ServerStatusResponseModel > ( {
27+ ctx . json < GetServerStatusResponse > ( {
2628 serverStatus : RuntimeLevelModel . INSTALL ,
2729 } ) ,
2830 ) ;
@@ -32,20 +34,41 @@ export const serverMustUpgradeHandler = rest.get(umbracoPath('/server/status'),
3234 return res (
3335 // Respond with a 200 status code
3436 ctx . status ( 200 ) ,
35- ctx . json < ServerStatusResponseModel > ( {
37+ ctx . json < GetServerStatusResponse > ( {
3638 serverStatus : RuntimeLevelModel . UPGRADE ,
3739 } ) ,
3840 ) ;
3941} ) ;
4042
4143export const serverInformationHandlers = [
44+ rest . get ( umbracoPath ( '/server/configuration' ) , ( _req , res , ctx ) => {
45+ return res (
46+ // Respond with a 200 status code
47+ ctx . status ( 200 ) ,
48+ ctx . json < GetServerConfigurationResponse > ( {
49+ allowPasswordReset : true ,
50+ versionCheckPeriod : 7 , // days
51+ } ) ,
52+ ) ;
53+ } ) ,
54+ rest . get ( umbracoPath ( '/server/upgrade-check' ) , ( _req , res , ctx ) => {
55+ return res (
56+ // Respond with a 200 status code
57+ ctx . status ( 200 ) ,
58+ ctx . json < GetServerUpgradeCheckResponse > ( {
59+ type : 'Minor' ,
60+ comment : "14.2.0.0 is released. Upgrade today - it's free!" ,
61+ url : 'https://our.umbraco.com/download/releases/1420' ,
62+ } ) ,
63+ ) ;
64+ } ) ,
4265 rest . get ( umbracoPath ( '/server/information' ) , ( _req , res , ctx ) => {
4366 return res (
4467 // Respond with a 200 status code
4568 ctx . status ( 200 ) ,
46- ctx . json < ServerInformationResponseModel > ( {
47- version : '14.0.0-preview004 ' ,
48- assemblyVersion : '14.0.0-preview004 ' ,
69+ ctx . json < GetServerInformationResponse > ( {
70+ version : '14.0.0' ,
71+ assemblyVersion : '14.0.0' ,
4972 baseUtcOffset : '01:00:00' ,
5073 runtimeMode : RuntimeModeModel . BACKOFFICE_DEVELOPMENT ,
5174 } ) ,
@@ -55,7 +78,7 @@ export const serverInformationHandlers = [
5578 return res (
5679 // Respond with a 200 status code
5780 ctx . status ( 200 ) ,
58- ctx . json < ServerTroubleshootingResponseModel > ( {
81+ ctx . json < GetServerTroubleshootingResponse > ( {
5982 items : [
6083 { name : 'Umbraco base url' , data : location . origin } ,
6184 { name : 'Mocked server' , data : 'true' } ,
0 commit comments