summaryrefslogtreecommitdiff
path: root/indoteknik_custom/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/controllers')
-rw-r--r--indoteknik_custom/controllers/__init__.py1
-rw-r--r--indoteknik_custom/controllers/website.py36
2 files changed, 37 insertions, 0 deletions
diff --git a/indoteknik_custom/controllers/__init__.py b/indoteknik_custom/controllers/__init__.py
new file mode 100644
index 00000000..02ab5287
--- /dev/null
+++ b/indoteknik_custom/controllers/__init__.py
@@ -0,0 +1 @@
+from . import website \ No newline at end of file
diff --git a/indoteknik_custom/controllers/website.py b/indoteknik_custom/controllers/website.py
new file mode 100644
index 00000000..2e3df519
--- /dev/null
+++ b/indoteknik_custom/controllers/website.py
@@ -0,0 +1,36 @@
+from odoo.http import request, Controller
+from odoo import http, _
+
+class Website(Controller):
+ @http.route('/content', auth='public')
+ def content(self, **kw):
+ url = kw.get('url', '')
+ iframe = f"<iframe src='{url}' onload='hideHeader(this)' ></iframe>"
+ style = '''
+ <style>
+ iframe {
+ border: none;
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100vw;
+ height: 100vh;
+ }
+ </style>
+ '''
+ script = '''
+ <script>
+ const hideHeader = (iframe) => {
+ var header = iframe.contentWindow.document.querySelector('header');
+ if (header) {
+ header.style.display = 'none';
+ }
+ var footer = iframe.contentWindow.document.querySelector('footer');
+ if (footer) {
+ footer.style.display = 'none';
+ }
+ }
+ </script>
+ '''
+ content = '<!DOCTYPE html><html>' + '<body>' + iframe + style + script + '</body>' + '</html>'
+ return request.make_response(content, [('Access-Control-Allow-Origin', '*'), ('Access-Control-Allow-Headers', '*')]) \ No newline at end of file