@@ -90,11 +90,6 @@ public async Task<IActionResult> Update([FromBody] UpdateConfigRequest request)
9090 if ( request . MultiConnectionBlockSizeMB . HasValue ) c . MultiConnectionBlockSizeMB = Math . Clamp ( request . MultiConnectionBlockSizeMB . Value , 1 , 16 ) ;
9191 if ( request . MultiConnectionMinFileSizeMB . HasValue ) c . MultiConnectionMinFileSizeMB = request . MultiConnectionMinFileSizeMB . Value ;
9292
93- c . webDav ??= new WebDavModel ( ) ;
94- if ( ! string . IsNullOrWhiteSpace ( request . WebDavHost ) ) c . webDav . Host = request . WebDavHost ;
95- if ( request . WebDavInternalPort . HasValue ) c . webDav . PuertoEntrada = request . WebDavInternalPort . Value ;
96- if ( request . WebDavExternalPort . HasValue ) c . webDav . PuertoSalida = request . WebDavExternalPort . Value ;
97-
9893 await GeneralConfigStatic . SaveChanges ( _db , c ) ;
9994
10095 return OkResult ( AppConfigDto . From ( GeneralConfigStatic . config ) , "Configuration saved" ) ;
@@ -106,55 +101,5 @@ public async Task<IActionResult> Update([FromBody] UpdateConfigRequest request)
106101 }
107102 }
108103
109- /// <summary>State of the WebDAV bridge.</summary>
110- [ HttpGet ( "webdav" ) ]
111- [ ProducesResponseType ( typeof ( ApiResult < WebDavConfigDto > ) , StatusCodes . Status200OK ) ]
112- public IActionResult WebDav ( ) => OkResult ( AppConfigDto . From ( GeneralConfigStatic . config ) . WebDav ) ;
113-
114- /// <summary>Starts the WebDAV bridge.</summary>
115- /// <remarks>
116- /// Once running, channels are reachable as WebDAV shares at
117- /// <c>http://<host>:<externalPort>/<channelId>/</c>,
118- /// which is how media servers mount a library.
119- /// </remarks>
120- [ HttpPost ( "webdav/start" ) ]
121- [ ProducesResponseType ( typeof ( ApiResult < WebDavConfigDto > ) , StatusCodes . Status200OK ) ]
122- public IActionResult StartWebDav ( )
123- {
124- try
125- {
126- var webDav = GeneralConfigStatic . config . webDav ;
127- if ( webDav == null )
128- return BadRequestResult ( "WebDAV is not configured" ) ;
129-
130- if ( webDav . webDavService ? . IsRunning == true )
131- return ConflictResult ( "The WebDAV bridge is already running" , ApiErrorCodes . AlreadyRunning ) ;
132-
133- webDav . start ( ) ;
134- return OkResult ( AppConfigDto . From ( GeneralConfigStatic . config ) . WebDav , "WebDAV bridge started" ) ;
135- }
136- catch ( Exception ex )
137- {
138- _logger . LogError ( ex , "Error starting the WebDAV bridge" ) ;
139- return ErrorResult ( "Could not start the WebDAV bridge" , ex ) ;
140- }
141- }
142-
143- /// <summary>Stops the WebDAV bridge.</summary>
144- [ HttpPost ( "webdav/stop" ) ]
145- [ ProducesResponseType ( typeof ( ApiResult < WebDavConfigDto > ) , StatusCodes . Status200OK ) ]
146- public IActionResult StopWebDav ( )
147- {
148- try
149- {
150- GeneralConfigStatic . config . webDav ? . stop ( ) ;
151- return OkResult ( AppConfigDto . From ( GeneralConfigStatic . config ) . WebDav , "WebDAV bridge stopped" ) ;
152- }
153- catch ( Exception ex )
154- {
155- _logger . LogError ( ex , "Error stopping the WebDAV bridge" ) ;
156- return ErrorResult ( "Could not stop the WebDAV bridge" , ex ) ;
157- }
158- }
159104 }
160105}
0 commit comments