Commit 3b2bb515 authored by Grant's avatar Grant
Browse files

wrong environment variable

parent 0f61447c
Loading
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ import { APub } from "../lib/apub/utils.js";
import { USER_IDENTIFIER } from "../lib/apub/federation.js";
import { Temporal } from "@js-temporal/polyfill";
import { stripHtml } from "string-strip-html";
import { Handoff } from "./index.js";

type Message = Note | ChatMessage;

@@ -39,7 +40,7 @@ export class HandoffActivityPub {
              name: actor.id!.toString(),
            }),
          ],
        })
        }),
      );
    }

@@ -56,20 +57,20 @@ export class HandoffActivityPub {
          published: Temporal.Instant.from(handoff.createdAt.toISOString()),
          replyTarget: object,
          content: handoff.getURL().toString(),
        })
        }),
      );
    }
  }

  isObjectValid(
    object: Message
    object: Message,
  ): { valid: false } | { valid: true; software: string } {
    const TOKEN = process.env.AUTOMATED_EXCHANGE_TOKEN;
    const TOKEN = Handoff.HANDOFF_TOKEN;

    if (!TOKEN) return { valid: false };

    const content = stripHtml(
      object.content?.toString() || object.contents[0]?.toString()
      object.content?.toString() || object.contents[0]?.toString(),
    ).result;

    if (content.indexOf(TOKEN) === -1) return { valid: false };