feat/show reblog

This commit is contained in:
SouthFox 2022-09-19 22:44:22 +08:00
parent 392e82f7d8
commit 6dfc26e6ba
2 changed files with 17 additions and 3 deletions

View file

@ -5,6 +5,9 @@
<div class="toot"> <div class="toot">
<div class="status"> <div class="status">
<div class="meta"> <div class="meta">
{% if toot.is_reblog%}
<small><span>转嘟了<i class="fa-solid fa-retweet"></i></span></small>
{% endif %}
<strong><span class ="username">{{ toot.acct }}</span></strong> <strong><span class ="username">{{ toot.acct }}</span></strong>
<a href="{{ toot.url }}" target="_blank" <a href="{{ toot.url }}" target="_blank"
rel="noopener noreferrer"> rel="noopener noreferrer">

View file

@ -3,7 +3,7 @@ import os
from flask import render_template, request, url_for, redirect, flash from flask import render_template, request, url_for, redirect, flash
from BDSM import app, db from BDSM import app, db
from BDSM.models import Media, Settings, Toot, Emoji from BDSM.models import Media, Settings, Toot, Emoji, Reblog
from BDSM.toot import app_register, archive_toot from BDSM.toot import app_register, archive_toot
from mastodon import Mastodon from mastodon import Mastodon
from types import SimpleNamespace from types import SimpleNamespace
@ -16,8 +16,19 @@ def index():
for toot_ in toots_.items: for toot_ in toots_.items:
toot = SimpleNamespace(**toot_.__dict__) toot = SimpleNamespace(**toot_.__dict__)
if toot.content == None: print(toot.reblog_id)
continue if toot.reblog_id != None:
if toot.reblog_myself:
toot = Toot.query.get(toot.reblog_id)
toot = SimpleNamespace(**toot.__dict__)
toot.is_reblog = True
else:
print('---\n\n\n----')
toot = Reblog.query.get(toot.reblog_id)
toot = SimpleNamespace(**toot.__dict__)
toot.is_reblog = True
print(toot)
if toot.media_list != "": if toot.media_list != "":
toot.medias = [] toot.medias = []