{
}
render() {
- const { renderMode, className } = this.props;
+ const { embedded, renderMode, className } = this.props;
return (
diff --git a/ui/scss/all.scss b/ui/scss/all.scss
index 87257d350..9deafe5b0 100644
--- a/ui/scss/all.scss
+++ b/ui/scss/all.scss
@@ -69,3 +69,4 @@
@import 'component/swipe-list';
@import 'component/utils';
@import 'component/settings';
+@import 'component/embed-player';
diff --git a/ui/scss/component/_embed-player.scss b/ui/scss/component/_embed-player.scss
new file mode 100644
index 000000000..59ee8119f
--- /dev/null
+++ b/ui/scss/component/_embed-player.scss
@@ -0,0 +1,67 @@
+.embed__wrapper {
+ height: 100vh;
+ width: 100vw;
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+ align-items: center;
+ background-color: var(--color-black);
+}
+
+.embed__wrapper--light-background {
+ @extend .embed__wrapper;
+
+ .vjs-poster,
+ video {
+ background-color: var(--color-white);
+ }
+}
+
+.embed__inline-button {
+ @include thumbnail;
+ position: relative;
+ background-position: 50% 50%;
+ background-repeat: no-repeat;
+ background-size: 100%;
+ width: 100%;
+ height: auto;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-top-left-radius: var(--border-radius);
+ border-top-right-radius: var(--border-radius);
+ background-color: var(--color-black);
+
+ @media (max-width: $breakpoint-small) {
+ height: 200px;
+ }
+}
+
+.embed__inline-button-preview {
+ @extend .embed__inline-button;
+ background-color: var(--color-editor-inline-code-bg);
+ width: 50%;
+}
+
+.embed__loading {
+ width: 100%;
+ height: 100%;
+}
+
+.embed__loading-text {
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ color: var(--color-white);
+
+ h1 {
+ font-size: var(--font-large);
+ }
+}
+
+.embed__overlay-logo {
+ max-height: 2rem;
+ max-width: 7rem;
+}
diff --git a/ui/util/remark-lbry.js b/ui/util/remark-lbry.js
index 129ed45a9..d478751cd 100644
--- a/ui/util/remark-lbry.js
+++ b/ui/util/remark-lbry.js
@@ -12,13 +12,19 @@ const invalidRegex = /[-_.+=?!@#$%^&*:;,{}<>\w/\\]/;
const mentionRegex = /@[^\s()"-_.+=?!@$%^&*;,{}<>/\\]*/gm;
function handlePunctuation(value) {
- const modifierIndex =
- (value.indexOf(':') >= 0 && value.indexOf(':')) || (value.indexOf('#') >= 0 && value.indexOf('#'));
+ const protocolIndex = value.indexOf('lbry://') === 0 ? protocol.length - 1 : 0;
+ const channelModifierIndex =
+ (value.indexOf(':', protocolIndex) >= 0 && value.indexOf(':', protocolIndex)) ||
+ (value.indexOf('#', protocolIndex) >= 0 && value.indexOf('#', protocolIndex));
+ const claimModifierIndex =
+ (value.indexOf(':', channelModifierIndex + 1) >= 0 && value.indexOf(':', channelModifierIndex + 1)) ||
+ (value.indexOf('#', channelModifierIndex + 1) >= 0 && value.indexOf('#', channelModifierIndex + 1)) ||
+ channelModifierIndex;
let punctuationIndex;
punctuationMarks.some((p) => {
- if (modifierIndex) {
- punctuationIndex = value.indexOf(p, modifierIndex + 1) >= 0 && value.indexOf(p, modifierIndex + 1);
+ if (claimModifierIndex) {
+ punctuationIndex = value.indexOf(p, claimModifierIndex + 1) >= 0 && value.indexOf(p, claimModifierIndex + 1);
}
return punctuationIndex;
});
@@ -108,15 +114,15 @@ function tokenizeURI(eat, value, silent) {
// Configure tokenizer for lbry urls
tokenizeURI.locator = locateURI;
-tokenizeURI.notInList = true;
+tokenizeURI.notInList = false;
tokenizeURI.notInLink = true;
-tokenizeURI.notInBlock = true;
+tokenizeURI.notInBlock = false;
// Configure tokenizer for lbry channels
tokenizeMention.locator = locateMention;
-tokenizeMention.notInList = true;
+tokenizeMention.notInList = false;
tokenizeMention.notInLink = true;
-tokenizeMention.notInBlock = true;
+tokenizeMention.notInBlock = false;
const visitor = (node, index, parent) => {
if (node.type === 'link' && parent && parent.type === 'paragraph') {
diff --git a/web/middleware/iframe-destroyer.js b/web/middleware/iframe-destroyer.js
new file mode 100644
index 000000000..13d6a7b2c
--- /dev/null
+++ b/web/middleware/iframe-destroyer.js
@@ -0,0 +1,16 @@
+const PAGES = require('../../ui/constants/pages');
+
+async function iframeDestroyerMiddleware(ctx, next) {
+ const {
+ request: { path },
+ } = ctx;
+ const decodedPath = decodeURIComponent(path);
+
+ if (!decodedPath.startsWith(`/$/${PAGES.EMBED}`)) {
+ ctx.set('X-Frame-Options', 'DENY');
+ }
+
+ return next();
+}
+
+module.exports = iframeDestroyerMiddleware;