);
}
diff --git a/apps/extension/content/content.tsx b/apps/extension/content/content.tsx
index df66cab0..bacb79c0 100644
--- a/apps/extension/content/content.tsx
+++ b/apps/extension/content/content.tsx
@@ -31,7 +31,7 @@ function initial() {
// Create a new div element to host the shadow root.
// Styles for this div is in `content/content.css`
const hostDiv = document.createElement("div");
- hostDiv.id = "extension-host";
+ hostDiv.id = "supermemory-extension-host";
document.body.appendChild(hostDiv);
// Attach the shadow DOM to the hostDiv and set the mode to
@@ -41,11 +41,40 @@ function initial() {
// Create a new div element that will be the root container for the React app
const rootDiv = document.createElement("div");
- rootDiv.id = "extension-root";
+ rootDiv.id = "supermemory-extension-root";
shadowRoot.appendChild(rootDiv);
appendTailwindStyleLink(shadowRoot);
const root = ReactDOM.createRoot(rootDiv);
- root.render();
+
+ const jwt = chrome.storage.local.get("jwt").then((data) => {
+ return data.jwt;
+ }) as Promise;
+
+ jwt.then((token) => root.render());
}
+
+window.addEventListener("message", (event) => {
+ if (event.source !== window) {
+ return;
+ }
+ const jwt = event.data.token;
+
+ if (jwt) {
+ if (
+ !(
+ window.location.hostname === "localhost" ||
+ window.location.hostname === "supermemory.ai" ||
+ window.location.hostname === "beta.supermemory.ai"
+ )
+ ) {
+ console.log(
+ "JWT is only allowed to be used on localhost or anycontext.dhr.wtf",
+ );
+ return;
+ }
+
+ chrome.storage.local.set({ jwt }, () => {});
+ }
+});
diff --git a/apps/extension/manifest.json b/apps/extension/manifest.json
index 72e26344..b898cb0b 100644
--- a/apps/extension/manifest.json
+++ b/apps/extension/manifest.json
@@ -1,8 +1,8 @@
{
"manifest_version": 3,
"version": "1.0",
- "name": "content-shadow-dom-tailwind",
- "description": "An extension template using React and TypeScript. This template includes a content script using Tailwind.css. To see it in action, visit https://docs.extensioncreate.com.",
+ "name": "supermemory",
+ "description": "An extension for https://supermemory.ai - an AI hub for all your bookmarks.",
"background": {
"service_worker": "./background.ts"
},
@@ -21,5 +21,7 @@
"resources": ["public/*"],
"matches": ["http://*/*", "https://*/*"]
}
- ]
+ ],
+ "permissions": ["webRequest", "storage"],
+ "host_permissions": ["https://x.com/*", "https://twitter.com/*"]
}
diff --git a/apps/web/app/(dash)/home/homeVariants.ts b/apps/web/app/(dash)/home/homeVariants.ts
index ec24e22b..cc533fc4 100644
--- a/apps/web/app/(dash)/home/homeVariants.ts
+++ b/apps/web/app/(dash)/home/homeVariants.ts
@@ -44,7 +44,7 @@ export const variants = [
},
{
type: "highlighted",
- content: " digital treasures.",
+ content: " digital treasure.",
},
],
];
diff --git a/apps/web/app/(dash)/home/page.tsx b/apps/web/app/(dash)/home/page.tsx
index 4f7e4af6..f648923c 100644
--- a/apps/web/app/(dash)/home/page.tsx
+++ b/apps/web/app/(dash)/home/page.tsx
@@ -3,7 +3,7 @@
import React, { useEffect, useState } from "react";
import QueryInput from "./queryinput";
import { homeSearchParamsCache } from "@/lib/searchParams";
-import { getSpaces } from "@/app/actions/fetchers";
+import { getSessionAuthToken, getSpaces } from "@/app/actions/fetchers";
import { useRouter } from "next/navigation";
import { createChatThread, linkTelegramToUser } from "@/app/actions/doers";
import { toast } from "sonner";
@@ -67,6 +67,11 @@ function Page({
});
setShowVariant(Math.floor(Math.random() * variants.length));
+
+ getSessionAuthToken().then((token) => {
+ if (typeof window === "undefined") return;
+ window.postMessage({ token: token.data }, "*");
+ });
}, []);
return (
diff --git a/apps/web/app/(dash)/memories/page.tsx b/apps/web/app/(dash)/memories/page.tsx
index cb3825e7..380a653e 100644
--- a/apps/web/app/(dash)/memories/page.tsx
+++ b/apps/web/app/(dash)/memories/page.tsx
@@ -1,18 +1,19 @@
"use client";
import { getAllUserMemoriesAndSpaces } from "@/app/actions/fetchers";
-import { Space } from "@/app/actions/types";
import { Content, StoredSpace } from "@/server/db/schema";
-import { NextIcon, SearchIcon, UrlIcon } from "@repo/ui/icons";
+import { MemoriesIcon, NextIcon, SearchIcon, UrlIcon } from "@repo/ui/icons";
+import { NotebookIcon, PaperclipIcon } from "lucide-react";
import Image from "next/image";
+import Link from "next/link";
import React, { useEffect, useMemo, useState } from "react";
import Masonry from "react-layout-masonry";
+import { getRawTweet } from "@repo/shared-types/utils";
+import { MyTweet } from "./render-tweet";
function Page() {
const [filter, setFilter] = useState("All");
- const [search, setSearch] = useState("");
-
const [memoriesAndSpaces, setMemoriesAndSpaces] = useState<{
memories: Content[];
spaces: StoredSpace[];
@@ -55,9 +56,13 @@ function Page() {
return (
item.item === "memory" && (item.data as Content).type === "note"
);
+ if (filter === "Tweet")
+ return (
+ item.item === "memory" && (item.data as Content).type === "tweet"
+ );
return false;
})
- .sort((a, b) => a.date - b.date);
+ .sort((a, b) => b.date - a.date);
}, [memoriesAndSpaces.memories, memoriesAndSpaces.spaces, filter]);
useEffect(() => {
@@ -69,7 +74,7 @@ function Page() {
}, []);
return (
-
+
My Memories
@@ -79,7 +84,7 @@ function Page() {
{sortedItems.map((item) => {
if (item.item === "memory") {
@@ -88,12 +93,15 @@ function Page() {
type={(item.data as Content).type ?? "note"}
content={(item.data as Content).content}
title={(item.data as Content).title ?? "Untitled"}
- url={(item.data as Content).url}
+ url={
+ (item.data as Content).baseUrl ?? (item.data as Content).url
+ }
image={
(item.data as Content).ogImage ??
(item.data as Content).image ??
"/placeholder-image.svg" // TODO: add this placeholder
}
+ description={(item.data as Content).description ?? ""}
/>
);
}
@@ -123,47 +131,73 @@ function TabComponent({
}) {
// TODO: Display the space name and desription which is the number of elemenet in the space
return (
-
-
-
- {title.slice(0, 2).toUpperCase()}
+
+
+ Space
+
+
+
+
+ {title.slice(0, 2).toUpperCase()}
+
+
+
+
{title}
+
{description}
+
+
+
-
-
-
{title}
-
{description}
-
-
-
);
}
-function LinkComponent({
+export function LinkComponent({
type,
content,
title,
url,
image,
+ description,
}: {
type: string;
content: string;
title: string;
url: string;
image?: string;
+ description: string;
}) {
// TODO: DISPLAY THE ITEM BASED ON `type` being note or page
return (
-