add origin to oembed

This commit is contained in:
Roy Olav Purser 2021-05-13 14:13:26 +02:00
parent 579308d68b
commit 7d821b0ea7
Signed by: roypur
GPG Key ID: E14D26A036F21656
2 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="alternate" type="application/json+oembed" href="{{ path }}?provider={{ provider }}&embed=true"> <link rel="alternate" type="application/json+oembed" href="{{ origin }}?provider={{ provider }}&embed=true">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ videojs_version }}/video-js.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ videojs_version }}/video-js.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@silvermine/videojs-chromecast@{{ chromecast_version }}/dist/silvermine-videojs-chromecast.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@silvermine/videojs-chromecast@{{ chromecast_version }}/dist/silvermine-videojs-chromecast.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ videojs_version }}/video.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ videojs_version }}/video.min.js"></script>

View File

@ -72,7 +72,7 @@ if icecast_server is not None and stream_server is not None:
template_html = None template_html = None
template_js = None template_js = None
template_embed = tornado.template.Template('<iframe src="{{ path }}?provider={{ provider }}&render=true"></iframe>') template_embed = tornado.template.Template('<iframe src="{{ origin }}{{ path }}?provider={{ provider }}&render=true"></iframe>')
videojs_version = None videojs_version = None
castjs_version = None castjs_version = None
@ -188,7 +188,7 @@ class MainHandler(tornado.web.RequestHandler):
embed_json["version"] = "1.0" embed_json["version"] = "1.0"
embed_json["type"] = "video" embed_json["type"] = "video"
embed_json["html"] = f'<iframe src="{self.request.uri}"></iframe>' embed_json["html"] = f'<iframe src="{self.request.uri}"></iframe>'
embed_json["html"] = str(template_embed.generate(path=self.request.path, provider=provider), "utf-8") embed_json["html"] = str(template_embed.generate(origin=stream_server, path=self.request.path, provider=provider), "utf-8")
self.set_header("Content-Type", "application/json+oembed; charset=utf-8") self.set_header("Content-Type", "application/json+oembed; charset=utf-8")
self.write(json.dumps(embed_json)) self.write(json.dumps(embed_json))