diff --git a/preview_easy/controllers/preview.py b/preview_easy/controllers/preview.py index 3e4b408a6..e811e3db4 100644 --- a/preview_easy/controllers/preview.py +++ b/preview_easy/controllers/preview.py @@ -15,7 +15,7 @@ _logger = logging.getLogger(__name__) class preview(http.Controller): - @http.route('/web/content/preview/', type='http', method=['Get'], auth="public") + @http.route('/web/content/preview/', type='http', method=['Get'], auth="none") def content_preview(self, id=None): ir_attach = request.env['ir.attachment'].sudo() attach = ir_attach.browse(id) @@ -39,24 +39,24 @@ class preview(http.Controller): # html = result.value # return template.render(html=html) elif attach.mimetype in excel or word: - # 'http://view.officeapps.live.com/op/view.aspx?src=https://oa.thtzjt.com/web/content/office_preview/' - # office_view_url = 'http://view.officeapps.live.com/op/view.aspx?src=' - # base_url = request.env['ir.config_parameter'].sudo().get_param('web.base.url') - # html = f'{office_view_url}{quote(base_url + "/web/content/office_preview/" + str(attach.id))}' - target_url = f'/onlyoffice/editor/{str(attach.id)}' - return werkzeug.utils.redirect(target_url) - # return werkzeug.wrappers.Response(f""" - # - # - # - # - # - # - # - # - # - # """, status=200, headers=[('Content-Type', 'text/html'), ('charset', 'utf-8')]) + 'http://view.officeapps.live.com/op/view.aspx?src=https://oa.thtzjt.com/web/content/office_preview/' + office_view_url = 'http://view.officeapps.live.com/op/view.aspx?src=' + base_url = request.env['ir.config_parameter'].sudo().get_param('web.base.url') + html = f'{office_view_url}{quote(base_url + "/web/content/office_preview/" + str(attach.id))}' + # target_url = f'/onlyoffice/editor/{str(attach.id)}' + # return werkzeug.utils.redirect(target_url) + return werkzeug.wrappers.Response(f""" + + + + + + + + + + """, status=200, headers=[('Content-Type', 'text/html'), ('charset', 'utf-8')]) else: return werkzeug.wrappers.Response('This format is not currently supported', status=200, headers=[('Content-Type', 'text/html'),('charset','utf-8')])