diff --git a/tubbymemes/helpers.py b/tubbymemes/helpers.py index 391b560..203bfd0 100644 --- a/tubbymemes/helpers.py +++ b/tubbymemes/helpers.py @@ -30,10 +30,7 @@ def upload_to_ipfs(meme_id: str): 'image': f'ipfs://{artwork_hash}', 'create_date': meme.create_date.strftime('%Y-%m-%d %H:%M:%S'), 'file_name': meme.file_name, - 'ipfs_hash': artwork_hash, - 'properties': { - 'creator_address': meme.user.public_address - } + 'ipfs_hash': artwork_hash } meta_hash = client.add_json(meta) print(f'[+] Uploaded metadata to IPFS: {meta_hash}') diff --git a/tubbymemes/routes/meme.py b/tubbymemes/routes/meme.py index 4cf9064..1a089d0 100644 --- a/tubbymemes/routes/meme.py +++ b/tubbymemes/routes/meme.py @@ -40,9 +40,6 @@ def mod(): @bp.route('/publish', methods=['GET', 'POST']) def publish(): - if not current_user.is_authenticated: - flash('You need to connect your wallet first.', 'warning') - return redirect(url_for('meme.index')) meme = None try: client = ipfsApi.Client('127.0.0.1', 5001) @@ -64,16 +61,19 @@ def publish(): ) full_path = f'{config.DATA_FOLDER}/uploads/{filename}' file.save(full_path) + id = None + if current_user.is_authenticated: + id = current_user.id try: meme = Meme( file_name=filename, title=title, description=description, - user_id=current_user.id + user_id=id ) db.session.add(meme) db.session.commit() - if current_user.verified or current_user.moderator: + if current_user.is_authenticated and (current_user.verified or current_user.moderator): res = upload_to_ipfs(meme.id) meme.meta_ipfs_hash = res[0] meme.meme_ipfs_hash = res[1] diff --git a/tubbymemes/templates/includes/meme_card.html b/tubbymemes/templates/includes/meme_card.html index 7d2df90..6515b1e 100644 --- a/tubbymemes/templates/includes/meme_card.html +++ b/tubbymemes/templates/includes/meme_card.html @@ -27,9 +27,11 @@

{{ meme.title }}

+ {#

({{ meme.user.public_address | shorten_address }})

+ #}
diff --git a/tubbymemes/templates/includes/navbar.html b/tubbymemes/templates/includes/navbar.html index 7f7041b..363fa34 100644 --- a/tubbymemes/templates/includes/navbar.html +++ b/tubbymemes/templates/includes/navbar.html @@ -25,10 +25,10 @@ {% if current_user.moderator %} Mod {% endif %} - New Meme {% else %} - Connect + Connect {% endif %} + New Meme diff --git a/tubbymemes/templates/meme.html b/tubbymemes/templates/meme.html index 3e5e237..3e3c66f 100644 --- a/tubbymemes/templates/meme.html +++ b/tubbymemes/templates/meme.html @@ -36,7 +36,6 @@
-

Poster Address:
{{ meme.user.public_address }}

{% if meme.meta_ipfs_hash %}

Metadata IPFS:
{{ meme.meta_ipfs_hash }}

{% endif %} diff --git a/tubbymemes/templates/publish.html b/tubbymemes/templates/publish.html index fab701b..d81310b 100644 --- a/tubbymemes/templates/publish.html +++ b/tubbymemes/templates/publish.html @@ -15,13 +15,6 @@ -
- -
-

{{ current_user.public_address }}

-
-
-