You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
4.8 KiB
HTML

<!DOCTYPE html>
<html>
{% include 'includes/head.html' %}
<body>
<section class="section">
<div class="container">
{% include 'includes/navbar.html' %}
{% if meme %}
{% if meme.meta_ipfs_hash %}
{% set meta_url = config.IPFS_SERVER + "/ipfs/" + meme.meta_ipfs_hash %}
{% set meme_url = config.IPFS_SERVER + "/ipfs/" + meme.meme_ipfs_hash %}
{% else %}
{% set meta_url = "" %}
{% set meme_url = url_for('meta.uploaded_file', filename=meme.file_name, _external=True) %}
{% endif %}
<div id="screen">
<div class="screen">
{% if meme.file_name.endswith('mp4') %}
<video style="max-height: 60vh!important;max-width:100%;" {% if not request.MOBILE %}autoplay{% else %}controls{% endif %} muted loop>
<source src="{{ meme_url }}" type="video/mp4">
Your browser does not support the video tag.
</video>
{% else %}
<img src="{{ meme_url }}" id="memeImage" />
{% endif %}
<br/>
<p>Title: <strong>{{ meme.title }}</strong></p>
<p>Description: <strong>{{ meme.description }}</strong></p>
3 years ago
<p>Poster Address: <a href="{{ url_for('user.show', handle=meme.user.handle) }}">{{ meme.user.handle }}</a></p>
{% if meme.meta_ipfs_hash %}
<p>Meta IPFS: <a href="{{ meta_url }}" target=_self up-preload up-follow=".container">{{ meme.meta_ipfs_hash }}</a></p>
{% endif %}
{% if meme.meme_ipfs_hash %}
<p>Meme IPFS: <a href="{{ meme_url }}" target=_self up-preload up-follow=".container">{{ meme.meme_ipfs_hash }}</a></p>
{% endif %}
<p>Meme ID: <code>{{ meme }}</code></p>
{% if not meme.meta_ipfs_hash %}
<br/>
<div class="columns">
<div class="column">
<a class="button is-info is-12 column" href="{{ url_for('meme.approve', meme_id=meme.id, action='approve') }}">Approve</a>
</div>
<div class="column">
<a class="button is-danger is-12 column" href="{{ url_for('meme.approve', meme_id=meme.id, action='deny') }}">Deny</a>
</div>
</div>
{% else %}
<br/>
<div class="columns">
{% if meme.minted %}
<div class="column">
<a class="button is-info is-12 column">Tip AVAX</a>
</div>
<div class="column">
<a class="button is-info is-12 column">Tip WOWX</a>
</div>
<div class="column">
<a class="button is-info is-12 column">Tip WOW</a>
</div>
{% else %}
<div class="column">
<a class="button is-danger is-12 column" onclick="mint()">Mint</a>
</div>
{% endif %}
</div>
{% endif %}
</div>
</div>
{% endif %}
</div>
</section>
{% include 'includes/footer.html' %}
{% include 'includes/web3.html' %}
<script type="text/javascript">
async function isMinted() {
const ipfsHash = '{{ meme.meta_ipfs_hash }}';
if (ipfsHash != '') {
const tokenId = await contract.methods.metadataTokenId(ipfsHash).call();
console.log(tokenId);
return
}
// if (userProfile.userHandle){document.getElementById('userHandle').innerHTML = userProfile.userHandle};
// if (userProfile.wowneroAddress){document.getElementById('wowneroAddress').innerHTML = userProfile.wowneroAddress};
// if (userProfile.metadataIPFSHash){document.getElementById('metadataIPFSHash').innerHTML = userProfile.metadataIPFSHash};
// if (userProfile.tippedAVAX){document.getElementById('tippedAVAX').innerHTML = userProfile.tippedAVAX};
// document.getElementById('tippedWOWX').innerHTML = 0;
// return
}
async function mint() {
const walletAddress = await getMetamaskAccount();
const gasPrice = await w3.eth.getGasPrice();
const gasLimit = await contract.methods.mint("{{ meme.meta_ipfs_hash }}", "{{ meme.user.public_address }}").estimateGas({from: walletAddress}, function(err, gas){
return gas;
});
try {
notif(`Minting meme "{{ meme.id }}" by "{{ meme.user.handle }} ({{ meme.user.public_address | shorten_address }})" to the Avalanche blockchain.`, 'info');
let res = await contract.methods.mint("{{ meme.meta_ipfs_hash }}", "{{ meme.user.public_address }}").send({
from: walletAddress,
value: 0,
gasPrice: gasPrice,
gas: gasLimit
});
console.log(res);
window.location.href = "";
} catch(e) {
notif(e.message, 'warning');
}
}
</script>
</body>
</html>