You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
650 B

  1. # -*- coding: utf-8 -*-
  2. # © 2016 Therp BV <http://therp.nl>
  3. # © 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
  4. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  5. import os
  6. from odoo import http
  7. from odoo.http import request
  8. from ..models.letsencrypt import get_challenge_dir
  9. class Letsencrypt(http.Controller):
  10. @http.route('/.well-known/acme-challenge/<filename>', auth='none')
  11. def acme_challenge(self, filename):
  12. try:
  13. with file(os.path.join(get_challenge_dir(), filename)) as key:
  14. return key.read()
  15. except IOError:
  16. pass
  17. return request.not_found()