Browse Source

Added a config setting to denote completion of the startup wizard

LukePulverenti 12 years ago
parent
commit
da535db655

+ 2 - 2
MediaBrowser.Common.Implementations/BaseApplicationHost.cs

@@ -158,10 +158,10 @@ namespace MediaBrowser.Common.Implementations
         {
             return Task.Run(() =>
             {
+                IsFirstRun = !ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted;
+                
                 Logger = LogManager.GetLogger("App");
 
-                IsFirstRun = !File.Exists(ApplicationPaths.SystemConfigurationFilePath);
-
                 DiscoverTypes();
 
                 LogManager.ReloadLogger(ConfigurationManager.CommonConfiguration.EnableDebugLevelLogging ? LogSeverity.Debug : LogSeverity.Info);

+ 7 - 0
MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs

@@ -65,6 +65,13 @@ namespace MediaBrowser.Model.Configuration
         /// <value>The legacy web socket port number.</value>
         [ProtoMember(59)]
         public int LegacyWebSocketPortNumber { get; set; }
+
+        /// <summary>
+        /// Gets or sets a value indicating whether this instance is first run.
+        /// </summary>
+        /// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
+        [ProtoMember(4)]
+        public bool IsStartupWizardCompleted { get; set; }
         
         /// <summary>
         /// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.

+ 1 - 0
MediaBrowser.WebDashboard/Api/DashboardService.cs

@@ -430,6 +430,7 @@ namespace MediaBrowser.WebDashboard.Api
                                       "UpdatePasswordPage.js",
                                       "UserImagePage.js",
                                       "UserProfilesPage.js",
+                                      "WizardFinishPage.js",
                                       "WizardStartPage.js",
                                       "WizardUserPage.js",
                                       "SupporterKeyPage.js",

+ 16 - 0
MediaBrowser.WebDashboard/Html/scripts/WizardFinishPage.js

@@ -0,0 +1,16 @@
+var WizardFinishPage = {
+  
+    onFinish: function() {
+        
+        ApiClient.getServerConfiguration().done(function (config) {
+
+            config.IsStartupWizardCompleted = true;
+
+            ApiClient.updateServerConfiguration(config).done(function() {
+                Dashboard.navigate('dashboard.html');
+            });
+        });
+
+    }
+
+};

+ 1 - 1
MediaBrowser.WebDashboard/Html/wizardFinish.html

@@ -16,7 +16,7 @@
 
                 <div class="wizardNavigation">
                     <button type="button" data-iconpos="left" data-icon="arrow-left" data-inline="true" onclick="history.back();">Previous</button>
-                    <button type="button" data-iconpos="right" data-icon="wrench" data-inline="true" onclick="Dashboard.navigate('dashboard.html');" data-theme="b">Go to the Dashboard</button>
+                    <button type="button" data-iconpos="right" data-icon="wrench" data-inline="true" onclick="WizardFinishPage.onFinish();" data-theme="b">Go to the Dashboard</button>
                 </div>
             </div>
 

+ 1 - 0
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -384,6 +384,7 @@
     <EmbeddedResource Include="Html\scripts\ItemDetailPage.js" />
   </ItemGroup>
   <ItemGroup>
+    <EmbeddedResource Include="Html\scripts\WizardFinishPage.js" />
     <EmbeddedResource Include="Html\Readme.txt" />
     <EmbeddedResource Include="Html\css\images\media\playCircle.png" />
     <EmbeddedResource Include="Html\css\images\media\nextTrack.png" />