Stores whether the server should require the client to connect via HTTPS. Expects a JSON data structure in the request body that contains the new setting `requiresHttps` as bool. Example: { "requiresHttps": true } Returns: Empty response on success, error object
()
| 670 | @api_blueprint.route('/settings/requiresHttps', methods=['PUT']) |
| 671 | @required_auth(auth.Role.ADMIN) |
| 672 | def settings_requires_https_put(): |
| 673 | """Stores whether the server should require the client to connect via HTTPS. |
| 674 | |
| 675 | Expects a JSON data structure in the request body that contains the new |
| 676 | setting `requiresHttps` as bool. Example: |
| 677 | { |
| 678 | "requiresHttps": true |
| 679 | } |
| 680 | |
| 681 | Returns: |
| 682 | Empty response on success, error object otherwise. |
| 683 | """ |
| 684 | try: |
| 685 | should_be_required = request_parsers.requires_https.parse(flask.request) |
| 686 | except request_parsers.errors.Error as e: |
| 687 | return json_response.error(e), 400 |
| 688 | db.settings.Settings().set_requires_https(should_be_required) |
| 689 | |
| 690 | # Configure cookie security. |
| 691 | is_session_cookie_secure = (not flask.current_app.debug and |
| 692 | should_be_required) |
| 693 | flask.current_app.config.update( |
| 694 | SESSION_COOKIE_SECURE=is_session_cookie_secure) |
| 695 | |
| 696 | return json_response.success() |
| 697 | |
| 698 | |
| 699 | @api_blueprint.route('/settings/video', methods=['GET']) |
nothing calls this directly
no test coverage detected