From 99cb730bc09b7b0e0612c950b31f28b53bcf08c4 Mon Sep 17 00:00:00 2001 From: pluja Date: Wed, 11 Jun 2025 10:39:20 +0000 Subject: [PATCH] Release 202506111039 --- pyworker/pyworker/database.py | 36 ++++++++++++++------------ web/src/constants/eventTypes.ts | 9 +++++++ web/src/pages/service/[slug].astro | 41 +++++++++++++++--------------- 3 files changed, 50 insertions(+), 36 deletions(-) diff --git a/pyworker/pyworker/database.py b/pyworker/pyworker/database.py index 597914a..3218a79 100644 --- a/pyworker/pyworker/database.py +++ b/pyworker/pyworker/database.py @@ -333,28 +333,32 @@ def remove_service_attribute_by_slug(service_id: int, attribute_slug: str) -> bo def save_tos_review(service_id: int, review: Optional[TosReviewType]): - """ - Save a TOS review for a specific service. + """Persist a TOS review and/or update the timestamp for a service. - Args: - service_id: The ID of the service. - review: A TypedDict containing the review data. + If *review* is ``None`` the existing review (if any) is preserved while + only the ``tosReviewAt`` column is updated. This ensures we still track + when the review task last ran even if the review generation failed or + produced no changes. """ try: - # Only serialize to JSON if review is not None - review_json = json.dumps(review) if review is not None else None with get_db_connection() as conn: with conn.cursor(row_factory=dict_row) as cursor: - cursor.execute( - """ - UPDATE "Service" - SET "tosReview" = %s, "tosReviewAt" = NOW() - WHERE id = %s - """, - (review_json, service_id), - ) + if review is None: + cursor.execute( + 'UPDATE "Service" SET "tosReviewAt" = NOW() WHERE id = %s AND "tosReview" IS NULL', + (service_id,), + ) + else: + review_json = json.dumps(review) + cursor.execute( + 'UPDATE "Service" SET "tosReview" = %s, "tosReviewAt" = NOW() WHERE id = %s', + (review_json, service_id), + ) + conn.commit() - logger.info(f"Successfully saved TOS review for service {service_id}") + logger.info( + f"Successfully saved TOS review (updated={review is not None}) for service {service_id}" + ) except Exception as e: logger.error(f"Error saving TOS review for service {service_id}: {e}") diff --git a/web/src/constants/eventTypes.ts b/web/src/constants/eventTypes.ts index c8fbdb7..20039a5 100644 --- a/web/src/constants/eventTypes.ts +++ b/web/src/constants/eventTypes.ts @@ -11,6 +11,7 @@ type EventTypeInfo = { description: string classNames: { dot: string + banner?: string } icon: string color: TailwindColor @@ -34,6 +35,7 @@ export const { description: '', classNames: { dot: 'bg-zinc-700 text-zinc-300 ring-zinc-700/50', + banner: 'bg-zinc-900/50 text-zinc-300 hover:bg-zinc-800/60 focus-visible:bg-zinc-800/60', }, icon: 'ri:question-fill', color: 'gray', @@ -48,6 +50,7 @@ export const { description: 'Potential issues that users should be aware of', classNames: { dot: 'bg-amber-900 text-amber-300 ring-amber-900/50', + banner: 'bg-yellow-900/50 text-yellow-300 hover:bg-yellow-800/60 focus-visible:bg-yellow-800/60', }, icon: 'ri:alert-fill', color: 'yellow', @@ -61,6 +64,7 @@ export const { description: 'A previously reported warning has been solved', classNames: { dot: 'bg-amber-900 text-amber-300 ring-amber-900/50', + banner: 'bg-yellow-900/50 text-yellow-300 hover:bg-yellow-800/60 focus-visible:bg-yellow-800/60', }, icon: 'ri:alert-fill', color: 'green', @@ -74,6 +78,7 @@ export const { description: 'Critical issues affecting service functionality', classNames: { dot: 'bg-red-900 text-red-300 ring-red-900/50', + banner: 'bg-red-900/50 text-red-300 hover:bg-red-800/60 focus-visible:bg-red-800/60', }, icon: 'ri:spam-fill', color: 'red', @@ -87,6 +92,7 @@ export const { description: 'A previously reported alert has been solved', classNames: { dot: 'bg-red-900 text-red-300 ring-red-900/50', + banner: 'bg-red-900/50 text-red-300 hover:bg-red-800/60 focus-visible:bg-red-800/60', }, icon: 'ri:spam-fill', color: 'green', @@ -100,6 +106,7 @@ export const { description: 'General information about the service', classNames: { dot: 'bg-blue-900 text-blue-300 ring-blue-900/50', + banner: 'bg-blue-900/50 text-blue-300 hover:bg-blue-800/60 focus-visible:bg-blue-800/60', }, icon: 'ri:information-fill', color: 'sky', @@ -113,6 +120,7 @@ export const { description: 'Regular service update or announcement', classNames: { dot: 'bg-zinc-700 text-zinc-300 ring-zinc-700/50', + banner: 'bg-zinc-900/50 text-zinc-300 hover:bg-zinc-800/60 focus-visible:bg-zinc-800/60', }, icon: 'ri:notification-fill', color: 'green', @@ -126,6 +134,7 @@ export const { description: 'Service details were updated on kycnot.me', classNames: { dot: 'bg-sky-900 text-sky-300 ring-sky-900/50', + banner: 'bg-sky-900/50 text-sky-300 hover:bg-sky-800/60 focus-visible:bg-sky-800/60', }, icon: 'ri:pencil-fill', color: 'sky', diff --git a/web/src/pages/service/[slug].astro b/web/src/pages/service/[slug].astro index 7e0ee0a..0d49e9e 100644 --- a/web/src/pages/service/[slug].astro +++ b/web/src/pages/service/[slug].astro @@ -407,9 +407,12 @@ const ogImageTemplateData = { const serviceVisibilityInfo = getServiceVisibilityInfo(service.serviceVisibility) -const activeAlertOrWarningEvents = service.events.filter( - (event) => getEventTypeInfo(event.type).showBanner && (event.endedAt === null || event.endedAt >= now) -) +const activeAlertOrWarningEvents = service.events + .map((event) => ({ + ...event, + typeInfo: getEventTypeInfo(event.type), + })) + .filter((event) => event.typeInfo.showBanner && (event.endedAt === null || event.endedAt >= now)) const activeEventToShow = activeAlertOrWarningEvents.find((event) => event.type === EventType.ALERT) ?? activeAlertOrWarningEvents[0] --- @@ -518,15 +521,10 @@ const activeEventToShow = href="#events" class={cn( 'group mb-4 block rounded-md px-3 py-2 text-sm transition-colors duration-200', - activeEventToShow.type === EventType.ALERT - ? 'bg-red-900/50 text-red-300 hover:bg-red-800/60 focus-visible:bg-red-800/60' - : 'bg-yellow-900/50 text-yellow-300 hover:bg-yellow-800/60 focus-visible:bg-yellow-800/60' + activeEventToShow.typeInfo.classNames.banner )} > - + {activeEventToShow.title} — {activeEventToShow.content} {activeAlertOrWarningEvents.length >= 2 && <>+{activeAlertOrWarningEvents.length - 1} more events.} Go to events @@ -1070,6 +1068,9 @@ const activeEventToShow = ) } +

+ Overall = 60% Privacy + 40% Trust (Rounded) +

@@ -1194,15 +1195,15 @@ const activeEventToShow =

Maybe due to captchas, client side rendering, DDoS protections, or non-text format.

- {service.tosUrls.length > 0 && ( -

- {service.tosUrls.map((url) => ( - - {urlDomain(url)} - - ))} -

- )} +

+ Reviewed + {service.tosUrls.length > 0 && 'from'} + {service.tosUrls.map((url) => ( + + {urlDomain(url)} + + ))} +

) ) : (