new thumbor (assets.discours.io -> images.discours.io), new visibility for non published articles (authors -> community)

This commit is contained in:
Igor Lobanov 2023-10-25 22:38:22 +02:00
parent da8ee9b9c3
commit c8a951594c
4 changed files with 7 additions and 7 deletions

View File

@ -10,8 +10,8 @@ TOOLTIP_REGEX = r"(\/\/\/(.+)\/\/\/)"
contentDir = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "..", "..", "discoursio-web", "content"
)
s3 = "https://discours-io.s3.amazonaws.com/"
cdn = "https://assets.discours.io"
cdn = "https://images.discours.io"
def replace_tooltips(body):
@ -311,7 +311,7 @@ def extract_media(entry):
url = m.get("fileUrl") or m.get("url", "")
pic = ""
if m.get("thumborId"):
pic = cdn + "/unsafe/1600x/" + m["thumborId"]
pic = cdn + "/unsafe/" + m["thumborId"]
# url
if not url:

View File

@ -140,10 +140,10 @@ async def migrate(entry, storage):
"authors": [author, ],
"slug": get_shout_slug(entry),
"cover": (
"https://assets.discours.io/unsafe/1600x/" +
"https://images.discours.io/unsafe/" +
entry["thumborId"] if entry.get("thumborId") else entry.get("image", {}).get("url")
),
"visibility": "public" if entry.get("published") else "authors",
"visibility": "public" if entry.get("published") else "community",
"publishedAt": date_parse(entry.get("publishedAt")) if entry.get("published") else None,
"deletedAt": date_parse(entry.get("deletedAt")) if entry.get("deletedAt") else None,
"createdAt": date_parse(entry.get("createdAt", OLD_DATE)),

View File

@ -46,7 +46,7 @@ def migrate(entry):
# userpic
try:
user_dict["userpic"] = (
"https://assets.discours.io/unsafe/100x/"
"https://images.discours.io/unsafe/"
+ entry["profile"]["thumborId"]
)
except KeyError:

File diff suppressed because one or more lines are too long