mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
fix: auth in extension
This commit is contained in:
parent
deab0568df
commit
a919affca3
5 changed files with 12 additions and 8 deletions
2
apps/extension/.gitignore
vendored
2
apps/extension/.gitignore
vendored
|
|
@ -1,4 +1,6 @@
|
|||
# Logs
|
||||
*.zip
|
||||
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"package": "zip -r extension.zip dist/"
|
||||
},
|
||||
"dependencies": {
|
||||
"@radix-ui/react-tooltip": "^1.0.7",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ function App() {
|
|||
|
||||
if (loginButton) {
|
||||
if (jwt) {
|
||||
fetch('https://anycontext.dhr.wtf/api/me', {
|
||||
fetch('https://supermemory.dhr.wtf/api/me', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${jwt}`,
|
||||
},
|
||||
|
|
@ -43,7 +43,7 @@ function App() {
|
|||
<button
|
||||
onClick={() =>
|
||||
chrome.tabs.create({
|
||||
url: 'https://anycontext.dhr.wtf/api/auth/signin',
|
||||
url: 'https://supermemory.dhr.wtf/api/auth/signin',
|
||||
})
|
||||
}
|
||||
id="login"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
|||
console.error("No JWT found");
|
||||
return;
|
||||
}
|
||||
fetch("https://anycontext.dhr.wtf/api/store", {
|
||||
fetch("https://supermemory.dhr.wtf/api/store", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Authorization": `Bearer ${jwt}`,
|
||||
|
|
@ -33,7 +33,7 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
|||
const jwt = request.jwt;
|
||||
|
||||
(async () => {
|
||||
await fetch("https://anycontext.dhr.wtf/api/ask", {
|
||||
await fetch("https://supermemory.dhr.wtf/api/ask", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Authorization": `Bearer ${jwt}`,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ window.addEventListener('message', (event) => {
|
|||
if (
|
||||
!(
|
||||
window.location.hostname === 'localhost' ||
|
||||
window.location.hostname.endsWith('dhr.wtf')
|
||||
window.location.hostname === 'anycontext.dhr.wtf' ||
|
||||
window.location.hostname === 'supermemory.dhr.wtf'
|
||||
)
|
||||
) {
|
||||
console.log(
|
||||
|
|
@ -35,10 +36,10 @@ import SideBar from './SideBar';
|
|||
// get JWT from local storage
|
||||
const jwt = chrome.storage.local.get('jwt').then((data) => {
|
||||
return data.jwt;
|
||||
}) as Promise<string>
|
||||
}) as Promise<string>;
|
||||
|
||||
jwt.then((jwt) => {
|
||||
ReactDOM.createRoot(
|
||||
document.getElementById('anycontext-app-container')!,
|
||||
).render(<SideBar jwt={jwt} />);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue