mirror of
https://github.com/filecoin-project/slate.git
synced 2024-09-19 18:28:03 +03:00
added detection that something is an nft link
This commit is contained in:
parent
b6b17e1551
commit
48d59d3f95
@ -182,6 +182,8 @@ export const gateways = {
|
||||
|
||||
export const hostname = "https://slate.host";
|
||||
|
||||
export const NFTDomains = ["foundation.app", "zora.co", "opensea.io"];
|
||||
|
||||
// more important filetypes to consider:
|
||||
// midi
|
||||
// txt, rtf, docx
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as Strings from "~/common/strings";
|
||||
import * as Constants from "~/common/constants";
|
||||
|
||||
import JSZip from "jszip";
|
||||
|
||||
@ -280,3 +281,10 @@ export const isUnityFile = async (file) => {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export const isNFTLink = async (file) => {
|
||||
let domain = file?.data?.link?.domain;
|
||||
if (!domain) return false;
|
||||
domain = domain.toLowerCase();
|
||||
return Constants.NFTDomains.includes(domain);
|
||||
};
|
||||
|
@ -34,6 +34,8 @@ export default class SlateLinkObject extends React.Component {
|
||||
const url = this.props.file.url;
|
||||
const link = this.props.file.data.link;
|
||||
const { html, iFrameAllowed } = link;
|
||||
const isNFTLink = Validations.isNFTLink(this.props.file);
|
||||
|
||||
if (html) {
|
||||
return (
|
||||
<div
|
||||
@ -43,7 +45,7 @@ export default class SlateLinkObject extends React.Component {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
} else if (iFrameAllowed && !isMobile) {
|
||||
} else if (iFrameAllowed && !isMobile && !isNFTLink) {
|
||||
return (
|
||||
<div
|
||||
style={{ position: "relative", display: "block", width: "100%", height: "100%" }}
|
||||
|
Loading…
Reference in New Issue
Block a user