mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-04 08:13:34 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b47557f40 | ||
|
|
13ea7c192e | ||
|
|
0d6bee2025 | ||
|
|
fba950aeb5 | ||
|
|
a047f913b4 | ||
|
|
44805ce481 | ||
|
|
a8eec32842 |
No files matched your search
+1
-1
@@ -284,7 +284,7 @@ export function useNewProviderOAuth() {
|
||||
redirectUri: window.location.origin + '/oauth/newprovider',
|
||||
usePKCE: false, // Set to true if provider supports PKCE
|
||||
getUserInfo: async (accessToken: string, corsProxy: string) => {
|
||||
const userUrl = proxyUrl(corsProxy, 'https://api.provider.com/user');
|
||||
const userUrl = proxyUrl({ template: corsProxy, url: 'https://api.provider.com/user' });
|
||||
const userResponse = await fetch(userUrl, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
|
||||
Generated
+336
-36
@@ -20,6 +20,7 @@
|
||||
"@mozilla/readability": "^0.6.0",
|
||||
"@nostrify/nostrify": "^0.48.2",
|
||||
"@nostrify/react": "^0.2.20",
|
||||
"@opensecret/react": "^1.5.4",
|
||||
"@radix-ui/react-accordion": "^1.2.0",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.1",
|
||||
"@radix-ui/react-aspect-ratio": "^1.1.0",
|
||||
@@ -195,7 +196,6 @@
|
||||
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.27.1",
|
||||
"@babel/generator": "^7.28.5",
|
||||
@@ -1831,7 +1831,6 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
@@ -1855,7 +1854,6 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
@@ -1877,7 +1875,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz",
|
||||
"integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@dnd-kit/accessibility": "^3.1.1",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
@@ -3024,6 +3021,173 @@
|
||||
"resolved": "https://registry.npmjs.org/@nostrify/types/-/types-0.36.8.tgz",
|
||||
"integrity": "sha512-tmpz5pkU8oXu7+V1qxvAzuoo8s5x4Gvo7h+JRm+JAW6x/2VZ8aQoA54yhn89qZ9agciMJhVdhqCm1PlK55w17A=="
|
||||
},
|
||||
"node_modules/@opensecret/react": {
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/@opensecret/react/-/react-1.5.4.tgz",
|
||||
"integrity": "sha512-nIrb1NfKIJ1G8IK+b8OnjXvPgc/C3GkLVbZVF9HCh6WBDV2yimg8B7Eo6Pqu5mUtiFrQslFL9UbeDj4Py0mbGA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@peculiar/x509": "^1.12.2",
|
||||
"@stablelib/base64": "^2.0.0",
|
||||
"@stablelib/chacha20poly1305": "^2.0.0",
|
||||
"@stablelib/random": "^2.0.0",
|
||||
"cbor2": "^1.7.0",
|
||||
"tweetnacl": "^1.0.3",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.0.0 || ^19.0.0",
|
||||
"react-dom": "^18.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@peculiar/asn1-cms": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/asn1-cms/-/asn1-cms-2.6.0.tgz",
|
||||
"integrity": "sha512-2uZqP+ggSncESeUF/9Su8rWqGclEfEiz1SyU02WX5fUONFfkjzS2Z/F1Li0ofSmf4JqYXIOdCAZqIXAIBAT1OA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-schema": "^2.6.0",
|
||||
"@peculiar/asn1-x509": "^2.6.0",
|
||||
"@peculiar/asn1-x509-attr": "^2.6.0",
|
||||
"asn1js": "^3.0.6",
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@peculiar/asn1-csr": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/asn1-csr/-/asn1-csr-2.6.0.tgz",
|
||||
"integrity": "sha512-BeWIu5VpTIhfRysfEp73SGbwjjoLL/JWXhJ/9mo4vXnz3tRGm+NGm3KNcRzQ9VMVqwYS2RHlolz21svzRXIHPQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-schema": "^2.6.0",
|
||||
"@peculiar/asn1-x509": "^2.6.0",
|
||||
"asn1js": "^3.0.6",
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@peculiar/asn1-ecc": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.6.0.tgz",
|
||||
"integrity": "sha512-FF3LMGq6SfAOwUG2sKpPXblibn6XnEIKa+SryvUl5Pik+WR9rmRA3OCiwz8R3lVXnYnyRkSZsSLdml8H3UiOcw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-schema": "^2.6.0",
|
||||
"@peculiar/asn1-x509": "^2.6.0",
|
||||
"asn1js": "^3.0.6",
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@peculiar/asn1-pfx": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pfx/-/asn1-pfx-2.6.0.tgz",
|
||||
"integrity": "sha512-rtUvtf+tyKGgokHHmZzeUojRZJYPxoD/jaN1+VAB4kKR7tXrnDCA/RAWXAIhMJJC+7W27IIRGe9djvxKgsldCQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-cms": "^2.6.0",
|
||||
"@peculiar/asn1-pkcs8": "^2.6.0",
|
||||
"@peculiar/asn1-rsa": "^2.6.0",
|
||||
"@peculiar/asn1-schema": "^2.6.0",
|
||||
"asn1js": "^3.0.6",
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@peculiar/asn1-pkcs8": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs8/-/asn1-pkcs8-2.6.0.tgz",
|
||||
"integrity": "sha512-KyQ4D8G/NrS7Fw3XCJrngxmjwO/3htnA0lL9gDICvEQ+GJ+EPFqldcJQTwPIdvx98Tua+WjkdKHSC0/Km7T+lA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-schema": "^2.6.0",
|
||||
"@peculiar/asn1-x509": "^2.6.0",
|
||||
"asn1js": "^3.0.6",
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@peculiar/asn1-pkcs9": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs9/-/asn1-pkcs9-2.6.0.tgz",
|
||||
"integrity": "sha512-b78OQ6OciW0aqZxdzliXGYHASeCvvw5caqidbpQRYW2mBtXIX2WhofNXTEe7NyxTb0P6J62kAAWLwn0HuMF1Fw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-cms": "^2.6.0",
|
||||
"@peculiar/asn1-pfx": "^2.6.0",
|
||||
"@peculiar/asn1-pkcs8": "^2.6.0",
|
||||
"@peculiar/asn1-schema": "^2.6.0",
|
||||
"@peculiar/asn1-x509": "^2.6.0",
|
||||
"@peculiar/asn1-x509-attr": "^2.6.0",
|
||||
"asn1js": "^3.0.6",
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@peculiar/asn1-rsa": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/asn1-rsa/-/asn1-rsa-2.6.0.tgz",
|
||||
"integrity": "sha512-Nu4C19tsrTsCp9fDrH+sdcOKoVfdfoQQ7S3VqjJU6vedR7tY3RLkQ5oguOIB3zFW33USDUuYZnPEQYySlgha4w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-schema": "^2.6.0",
|
||||
"@peculiar/asn1-x509": "^2.6.0",
|
||||
"asn1js": "^3.0.6",
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@peculiar/asn1-schema": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.6.0.tgz",
|
||||
"integrity": "sha512-xNLYLBFTBKkCzEZIw842BxytQQATQv+lDTCEMZ8C196iJcJJMBUZxrhSTxLaohMyKK8QlzRNTRkUmanucnDSqg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"asn1js": "^3.0.6",
|
||||
"pvtsutils": "^1.3.6",
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@peculiar/asn1-x509": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/asn1-x509/-/asn1-x509-2.6.0.tgz",
|
||||
"integrity": "sha512-uzYbPEpoQiBoTq0/+jZtpM6Gq6zADBx+JNFP3yqRgziWBxQ/Dt/HcuvRfm9zJTPdRcBqPNdaRHTVwpyiq6iNMA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-schema": "^2.6.0",
|
||||
"asn1js": "^3.0.6",
|
||||
"pvtsutils": "^1.3.6",
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@peculiar/asn1-x509-attr": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-attr/-/asn1-x509-attr-2.6.0.tgz",
|
||||
"integrity": "sha512-MuIAXFX3/dc8gmoZBkwJWxUWOSvG4MMDntXhrOZpJVMkYX+MYc/rUAU2uJOved9iJEoiUx7//3D8oG83a78UJA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-schema": "^2.6.0",
|
||||
"@peculiar/asn1-x509": "^2.6.0",
|
||||
"asn1js": "^3.0.6",
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@peculiar/x509": {
|
||||
"version": "1.14.3",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.14.3.tgz",
|
||||
"integrity": "sha512-C2Xj8FZ0uHWeCXXqX5B4/gVFQmtSkiuOolzAgutjTfseNOHT3pUjljDZsTSxXFGgio54bCzVFqmEOUrIVk8RDA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-cms": "^2.6.0",
|
||||
"@peculiar/asn1-csr": "^2.6.0",
|
||||
"@peculiar/asn1-ecc": "^2.6.0",
|
||||
"@peculiar/asn1-pkcs9": "^2.6.0",
|
||||
"@peculiar/asn1-rsa": "^2.6.0",
|
||||
"@peculiar/asn1-schema": "^2.6.0",
|
||||
"@peculiar/asn1-x509": "^2.6.0",
|
||||
"pvtsutils": "^1.3.6",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"tslib": "^2.8.1",
|
||||
"tsyringe": "^4.10.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@pkgjs/parseargs": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
|
||||
@@ -5039,6 +5203,89 @@
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@stablelib/aead": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@stablelib/aead/-/aead-2.0.0.tgz",
|
||||
"integrity": "sha512-U/RMANRxbT/ahIpYsPSiFwDFNjADHdnCFfmo09MO1ai2XmerPAOPtMl0qmX7XVvygnACC6ijKDyHBoT2rGyElg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@stablelib/base64": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@stablelib/base64/-/base64-2.0.1.tgz",
|
||||
"integrity": "sha512-P2z89A7N1ETt6RxgpVdDT2xlg8cnm3n6td0lY9gyK7EiWK3wdq388yFX/hLknkCC0we05OZAD1rfxlQJUbl5VQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@stablelib/binary": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@stablelib/binary/-/binary-2.0.1.tgz",
|
||||
"integrity": "sha512-U9iAO8lXgEDONsA0zPPSgcf3HUBNAqHiJmSHgZz62OvC3Hi2Bhc5kTnQ3S1/L+sthDTHtCMhcEiklmIly6uQ3w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@stablelib/int": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@stablelib/chacha": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@stablelib/chacha/-/chacha-2.0.1.tgz",
|
||||
"integrity": "sha512-lS1FqtNqofxe2vLkRsLli2m3x/XanUyAYRphLhdHumKeIsLbjbCXdCq3Pf/eWiO7G3QlSG5ViqnoVjktzfLWMg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@stablelib/binary": "^2.0.1",
|
||||
"@stablelib/wipe": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@stablelib/chacha20poly1305": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@stablelib/chacha20poly1305/-/chacha20poly1305-2.0.1.tgz",
|
||||
"integrity": "sha512-kOoBsXbDPVRlelzXl+5WViycgM19lD7lF3Bc3KWI+DzId0Stc2HlxAfSc+Xpn3RgqSCl1ZNTXr33LegqBhBBaw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@stablelib/aead": "^2.0.0",
|
||||
"@stablelib/binary": "^2.0.1",
|
||||
"@stablelib/chacha": "^2.0.1",
|
||||
"@stablelib/constant-time": "^2.0.1",
|
||||
"@stablelib/poly1305": "^2.0.1",
|
||||
"@stablelib/wipe": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@stablelib/constant-time": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@stablelib/constant-time/-/constant-time-2.0.1.tgz",
|
||||
"integrity": "sha512-0NWPogffRm+UWBH0+iM5otZmNrVe5OHFIvyoNIVankMAYOQzMwcdVALOVPrB5Ho0dST+Oc3H8/hPh65Z8R/uew==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@stablelib/int": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@stablelib/int/-/int-2.0.1.tgz",
|
||||
"integrity": "sha512-Ht63fQp3wz/F8U4AlXEPb7hfJOIILs8Lq55jgtD7KueWtyjhVuzcsGLSTAWtZs3XJDZYdF1WcSKn+kBtbzupww==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@stablelib/poly1305": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@stablelib/poly1305/-/poly1305-2.0.1.tgz",
|
||||
"integrity": "sha512-D8xfZcL/5zeVARJ9I2fZOUCnZvsJx8G4JDQvD+ecsnaCildPtqZDwqqjtOc4cfHAdScrMjOzUVsssjXUTBw3YQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@stablelib/constant-time": "^2.0.1",
|
||||
"@stablelib/wipe": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@stablelib/random": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@stablelib/random/-/random-2.0.1.tgz",
|
||||
"integrity": "sha512-W6GAtXEEs7r+dSbuBsvoFmlyL3gLxle41tQkjKu17dDWtDdjhVUbtRfRCQcCUeczwkgjQxMPopgwYEvxXtHXGw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@stablelib/binary": "^2.0.1",
|
||||
"@stablelib/wipe": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@stablelib/wipe": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@stablelib/wipe/-/wipe-2.0.1.tgz",
|
||||
"integrity": "sha512-1eU2K9EgOcV4qc9jcP6G72xxZxEm5PfeI5H55l08W95b4oRJaqhmlWRc4xZAm6IVSKhVNxMi66V67hCzzuMTAg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@std/encoding": {
|
||||
"name": "@jsr/std__encoding",
|
||||
"version": "1.0.10",
|
||||
@@ -5446,7 +5693,8 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz",
|
||||
"integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@types/chrome": {
|
||||
"version": "0.0.74",
|
||||
@@ -5658,7 +5906,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.20.tgz",
|
||||
"integrity": "sha512-IPaCZN7PShZK/3t6Q87pfTkRm6oLTd4vztyoj+cbHUF1g3FfVb2tFIL79uCRKEfv16AhqDMBywP2VW3KIZUvcg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/prop-types": "*",
|
||||
"csstype": "^3.0.2"
|
||||
@@ -5670,7 +5917,6 @@
|
||||
"integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"@types/react": "^18.0.0"
|
||||
}
|
||||
@@ -5754,7 +6000,6 @@
|
||||
"integrity": "sha512-oU/OtYVydhXnumd0BobL9rkJg7wFJ9bFFPmSmB/bf/XWN85hlViji59ko6bSKBXyseT9V8l+CN1nwmlbiN0G7Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.31.1",
|
||||
"@typescript-eslint/types": "8.31.1",
|
||||
@@ -6114,7 +6359,6 @@
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
|
||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -6324,6 +6568,20 @@
|
||||
"integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/asn1js": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmjs.org/asn1js/-/asn1js-3.0.7.tgz",
|
||||
"integrity": "sha512-uLvq6KJu04qoQM6gvBfKFjlh6Gl0vOKQuR5cJMDHQkmwfMOQeN3F3SHCv9SNYSL+CRoHvOGFfllDlVz03GQjvQ==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"pvtsutils": "^1.3.6",
|
||||
"pvutils": "^1.1.3",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/assertion-error": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
|
||||
@@ -6629,7 +6887,6 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"baseline-browser-mapping": "^2.8.19",
|
||||
"caniuse-lite": "^1.0.30001751",
|
||||
@@ -6790,6 +7047,15 @@
|
||||
],
|
||||
"license": "CC-BY-4.0"
|
||||
},
|
||||
"node_modules/cbor2": {
|
||||
"version": "1.12.0",
|
||||
"resolved": "https://registry.npmjs.org/cbor2/-/cbor2-1.12.0.tgz",
|
||||
"integrity": "sha512-3Cco8XQhi27DogSp9Ri6LYNZLi/TBY/JVnDe+mj06NkBjW/ZYOtekaEU4wZ4xcRMNrFkDv8KNtOAqHyDfz3lYg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18.7"
|
||||
}
|
||||
},
|
||||
"node_modules/ccount": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz",
|
||||
@@ -6859,7 +7125,6 @@
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
|
||||
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
@@ -7619,7 +7884,8 @@
|
||||
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz",
|
||||
"integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/dom-helpers": {
|
||||
"version": "5.2.1",
|
||||
@@ -7684,8 +7950,7 @@
|
||||
"version": "8.6.0",
|
||||
"resolved": "https://registry.npmjs.org/embla-carousel/-/embla-carousel-8.6.0.tgz",
|
||||
"integrity": "sha512-SjWyZBHJPbqxHOzckOfo8lHisEaJWmwd23XppYFYVh10bU66/Pn5tkVkbkCMZVdbUE5eTCI2nD8OyIP4Z+uwkA==",
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/embla-carousel-react": {
|
||||
"version": "8.6.0",
|
||||
@@ -7971,7 +8236,6 @@
|
||||
"integrity": "sha512-QldCVh/ztyKJJZLr4jXNUByx3gR+TDYZCRXEktiZoUR3PGy4qCmSbkxcIle8GEwGpb5JBZazlaJ/CxLidXdEbQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.12.1",
|
||||
@@ -8237,7 +8501,6 @@
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz",
|
||||
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"accepts": "^2.0.0",
|
||||
"body-parser": "^2.2.0",
|
||||
@@ -9211,9 +9474,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/hono": {
|
||||
"version": "4.11.1",
|
||||
"resolved": "https://registry.npmjs.org/hono/-/hono-4.11.1.tgz",
|
||||
"integrity": "sha512-KsFcH0xxHes0J4zaQgWbYwmz3UPOOskdqZmItstUG93+Wk1ePBLkLGwbP9zlmh1BFUiL8Qp+Xfu9P7feJWpGNg==",
|
||||
"version": "4.11.4",
|
||||
"resolved": "https://registry.npmjs.org/hono/-/hono-4.11.4.tgz",
|
||||
"integrity": "sha512-U7tt8JsyrxSRKspfhtLET79pU8K+tInj5QZXs1jSugO1Vq5dFj3kmZsRldo29mTBfcjDRVRXrEZ6LS63Cog9ZA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
@@ -9335,7 +9598,6 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.27.6"
|
||||
},
|
||||
@@ -10129,7 +10391,6 @@
|
||||
"integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"cssstyle": "^4.2.1",
|
||||
"data-urls": "^5.0.0",
|
||||
@@ -10514,6 +10775,7 @@
|
||||
"integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"lz-string": "bin/bin.js"
|
||||
}
|
||||
@@ -12267,7 +12529,6 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.8",
|
||||
"picocolors": "^1.1.1",
|
||||
@@ -12435,6 +12696,7 @@
|
||||
"integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1",
|
||||
"ansi-styles": "^5.0.0",
|
||||
@@ -12450,6 +12712,7 @@
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
@@ -12460,6 +12723,7 @@
|
||||
"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
@@ -12472,7 +12736,8 @@
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
|
||||
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/prismjs": {
|
||||
"version": "1.30.0",
|
||||
@@ -12539,6 +12804,24 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/pvtsutils": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.3.6.tgz",
|
||||
"integrity": "sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
},
|
||||
"node_modules/pvutils": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.1.5.tgz",
|
||||
"integrity": "sha512-KTqnxsgGiQ6ZAzZCVlJH5eOjSnvlyEgx1m8bkRJfOhmGRqfo5KLvmAlACQkrjEtOQ4B7wF9TdSLIs9O90MX9xA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/qrcode": {
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
|
||||
@@ -12646,7 +12929,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
||||
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0"
|
||||
},
|
||||
@@ -12673,7 +12955,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
|
||||
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0",
|
||||
"scheduler": "^0.23.2"
|
||||
@@ -12699,7 +12980,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.56.1.tgz",
|
||||
"integrity": "sha512-qWAVokhSpshhcEuQDSANHx3jiAEFzu2HAaaQIzi/r9FNPm1ioAvuJSD4EuZzWd7Al7nTRKcKPnBKO7sRn+zavQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
@@ -12748,7 +13028,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz",
|
||||
"integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/hast": "^3.0.0",
|
||||
"@types/mdast": "^4.0.0",
|
||||
@@ -12994,6 +13273,12 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/reflect-metadata": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz",
|
||||
"integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/reflect.getprototypeof": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz",
|
||||
@@ -13291,7 +13576,6 @@
|
||||
"integrity": "sha512-C5VvvgCCyfyotVITIAv+4efVytl5F7wt+/I2i9q9GZcEXW9BP52YYOXC58igUi+LFZVHukErIIqQSWwv/M3WRw==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/estree": "1.0.7"
|
||||
},
|
||||
@@ -14346,7 +14630,6 @@
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.17.tgz",
|
||||
"integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@alloc/quick-lru": "^5.2.0",
|
||||
"arg": "^5.0.2",
|
||||
@@ -14550,7 +14833,6 @@
|
||||
"integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
@@ -14714,6 +14996,24 @@
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/tsyringe": {
|
||||
"version": "4.10.0",
|
||||
"resolved": "https://registry.npmjs.org/tsyringe/-/tsyringe-4.10.0.tgz",
|
||||
"integrity": "sha512-axr3IdNuVIxnaK5XGEUFTu3YmAQ6lllgrvqfEoR16g/HGnYY/6We4oWENtAnzK6/LpJ2ur9PAb80RBt7/U4ugw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^1.9.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tsyringe/node_modules/tslib": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
|
||||
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
|
||||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/turndown": {
|
||||
"version": "7.2.1",
|
||||
"resolved": "https://registry.npmjs.org/turndown/-/turndown-7.2.1.tgz",
|
||||
@@ -14723,6 +15023,12 @@
|
||||
"@mixmark-io/domino": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tweetnacl": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
|
||||
"integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==",
|
||||
"license": "Unlicense"
|
||||
},
|
||||
"node_modules/type-check": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
||||
@@ -14846,7 +15152,6 @@
|
||||
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@@ -15374,7 +15679,6 @@
|
||||
"integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"esbuild": "^0.25.0",
|
||||
"fdir": "^6.4.4",
|
||||
@@ -15519,7 +15823,6 @@
|
||||
"integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
@@ -15991,7 +16294,6 @@
|
||||
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"fast-uri": "^3.0.1",
|
||||
@@ -16068,7 +16370,6 @@
|
||||
"integrity": "sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
},
|
||||
@@ -16517,7 +16818,6 @@
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
||||
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
"@mozilla/readability": "^0.6.0",
|
||||
"@nostrify/nostrify": "^0.48.2",
|
||||
"@nostrify/react": "^0.2.20",
|
||||
"@opensecret/react": "^1.5.4",
|
||||
"@radix-ui/react-accordion": "^1.2.0",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.1",
|
||||
"@radix-ui/react-aspect-ratio": "^1.1.0",
|
||||
|
||||
@@ -28,7 +28,6 @@ import { DynamicFavicon } from '@/components/DynamicFavicon';
|
||||
import { OfflineIndicator } from '@/components/OfflineIndicator';
|
||||
import { PWAUpdatePrompt } from '@/components/PWAUpdatePrompt';
|
||||
import { ErrorBoundary } from '@/components/ErrorBoundary';
|
||||
import { NWCProvider } from '@/contexts/NWCContext';
|
||||
|
||||
import AppRouter from './AppRouter';
|
||||
|
||||
@@ -143,7 +142,6 @@ export function App() {
|
||||
<NostrLoginProvider storageKey='nostr:login'>
|
||||
<NostrProvider>
|
||||
<NostrSync />
|
||||
<NWCProvider>
|
||||
<AISettingsProvider>
|
||||
<GitSettingsProvider>
|
||||
<DeploySettingsProvider>
|
||||
@@ -163,7 +161,6 @@ export function App() {
|
||||
</DeploySettingsProvider>
|
||||
</GitSettingsProvider>
|
||||
</AISettingsProvider>
|
||||
</NWCProvider>
|
||||
</NostrProvider>
|
||||
</NostrLoginProvider>
|
||||
</ConsoleErrorProvider>
|
||||
|
||||
@@ -5,14 +5,12 @@ import { URLFragmentHandler } from "./components/URLFragmentHandler";
|
||||
|
||||
import Index from "./pages/Index";
|
||||
import Clone from "./pages/Clone";
|
||||
import Explore from "./pages/Explore";
|
||||
import Settings from "./pages/Settings";
|
||||
import Preferences from "./pages/Preferences";
|
||||
import NostrSettings from "./pages/NostrSettings";
|
||||
import AISettings from "./pages/AISettings";
|
||||
import GitSettings from "./pages/GitSettings";
|
||||
import DeploySettings from "./pages/DeploySettings";
|
||||
import WalletSettings from "./pages/WalletSettings";
|
||||
import SystemSettings from "./pages/SystemSettings";
|
||||
import StorageSettings from "./pages/StorageSettings";
|
||||
import AboutSettings from "./pages/AboutSettings";
|
||||
@@ -39,7 +37,6 @@ export function AppRouter() {
|
||||
<Route path="/" element={<Index />} />
|
||||
<Route path="/giftcard" element={<Index />} />
|
||||
<Route path="/clone" element={<Clone />} />
|
||||
<Route path="/explore" element={<Explore />} />
|
||||
<Route path="/oauth/github" element={<GitHubOAuth />} />
|
||||
<Route path="/oauth/netlify" element={<NetlifyOAuth />} />
|
||||
<Route path="/oauth/vercel" element={<VercelOAuth />} />
|
||||
@@ -51,7 +48,6 @@ export function AppRouter() {
|
||||
<Route path="ai" element={<AISettings />} />
|
||||
<Route path="git" element={<GitSettings />} />
|
||||
<Route path="deploy" element={<DeploySettings />} />
|
||||
<Route path="wallet" element={<WalletSettings />} />
|
||||
<Route path="system" element={<SystemSettings />} />
|
||||
<Route path="storage" element={<StorageSettings />} />
|
||||
<Route path="about" element={<AboutSettings />} />
|
||||
|
||||
@@ -1041,12 +1041,31 @@ export function AIProviderConfigDialog({
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="provider-auth">{t('authentication')}</Label>
|
||||
<Select
|
||||
value={localProvider.nostr ? 'nostr' : 'api-key'}
|
||||
onValueChange={(value: 'api-key' | 'nostr') => setLocalProvider({
|
||||
...localProvider,
|
||||
nostr: value === 'nostr' || undefined,
|
||||
apiKey: value === 'nostr' ? undefined : localProvider.apiKey
|
||||
})}
|
||||
value={localProvider.nostr ? 'nostr' : localProvider.openSecret ? 'opensecret' : 'api-key'}
|
||||
onValueChange={(value: 'api-key' | 'nostr' | 'opensecret') => {
|
||||
if (value === 'nostr') {
|
||||
setLocalProvider({
|
||||
...localProvider,
|
||||
nostr: true,
|
||||
openSecret: undefined,
|
||||
apiKey: undefined
|
||||
});
|
||||
} else if (value === 'opensecret') {
|
||||
setLocalProvider({
|
||||
...localProvider,
|
||||
nostr: undefined,
|
||||
openSecret: localProvider.openSecret,
|
||||
apiKey: localProvider.apiKey
|
||||
});
|
||||
} else {
|
||||
setLocalProvider({
|
||||
...localProvider,
|
||||
nostr: undefined,
|
||||
openSecret: undefined,
|
||||
apiKey: localProvider.apiKey
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue />
|
||||
@@ -1054,10 +1073,25 @@ export function AIProviderConfigDialog({
|
||||
<SelectContent>
|
||||
<SelectItem value="api-key">{t('apiKey')}</SelectItem>
|
||||
<SelectItem value="nostr">Nostr</SelectItem>
|
||||
<SelectItem value="opensecret">OpenSecret</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
{localProvider.openSecret && (
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="provider-opensecret-url">
|
||||
OpenSecret API URL <span className="text-destructive">*</span>
|
||||
</Label>
|
||||
<Input
|
||||
id="provider-opensecret-url"
|
||||
placeholder="https://enclave.trymaple.ai"
|
||||
value={localProvider.openSecret || ''}
|
||||
onChange={(e) => setLocalProvider({ ...localProvider, openSecret: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!localProvider.nostr && (
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="provider-apiKey">{t('apiKey')}</Label>
|
||||
|
||||
@@ -50,7 +50,8 @@ export function AddCustomAIProviderDialog({
|
||||
const [customIdManuallyEdited, setCustomIdManuallyEdited] = useState(false);
|
||||
const [customBaseURL, setCustomBaseURL] = useState('');
|
||||
const [customApiKey, setCustomApiKey] = useState('');
|
||||
const [customAuthMethod, setCustomAuthMethod] = useState<'api-key' | 'nostr'>('api-key');
|
||||
const [customAuthMethod, setCustomAuthMethod] = useState<'api-key' | 'nostr' | 'opensecret'>('api-key');
|
||||
const [customOpenSecretUrl, setCustomOpenSecretUrl] = useState('');
|
||||
const [customProxy, setCustomProxy] = useState(false);
|
||||
|
||||
const handleAdd = () => {
|
||||
@@ -66,6 +67,11 @@ export function AddCustomAIProviderDialog({
|
||||
provider.apiKey = customApiKey.trim();
|
||||
} else if (customAuthMethod === 'nostr') {
|
||||
provider.nostr = true;
|
||||
} else if (customAuthMethod === 'opensecret') {
|
||||
provider.openSecret = customOpenSecretUrl.trim();
|
||||
if (customApiKey.trim()) {
|
||||
provider.apiKey = customApiKey.trim();
|
||||
}
|
||||
}
|
||||
|
||||
if (customProxy) {
|
||||
@@ -81,6 +87,7 @@ export function AddCustomAIProviderDialog({
|
||||
setCustomBaseURL('');
|
||||
setCustomApiKey('');
|
||||
setCustomAuthMethod('api-key');
|
||||
setCustomOpenSecretUrl('');
|
||||
setCustomProxy(false);
|
||||
|
||||
onOpenChange(false);
|
||||
@@ -89,6 +96,7 @@ export function AddCustomAIProviderDialog({
|
||||
const isValid = customProviderName.trim() &&
|
||||
customProviderId.trim() &&
|
||||
customBaseURL.trim() &&
|
||||
(customAuthMethod !== 'opensecret' || customOpenSecretUrl.trim()) &&
|
||||
!existingIds.includes(customProviderId.trim());
|
||||
|
||||
const idExists = existingIds.includes(customProviderId.trim());
|
||||
@@ -156,7 +164,7 @@ export function AddCustomAIProviderDialog({
|
||||
<Label htmlFor="custom-auth">{t('authentication')}</Label>
|
||||
<Select
|
||||
value={customAuthMethod}
|
||||
onValueChange={(value: 'api-key' | 'nostr') => {
|
||||
onValueChange={(value: 'api-key' | 'nostr' | 'opensecret') => {
|
||||
setCustomAuthMethod(value);
|
||||
if (value === 'nostr') {
|
||||
setCustomApiKey(''); // Clear API key when switching to Nostr auth
|
||||
@@ -169,11 +177,26 @@ export function AddCustomAIProviderDialog({
|
||||
<SelectContent>
|
||||
<SelectItem value="api-key">{t('apiKey')}</SelectItem>
|
||||
<SelectItem value="nostr">Nostr</SelectItem>
|
||||
<SelectItem value="opensecret">OpenSecret</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
{customAuthMethod === 'api-key' && (
|
||||
{customAuthMethod === 'opensecret' && (
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="custom-opensecret-url">
|
||||
OpenSecret API URL <span className="text-destructive">*</span>
|
||||
</Label>
|
||||
<Input
|
||||
id="custom-opensecret-url"
|
||||
placeholder="https://enclave.trymaple.ai"
|
||||
value={customOpenSecretUrl}
|
||||
onChange={(e) => setCustomOpenSecretUrl(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{(customAuthMethod === 'api-key' || customAuthMethod === 'opensecret') && (
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="custom-apikey">{t('apiKey')}</Label>
|
||||
<PasswordInput
|
||||
|
||||
@@ -33,10 +33,10 @@ export function ExternalFavicon({
|
||||
const parsedUrl = new URL(url);
|
||||
|
||||
// Strip `ai.` and `api.` subdomains for a better chance at finding a favicon
|
||||
parsedUrl.hostname = parsedUrl.hostname.replace(/^(ai\.|api\.)/, '');
|
||||
parsedUrl.hostname = parsedUrl.hostname.replace(/^(ai\.|api\.|enclave\.)/, '');
|
||||
|
||||
// Normalize the URL to ensure it has a protocol
|
||||
return faviconUrl(config.faviconUrl, parsedUrl);
|
||||
return faviconUrl({ template: config.faviconUrl, url: parsedUrl });
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useEffect, useState, useMemo } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Plus, Folder, GitBranch, Loader2, ChevronDown, ChevronRight, Star, Columns2, X, Settings, HelpCircle, Search, Tag, Folders, Compass } from 'lucide-react';
|
||||
import { Plus, Folder, GitBranch, Loader2, ChevronDown, ChevronRight, Star, Columns2, X, Settings, HelpCircle, Search, Tag, Folders } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -367,13 +367,6 @@ export function ProjectSidebar({
|
||||
<GitBranch className="h-4 w-4" />
|
||||
{t('importRepository')}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() => navigateAndClose('/explore')}
|
||||
className="flex items-center gap-2 w-full"
|
||||
>
|
||||
<Compass className="h-4 w-4" />
|
||||
{t('exploreApps')}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() => setLabelsDialogOpen(true)}
|
||||
className="flex items-center gap-2 w-full"
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
import React, { useState, useRef, useEffect, memo } from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { GitBranch, Loader2, EllipsisVertical, Edit, Code, ExternalLink } from 'lucide-react';
|
||||
import { GitBranch, Loader2, EllipsisVertical, Edit } from 'lucide-react';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import type { Repository } from '@/hooks/useUserRepositories';
|
||||
import { useAuthor } from '@/hooks/useAuthor';
|
||||
import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar';
|
||||
@@ -30,26 +23,13 @@ import { useGitSettings } from '@/hooks/useGitSettings';
|
||||
import { detectFork } from '@/lib/detectFork';
|
||||
import { NostrRepoEditDialog } from '@/components/NostrRepoEditDialog';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useOGImage } from '@/hooks/useOGImage';
|
||||
import { ZapDialog } from '@/components/ZapDialog';
|
||||
import { Zap } from 'lucide-react';
|
||||
import type { Event } from 'nostr-tools';
|
||||
import type { NostrMetadata } from '@nostrify/nostrify';
|
||||
import { formatRelativeTime } from '@/lib/utils';
|
||||
|
||||
interface RepositoryCardProps {
|
||||
repo: Repository;
|
||||
/** Pre-fetched author metadata to avoid individual fetches */
|
||||
authorMetadata?: NostrMetadata;
|
||||
/** Callback when a tag is clicked - receives the tag value */
|
||||
onTagClick?: (tag: string) => void;
|
||||
}
|
||||
|
||||
function RepositoryCardInner({ repo, authorMetadata: preloadedMetadata, onTagClick }: RepositoryCardProps) {
|
||||
// Only fetch author data if not preloaded
|
||||
const { data: authorData } = useAuthor(preloadedMetadata ? undefined : repo.pubkey);
|
||||
const metadata = preloadedMetadata ?? authorData?.metadata;
|
||||
|
||||
export function RepositoryCard({ repo }: RepositoryCardProps) {
|
||||
const { data: authorData } = useAuthor(repo.pubkey);
|
||||
const { user } = useCurrentUser();
|
||||
const { settings: gitSettings } = useGitSettings();
|
||||
const navigate = useNavigate();
|
||||
@@ -59,41 +39,10 @@ function RepositoryCardInner({ repo, authorMetadata: preloadedMetadata, onTagCli
|
||||
const queryClient = useQueryClient();
|
||||
const [isCloning, setIsCloning] = useState(false);
|
||||
const [editRepoOpen, setEditRepoOpen] = useState(false);
|
||||
const [imageError, setImageError] = useState(false);
|
||||
const [eventViewerOpen, setEventViewerOpen] = useState(false);
|
||||
const [isInViewport, setIsInViewport] = useState(false);
|
||||
const cardRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// Lazy load OG images - only fetch when card is in viewport
|
||||
useEffect(() => {
|
||||
const observer = new IntersectionObserver(
|
||||
([entry]) => {
|
||||
if (entry.isIntersecting) {
|
||||
setIsInViewport(true);
|
||||
observer.disconnect();
|
||||
}
|
||||
},
|
||||
{ rootMargin: '100px' } // Start loading slightly before visible
|
||||
);
|
||||
|
||||
if (cardRef.current) {
|
||||
observer.observe(cardRef.current);
|
||||
}
|
||||
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
|
||||
const displayName = metadata?.name || genUserName(repo.pubkey);
|
||||
const profileImage = metadata?.picture;
|
||||
const displayName = authorData?.metadata?.name || genUserName(repo.pubkey);
|
||||
const profileImage = authorData?.metadata?.picture;
|
||||
const isOwnRepo = user?.pubkey === repo.pubkey;
|
||||
const hasLightning = !!(metadata?.lud16 || metadata?.lud06);
|
||||
const canZap = user && !isOwnRepo && hasLightning;
|
||||
|
||||
// Get OG metadata from first web URL - only when in viewport
|
||||
const firstWebUrl = repo.webUrls?.[0];
|
||||
const { data: ogMetadata } = useOGImage(isInViewport ? firstWebUrl : undefined);
|
||||
const ogImageUrl = ogMetadata?.image ?? null;
|
||||
const ogDescription = ogMetadata?.description ?? null;
|
||||
|
||||
// Construct Nostr clone URL
|
||||
const nostrURI = new NostrURI({
|
||||
@@ -160,117 +109,52 @@ function RepositoryCardInner({ repo, authorMetadata: preloadedMetadata, onTagCli
|
||||
queryClient.invalidateQueries({ queryKey: ['nostr', 'user-repositories', user?.pubkey] });
|
||||
};
|
||||
|
||||
// Check if we have a valid OG image to show
|
||||
const hasValidImage = ogImageUrl && !imageError;
|
||||
|
||||
return (
|
||||
<Card ref={cardRef} className="h-full flex flex-col hover:shadow-lg transition-shadow">
|
||||
{/* Preview Image or Placeholder */}
|
||||
{hasValidImage && firstWebUrl ? (
|
||||
<a
|
||||
href={firstWebUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="block aspect-video bg-muted overflow-hidden rounded-t-lg cursor-pointer hover:opacity-90 transition-opacity"
|
||||
>
|
||||
<img
|
||||
src={ogImageUrl}
|
||||
alt={`${repo.name} preview`}
|
||||
className="w-full h-full object-cover"
|
||||
onError={() => setImageError(true)}
|
||||
/>
|
||||
</a>
|
||||
) : (
|
||||
<div className="aspect-video bg-gradient-to-br from-primary to-accent rounded-t-lg flex items-center justify-center">
|
||||
<Code className="h-12 w-12 text-white" />
|
||||
</div>
|
||||
)}
|
||||
<Card className="h-full flex flex-col hover:shadow-lg transition-shadow">
|
||||
<CardContent className="p-6 flex flex-col flex-1">
|
||||
{/* Header with name and menu */}
|
||||
<div className="mb-4 flex items-start justify-between">
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-end gap-2 mb-2">
|
||||
<h3 className="font-semibold text-lg leading-tight truncate">
|
||||
{repo.name}
|
||||
</h3>
|
||||
<span className="text-sm text-muted-foreground shrink-0">
|
||||
{formatRelativeTime(repo.created_at)}
|
||||
</span>
|
||||
</div>
|
||||
<h3 className="font-semibold text-lg leading-tight mb-2 truncate">
|
||||
{repo.name}
|
||||
</h3>
|
||||
</div>
|
||||
<div className="flex items-center -mt-1 -mr-2 shrink-0">
|
||||
{canZap && (
|
||||
<ZapDialog target={repo as unknown as Event}>
|
||||
<Button variant="ghost" size="icon" className="h-8 w-8 text-amber-500 hover:text-amber-600 hover:bg-amber-500/10">
|
||||
<Zap className="h-4 w-4" />
|
||||
</Button>
|
||||
</ZapDialog>
|
||||
)}
|
||||
{isOwnRepo && (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" size="icon" className="h-8 w-8">
|
||||
<Button variant="ghost" size="icon" className="h-8 w-8 -mt-1 -mr-2 shrink-0">
|
||||
<EllipsisVertical className="h-4 w-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
{firstWebUrl && (
|
||||
<DropdownMenuItem asChild className="gap-2">
|
||||
<a href={firstWebUrl} target="_blank" rel="noopener noreferrer">
|
||||
<ExternalLink className="h-4 w-4" />
|
||||
Open Website
|
||||
</a>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem onClick={() => setEditRepoOpen(true)} className="gap-2">
|
||||
<Edit className="h-4 w-4" />
|
||||
Edit Repository
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuItem onClick={() => setEventViewerOpen(true)} className="gap-2">
|
||||
<Code className="h-4 w-4" />
|
||||
View Event
|
||||
</DropdownMenuItem>
|
||||
{isOwnRepo && (
|
||||
<>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem onClick={() => setEditRepoOpen(true)} className="gap-2">
|
||||
<Edit className="h-4 w-4" />
|
||||
Edit Repository
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
)}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Author */}
|
||||
<div className="mb-4">
|
||||
<div className="flex items-center gap-3 text-sm">
|
||||
<Avatar className="h-10 w-10">
|
||||
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||
<Avatar className="h-4 w-4">
|
||||
{profileImage && (
|
||||
<AvatarImage src={profileImage} alt={displayName} />
|
||||
)}
|
||||
<AvatarFallback className="text-xs">
|
||||
<AvatarFallback className="text-[8px]">
|
||||
{displayName.slice(0, 2).toUpperCase()}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className="flex items-center gap-2 min-w-0 flex-1">
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onTagClick?.(displayName);
|
||||
}}
|
||||
className="truncate font-medium text-base text-foreground hover:text-primary hover:underline transition-colors text-left"
|
||||
>
|
||||
{displayName}
|
||||
</button>
|
||||
{metadata?.nip05 && (
|
||||
<span className="text-sm text-muted-foreground shrink-0">{metadata.nip05}</span>
|
||||
)}
|
||||
</div>
|
||||
<span className="truncate">{displayName}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Description */}
|
||||
{(repo.description || ogDescription) && (
|
||||
{repo.description && (
|
||||
<p className="text-sm text-muted-foreground line-clamp-2 mb-4">
|
||||
{repo.description || ogDescription}
|
||||
{repo.description}
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -278,21 +162,14 @@ function RepositoryCardInner({ repo, authorMetadata: preloadedMetadata, onTagCli
|
||||
{repo.repoTags.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1 mb-4">
|
||||
{repo.repoTags.slice(0, 3).map((tag, index) => (
|
||||
<button
|
||||
key={index}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onTagClick?.(tag);
|
||||
}}
|
||||
className="text-sm text-primary hover:text-primary/80 hover:underline transition-colors font-medium"
|
||||
>
|
||||
#{tag}
|
||||
</button>
|
||||
<Badge key={index} variant="secondary" className="text-xs">
|
||||
{tag}
|
||||
</Badge>
|
||||
))}
|
||||
{repo.repoTags.length > 3 && (
|
||||
<span className="text-sm text-muted-foreground">
|
||||
<Badge variant="secondary" className="text-xs">
|
||||
+{repo.repoTags.length - 3}
|
||||
</span>
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -335,31 +212,6 @@ function RepositoryCardInner({ repo, authorMetadata: preloadedMetadata, onTagCli
|
||||
repoIdentifier={repo.repoId}
|
||||
onSuccess={handleRepoEditSuccess}
|
||||
/>
|
||||
|
||||
{/* Event Viewer Dialog */}
|
||||
<Dialog open={eventViewerOpen} onOpenChange={setEventViewerOpen}>
|
||||
<DialogContent className="max-w-2xl max-h-[80vh] flex flex-col">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Repository Event</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="overflow-y-auto flex-1 min-h-0">
|
||||
<pre className="text-xs p-4 rounded-lg overflow-x-auto">
|
||||
{JSON.stringify({
|
||||
id: repo.id,
|
||||
pubkey: repo.pubkey,
|
||||
created_at: repo.created_at,
|
||||
kind: repo.kind,
|
||||
tags: repo.tags,
|
||||
content: repo.content,
|
||||
sig: repo.sig,
|
||||
}, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
// Memoize to prevent re-renders when parent re-renders with same props
|
||||
export const RepositoryCard = memo(RepositoryCardInner);
|
||||
@@ -0,0 +1,246 @@
|
||||
import { useEffect, useRef, useState, useCallback } from 'react';
|
||||
import { MessageSquare, Minus, X } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { ChatPane, type ChatPaneRef } from '@/components/Shakespeare/ChatPane';
|
||||
import { ShakespeareLogo } from '@/components/ShakespeareLogo';
|
||||
import { ProjectPreviewConsoleError } from '@/lib/consoleMessages';
|
||||
import { useLocalStorage } from '@/hooks/useLocalStorage';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
interface FloatingChatWidgetProps {
|
||||
projectId: string;
|
||||
isMinimized: boolean;
|
||||
onToggleMinimize: () => void;
|
||||
onClose: () => void;
|
||||
onNewChat: () => void;
|
||||
onFirstInteraction?: () => void;
|
||||
onLoadingChange?: (isLoading: boolean) => void;
|
||||
isLoading?: boolean;
|
||||
isBuildLoading?: boolean;
|
||||
consoleError?: ProjectPreviewConsoleError | null;
|
||||
onDismissConsoleError?: () => void;
|
||||
}
|
||||
|
||||
interface ChatSize {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
const MIN_WIDTH = 320;
|
||||
const MIN_HEIGHT = 380;
|
||||
const MAX_WIDTH = 720;
|
||||
const MAX_HEIGHT = 900;
|
||||
const DEFAULT_WIDTH = 420;
|
||||
const DEFAULT_HEIGHT = 520;
|
||||
|
||||
export function FloatingChatWidget({
|
||||
projectId,
|
||||
isMinimized,
|
||||
onToggleMinimize,
|
||||
onClose,
|
||||
onNewChat,
|
||||
onFirstInteraction,
|
||||
onLoadingChange,
|
||||
isLoading,
|
||||
isBuildLoading,
|
||||
consoleError,
|
||||
onDismissConsoleError,
|
||||
}: FloatingChatWidgetProps) {
|
||||
const chatPaneRef = useRef<ChatPaneRef>(null);
|
||||
const [size, setSize] = useLocalStorage<ChatSize>('shk:floatingChatSize', {
|
||||
width: DEFAULT_WIDTH,
|
||||
height: DEFAULT_HEIGHT,
|
||||
});
|
||||
const [isResizing, setIsResizing] = useState(false);
|
||||
const resizeStartRef = useRef<{ x: number; y: number; width: number; height: number } | null>(null);
|
||||
|
||||
// Handle keyboard escape to minimize
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Escape' && !isMinimized) {
|
||||
onToggleMinimize();
|
||||
}
|
||||
};
|
||||
|
||||
if (!isMinimized) {
|
||||
window.addEventListener('keydown', handleKeyDown);
|
||||
return () => window.removeEventListener('keydown', handleKeyDown);
|
||||
}
|
||||
}, [isMinimized, onToggleMinimize]);
|
||||
|
||||
// Resize handlers
|
||||
const startResize = useCallback((e: React.PointerEvent, direction: 'right' | 'bottom' | 'top' | 'bottomLeft' | 'topRight') => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const target = e.currentTarget as HTMLElement;
|
||||
target.setPointerCapture(e.pointerId);
|
||||
|
||||
setIsResizing(true);
|
||||
document.body.style.userSelect = 'none';
|
||||
|
||||
resizeStartRef.current = {
|
||||
x: e.clientX,
|
||||
y: e.clientY,
|
||||
width: size.width,
|
||||
height: size.height,
|
||||
};
|
||||
|
||||
const handlePointerMove = (moveEvent: PointerEvent) => {
|
||||
if (!resizeStartRef.current) return;
|
||||
|
||||
const maxW = Math.min(MAX_WIDTH, window.innerWidth - 16);
|
||||
const maxH = Math.min(MAX_HEIGHT, window.innerHeight - 16);
|
||||
|
||||
let newWidth = resizeStartRef.current.width;
|
||||
let newHeight = resizeStartRef.current.height;
|
||||
|
||||
// Handle horizontal resizing (left edge for bottom-right anchored widget)
|
||||
if (direction === 'right' || direction === 'bottomLeft' || direction === 'topRight') {
|
||||
const deltaX = resizeStartRef.current.x - moveEvent.clientX;
|
||||
newWidth = Math.max(MIN_WIDTH, Math.min(maxW, resizeStartRef.current.width + deltaX));
|
||||
}
|
||||
|
||||
// Handle vertical resizing from bottom (grows downward)
|
||||
if (direction === 'bottom' || direction === 'bottomLeft') {
|
||||
const deltaY = resizeStartRef.current.y - moveEvent.clientY;
|
||||
newHeight = Math.max(MIN_HEIGHT, Math.min(maxH, resizeStartRef.current.height + deltaY));
|
||||
}
|
||||
|
||||
// Handle vertical resizing from top (grows upward, widget anchored at bottom)
|
||||
if (direction === 'top' || direction === 'topRight') {
|
||||
const deltaY = moveEvent.clientY - resizeStartRef.current.y;
|
||||
newHeight = Math.max(MIN_HEIGHT, Math.min(maxH, resizeStartRef.current.height - deltaY));
|
||||
}
|
||||
|
||||
setSize({ width: newWidth, height: newHeight });
|
||||
};
|
||||
|
||||
const handlePointerUp = () => {
|
||||
setIsResizing(false);
|
||||
document.body.style.userSelect = '';
|
||||
resizeStartRef.current = null;
|
||||
|
||||
window.removeEventListener('pointermove', handlePointerMove);
|
||||
window.removeEventListener('pointerup', handlePointerUp);
|
||||
};
|
||||
|
||||
window.addEventListener('pointermove', handlePointerMove);
|
||||
window.addEventListener('pointerup', handlePointerUp);
|
||||
}, [size, setSize]);
|
||||
|
||||
if (isMinimized) {
|
||||
return (
|
||||
<div className="fixed right-4 bottom-4 z-50">
|
||||
<Button
|
||||
onClick={onToggleMinimize}
|
||||
size="icon"
|
||||
className="h-14 w-14 rounded-full shadow-lg hover:shadow-xl transition-all duration-200"
|
||||
aria-label="Open chat"
|
||||
>
|
||||
<MessageSquare className="h-6 w-6" />
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"fixed right-4 bottom-4 z-50",
|
||||
"rounded-lg border shadow-2xl bg-background",
|
||||
"flex flex-col overflow-hidden",
|
||||
isResizing && "select-none"
|
||||
)}
|
||||
style={{
|
||||
width: `${size.width}px`,
|
||||
height: `${size.height}px`,
|
||||
maxWidth: '92vw',
|
||||
maxHeight: '70vh',
|
||||
}}
|
||||
>
|
||||
{/* Header - Styled like ProjectSidebar */}
|
||||
<div className="h-12 px-4 border-b flex-shrink-0 flex items-center justify-between bg-gradient-to-r from-primary/10 via-accent/5 to-primary/10 backdrop-blur">
|
||||
<div className="flex items-center gap-2">
|
||||
<ShakespeareLogo className="w-5 h-5" />
|
||||
<h2 className="text-base font-semibold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
|
||||
Shakespeare
|
||||
</h2>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<Button
|
||||
onClick={onToggleMinimize}
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
aria-label="Minimize chat"
|
||||
>
|
||||
<Minus className="h-4 w-4" />
|
||||
</Button>
|
||||
<Button
|
||||
onClick={onClose}
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
aria-label="Close floating chat"
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Chat Body */}
|
||||
<div className="flex-1 min-h-0 overflow-hidden">
|
||||
<div className="h-full">
|
||||
<ChatPane
|
||||
ref={chatPaneRef}
|
||||
projectId={projectId}
|
||||
onNewChat={onNewChat}
|
||||
onFirstInteraction={onFirstInteraction}
|
||||
onLoadingChange={onLoadingChange}
|
||||
isLoading={isLoading}
|
||||
isBuildLoading={isBuildLoading}
|
||||
consoleError={consoleError}
|
||||
onDismissConsoleError={onDismissConsoleError}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Resize Handles */}
|
||||
{/* Left edge (appears as "right" from widget perspective, but it's on the left side) */}
|
||||
<div
|
||||
className="absolute top-0 left-0 h-full w-2 cursor-ew-resize hover:bg-primary/10 active:bg-primary/20 transition-colors"
|
||||
onPointerDown={(e) => startResize(e, 'right')}
|
||||
style={{ touchAction: 'none' }}
|
||||
/>
|
||||
|
||||
{/* Top edge */}
|
||||
<div
|
||||
className="absolute top-0 left-0 w-full h-2 cursor-ns-resize hover:bg-primary/10 active:bg-primary/20 transition-colors"
|
||||
onPointerDown={(e) => startResize(e, 'top')}
|
||||
style={{ touchAction: 'none' }}
|
||||
/>
|
||||
|
||||
{/* Bottom edge */}
|
||||
<div
|
||||
className="absolute bottom-0 left-0 w-full h-2 cursor-ns-resize hover:bg-primary/10 active:bg-primary/20 transition-colors"
|
||||
onPointerDown={(e) => startResize(e, 'bottom')}
|
||||
style={{ touchAction: 'none' }}
|
||||
/>
|
||||
|
||||
{/* Bottom-left corner */}
|
||||
<div
|
||||
className="absolute bottom-0 left-0 w-4 h-4 cursor-nesw-resize hover:bg-primary/20 active:bg-primary/30 transition-colors"
|
||||
onPointerDown={(e) => startResize(e, 'bottomLeft')}
|
||||
style={{ touchAction: 'none' }}
|
||||
/>
|
||||
|
||||
{/* Top-right corner */}
|
||||
<div
|
||||
className="absolute top-0 right-0 w-4 h-4 cursor-nesw-resize hover:bg-primary/20 active:bg-primary/30 transition-colors"
|
||||
onPointerDown={(e) => startResize(e, 'topRight')}
|
||||
style={{ touchAction: 'none' }}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -251,7 +251,7 @@ export function ZapDialog({ target, children, className }: ZapDialogProps) {
|
||||
|
||||
useEffect(() => {
|
||||
if (target) {
|
||||
setComment('Zapped from Shakespeare!');
|
||||
setComment('Zapped with MKStack!');
|
||||
}
|
||||
}, [target]);
|
||||
|
||||
|
||||
@@ -63,10 +63,10 @@ export function CloudflareDeployForm({
|
||||
const workersUrl = `${baseURL}/accounts/${accountId}/workers/scripts`;
|
||||
|
||||
const [subdomainResponse, workersResponse] = await Promise.all([
|
||||
fetch(corsProxy ? proxyUrl(corsProxy, subdomainUrl) : subdomainUrl, {
|
||||
fetch(corsProxy ? proxyUrl({ template: corsProxy, url: subdomainUrl }) : subdomainUrl, {
|
||||
headers: { 'Authorization': `Bearer ${apiKey}` },
|
||||
}),
|
||||
fetch(corsProxy ? proxyUrl(corsProxy, workersUrl) : workersUrl, {
|
||||
fetch(corsProxy ? proxyUrl({ template: corsProxy, url: workersUrl }) : workersUrl, {
|
||||
headers: { 'Authorization': `Bearer ${apiKey}` },
|
||||
}),
|
||||
]);
|
||||
|
||||
@@ -56,7 +56,7 @@ export function DenoDeployForm({
|
||||
|
||||
try {
|
||||
const url = `${baseURL}/organizations/${organizationId}/projects?limit=100`;
|
||||
const targetUrl = corsProxy ? proxyUrl(corsProxy, url) : url;
|
||||
const targetUrl = corsProxy ? proxyUrl({ template: corsProxy, url }) : url;
|
||||
|
||||
const response = await fetch(targetUrl, {
|
||||
headers: { 'Authorization': `Bearer ${apiKey}` },
|
||||
|
||||
@@ -13,10 +13,6 @@ import { useFS } from '@/hooks/useFS';
|
||||
import { useFSPaths } from '@/hooks/useFSPaths';
|
||||
import { useAppContext } from '@/hooks/useAppContext';
|
||||
import { useNostr } from '@nostrify/react';
|
||||
import { useNostrPublish } from '@/hooks/useNostrPublish';
|
||||
import { useGit } from '@/hooks/useGit';
|
||||
import { NostrURI } from '@/lib/NostrURI';
|
||||
import { createRepositoryAnnouncementEvent } from '@/lib/announceRepository';
|
||||
import { Link } from 'react-router-dom';
|
||||
import type { DeployProvider } from '@/contexts/DeploySettingsContext';
|
||||
import type { PresetDeployProvider } from '@/lib/deploy/types';
|
||||
@@ -114,8 +110,6 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
||||
const { projectsPath } = useFSPaths();
|
||||
const { config } = useAppContext();
|
||||
const { nostr } = useNostr();
|
||||
const { mutateAsync: publishEvent } = useNostrPublish();
|
||||
const { git } = useGit();
|
||||
|
||||
const [selectedProviderId, setSelectedProviderId] = useState<string>('');
|
||||
const [isDeploying, setIsDeploying] = useState(false);
|
||||
@@ -329,65 +323,6 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
||||
}
|
||||
|
||||
setDeployResult(result);
|
||||
|
||||
// Update repository announcement with deployment URL if using Nostr git
|
||||
try {
|
||||
const projectPath = `${projectsPath}/${projectId}`;
|
||||
const remoteUrl = await git.getRemoteURL(projectPath, 'origin');
|
||||
|
||||
if (remoteUrl && remoteUrl.startsWith('nostr://') && user) {
|
||||
const nostrURI = await NostrURI.parse(remoteUrl);
|
||||
|
||||
// Query for existing repository announcement
|
||||
const existingRepos = await nostr.query(
|
||||
[{ kinds: [30617], authors: [user.pubkey], '#d': [nostrURI.identifier], limit: 1 }],
|
||||
{ signal: AbortSignal.timeout(5000) }
|
||||
);
|
||||
|
||||
if (existingRepos.length > 0) {
|
||||
const existingEvent = existingRepos[0];
|
||||
|
||||
// Extract existing data from the event
|
||||
const description = existingEvent.tags.find(([tagName]) => tagName === 'description')?.[1];
|
||||
const webTag = existingEvent.tags.find(([tagName]) => tagName === 'web');
|
||||
const existingWebUrls = webTag ? webTag.slice(1) : [];
|
||||
const cloneTag = existingEvent.tags.find(([tagName]) => tagName === 'clone');
|
||||
const cloneUrls = cloneTag ? cloneTag.slice(1) : [];
|
||||
const relaysTag = existingEvent.tags.find(([tagName]) => tagName === 'relays');
|
||||
const relays = relaysTag ? relaysTag.slice(1) : [];
|
||||
const tTags = existingEvent.tags
|
||||
.filter(([tagName]) => tagName === 't')
|
||||
.map(([, value]) => value);
|
||||
const eucTag = existingEvent.tags.find(([tagName, , marker]) => tagName === 'r' && marker === 'euc');
|
||||
const earliestCommit = eucTag?.[1];
|
||||
const name = existingEvent.tags.find(([tagName]) => tagName === 'name')?.[1];
|
||||
|
||||
// Add deployment URL if not already present
|
||||
const deploymentUrl = result.url;
|
||||
const updatedWebUrls = existingWebUrls.includes(deploymentUrl)
|
||||
? existingWebUrls
|
||||
: [...existingWebUrls, deploymentUrl];
|
||||
|
||||
// Create updated repository announcement event
|
||||
const eventTemplate = createRepositoryAnnouncementEvent({
|
||||
repoId: nostrURI.identifier,
|
||||
name,
|
||||
description,
|
||||
webUrls: updatedWebUrls,
|
||||
cloneUrls,
|
||||
relays,
|
||||
tTags: tTags.length > 0 ? tTags : undefined,
|
||||
earliestCommit,
|
||||
});
|
||||
|
||||
// Publish the updated event
|
||||
await publishEvent(eventTemplate);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
// Silently fail - updating web tag is not critical for deployment
|
||||
console.warn('Failed to update repository announcement with deployment URL:', err);
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Deployment failed');
|
||||
} finally {
|
||||
|
||||
@@ -53,7 +53,7 @@ export function NetlifyDeployForm({
|
||||
|
||||
try {
|
||||
const url = `${baseURL}/sites`;
|
||||
const targetUrl = corsProxy ? proxyUrl(corsProxy, url) : url;
|
||||
const targetUrl = corsProxy ? proxyUrl({ template: corsProxy, url }) : url;
|
||||
|
||||
const response = await fetch(targetUrl, {
|
||||
headers: {
|
||||
|
||||
@@ -154,7 +154,7 @@ export function SyncStep({ projectId, remoteUrl }: SyncStepProps) {
|
||||
|
||||
if (url.protocol === 'nostr:') {
|
||||
const nostrUri = await NostrURI.parse(url.href);
|
||||
return ngitWebUrl(config.ngitWebUrl, nostrUri);
|
||||
return ngitWebUrl({ template: config.ngitWebUrl, nostrURI: nostrUri });
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface AIProvider {
|
||||
apiKey?: string;
|
||||
nostr?: boolean;
|
||||
proxy?: boolean;
|
||||
openSecret?: string;
|
||||
}
|
||||
|
||||
export interface MCPServer {
|
||||
|
||||
@@ -13,7 +13,7 @@ export function useFollowedRepositories(followedPubkeys: string[] = []) {
|
||||
const { nostr } = useNostr();
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['nostr', 'followed-repositories', followedPubkeys],
|
||||
queryKey: ['nostr', 'followed-repositories', followedPubkeys.sort().join(',')],
|
||||
queryFn: async (): Promise<Repository[]> => {
|
||||
if (followedPubkeys.length === 0) {
|
||||
return [];
|
||||
@@ -50,19 +50,10 @@ export function useFollowedRepositories(followedPubkeys: string[] = []) {
|
||||
|
||||
const name = event.tags.find(tag => tag[0] === 'name')?.[1] || dTag;
|
||||
const description = event.tags.find(tag => tag[0] === 'description')?.[1] || '';
|
||||
|
||||
// Extract multi-value tags correctly (all values are in a single tag per NIP-34)
|
||||
const webTag = event.tags.find(tag => tag[0] === 'web');
|
||||
const webUrls = webTag ? webTag.slice(1).filter(Boolean) : [];
|
||||
|
||||
const cloneTag = event.tags.find(tag => tag[0] === 'clone');
|
||||
const cloneUrls = cloneTag ? cloneTag.slice(1).filter(Boolean) : [];
|
||||
|
||||
const relaysTag = event.tags.find(tag => tag[0] === 'relays');
|
||||
const relays = relaysTag ? relaysTag.slice(1).filter(Boolean) : [];
|
||||
|
||||
const maintainersTag = event.tags.find(tag => tag[0] === 'maintainers');
|
||||
const maintainers = maintainersTag ? maintainersTag.slice(1).filter(Boolean) : [];
|
||||
const webUrls = event.tags.filter(tag => tag[0] === 'web').map(tag => tag[1]).filter(Boolean);
|
||||
const cloneUrls = event.tags.filter(tag => tag[0] === 'clone').map(tag => tag[1]).filter(Boolean);
|
||||
const relays = event.tags.filter(tag => tag[0] === 'relays').map(tag => tag[1]).filter(Boolean);
|
||||
const maintainers = event.tags.filter(tag => tag[0] === 'maintainers').map(tag => tag[1]).filter(Boolean);
|
||||
const repoTags = event.tags.filter(tag => tag[0] === 't' && tag[1] !== 'personal-fork').map(tag => tag[1]);
|
||||
const earliestUniqueCommit = event.tags.find(tag => tag[0] === 'r' && tag[2] === 'euc')?.[1];
|
||||
const isPersonalFork = event.tags.some(tag => tag[0] === 't' && tag[1] === 'personal-fork');
|
||||
|
||||
@@ -30,7 +30,7 @@ export function useGitHubOAuth() {
|
||||
redirectUri: window.location.origin + '/oauth/github',
|
||||
usePKCE: true, // GitHub supports PKCE
|
||||
getUserInfo: async (accessToken: string, corsProxy: string) => {
|
||||
const userUrl = proxyUrl(corsProxy, 'https://api.github.com/user');
|
||||
const userUrl = proxyUrl({ template: corsProxy, url: 'https://api.github.com/user' });
|
||||
const userResponse = await fetch(userUrl, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
|
||||
@@ -30,7 +30,7 @@ export function useNetlifyOAuth() {
|
||||
redirectUri: window.location.origin + '/oauth/netlify',
|
||||
usePKCE: false, // Netlify doesn't support PKCE
|
||||
getUserInfo: async (accessToken: string, corsProxy: string) => {
|
||||
const userUrl = proxyUrl(corsProxy, 'https://api.netlify.com/api/v1/user');
|
||||
const userUrl = proxyUrl({ template: corsProxy, url: 'https://api.netlify.com/api/v1/user' });
|
||||
const userResponse = await fetch(userUrl, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
|
||||
@@ -169,7 +169,7 @@ export function useOAuth(config: OAuthConfig) {
|
||||
}
|
||||
|
||||
// Exchange code for access token
|
||||
const tokenUrl = proxyUrl(corsProxy, config.tokenUrl);
|
||||
const tokenUrl = proxyUrl({ template: corsProxy, url: config.tokenUrl });
|
||||
const tokenResponse = await fetch(tokenUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useAppContext } from './useAppContext';
|
||||
import { proxyUrl } from '@/lib/proxyUrl';
|
||||
|
||||
export interface OGMetadata {
|
||||
image: string | null;
|
||||
description: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to fetch Open Graph metadata from a web URL using CORS proxy
|
||||
* @param webUrl - The web URL to fetch OG metadata from
|
||||
* @returns Query result with OG image URL and description
|
||||
*/
|
||||
export function useOGImage(webUrl?: string) {
|
||||
const { config } = useAppContext();
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['og-metadata', webUrl],
|
||||
queryFn: async (): Promise<OGMetadata> => {
|
||||
if (!webUrl) {
|
||||
return { image: null, description: null };
|
||||
}
|
||||
|
||||
try {
|
||||
// Use CORS proxy to fetch the HTML
|
||||
const proxiedUrl = proxyUrl(config.corsProxy, webUrl);
|
||||
const response = await fetch(proxiedUrl, {
|
||||
signal: AbortSignal.timeout(5000),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
return { image: null, description: null };
|
||||
}
|
||||
|
||||
const html = await response.text();
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(html, 'text/html');
|
||||
|
||||
// Extract OG image
|
||||
let ogImage: string | null = null;
|
||||
const ogImageMeta = doc.querySelector('meta[property="og:image"]')?.getAttribute('content');
|
||||
if (ogImageMeta) {
|
||||
try {
|
||||
ogImage = new URL(ogImageMeta, webUrl).href;
|
||||
} catch {
|
||||
ogImage = ogImageMeta.startsWith('http') ? ogImageMeta : null;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to twitter:image if og:image not found
|
||||
if (!ogImage) {
|
||||
const twitterImage = doc.querySelector('meta[name="twitter:image"]')?.getAttribute('content');
|
||||
if (twitterImage) {
|
||||
try {
|
||||
ogImage = new URL(twitterImage, webUrl).href;
|
||||
} catch {
|
||||
ogImage = twitterImage.startsWith('http') ? twitterImage : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Extract OG description
|
||||
let ogDescription: string | null = null;
|
||||
const ogDescriptionMeta = doc.querySelector('meta[property="og:description"]')?.getAttribute('content');
|
||||
if (ogDescriptionMeta) {
|
||||
ogDescription = ogDescriptionMeta.trim();
|
||||
}
|
||||
|
||||
// Fallback to twitter:description if og:description not found
|
||||
if (!ogDescription) {
|
||||
const twitterDescription = doc.querySelector('meta[name="twitter:description"]')?.getAttribute('content');
|
||||
if (twitterDescription) {
|
||||
ogDescription = twitterDescription.trim();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
image: ogImage,
|
||||
description: ogDescription || null,
|
||||
};
|
||||
} catch (error) {
|
||||
console.warn('Failed to fetch OG metadata:', error);
|
||||
return { image: null, description: null };
|
||||
}
|
||||
},
|
||||
enabled: !!webUrl,
|
||||
staleTime: 1000 * 60 * 60, // 1 hour
|
||||
retry: 1,
|
||||
});
|
||||
}
|
||||
@@ -55,19 +55,10 @@ export function useUserRepositories(userPubkey?: string) {
|
||||
try {
|
||||
const name = event.tags.find(tag => tag[0] === 'name')?.[1] || dTag;
|
||||
const description = event.tags.find(tag => tag[0] === 'description')?.[1] || '';
|
||||
|
||||
// Extract multi-value tags correctly (all values are in a single tag per NIP-34)
|
||||
const webTag = event.tags.find(tag => tag[0] === 'web');
|
||||
const webUrls = webTag ? webTag.slice(1).filter(Boolean) : [];
|
||||
|
||||
const cloneTag = event.tags.find(tag => tag[0] === 'clone');
|
||||
const cloneUrls = cloneTag ? cloneTag.slice(1).filter(Boolean) : [];
|
||||
|
||||
const relaysTag = event.tags.find(tag => tag[0] === 'relays');
|
||||
const relays = relaysTag ? relaysTag.slice(1).filter(Boolean) : [];
|
||||
|
||||
const maintainersTag = event.tags.find(tag => tag[0] === 'maintainers');
|
||||
const maintainers = maintainersTag ? maintainersTag.slice(1).filter(Boolean) : [];
|
||||
const webUrls = event.tags.filter(tag => tag[0] === 'web').map(tag => tag[1]).filter(Boolean);
|
||||
const cloneUrls = event.tags.filter(tag => tag[0] === 'clone').map(tag => tag[1]).filter(Boolean);
|
||||
const relays = event.tags.filter(tag => tag[0] === 'relays').map(tag => tag[1]).filter(Boolean);
|
||||
const maintainers = event.tags.filter(tag => tag[0] === 'maintainers').map(tag => tag[1]).filter(Boolean);
|
||||
const repoTags = event.tags.filter(tag => tag[0] === 't' && tag[1] !== 'personal-fork').map(tag => tag[1]);
|
||||
const earliestUniqueCommit = event.tags.find(tag => tag[0] === 'r' && tag[2] === 'euc')?.[1];
|
||||
const isPersonalFork = event.tags.some(tag => tag[0] === 't' && tag[1] === 'personal-fork');
|
||||
|
||||
@@ -34,7 +34,7 @@ export function useVercelOAuth() {
|
||||
redirectUri: window.location.origin + '/oauth/vercel',
|
||||
usePKCE: false, // Vercel doesn't require PKCE
|
||||
getUserInfo: async (accessToken: string, corsProxy: string) => {
|
||||
const userUrl = proxyUrl(corsProxy, 'https://api.vercel.com/v2/user');
|
||||
const userUrl = proxyUrl({ template: corsProxy, url: 'https://api.vercel.com/v2/user' });
|
||||
const userResponse = await fetch(userUrl, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
|
||||
@@ -720,13 +720,50 @@ export class SessionManager {
|
||||
this.emit('finishReasonChanged', projectId, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if content exceeds size/line limits
|
||||
*/
|
||||
private exceedsLimits(content: string): boolean {
|
||||
const MAX_SIZE_BYTES = 50 * 1024; // 50 KiB
|
||||
const MAX_LINES = 2000;
|
||||
|
||||
const sizeBytes = new Blob([content]).size;
|
||||
const lineCount = content.split('\n').length;
|
||||
|
||||
return sizeBytes > MAX_SIZE_BYTES || lineCount > MAX_LINES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save content to tmpDir and return the file path
|
||||
*/
|
||||
private async saveToTmpFile(projectId: string, content: string, toolCallId: string): Promise<string> {
|
||||
const config = this.getConfig();
|
||||
const timestamp = Date.now();
|
||||
const filename = `tool-output-${toolCallId}-${timestamp}.txt`;
|
||||
const filepath = `${config.fsPathTmp}/${filename}`;
|
||||
|
||||
await this.fs.writeFile(filepath, content, 'utf8');
|
||||
return filepath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to add tool messages and update conversation
|
||||
*/
|
||||
private async addToolMessage(projectId: string, toolCallId: string, content: string): Promise<void> {
|
||||
let finalContent = content;
|
||||
|
||||
// Check if content exceeds limits
|
||||
if (this.exceedsLimits(content)) {
|
||||
// Save full content to tmp file
|
||||
const filepath = await this.saveToTmpFile(projectId, content, toolCallId);
|
||||
|
||||
// Create placeholder message
|
||||
finalContent = `The tool call succeeded but the output was truncated. Full output saved to: ${filepath}\nUse grep to search it for specific content, or text_editor_view with start_line/end_line to view specific sections.`;
|
||||
}
|
||||
|
||||
const toolMessage: AIMessage = {
|
||||
role: 'tool',
|
||||
content,
|
||||
content: finalContent,
|
||||
tool_call_id: toolCallId
|
||||
};
|
||||
|
||||
|
||||
@@ -12,17 +12,21 @@ import { proxyUrl } from './proxyUrl';
|
||||
* If the provider has proxy enabled, requests will be proxied through the corsProxy.
|
||||
*/
|
||||
export function createAIClient(provider: AIProvider, user?: NUser, corsProxy?: string): OpenAI {
|
||||
const baseConfig: ConstructorParameters<typeof OpenAI>[0] = {
|
||||
const openai = new OpenAI({
|
||||
baseURL: provider.baseURL,
|
||||
apiKey: provider.apiKey ?? '',
|
||||
dangerouslyAllowBrowser: true,
|
||||
};
|
||||
|
||||
const openai = new OpenAI({
|
||||
...baseConfig,
|
||||
fetch: async (input, init) => {
|
||||
let request = new Request(input, init);
|
||||
|
||||
// OpenSecret auth
|
||||
// https://docs.opensecret.cloud/docs/maple-ai/
|
||||
if (provider.openSecret) {
|
||||
const { createCustomFetch } = await import('@opensecret/react');
|
||||
return createCustomFetch({ apiKey: provider.apiKey, apiUrl: provider.openSecret })(input, init);
|
||||
}
|
||||
|
||||
// Add OpenRouter headers
|
||||
// https://openrouter.ai/docs/app-attribution
|
||||
if (provider.id === 'openrouter') {
|
||||
@@ -47,7 +51,7 @@ export function createAIClient(provider: AIProvider, user?: NUser, corsProxy?: s
|
||||
|
||||
// If proxy is enabled and we have a CORS proxy URL, modify the request URL
|
||||
if (provider.proxy && corsProxy) {
|
||||
request = new Request(proxyUrl(corsProxy, request.url), request);
|
||||
request = new Request(proxyUrl({ template: corsProxy, url: request.url }), request);
|
||||
}
|
||||
|
||||
return fetch(request);
|
||||
|
||||
@@ -6,6 +6,7 @@ export interface PresetProvider {
|
||||
nostr?: boolean;
|
||||
tosURL?: string;
|
||||
proxy?: boolean;
|
||||
openSecret?: string;
|
||||
}
|
||||
|
||||
export const AI_PROVIDER_PRESETS: PresetProvider[] = [
|
||||
@@ -16,13 +17,6 @@ export const AI_PROVIDER_PRESETS: PresetProvider[] = [
|
||||
tosURL: "https://ai.shakespeare.diy/terms",
|
||||
nostr: true,
|
||||
},
|
||||
{
|
||||
id: "openrouter",
|
||||
name: "OpenRouter",
|
||||
baseURL: "https://openrouter.ai/api/v1",
|
||||
apiKeysURL: "https://openrouter.ai/settings/keys",
|
||||
tosURL: "https://openrouter.ai/terms",
|
||||
},
|
||||
{
|
||||
id: "opencode",
|
||||
name: "OpenCode Zen",
|
||||
@@ -31,6 +25,21 @@ export const AI_PROVIDER_PRESETS: PresetProvider[] = [
|
||||
tosURL: "https://opencode.ai/legal/terms-of-service",
|
||||
proxy: true,
|
||||
},
|
||||
{
|
||||
id: "maple",
|
||||
name: "Maple AI",
|
||||
baseURL: "https://enclave.trymaple.ai/v1",
|
||||
apiKeysURL: "https://trymaple.ai/",
|
||||
tosURL: "https://opensecret.cloud/terms",
|
||||
openSecret: "https://enclave.trymaple.ai",
|
||||
},
|
||||
{
|
||||
id: "openrouter",
|
||||
name: "OpenRouter",
|
||||
baseURL: "https://openrouter.ai/api/v1",
|
||||
apiKeysURL: "https://openrouter.ai/settings/keys",
|
||||
tosURL: "https://openrouter.ai/terms",
|
||||
},
|
||||
{
|
||||
id: "ppq",
|
||||
name: "PayPerQ",
|
||||
|
||||
@@ -260,6 +260,19 @@ export function esmPlugin(options: EsmPluginOptions): Plugin {
|
||||
// not a URL; continue
|
||||
}
|
||||
|
||||
// Check if this is a file: dependency
|
||||
const allDeps = {
|
||||
...packageJson.dependencies,
|
||||
...packageJson.devDependencies,
|
||||
...packageJson.peerDependencies,
|
||||
};
|
||||
const depVersion = allDeps[packageName];
|
||||
|
||||
if (depVersion && depVersion.startsWith("file:")) {
|
||||
// Let fsPlugin handle file: dependencies
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine importer lock path (breadcrumb)
|
||||
const importerLockPath = getImporterLockPath(args.importer);
|
||||
|
||||
@@ -430,6 +443,8 @@ export function esmPlugin(options: EsmPluginOptions): Plugin {
|
||||
if (contentType) {
|
||||
if (contentType === "application/javascript") {
|
||||
loader = "js";
|
||||
} else if (contentType === "application/json") {
|
||||
loader = "json";
|
||||
} else if (contentType === "text/css") {
|
||||
loader = "css";
|
||||
} else if (contentType === "application/wasm") {
|
||||
|
||||
@@ -10,14 +10,21 @@ interface TsConfig {
|
||||
};
|
||||
}
|
||||
|
||||
interface PackageJson {
|
||||
dependencies?: { [key: string]: string };
|
||||
devDependencies?: { [key: string]: string };
|
||||
peerDependencies?: { [key: string]: string };
|
||||
}
|
||||
|
||||
interface FsPluginOptions {
|
||||
fs: JSRuntimeFS;
|
||||
cwd: string;
|
||||
tsconfig?: TsConfig;
|
||||
packageJson?: PackageJson;
|
||||
}
|
||||
|
||||
export function fsPlugin(options: FsPluginOptions): Plugin {
|
||||
const { fs, cwd, tsconfig } = options;
|
||||
const { fs, cwd, tsconfig, packageJson } = options;
|
||||
return {
|
||||
name: "fs",
|
||||
|
||||
@@ -30,21 +37,65 @@ export function fsPlugin(options: FsPluginOptions): Plugin {
|
||||
});
|
||||
|
||||
build.onResolve({ filter: /.*/ }, async (args) => {
|
||||
// Skip resolving paths from external URLs
|
||||
// Skip resolving paths from external URLs (but not fs: namespace)
|
||||
if (/^https?:\/\//.test(args.importer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let resolved: string;
|
||||
let resolved: string | undefined;
|
||||
|
||||
// Handle absolute paths
|
||||
if (args.path.startsWith("/")) {
|
||||
resolved = args.path;
|
||||
} else if (args.path.startsWith("@/")) {
|
||||
}
|
||||
// Handle @/ alias
|
||||
else if (args.path.startsWith("@/")) {
|
||||
resolved = join(cwd, "src", args.path.slice(2));
|
||||
} else if (args.importer && (args.path.startsWith("./") || args.path.startsWith("../"))) {
|
||||
resolved = join(dirname(args.importer), args.path);
|
||||
} else if (args.importer && tsconfig?.compilerOptions?.baseUrl) {
|
||||
}
|
||||
// Handle relative paths
|
||||
else if (args.importer && (args.path.startsWith("./") || args.path.startsWith("../"))) {
|
||||
// Remove fs: prefix from importer if present
|
||||
const importerPath = args.importer.replace(/^fs:/, '');
|
||||
resolved = join(dirname(importerPath), args.path);
|
||||
}
|
||||
// Handle bare imports (e.g., "react", "@scope/package")
|
||||
else if (args.path.match(/^[^./]/)) {
|
||||
// Check if this is a file: dependency
|
||||
const packageName = args.path.startsWith("@")
|
||||
? args.path.split("/").slice(0, 2).join("/")
|
||||
: args.path.split("/")[0];
|
||||
|
||||
const allDeps = {
|
||||
...packageJson?.dependencies,
|
||||
...packageJson?.devDependencies,
|
||||
...packageJson?.peerDependencies,
|
||||
};
|
||||
|
||||
const depVersion = allDeps[packageName];
|
||||
|
||||
if (depVersion && depVersion.startsWith("file:")) {
|
||||
// Extract the file path (e.g., "file:./path" -> "./path")
|
||||
const filePath = depVersion.slice(5); // Remove "file:" prefix
|
||||
const packagePath = join(cwd, filePath);
|
||||
|
||||
// Get the subpath within the package (e.g., "package/subdir/file" -> "/subdir/file")
|
||||
const subpath = args.path.slice(packageName.length);
|
||||
|
||||
resolved = join(packagePath, subpath);
|
||||
} else {
|
||||
return; // Let esmPlugin handle this
|
||||
}
|
||||
}
|
||||
// Handle tsconfig baseUrl
|
||||
else if (args.importer && tsconfig?.compilerOptions?.baseUrl) {
|
||||
resolved = join(cwd, tsconfig.compilerOptions.baseUrl, args.path);
|
||||
} else {
|
||||
}
|
||||
// Nothing matched, let other plugins handle it
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!resolved) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,8 +165,43 @@ async function tryFileVariants(
|
||||
return basePath;
|
||||
}
|
||||
|
||||
// If it's a directory, try index files
|
||||
// If it's a directory, try package.json first, then index files
|
||||
if (stat.isDirectory()) {
|
||||
// Try to read package.json for entry point
|
||||
try {
|
||||
const packageJsonPath = join(basePath, "package.json");
|
||||
const packageJsonText = await fs.readFile(packageJsonPath, "utf8");
|
||||
const packageJson = JSON.parse(packageJsonText);
|
||||
|
||||
// Check for various entry point fields
|
||||
const entryPoint = packageJson.exports?.['.']
|
||||
|| packageJson.module
|
||||
|| packageJson.main
|
||||
|| 'index.js';
|
||||
|
||||
// Resolve the entry point
|
||||
const entryPath = typeof entryPoint === 'string'
|
||||
? join(basePath, entryPoint)
|
||||
: join(basePath, 'index.js');
|
||||
|
||||
const entryStat = await statSafe(fs, entryPath);
|
||||
if (entryStat.isFile()) {
|
||||
return entryPath;
|
||||
}
|
||||
|
||||
// Try with different extensions if the entry point doesn't exist
|
||||
for (const ext of extensions) {
|
||||
const entryWithExt = entryPath.replace(/\.[^.]+$/, '') + ext;
|
||||
const entryExtStat = await statSafe(fs, entryWithExt);
|
||||
if (entryExtStat.isFile()) {
|
||||
return entryWithExt;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// package.json doesn't exist or is invalid, fall through to index files
|
||||
}
|
||||
|
||||
// Fall back to trying index files
|
||||
for (const ext of extensions) {
|
||||
const indexFile = join(basePath, "index" + ext);
|
||||
const indexStat = await statSafe(fs, indexFile);
|
||||
|
||||
@@ -535,4 +535,63 @@ react@^18.0.0:
|
||||
// Verify tsconfig.json was attempted to be read
|
||||
expect(mockFS.readFile).toHaveBeenCalledWith('/test/project/tsconfig.json', 'utf8');
|
||||
});
|
||||
|
||||
it('should support file: dependencies in package.json', async () => {
|
||||
const packageJsonWithFileDeps = JSON.stringify({
|
||||
name: "test-project",
|
||||
dependencies: {
|
||||
"@bitchat/capacitor-ble-mesh": "file:./capacitor-bitchat-mesh",
|
||||
"react": "^18.2.0"
|
||||
}
|
||||
});
|
||||
|
||||
// Mock required files
|
||||
vi.mocked(mockFS.readFile)
|
||||
.mockImplementation(async (path: string) => {
|
||||
if (path.endsWith('package.json')) {
|
||||
return packageJsonWithFileDeps;
|
||||
}
|
||||
if (path.endsWith('index.html')) {
|
||||
return '<html><head></head><body><script src="/src/main.tsx"></script></body></html>';
|
||||
}
|
||||
if (path.endsWith('package-lock.json')) {
|
||||
return '{"dependencies": {}}';
|
||||
}
|
||||
throw new Error(`File not found: ${path}`);
|
||||
});
|
||||
|
||||
// Mock stat to indicate no public directory
|
||||
vi.mocked(mockFS.stat)
|
||||
.mockImplementation(async (path: string) => {
|
||||
if (path === '/test/project/public') {
|
||||
throw new Error('Directory not found');
|
||||
}
|
||||
return { isDirectory: () => false, isFile: () => true };
|
||||
});
|
||||
|
||||
// Mock additional filesystem operations for buildProject
|
||||
vi.mocked(mockFS.readdir).mockImplementation(async (path: string) => {
|
||||
if (path === '/test/project/dist') {
|
||||
return [];
|
||||
}
|
||||
return [];
|
||||
});
|
||||
|
||||
vi.mocked(mockFS.mkdir).mockResolvedValue(undefined);
|
||||
vi.mocked(mockFS.writeFile).mockResolvedValue(undefined);
|
||||
|
||||
const result = await buildProject({
|
||||
fs: mockFS,
|
||||
projectPath: '/test/project',
|
||||
domParser: mockDOMParser,
|
||||
esmUrl: 'https://esm.shakespeare.diy',
|
||||
});
|
||||
|
||||
// Should successfully build with file: dependencies
|
||||
expect(result.files['stdin-abc123.js']).toEqual(new Uint8Array([1, 2, 3]));
|
||||
expect(result.files['index.html']).toBeDefined();
|
||||
|
||||
// Verify package.json was read
|
||||
expect(mockFS.readFile).toHaveBeenCalledWith('/test/project/package.json', 'utf8');
|
||||
});
|
||||
});
|
||||
@@ -130,7 +130,7 @@ async function bundle(
|
||||
assetNames: "[name]-[hash]",
|
||||
plugins: [
|
||||
shakespearePlugin({ esmUrl }),
|
||||
fsPlugin({ fs, cwd: projectPath, tsconfig }),
|
||||
fsPlugin({ fs, cwd: projectPath, tsconfig, packageJson }),
|
||||
esmPlugin({ packageJson, packageLock, target, esmUrl }),
|
||||
],
|
||||
define: {
|
||||
|
||||
@@ -66,7 +66,7 @@ export class CurlCommand implements ShellCommand {
|
||||
|
||||
// Proxy the URL through configured CorsProxy
|
||||
const originalUrl = url.toString();
|
||||
const proxiedUrl = proxyUrl(this.corsProxy, originalUrl);
|
||||
const proxiedUrl = proxyUrl({ template: this.corsProxy, url: originalUrl });
|
||||
|
||||
// Prepare request
|
||||
const requestInit: RequestInit = {
|
||||
|
||||
@@ -37,6 +37,7 @@ const aiProviderSchema = z.object({
|
||||
apiKey: z.string().optional(),
|
||||
nostr: z.boolean().optional(),
|
||||
proxy: z.boolean().optional(),
|
||||
openSecret: z.string().url().optional(),
|
||||
});
|
||||
|
||||
const providerModelSchema = z.string().regex(
|
||||
|
||||
@@ -140,7 +140,7 @@ export class CloudflareAdapter implements DeployAdapter {
|
||||
|
||||
private async getWorkersSubdomain(): Promise<string> {
|
||||
const url = `${this.baseURL}/accounts/${this.accountId}/workers/subdomain`;
|
||||
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||
const targetUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url }) : url;
|
||||
|
||||
const response = await fetch(targetUrl, {
|
||||
method: 'GET',
|
||||
@@ -160,7 +160,7 @@ export class CloudflareAdapter implements DeployAdapter {
|
||||
|
||||
private async enableWorkersDevSubdomain(scriptName: string): Promise<void> {
|
||||
const url = `${this.baseURL}/accounts/${this.accountId}/workers/scripts/${scriptName}/subdomain`;
|
||||
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||
const targetUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url }) : url;
|
||||
|
||||
const response = await fetch(targetUrl, {
|
||||
method: 'POST',
|
||||
@@ -185,7 +185,7 @@ export class CloudflareAdapter implements DeployAdapter {
|
||||
manifest: AssetManifest
|
||||
): Promise<InitializeAssetsResponse> {
|
||||
const url = `${this.baseURL}/accounts/${this.accountId}/workers/scripts/${scriptName}/assets-upload-session`;
|
||||
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||
const targetUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url }) : url;
|
||||
|
||||
const response = await fetch(targetUrl, {
|
||||
method: 'POST',
|
||||
@@ -211,7 +211,7 @@ export class CloudflareAdapter implements DeployAdapter {
|
||||
hashToFile: Map<string, { path: string; info: FileInfo }>
|
||||
): Promise<UploadResponse> {
|
||||
const url = `${this.baseURL}/accounts/${this.accountId}/workers/assets/upload?base64=true`;
|
||||
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||
const targetUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url }) : url;
|
||||
|
||||
const formData = new FormData();
|
||||
|
||||
@@ -251,7 +251,7 @@ export class CloudflareAdapter implements DeployAdapter {
|
||||
|
||||
private async deployWorker(scriptName: string, assetsJwt: string): Promise<WorkerScript> {
|
||||
const url = `${this.baseURL}/accounts/${this.accountId}/workers/scripts/${scriptName}`;
|
||||
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||
const targetUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url }) : url;
|
||||
|
||||
// Create a minimal worker script that serves static assets
|
||||
// This is an assets-only worker - Cloudflare will automatically serve the uploaded assets
|
||||
|
||||
@@ -96,7 +96,7 @@ export class DenoDeployAdapter implements DeployAdapter {
|
||||
|
||||
private async findProject(projectName: string): Promise<Project | null> {
|
||||
const url = `${this.baseURL}/organizations/${this.organizationId}/projects?q=${encodeURIComponent(projectName)}`;
|
||||
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||
const targetUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url }) : url;
|
||||
|
||||
const response = await fetch(targetUrl, {
|
||||
method: 'GET',
|
||||
@@ -116,7 +116,7 @@ export class DenoDeployAdapter implements DeployAdapter {
|
||||
|
||||
private async createProject(projectName: string): Promise<Project> {
|
||||
const url = `${this.baseURL}/organizations/${this.organizationId}/projects`;
|
||||
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||
const targetUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url }) : url;
|
||||
|
||||
const response = await fetch(targetUrl, {
|
||||
method: 'POST',
|
||||
@@ -143,7 +143,7 @@ export class DenoDeployAdapter implements DeployAdapter {
|
||||
domain: string
|
||||
): Promise<Deployment> {
|
||||
const url = `${this.baseURL}/projects/${projectId}/deployments`;
|
||||
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||
const targetUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url }) : url;
|
||||
|
||||
// Create a minimal server script that serves static files
|
||||
// For static sites, we use a simple file server entry point
|
||||
|
||||
@@ -89,7 +89,7 @@ export class NetlifyAdapter implements DeployAdapter {
|
||||
|
||||
private async createSite(name: string): Promise<NetlifySite> {
|
||||
const url = `${this.baseURL}/sites`;
|
||||
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||
const targetUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url }) : url;
|
||||
|
||||
const response = await fetch(targetUrl, {
|
||||
method: 'POST',
|
||||
@@ -113,7 +113,7 @@ export class NetlifyAdapter implements DeployAdapter {
|
||||
|
||||
private async getSite(siteId: string): Promise<NetlifySite> {
|
||||
const url = `${this.baseURL}/sites/${siteId}`;
|
||||
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||
const targetUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url }) : url;
|
||||
|
||||
const response = await fetch(targetUrl, {
|
||||
method: 'GET',
|
||||
@@ -132,7 +132,7 @@ export class NetlifyAdapter implements DeployAdapter {
|
||||
|
||||
private async triggerDeploy(siteId: string, zipBlob: Blob): Promise<NetlifyBuildResponse> {
|
||||
const url = `${this.baseURL}/sites/${siteId}/deploys`;
|
||||
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||
const targetUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url }) : url;
|
||||
|
||||
const response = await fetch(targetUrl, {
|
||||
method: 'POST',
|
||||
|
||||
@@ -72,7 +72,7 @@ export class ShakespeareAdapter implements DeployAdapter {
|
||||
|
||||
// Apply proxy if configured
|
||||
if (this.corsProxy) {
|
||||
request = new Request(proxyUrl(this.corsProxy, request.url), request);
|
||||
request = new Request(proxyUrl({ template: this.corsProxy, url: request.url }), request);
|
||||
}
|
||||
|
||||
// Deploy
|
||||
|
||||
@@ -68,7 +68,7 @@ export class VercelAdapter implements DeployAdapter {
|
||||
}
|
||||
|
||||
// Apply proxy if configured
|
||||
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, apiUrl) : apiUrl;
|
||||
const targetUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url: apiUrl }) : apiUrl;
|
||||
|
||||
// Deploy to Vercel
|
||||
const response = await fetch(targetUrl, {
|
||||
|
||||
+11
-5
@@ -1,15 +1,21 @@
|
||||
import UriTemplate from 'uri-templates';
|
||||
|
||||
export interface FaviconUrlOpts {
|
||||
template: string;
|
||||
url: string | URL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a favicon URL from a template and input URL
|
||||
* @param template - URL template with placeholders like {hostname}, {origin}, etc.
|
||||
* @param url - The URL to extract parts from
|
||||
* @param opts - Options object
|
||||
* @param opts.template - URL template with placeholders like {hostname}, {origin}, etc.
|
||||
* @param opts.url - The URL to extract parts from
|
||||
* @returns The hydrated favicon URL
|
||||
*/
|
||||
export function faviconUrl(template: string, url: string | URL): string {
|
||||
const u = new URL(url);
|
||||
export function faviconUrl(opts: FaviconUrlOpts): string {
|
||||
const u = new URL(opts.url);
|
||||
|
||||
return UriTemplate(template).fill({
|
||||
return UriTemplate(opts.template).fill({
|
||||
href: u.href,
|
||||
origin: u.origin,
|
||||
protocol: u.protocol,
|
||||
|
||||
+2
-3
@@ -1107,8 +1107,7 @@ class GitHttp implements HttpClient {
|
||||
|
||||
constructor(proxy?: string, fetch?: typeof globalThis.fetch) {
|
||||
this.proxy = proxy;
|
||||
// Bind fetch to globalThis to preserve context when called as this.fetch()
|
||||
this.fetch = fetch ?? globalThis.fetch.bind(globalThis);
|
||||
this.fetch = fetch ?? globalThis.fetch;
|
||||
}
|
||||
|
||||
async request(request: GitHttpRequest): Promise<GitHttpResponse> {
|
||||
@@ -1116,7 +1115,7 @@ class GitHttp implements HttpClient {
|
||||
const url = new URL(request.url);
|
||||
|
||||
const target = this.proxy
|
||||
? proxyUrl(this.proxy, url)
|
||||
? proxyUrl({ template: this.proxy, url })
|
||||
: url.href;
|
||||
|
||||
const init: RequestInit = {
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('ngitWebUrl', () => {
|
||||
const identifier = 'my-repo';
|
||||
const nostrURI = new NostrURI({ pubkey, identifier });
|
||||
|
||||
const result = ngitWebUrl(template, nostrURI);
|
||||
const result = ngitWebUrl({ template, nostrURI });
|
||||
|
||||
expect(result).toMatch(/^https:\/\/nostrhub\.io\/naddr1/);
|
||||
});
|
||||
@@ -20,7 +20,7 @@ describe('ngitWebUrl', () => {
|
||||
const identifier = 'my-repo';
|
||||
const nostrURI = new NostrURI({ pubkey, identifier });
|
||||
|
||||
const result = ngitWebUrl(template, nostrURI);
|
||||
const result = ngitWebUrl({ template, nostrURI });
|
||||
|
||||
expect(result).toMatch(/^https:\/\/example\.com\/npub1/);
|
||||
});
|
||||
@@ -31,7 +31,7 @@ describe('ngitWebUrl', () => {
|
||||
const identifier = 'my-repo';
|
||||
const nostrURI = new NostrURI({ pubkey, identifier });
|
||||
|
||||
const result = ngitWebUrl(template, nostrURI);
|
||||
const result = ngitWebUrl({ template, nostrURI });
|
||||
|
||||
expect(result).toBe(`https://example.com/${pubkey}`);
|
||||
});
|
||||
@@ -42,7 +42,7 @@ describe('ngitWebUrl', () => {
|
||||
const identifier = 'my-repo';
|
||||
const nostrURI = new NostrURI({ pubkey, identifier });
|
||||
|
||||
const result = ngitWebUrl(template, nostrURI);
|
||||
const result = ngitWebUrl({ template, nostrURI });
|
||||
|
||||
expect(result).toBe('https://example.com/my-repo');
|
||||
});
|
||||
@@ -53,7 +53,7 @@ describe('ngitWebUrl', () => {
|
||||
const identifier = 'my-repo';
|
||||
const nostrURI = new NostrURI({ pubkey, identifier });
|
||||
|
||||
const result = ngitWebUrl(template, nostrURI);
|
||||
const result = ngitWebUrl({ template, nostrURI });
|
||||
|
||||
expect(result).toMatch(/^https:\/\/example\.com\/npub1[^/]+\/my-repo$/);
|
||||
});
|
||||
@@ -65,7 +65,7 @@ describe('ngitWebUrl', () => {
|
||||
const relay = 'wss://relay.example.com/';
|
||||
const nostrURI = new NostrURI({ pubkey, identifier, relay });
|
||||
|
||||
const result = ngitWebUrl(template, nostrURI);
|
||||
const result = ngitWebUrl({ template, nostrURI });
|
||||
|
||||
// The naddr should be longer when it includes relay information
|
||||
expect(result).toMatch(/^https:\/\/nostrhub\.io\/naddr1/);
|
||||
|
||||
+14
-8
@@ -2,20 +2,26 @@ import UriTemplate from 'uri-templates';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
import { NostrURI } from './NostrURI';
|
||||
|
||||
export interface NgitWebUrlOpts {
|
||||
template: string;
|
||||
nostrURI: NostrURI;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a Nostr Git web URL from a template and Nostr URI
|
||||
* @param template - URL template with placeholders like {naddr}, {npub}, {pubkey}, {identifier}
|
||||
* @param nostrURI - The Nostr URI containing pubkey, identifier, and optional relay
|
||||
* @param opts - Options object
|
||||
* @param opts.template - URL template with placeholders like {naddr}, {npub}, {pubkey}, {identifier}
|
||||
* @param opts.nostrURI - The Nostr URI containing pubkey, identifier, and optional relay
|
||||
* @returns The hydrated web URL
|
||||
*/
|
||||
export function ngitWebUrl(template: string, nostrURI: NostrURI): string {
|
||||
const naddr = nostrURI.toNaddr();
|
||||
const npub = nip19.npubEncode(nostrURI.pubkey);
|
||||
export function ngitWebUrl(opts: NgitWebUrlOpts): string {
|
||||
const naddr = opts.nostrURI.toNaddr();
|
||||
const npub = nip19.npubEncode(opts.nostrURI.pubkey);
|
||||
|
||||
return UriTemplate(template).fill({
|
||||
return UriTemplate(opts.template).fill({
|
||||
naddr,
|
||||
npub,
|
||||
pubkey: nostrURI.pubkey,
|
||||
identifier: nostrURI.identifier,
|
||||
pubkey: opts.nostrURI.pubkey,
|
||||
identifier: opts.nostrURI.identifier,
|
||||
});
|
||||
}
|
||||
+8
-3
@@ -1,8 +1,13 @@
|
||||
import UriTemplate from 'uri-templates';
|
||||
|
||||
export function proxyUrl(template: string, url: string | URL): string {
|
||||
const u = new URL(url);
|
||||
return UriTemplate(template).fill({
|
||||
export interface ProxyUrlOpts {
|
||||
template: string;
|
||||
url: string | URL;
|
||||
}
|
||||
|
||||
export function proxyUrl(opts: ProxyUrlOpts): string {
|
||||
const u = new URL(opts.url);
|
||||
return UriTemplate(opts.template).fill({
|
||||
href: u.href,
|
||||
origin: u.origin,
|
||||
protocol: u.protocol,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Bot, GitBranch, Database, Wifi, Settings2, Info, Settings, Rocket, Wallet } from 'lucide-react';
|
||||
import { Bot, GitBranch, Database, Wifi, Settings2, Info, Settings, Rocket } from 'lucide-react';
|
||||
|
||||
export interface SettingsItem {
|
||||
id: string;
|
||||
@@ -59,12 +59,6 @@ export const getSettingsCategories = (t: (key: string) => string): SettingsCateg
|
||||
title: t('nostrSettings'),
|
||||
href: '/settings/nostr',
|
||||
},
|
||||
{
|
||||
id: 'wallet',
|
||||
icon: Wallet,
|
||||
title: t('walletSettings'),
|
||||
href: '/settings/wallet',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -137,7 +137,7 @@ export class GenerateImageTool implements Tool<GenerateImageParams> {
|
||||
}
|
||||
} else if (firstImage.url) {
|
||||
// Fetch the image from the URL
|
||||
const imageUrl = this.corsProxy ? proxyUrl(this.corsProxy, firstImage.url) : firstImage.url;
|
||||
const imageUrl = this.corsProxy ? proxyUrl({ template: this.corsProxy, url: firstImage.url }) : firstImage.url;
|
||||
const imageResponse = await fetch(imageUrl);
|
||||
|
||||
if (!imageResponse.ok) {
|
||||
|
||||
@@ -106,43 +106,12 @@
|
||||
"deploySettingsDescription": "Configure deployment providers",
|
||||
"nostrSettings": "Nostr",
|
||||
"nostrSettingsDescription": "Configure relay connections and Nostr preferences",
|
||||
"walletSettings": "Wallet",
|
||||
"walletSettingsDescription": "Connect Lightning wallets for zaps",
|
||||
"currentStatus": "Current Status",
|
||||
"browserExtension": "Browser extension",
|
||||
"ready": "Ready",
|
||||
"notFound": "Not Found",
|
||||
"nostrWalletConnect": "Nostr Wallet Connect",
|
||||
"walletsConnected": "{{count}} wallet(s) connected",
|
||||
"remoteWalletConnection": "Remote wallet connection",
|
||||
"none": "None",
|
||||
"noWalletsConnected": "No wallets connected",
|
||||
"addNwcWalletToGetStarted": "Add an NWC wallet to get started",
|
||||
"lightningWallet": "Lightning Wallet",
|
||||
"nwcConnection": "NWC Connection",
|
||||
"setAsActive": "Set as active",
|
||||
"activeWalletChanged": "Active wallet changed",
|
||||
"selectedWalletNowActive": "The selected wallet is now active for zaps.",
|
||||
"installWeblnOrConnectNwc": "Install a WebLN extension or connect an NWC wallet to send zaps.",
|
||||
"connectNwcWallet": "Connect NWC Wallet",
|
||||
"enterConnectionStringFromWallet": "Enter your connection string from a compatible wallet.",
|
||||
"walletNameOptional": "Wallet Name (optional)",
|
||||
"myLightningWallet": "My Lightning Wallet",
|
||||
"connectionUri": "Connection URI",
|
||||
"connecting": "Connecting...",
|
||||
"connect": "Connect",
|
||||
"connectionUriRequired": "Connection URI required",
|
||||
"pleaseEnterValidNwcUri": "Please enter a valid NWC connection URI.",
|
||||
"storageSettings": "Storage",
|
||||
"storageSettingsDescription": "Export files and manage local data",
|
||||
"emailUpdates": "Email Updates",
|
||||
"emailUpdatesDescription": "Subscribe to Shakespeare updates and resources",
|
||||
"newProject": "New Project",
|
||||
"importRepository": "Import Repository",
|
||||
"explore": "Explore",
|
||||
"exploreApps": "Explore Apps",
|
||||
"exploreRepositories": "Explore repositories from the Nostr network",
|
||||
"pleaseLogInToExplore": "Please log in to explore repositories",
|
||||
"noProjectsYet": "No projects yet",
|
||||
"createFirstProject": "Create your first project to get started",
|
||||
"searchProjects": "Search projects...",
|
||||
|
||||
@@ -104,33 +104,6 @@
|
||||
"nostrSettingsDescription": "Saita haɗin relay da zaɓuɓɓukan Nostr",
|
||||
"storageSettings": "Ajiya",
|
||||
"storageSettingsDescription": "Fitar da fayiloli da sarrafa bayanan gida",
|
||||
"walletSettings": "Walat",
|
||||
"walletSettingsDescription": "Haɗa walat na Lightning don zaps",
|
||||
"currentStatus": "Matsayin Yanzu",
|
||||
"browserExtension": "Ƙari na bincike",
|
||||
"ready": "Shirye",
|
||||
"notFound": "Ba a Samu ba",
|
||||
"nostrWalletConnect": "Nostr Wallet Connect",
|
||||
"walletsConnected": "{{count}} walat da aka haɗa",
|
||||
"remoteWalletConnection": "Haɗin walat na nesa",
|
||||
"none": "Babu",
|
||||
"noWalletsConnected": "Babu walat da aka haɗa",
|
||||
"addNwcWalletToGetStarted": "Ƙara walat NWC don farawa",
|
||||
"lightningWallet": "Walat na Lightning",
|
||||
"nwcConnection": "Haɗin NWC",
|
||||
"setAsActive": "Saita a matsayin mai aiki",
|
||||
"activeWalletChanged": "Walat mai aiki ya canza",
|
||||
"selectedWalletNowActive": "Walat da aka zaɓa yanzu yana aiki don zaps.",
|
||||
"installWeblnOrConnectNwc": "Shigar da ƙarin WebLN ko haɗa walat NWC don aika zaps.",
|
||||
"connectNwcWallet": "Haɗa Walat NWC",
|
||||
"enterConnectionStringFromWallet": "Shigar da igiyar haɗin ku daga walat mai dacewa.",
|
||||
"walletNameOptional": "Sunan Walat (na zaɓi)",
|
||||
"myLightningWallet": "Walat na Lightning Na",
|
||||
"connectionUri": "URI Haɗi",
|
||||
"connecting": "Ana haɗawa...",
|
||||
"connect": "Haɗa",
|
||||
"connectionUriRequired": "URI haɗi yana buƙata",
|
||||
"pleaseEnterValidNwcUri": "Da fatan za a shigar da URI haɗin NWC mai inganci.",
|
||||
"emailUpdates": "Sabuntawar Imel",
|
||||
"emailUpdatesDescription": "Yi rajista don karbar sabuntawar Shakespeare da albarkatu",
|
||||
"newProject": "Sabon Aikin",
|
||||
@@ -167,10 +140,6 @@
|
||||
"unsavedChanges": "Canje-canjen da ba a ajiye ba",
|
||||
"saving": "Ana ajiyewa...",
|
||||
"languageLabel": "Harshe",
|
||||
"explore": "Bincika",
|
||||
"exploreApps": "Bincika Ayyuka",
|
||||
"exploreRepositories": "Bincika ma'ajiyar bayanai daga hanyar sadarwa ta Nostr",
|
||||
"pleaseLogInToExplore": "Da fatan za a shiga don bincika ma'ajiyar bayanai",
|
||||
"searchFiles": "Neman fayiloli...",
|
||||
"noFilesFound": "Babu fayilolin da aka samu",
|
||||
"noFilesFoundSearch": "Babu fayilolin da suka dace da bincikenku",
|
||||
|
||||
@@ -104,33 +104,6 @@
|
||||
"nostrSettingsDescription": "Hazie njikọ relay na nhọrọ Nostr",
|
||||
"storageSettings": "Nchekwa",
|
||||
"storageSettingsDescription": "Bupụta faịlụ na jikwaa data mpaghara",
|
||||
"walletSettings": "Obere Akpa",
|
||||
"walletSettingsDescription": "Jikọọ obere akpa Lightning maka zaps",
|
||||
"currentStatus": "Ọnọdụ Ugbu A",
|
||||
"browserExtension": "Mgbatị ihe nchọgharị",
|
||||
"ready": "Njikere",
|
||||
"notFound": "Achọtaghị",
|
||||
"nostrWalletConnect": "Nostr Wallet Connect",
|
||||
"walletsConnected": "{{count}} obere akpa jikọrọ",
|
||||
"remoteWalletConnection": "Njikọ obere akpa dị anya",
|
||||
"none": "Ọ dịghị",
|
||||
"noWalletsConnected": "Enweghị obere akpa jikọrọ",
|
||||
"addNwcWalletToGetStarted": "Tinye obere akpa NWC iji malite",
|
||||
"lightningWallet": "Obere Akpa Lightning",
|
||||
"nwcConnection": "Njikọ NWC",
|
||||
"setAsActive": "Tọọ dị ka ọrụ",
|
||||
"activeWalletChanged": "Obere akpa na-arụ ọrụ agbanweela",
|
||||
"selectedWalletNowActive": "Obere akpa ahọpụtara na-arụ ọrụ ugbu a maka zaps.",
|
||||
"installWeblnOrConnectNwc": "Wụnye mgbatị WebLN ma ọ bụ jikọọ obere akpa NWC iji zipu zaps.",
|
||||
"connectNwcWallet": "Jikọọ Obere Akpa NWC",
|
||||
"enterConnectionStringFromWallet": "Tinye eriri njikọ gị site na obere akpa dakọtara.",
|
||||
"walletNameOptional": "Aha Obere Akpa (nhọrọ)",
|
||||
"myLightningWallet": "Obere Akpa Lightning M",
|
||||
"connectionUri": "URI Njikọ",
|
||||
"connecting": "Na-ejikọ...",
|
||||
"connect": "Jikọọ",
|
||||
"connectionUriRequired": "URI njikọ achọrọ",
|
||||
"pleaseEnterValidNwcUri": "Biko tinye URI njikọ NWC dị mma.",
|
||||
"emailUpdates": "Nmelite Email",
|
||||
"emailUpdatesDescription": "Debanye aha maka nmelite Shakespeare na akụrụngwa",
|
||||
"newProject": "Ọrụ Ọhụrụ",
|
||||
@@ -167,10 +140,6 @@
|
||||
"unsavedChanges": "Mgbanwe ndị na-echekwaghị",
|
||||
"saving": "Na-echekwa...",
|
||||
"languageLabel": "Asụsụ",
|
||||
"explore": "Chọpụta",
|
||||
"exploreApps": "Chọpụta Ngwa",
|
||||
"exploreRepositories": "Chọpụta ebe nchekwa sitere na netwọk Nostr",
|
||||
"pleaseLogInToExplore": "Biko banye iji chọpụta ebe nchekwa",
|
||||
"searchFiles": "Chọọ faịlụ...",
|
||||
"noFilesFound": "Ahụghị faịlụ ọ bụla",
|
||||
"noFilesFoundSearch": "Ahụghị faịlụ ọ bụla dabara na nchọgharị gị",
|
||||
|
||||
@@ -106,33 +106,6 @@
|
||||
"nostrSettingsDescription": "Configure conexões de relay e preferências do Nostr",
|
||||
"storageSettings": "Armazenamento",
|
||||
"storageSettingsDescription": "Exporte arquivos e gerencie dados locais",
|
||||
"walletSettings": "Carteira",
|
||||
"walletSettingsDescription": "Conecte carteiras Lightning para zaps",
|
||||
"currentStatus": "Status Atual",
|
||||
"browserExtension": "Extensão do navegador",
|
||||
"ready": "Pronto",
|
||||
"notFound": "Não Encontrado",
|
||||
"nostrWalletConnect": "Nostr Wallet Connect",
|
||||
"walletsConnected": "{{count}} carteira(s) conectada(s)",
|
||||
"remoteWalletConnection": "Conexão de carteira remota",
|
||||
"none": "Nenhum",
|
||||
"noWalletsConnected": "Nenhuma carteira conectada",
|
||||
"addNwcWalletToGetStarted": "Adicione uma carteira NWC para começar",
|
||||
"lightningWallet": "Carteira Lightning",
|
||||
"nwcConnection": "Conexão NWC",
|
||||
"setAsActive": "Definir como ativa",
|
||||
"activeWalletChanged": "Carteira ativa alterada",
|
||||
"selectedWalletNowActive": "A carteira selecionada está agora ativa para zaps.",
|
||||
"installWeblnOrConnectNwc": "Instale uma extensão WebLN ou conecte uma carteira NWC para enviar zaps.",
|
||||
"connectNwcWallet": "Conectar Carteira NWC",
|
||||
"enterConnectionStringFromWallet": "Digite sua string de conexão de uma carteira compatível.",
|
||||
"walletNameOptional": "Nome da Carteira (opcional)",
|
||||
"myLightningWallet": "Minha Carteira Lightning",
|
||||
"connectionUri": "URI de Conexão",
|
||||
"connecting": "Conectando...",
|
||||
"connect": "Conectar",
|
||||
"connectionUriRequired": "URI de conexão obrigatória",
|
||||
"pleaseEnterValidNwcUri": "Por favor, insira um URI de conexão NWC válido.",
|
||||
"emailUpdates": "Atualizações por Email",
|
||||
"emailUpdatesDescription": "Inscreva-se para receber atualizações e recursos do Shakespeare",
|
||||
"newProject": "Novo Projeto",
|
||||
@@ -169,10 +142,6 @@
|
||||
"unsavedChanges": "Alterações não salvas",
|
||||
"saving": "Salvando...",
|
||||
"languageLabel": "Linguagem",
|
||||
"explore": "Explorar",
|
||||
"exploreApps": "Explorar Aplicativos",
|
||||
"exploreRepositories": "Explorar repositórios da rede Nostr",
|
||||
"pleaseLogInToExplore": "Por favor, faça login para explorar repositórios",
|
||||
"searchFiles": "Buscar arquivos...",
|
||||
"noFilesFound": "Nenhum arquivo encontrado",
|
||||
"noFilesFoundSearch": "Nenhum arquivo encontrado correspondente à sua busca",
|
||||
|
||||
@@ -104,33 +104,6 @@
|
||||
"nostrSettingsDescription": "Tunto awọn asopọ relay ati awọn ayanfẹ Nostr",
|
||||
"storageSettings": "Ibi ipamọ",
|
||||
"storageSettingsDescription": "Gbe awọn faili jade ati ṣakoso data agbegbe",
|
||||
"walletSettings": "Apamọwọ",
|
||||
"walletSettingsDescription": "So awọn apamọwọ Lightning mọ fun zaps",
|
||||
"currentStatus": "Ipo Lọwọlọwọ",
|
||||
"browserExtension": "Afikun awoṣe",
|
||||
"ready": "Ṣetan",
|
||||
"notFound": "Ko Ri",
|
||||
"nostrWalletConnect": "Nostr Wallet Connect",
|
||||
"walletsConnected": "{{count}} apamọwọ ti a sopọ mọ",
|
||||
"remoteWalletConnection": "Asopọ apamọwọ latọna jijin",
|
||||
"none": "Ko si",
|
||||
"noWalletsConnected": "Ko si awọn apamọwọ ti a sopọ mọ",
|
||||
"addNwcWalletToGetStarted": "Fi apamọwọ NWC kun lati bẹrẹ",
|
||||
"lightningWallet": "Apamọwọ Lightning",
|
||||
"nwcConnection": "Asopọ NWC",
|
||||
"setAsActive": "Ṣeto bi ti nṣiṣẹ",
|
||||
"activeWalletChanged": "Apamọwọ ti nṣiṣẹ ti yipada",
|
||||
"selectedWalletNowActive": "Apamọwọ ti a yan ti nṣiṣẹ bayi fun zaps.",
|
||||
"installWeblnOrConnectNwc": "Fi afikun WebLN sori tabi sopọ apamọwọ NWC lati fi zaps ranṣẹ.",
|
||||
"connectNwcWallet": "Sopọ Apamọwọ NWC",
|
||||
"enterConnectionStringFromWallet": "Tẹ okun asopọ rẹ lati apamọwọ ti o baamu.",
|
||||
"walletNameOptional": "Orukọ Apamọwọ (aṣayan)",
|
||||
"myLightningWallet": "Apamọwọ Lightning Mi",
|
||||
"connectionUri": "URI Asopọ",
|
||||
"connecting": "N sopọ mọ...",
|
||||
"connect": "Sopọ mọ",
|
||||
"connectionUriRequired": "URI asopọ nilo",
|
||||
"pleaseEnterValidNwcUri": "Jọwọ tẹ URI asopọ NWC ti o tọ.",
|
||||
"emailUpdates": "Awọn Imudojuiwọn Imeeli",
|
||||
"emailUpdatesDescription": "Forukọsilẹ fun awọn imudojuiwọn Shakespeare ati awọn ohun elo",
|
||||
"newProject": "Iṣẹ akanṣe Tuntun",
|
||||
@@ -167,10 +140,6 @@
|
||||
"unsavedChanges": "Awọn iyipada ti a ko fi pamọ",
|
||||
"saving": "N fi pamọ...",
|
||||
"languageLabel": "Ede",
|
||||
"explore": "Ṣawari",
|
||||
"exploreApps": "Ṣawari Awọn Ohun Elo",
|
||||
"exploreRepositories": "Ṣawari awọn ibi ipamọ lati nẹtiwọki Nostr",
|
||||
"pleaseLogInToExplore": "Jọwọ wọle lati ṣawari awọn ibi ipamọ",
|
||||
"searchFiles": "Wa awọn faili...",
|
||||
"noFilesFound": "Ko si awọn faili ti a ri",
|
||||
"noFilesFoundSearch": "Ko si awọn faili ti o baamu wiwa rẹ",
|
||||
|
||||
@@ -106,33 +106,6 @@
|
||||
"nostrSettingsDescription": "配置中继连接和Nostr偏好",
|
||||
"storageSettings": "存储",
|
||||
"storageSettingsDescription": "导出文件和管理本地数据",
|
||||
"walletSettings": "钱包",
|
||||
"walletSettingsDescription": "连接闪电钱包以进行打赏",
|
||||
"currentStatus": "当前状态",
|
||||
"browserExtension": "浏览器扩展",
|
||||
"ready": "就绪",
|
||||
"notFound": "未找到",
|
||||
"nostrWalletConnect": "Nostr钱包连接",
|
||||
"walletsConnected": "已连接{{count}}个钱包",
|
||||
"remoteWalletConnection": "远程钱包连接",
|
||||
"none": "无",
|
||||
"noWalletsConnected": "未连接钱包",
|
||||
"addNwcWalletToGetStarted": "添加NWC钱包以开始使用",
|
||||
"lightningWallet": "闪电钱包",
|
||||
"nwcConnection": "NWC连接",
|
||||
"setAsActive": "设为活动",
|
||||
"activeWalletChanged": "活动钱包已更改",
|
||||
"selectedWalletNowActive": "所选钱包现在已激活用于打赏。",
|
||||
"installWeblnOrConnectNwc": "安装WebLN扩展或连接NWC钱包以发送打赏。",
|
||||
"connectNwcWallet": "连接NWC钱包",
|
||||
"enterConnectionStringFromWallet": "输入来自兼容钱包的连接字符串。",
|
||||
"walletNameOptional": "钱包名称(可选)",
|
||||
"myLightningWallet": "我的闪电钱包",
|
||||
"connectionUri": "连接URI",
|
||||
"connecting": "连接中...",
|
||||
"connect": "连接",
|
||||
"connectionUriRequired": "需要连接URI",
|
||||
"pleaseEnterValidNwcUri": "请输入有效的NWC连接URI。",
|
||||
"emailUpdates": "邮件更新",
|
||||
"emailUpdatesDescription": "订阅Shakespeare更新和资源",
|
||||
"newProject": "新项目",
|
||||
@@ -169,10 +142,6 @@
|
||||
"unsavedChanges": "未保存的更改",
|
||||
"saving": "保存中...",
|
||||
"languageLabel": "语言",
|
||||
"explore": "探索",
|
||||
"exploreApps": "探索应用",
|
||||
"exploreRepositories": "探索Nostr网络中的仓库",
|
||||
"pleaseLogInToExplore": "请登录以探索仓库",
|
||||
"searchFiles": "搜索文件...",
|
||||
"noFilesFound": "未找到文件",
|
||||
"noFilesFoundSearch": "未找到与您搜索匹配的文件",
|
||||
|
||||
@@ -118,6 +118,9 @@ export function AISettings() {
|
||||
if (typeof preset.proxy === 'boolean') {
|
||||
newProvider.proxy = preset.proxy;
|
||||
}
|
||||
if (preset.openSecret) {
|
||||
newProvider.openSecret = preset.openSecret;
|
||||
}
|
||||
|
||||
setProvider(newProvider);
|
||||
};
|
||||
|
||||
+359
-75
@@ -1,19 +1,32 @@
|
||||
import { useState, useEffect, useCallback, useRef } from 'react';
|
||||
import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { AppLayout } from '@/components/AppLayout';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { GitBranch, Loader2, AlertCircle, FileArchive, MoreHorizontal } from 'lucide-react';
|
||||
import { GitBranch, Loader2, AlertCircle, FileArchive, MoreHorizontal, Search } from 'lucide-react';
|
||||
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
||||
import { useToast } from '@/hooks/useToast';
|
||||
import { ZipImportDialog } from '@/components/ZipImportDialog';
|
||||
import { useSeoMeta } from '@unhead/react';
|
||||
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '@/components/ui/dropdown-menu';
|
||||
import { useCurrentUser } from '@/hooks/useCurrentUser';
|
||||
import { useUserRepositories } from '@/hooks/useUserRepositories';
|
||||
import { useContacts } from '@/hooks/useContacts';
|
||||
import { useFollowedRepositories } from '@/hooks/useFollowedRepositories';
|
||||
import { RepositoryCard } from '@/components/RepositoryCard';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
|
||||
import type { Repository } from '@/hooks/useUserRepositories';
|
||||
import { useNostr } from '@nostrify/react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
import { NSchema as n } from '@nostrify/nostrify';
|
||||
import type { NostrMetadata } from '@nostrify/nostrify';
|
||||
import { NostrURI } from '@/lib/NostrURI';
|
||||
import { useGitSettings } from '@/hooks/useGitSettings';
|
||||
import { detectFork } from '@/lib/detectFork';
|
||||
import { NostrURI } from '@/lib/NostrURI';
|
||||
|
||||
export default function Clone() {
|
||||
const { t } = useTranslation();
|
||||
@@ -28,6 +41,46 @@ export default function Clone() {
|
||||
const [isZipDialogOpen, setIsZipDialogOpen] = useState(false);
|
||||
const { user } = useCurrentUser();
|
||||
const { settings: gitSettings } = useGitSettings();
|
||||
const { data: repositories = [], isLoading: isLoadingRepos } = useUserRepositories(user?.pubkey);
|
||||
const { data: contacts = [] } = useContacts(user?.pubkey);
|
||||
const { data: followedRepositories = [], isLoading: isLoadingFollowedRepos } = useFollowedRepositories(contacts);
|
||||
const [activeTab, setActiveTab] = useState<'my-projects' | 'follows'>('my-projects');
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
|
||||
// Get unique pubkeys from all repositories
|
||||
const allRepos = useMemo(() => [...repositories, ...followedRepositories], [repositories, followedRepositories]);
|
||||
const uniquePubkeys = useMemo(() => {
|
||||
const pubkeys = new Set<string>();
|
||||
allRepos.forEach(repo => pubkeys.add(repo.pubkey));
|
||||
return Array.from(pubkeys);
|
||||
}, [allRepos]);
|
||||
|
||||
// Fetch author metadata for all unique pubkeys
|
||||
const { nostr } = useNostr();
|
||||
const { data: authorMetadataMap = new Map<string, NostrMetadata>() } = useQuery({
|
||||
queryKey: ['repository-authors', uniquePubkeys.sort().join(',')],
|
||||
queryFn: async () => {
|
||||
if (uniquePubkeys.length === 0) return new Map<string, NostrMetadata>();
|
||||
|
||||
const events = await nostr.query(
|
||||
[{ kinds: [0], authors: uniquePubkeys, limit: uniquePubkeys.length }],
|
||||
{ signal: AbortSignal.timeout(3000) }
|
||||
);
|
||||
|
||||
const metadataMap = new Map<string, NostrMetadata>();
|
||||
for (const event of events) {
|
||||
try {
|
||||
const metadata = n.json().pipe(n.metadata()).parse(event.content);
|
||||
metadataMap.set(event.pubkey, metadata);
|
||||
} catch {
|
||||
// If parsing fails, continue without metadata for this pubkey
|
||||
}
|
||||
}
|
||||
return metadataMap;
|
||||
},
|
||||
enabled: uniquePubkeys.length > 0,
|
||||
staleTime: 60000, // 1 minute
|
||||
});
|
||||
|
||||
useSeoMeta({
|
||||
title: `${t('importRepository')} - Shakespeare`,
|
||||
@@ -203,83 +256,140 @@ export default function Clone() {
|
||||
}
|
||||
};
|
||||
|
||||
// Filter repositories based on search query
|
||||
const filterRepositories = useCallback((repos: Repository[], query: string): Repository[] => {
|
||||
if (!query.trim()) {
|
||||
return repos;
|
||||
}
|
||||
|
||||
const lowerQuery = query.toLowerCase();
|
||||
|
||||
return repos.filter((repo) => {
|
||||
// Filter by repository name
|
||||
if (repo.name.toLowerCase().includes(lowerQuery)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Filter by description
|
||||
if (repo.description?.toLowerCase().includes(lowerQuery)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Filter by tags (hashtags)
|
||||
if (repo.repoTags.some(tag => tag.toLowerCase().includes(lowerQuery))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Filter by hex pubkey
|
||||
if (repo.pubkey.toLowerCase().includes(lowerQuery)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Filter by npub (bech32 encoded pubkey)
|
||||
try {
|
||||
const npub = nip19.npubEncode(repo.pubkey);
|
||||
if (npub.toLowerCase().includes(lowerQuery)) {
|
||||
return true;
|
||||
}
|
||||
} catch {
|
||||
// If encoding fails, skip npub search
|
||||
}
|
||||
|
||||
// Filter by author name
|
||||
const authorMetadata = authorMetadataMap.get(repo.pubkey);
|
||||
if (authorMetadata?.name?.toLowerCase().includes(lowerQuery)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}, [authorMetadataMap]);
|
||||
|
||||
// Filtered repositories for "My Projects" tab
|
||||
const filteredMyRepositories = useMemo(() => {
|
||||
return filterRepositories(repositories, searchQuery);
|
||||
}, [repositories, searchQuery, filterRepositories]);
|
||||
|
||||
// Filtered repositories for "Follows" tab
|
||||
const filteredFollowedRepositories = useMemo(() => {
|
||||
return filterRepositories(followedRepositories, searchQuery);
|
||||
}, [followedRepositories, searchQuery, filterRepositories]);
|
||||
|
||||
return (
|
||||
<AppLayout title={t('importRepository')}>
|
||||
<div className="min-h-[calc(100vh-12rem)] flex items-center justify-center">
|
||||
<div className="max-w-2xl mx-auto w-full">
|
||||
<div className="text-center mb-8">
|
||||
<div className="text-4xl mb-4">
|
||||
<GitBranch className="h-12 w-12 mx-auto text-primary" />
|
||||
<div className="max-w-2xl mx-auto">
|
||||
<div className="text-center mb-8">
|
||||
<div className="text-4xl mb-4">
|
||||
<GitBranch className="h-12 w-12 mx-auto text-primary" />
|
||||
</div>
|
||||
<h1 className="text-3xl font-bold mb-3 bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
|
||||
{t('importRepository')}
|
||||
</h1>
|
||||
<p className="text-lg text-muted-foreground">
|
||||
{t('cloneGitRepository')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Input
|
||||
id="repo-url"
|
||||
type="text"
|
||||
placeholder="https://github.com/username/repository.git"
|
||||
value={repoUrl}
|
||||
onChange={(e) => {
|
||||
setRepoUrl(e.target.value);
|
||||
setError(null); // Clear error when user types
|
||||
}}
|
||||
onKeyDown={handleKeyDown}
|
||||
disabled={isCloning}
|
||||
/>
|
||||
|
||||
{error && (
|
||||
<div className="flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md">
|
||||
<AlertCircle className="h-4 w-4 text-destructive flex-shrink-0" />
|
||||
<p className="text-sm text-destructive">{error}</p>
|
||||
</div>
|
||||
<h1 className="text-3xl font-bold mb-3 bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
|
||||
{t('importRepository')}
|
||||
</h1>
|
||||
<p className="text-lg text-muted-foreground">
|
||||
{t('cloneGitRepository')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-2">
|
||||
<Input
|
||||
id="repo-url"
|
||||
type="text"
|
||||
placeholder="https://github.com/username/repository.git"
|
||||
value={repoUrl}
|
||||
onChange={(e) => {
|
||||
setRepoUrl(e.target.value);
|
||||
setError(null); // Clear error when user types
|
||||
}}
|
||||
onKeyDown={handleKeyDown}
|
||||
disabled={isCloning}
|
||||
/>
|
||||
|
||||
{error && (
|
||||
<div className="flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md">
|
||||
<AlertCircle className="h-4 w-4 text-destructive flex-shrink-0" />
|
||||
<p className="text-sm text-destructive">{error}</p>
|
||||
</div>
|
||||
<Button
|
||||
onClick={() => handleClone()}
|
||||
disabled={!repoUrl.trim() || isCloning}
|
||||
className="w-full focus-ring bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary/80 shadow-lg"
|
||||
size="lg"
|
||||
>
|
||||
{isCloning ? (
|
||||
<>
|
||||
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
||||
{t('cloningRepository')}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<GitBranch className="mr-2 h-4 w-4" />
|
||||
{t('importRepository')}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
onClick={() => handleClone()}
|
||||
disabled={!repoUrl.trim() || isCloning}
|
||||
className="w-full focus-ring bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary/80 shadow-lg"
|
||||
size="lg"
|
||||
>
|
||||
{isCloning ? (
|
||||
<>
|
||||
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
||||
{t('cloningRepository')}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<GitBranch className="mr-2 h-4 w-4" />
|
||||
{t('importRepository')}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* Import ZIP File Link */}
|
||||
<div className="mt-8 text-center">
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" size="icon" className="text-muted-foreground hover:text-primary hover:bg-transparent">
|
||||
<MoreHorizontal className="h-5 w-5" />
|
||||
<span className="sr-only">More options</span>
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="center">
|
||||
<DropdownMenuItem
|
||||
className="flex items-center gap-2 w-full"
|
||||
onClick={() => setIsZipDialogOpen(true)}
|
||||
>
|
||||
<FileArchive className="h-4 w-4" />
|
||||
Import ZIP File
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
{/* Import ZIP File Link */}
|
||||
<div className="mt-8 text-center">
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" size="icon" className="text-muted-foreground hover:text-primary hover:bg-transparent">
|
||||
<MoreHorizontal className="h-5 w-5" />
|
||||
<span className="sr-only">More options</span>
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="center">
|
||||
<DropdownMenuItem
|
||||
className="flex items-center gap-2 w-full"
|
||||
onClick={() => setIsZipDialogOpen(true)}
|
||||
>
|
||||
<FileArchive className="h-4 w-4" />
|
||||
Import ZIP File
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -289,6 +399,180 @@ export default function Clone() {
|
||||
open={isZipDialogOpen}
|
||||
onOpenChange={setIsZipDialogOpen}
|
||||
/>
|
||||
|
||||
{/* NIP-34 Repositories with Tabs */}
|
||||
{user && (
|
||||
<div className="mt-16 max-w-7xl mx-auto">
|
||||
<Tabs value={activeTab} onValueChange={(value) => setActiveTab(value as 'my-projects' | 'follows')}>
|
||||
<div className="flex items-center gap-4 mb-6 flex-wrap">
|
||||
<TabsList>
|
||||
<TabsTrigger value="my-projects">
|
||||
My Projects
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="follows">
|
||||
Follows
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
{/* Search Input */}
|
||||
{(repositories.length > 0 || followedRepositories.length > 0) && (
|
||||
<div className="relative flex-1 min-w-[200px] max-w-md">
|
||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" />
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="Search repositories..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
className="pl-9 h-10 text-sm"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<TabsContent value="my-projects">
|
||||
{isLoadingRepos ? (
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{Array.from({ length: 3 }).map((_, i) => (
|
||||
<Card key={i} className="h-full flex flex-col">
|
||||
<CardContent className="p-6 flex flex-col flex-1">
|
||||
<div className="flex items-start gap-3 mb-4">
|
||||
<Skeleton className="w-12 h-12 rounded-lg" />
|
||||
<div className="flex-1 space-y-2">
|
||||
<Skeleton className="h-5 w-32" />
|
||||
<Skeleton className="h-4 w-24" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2 mb-4">
|
||||
<Skeleton className="h-4 w-full" />
|
||||
<Skeleton className="h-4 w-4/5" />
|
||||
</div>
|
||||
<div className="flex gap-1 mb-4">
|
||||
<Skeleton className="h-5 w-16" />
|
||||
<Skeleton className="h-5 w-20" />
|
||||
</div>
|
||||
<div className="mt-auto flex gap-2">
|
||||
<Skeleton className="h-9 flex-1" />
|
||||
<Skeleton className="h-9 w-9" />
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
) : filteredMyRepositories.length > 0 ? (
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{filteredMyRepositories.map((repo) => (
|
||||
<RepositoryCard key={repo.id} repo={repo} />
|
||||
))}
|
||||
</div>
|
||||
) : searchQuery.trim() ? (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-12 px-8 text-center">
|
||||
<div className="max-w-sm mx-auto space-y-4">
|
||||
<Search className="h-8 w-8 mx-auto mb-2 opacity-50 text-muted-foreground" />
|
||||
<p className="text-muted-foreground">
|
||||
No repositories found matching "{searchQuery}".
|
||||
</p>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => setSearchQuery('')}
|
||||
>
|
||||
Clear search
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
) : (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-12 px-8 text-center">
|
||||
<div className="max-w-sm mx-auto space-y-4">
|
||||
<p className="text-muted-foreground">
|
||||
No repositories found. Publish your first repository to Nostr to see it here.
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="follows">
|
||||
{isLoadingFollowedRepos ? (
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{Array.from({ length: 6 }).map((_, i) => (
|
||||
<Card key={i} className="h-full flex flex-col">
|
||||
<CardContent className="p-6 flex flex-col flex-1">
|
||||
<div className="flex items-start gap-3 mb-4">
|
||||
<Skeleton className="w-12 h-12 rounded-lg" />
|
||||
<div className="flex-1 space-y-2">
|
||||
<Skeleton className="h-5 w-32" />
|
||||
<Skeleton className="h-4 w-24" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2 mb-4">
|
||||
<Skeleton className="h-4 w-full" />
|
||||
<Skeleton className="h-4 w-4/5" />
|
||||
</div>
|
||||
<div className="flex gap-1 mb-4">
|
||||
<Skeleton className="h-5 w-16" />
|
||||
<Skeleton className="h-5 w-20" />
|
||||
</div>
|
||||
<div className="mt-auto flex gap-2">
|
||||
<Skeleton className="h-9 flex-1" />
|
||||
<Skeleton className="h-9 w-9" />
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
) : filteredFollowedRepositories.length > 0 ? (
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{filteredFollowedRepositories.map((repo) => (
|
||||
<RepositoryCard key={repo.id} repo={repo} />
|
||||
))}
|
||||
</div>
|
||||
) : searchQuery.trim() ? (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-12 px-8 text-center">
|
||||
<div className="max-w-sm mx-auto space-y-4">
|
||||
<Search className="h-8 w-8 mx-auto mb-2 opacity-50 text-muted-foreground" />
|
||||
<p className="text-muted-foreground">
|
||||
No repositories found matching "{searchQuery}".
|
||||
</p>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => setSearchQuery('')}
|
||||
>
|
||||
Clear search
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
) : contacts.length > 0 ? (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-12 px-8 text-center">
|
||||
<div className="max-w-sm mx-auto space-y-4">
|
||||
<p className="text-muted-foreground">
|
||||
None of the people you follow have published repositories yet.
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
) : (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-12 px-8 text-center">
|
||||
<div className="max-w-sm mx-auto space-y-4">
|
||||
<p className="text-muted-foreground">
|
||||
You're not following anyone yet. Follow people on Nostr to see their repositories here.
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</div>
|
||||
)}
|
||||
</AppLayout>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,358 +0,0 @@
|
||||
import { useState, useMemo, useDeferredValue } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { AppLayout } from '@/components/AppLayout';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Search, Compass } from 'lucide-react';
|
||||
import { useCurrentUser } from '@/hooks/useCurrentUser';
|
||||
import { useUserRepositories } from '@/hooks/useUserRepositories';
|
||||
import { useContacts } from '@/hooks/useContacts';
|
||||
import { useFollowedRepositories } from '@/hooks/useFollowedRepositories';
|
||||
import { RepositoryCard } from '@/components/RepositoryCard';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import type { Repository } from '@/hooks/useUserRepositories';
|
||||
import { useNostr } from '@nostrify/react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
import { NSchema as n } from '@nostrify/nostrify';
|
||||
import type { NostrMetadata } from '@nostrify/nostrify';
|
||||
import { useSeoMeta } from '@unhead/react';
|
||||
|
||||
export default function Explore() {
|
||||
const { t } = useTranslation();
|
||||
const { user } = useCurrentUser();
|
||||
const { data: repositories = [], isLoading: isLoadingRepos } = useUserRepositories(user?.pubkey);
|
||||
const { data: contacts = [] } = useContacts(user?.pubkey);
|
||||
const { data: followedRepositories = [], isLoading: isLoadingFollowedRepos } = useFollowedRepositories(contacts);
|
||||
const [activeTab, setActiveTab] = useState<'my-projects' | 'follows'>('follows');
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
|
||||
// Defer search query to prevent blocking UI on every keystroke
|
||||
const deferredSearchQuery = useDeferredValue(searchQuery);
|
||||
|
||||
// Get unique pubkeys from all repositories
|
||||
const allRepos = useMemo(() => [...repositories, ...followedRepositories], [repositories, followedRepositories]);
|
||||
const uniquePubkeys = useMemo(() => {
|
||||
const pubkeys = new Set<string>();
|
||||
allRepos.forEach(repo => pubkeys.add(repo.pubkey));
|
||||
return Array.from(pubkeys);
|
||||
}, [allRepos]);
|
||||
|
||||
// Pre-compute npubs once to avoid expensive encoding on every search
|
||||
const npubMap = useMemo(() => {
|
||||
const map = new Map<string, string>();
|
||||
allRepos.forEach(repo => {
|
||||
if (!map.has(repo.pubkey)) {
|
||||
try {
|
||||
map.set(repo.pubkey, nip19.npubEncode(repo.pubkey));
|
||||
} catch {
|
||||
// ignore encoding failures
|
||||
}
|
||||
}
|
||||
});
|
||||
return map;
|
||||
}, [allRepos]);
|
||||
|
||||
// Fetch author metadata for all unique pubkeys
|
||||
const { nostr } = useNostr();
|
||||
const { data: authorMetadataMap = new Map<string, NostrMetadata>() } = useQuery({
|
||||
queryKey: ['repository-authors', uniquePubkeys],
|
||||
queryFn: async () => {
|
||||
if (uniquePubkeys.length === 0) return new Map<string, NostrMetadata>();
|
||||
|
||||
const events = await nostr.query(
|
||||
[{ kinds: [0], authors: uniquePubkeys, limit: uniquePubkeys.length }],
|
||||
{ signal: AbortSignal.timeout(3000) }
|
||||
);
|
||||
|
||||
const metadataMap = new Map<string, NostrMetadata>();
|
||||
for (const event of events) {
|
||||
try {
|
||||
const metadata = n.json().pipe(n.metadata()).parse(event.content);
|
||||
metadataMap.set(event.pubkey, metadata);
|
||||
} catch {
|
||||
// If parsing fails, continue without metadata for this pubkey
|
||||
}
|
||||
}
|
||||
return metadataMap;
|
||||
},
|
||||
enabled: uniquePubkeys.length > 0,
|
||||
staleTime: 60000, // 1 minute
|
||||
});
|
||||
|
||||
useSeoMeta({
|
||||
title: `${t('explore')} - Shakespeare`,
|
||||
description: t('exploreRepositories'),
|
||||
});
|
||||
|
||||
// Filter repositories based on search query - stable function with no dependencies
|
||||
const filterRepositories = (
|
||||
repos: Repository[],
|
||||
query: string,
|
||||
metadata: Map<string, NostrMetadata>,
|
||||
npubs: Map<string, string>
|
||||
): Repository[] => {
|
||||
if (!query.trim()) {
|
||||
return repos;
|
||||
}
|
||||
|
||||
const lowerQuery = query.toLowerCase();
|
||||
|
||||
return repos.filter((repo) => {
|
||||
// Filter by repository name
|
||||
if (repo.name.toLowerCase().includes(lowerQuery)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Filter by description
|
||||
if (repo.description?.toLowerCase().includes(lowerQuery)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Filter by tags (hashtags)
|
||||
if (repo.repoTags.some(tag => tag.toLowerCase().includes(lowerQuery))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Filter by hex pubkey
|
||||
if (repo.pubkey.toLowerCase().includes(lowerQuery)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Filter by npub (pre-computed)
|
||||
const npub = npubs.get(repo.pubkey);
|
||||
if (npub?.toLowerCase().includes(lowerQuery)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Filter by author name
|
||||
const authorMetadata = metadata.get(repo.pubkey);
|
||||
if (authorMetadata?.name?.toLowerCase().includes(lowerQuery)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
// Filtered repositories for "My Projects" tab - uses deferred query
|
||||
const filteredMyRepositories = useMemo(() => {
|
||||
return filterRepositories(repositories, deferredSearchQuery, authorMetadataMap, npubMap);
|
||||
}, [repositories, deferredSearchQuery, authorMetadataMap, npubMap]);
|
||||
|
||||
// Filtered repositories for "Follows" tab - uses deferred query
|
||||
const filteredFollowedRepositories = useMemo(() => {
|
||||
return filterRepositories(followedRepositories, deferredSearchQuery, authorMetadataMap, npubMap);
|
||||
}, [followedRepositories, deferredSearchQuery, authorMetadataMap, npubMap]);
|
||||
|
||||
if (!user) {
|
||||
return (
|
||||
<AppLayout title={t('exploreApps')}>
|
||||
<div className="max-w-2xl mx-auto text-center py-12">
|
||||
<p className="text-lg text-muted-foreground">
|
||||
{t('pleaseLogInToExplore')}
|
||||
</p>
|
||||
</div>
|
||||
</AppLayout>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<AppLayout title={t('exploreApps')}>
|
||||
<div className="max-w-7xl mx-auto">
|
||||
<div className="mb-8">
|
||||
<div className="flex items-center gap-3 mb-3">
|
||||
<Compass className="h-8 w-8 text-primary flex-shrink-0" />
|
||||
<h1 className="text-3xl font-bold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
|
||||
{t('exploreApps')}
|
||||
</h1>
|
||||
</div>
|
||||
<p className="text-lg text-muted-foreground">
|
||||
{t('exploreRepositories')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Tabs value={activeTab} onValueChange={(value) => setActiveTab(value as 'my-projects' | 'follows')}>
|
||||
<div className="flex items-center gap-4 mb-6 flex-wrap">
|
||||
<TabsList>
|
||||
<TabsTrigger value="my-projects">
|
||||
My Projects
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="follows">
|
||||
Follows
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
{/* Search Input */}
|
||||
{(repositories.length > 0 || followedRepositories.length > 0) && (
|
||||
<div className="relative flex-1 min-w-[200px] max-w-md">
|
||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" />
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="Search repositories..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
className="pl-9 h-10 text-sm"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<TabsContent value="my-projects">
|
||||
{isLoadingRepos ? (
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{Array.from({ length: 3 }).map((_, i) => (
|
||||
<Card key={i} className="h-full flex flex-col">
|
||||
<CardContent className="p-6 flex flex-col flex-1">
|
||||
<div className="flex items-start gap-3 mb-4">
|
||||
<Skeleton className="w-12 h-12 rounded-lg" />
|
||||
<div className="flex-1 space-y-2">
|
||||
<Skeleton className="h-5 w-32" />
|
||||
<Skeleton className="h-4 w-24" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2 mb-4">
|
||||
<Skeleton className="h-4 w-full" />
|
||||
<Skeleton className="h-4 w-4/5" />
|
||||
</div>
|
||||
<div className="flex gap-1 mb-4">
|
||||
<Skeleton className="h-5 w-16" />
|
||||
<Skeleton className="h-5 w-20" />
|
||||
</div>
|
||||
<div className="mt-auto flex gap-2">
|
||||
<Skeleton className="h-9 flex-1" />
|
||||
<Skeleton className="h-9 w-9" />
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
) : filteredMyRepositories.length > 0 ? (
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{filteredMyRepositories.map((repo) => (
|
||||
<RepositoryCard
|
||||
key={repo.id}
|
||||
repo={repo}
|
||||
authorMetadata={authorMetadataMap.get(repo.pubkey)}
|
||||
onTagClick={(tag) => setSearchQuery(tag)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
) : searchQuery.trim() ? (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-12 px-8 text-center">
|
||||
<div className="max-w-sm mx-auto space-y-4">
|
||||
<Search className="h-8 w-8 mx-auto mb-2 opacity-50 text-muted-foreground" />
|
||||
<p className="text-muted-foreground">
|
||||
No repositories found matching "{searchQuery}".
|
||||
</p>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => setSearchQuery('')}
|
||||
>
|
||||
Clear search
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
) : (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-12 px-8 text-center">
|
||||
<div className="max-w-sm mx-auto space-y-4">
|
||||
<p className="text-muted-foreground">
|
||||
No repositories found. Publish your first repository to Nostr to see it here.
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="follows">
|
||||
{isLoadingFollowedRepos ? (
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{Array.from({ length: 6 }).map((_, i) => (
|
||||
<Card key={i} className="h-full flex flex-col">
|
||||
<CardContent className="p-6 flex flex-col flex-1">
|
||||
<div className="flex items-start gap-3 mb-4">
|
||||
<Skeleton className="w-12 h-12 rounded-lg" />
|
||||
<div className="flex-1 space-y-2">
|
||||
<Skeleton className="h-5 w-32" />
|
||||
<Skeleton className="h-4 w-24" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2 mb-4">
|
||||
<Skeleton className="h-4 w-full" />
|
||||
<Skeleton className="h-4 w-4/5" />
|
||||
</div>
|
||||
<div className="flex gap-1 mb-4">
|
||||
<Skeleton className="h-5 w-16" />
|
||||
<Skeleton className="h-5 w-20" />
|
||||
</div>
|
||||
<div className="mt-auto flex gap-2">
|
||||
<Skeleton className="h-9 flex-1" />
|
||||
<Skeleton className="h-9 w-9" />
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
) : filteredFollowedRepositories.length > 0 ? (
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{filteredFollowedRepositories.map((repo) => (
|
||||
<RepositoryCard
|
||||
key={repo.id}
|
||||
repo={repo}
|
||||
authorMetadata={authorMetadataMap.get(repo.pubkey)}
|
||||
onTagClick={(tag) => setSearchQuery(tag)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
) : searchQuery.trim() ? (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-12 px-8 text-center">
|
||||
<div className="max-w-sm mx-auto space-y-4">
|
||||
<Search className="h-8 w-8 mx-auto mb-2 opacity-50 text-muted-foreground" />
|
||||
<p className="text-muted-foreground">
|
||||
No repositories found matching "{searchQuery}".
|
||||
</p>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => setSearchQuery('')}
|
||||
>
|
||||
Clear search
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
) : contacts.length > 0 ? (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-12 px-8 text-center">
|
||||
<div className="max-w-sm mx-auto space-y-4">
|
||||
<p className="text-muted-foreground">
|
||||
None of the people you follow have published repositories yet.
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
) : (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-12 px-8 text-center">
|
||||
<div className="max-w-sm mx-auto space-y-4">
|
||||
<p className="text-muted-foreground">
|
||||
You're not following anyone yet. Follow people on Nostr to see their repositories here.
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</div>
|
||||
</AppLayout>
|
||||
);
|
||||
}
|
||||
+197
-97
@@ -31,6 +31,9 @@ import { useGitAutosync } from '@/hooks/useGitAutosync';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useProjectSessionStatus } from '@/hooks/useProjectSessionStatus';
|
||||
import { useLocalStorage } from '@/hooks/useLocalStorage';
|
||||
import { FloatingChatWidget } from '@/components/Shakespeare/FloatingChatWidget';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
||||
|
||||
export function ProjectView() {
|
||||
const { projectId } = useParams<{ projectId: string }>();
|
||||
@@ -59,6 +62,16 @@ export function ProjectView() {
|
||||
|
||||
const [isSidebarVisible, setIsSidebarVisible] = useState(!isMobile);
|
||||
|
||||
// Floating chat state
|
||||
const [isFloatingChatEnabled, setIsFloatingChatEnabled] = useLocalStorage(
|
||||
'shk:floatingChatEnabled',
|
||||
false
|
||||
);
|
||||
const [isFloatingChatMinimized, setIsFloatingChatMinimized] = useLocalStorage(
|
||||
'shk:floatingChatMinimized',
|
||||
false
|
||||
);
|
||||
|
||||
const build = useBuildProject(projectId!);
|
||||
const { data: isPreviewable = false } = useIsProjectPreviewable(projectId!);
|
||||
const { hasRunningSessions } = useProjectSessionStatus(projectId || '');
|
||||
@@ -227,7 +240,7 @@ export function ProjectView() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-4 px-3">
|
||||
<div className="flex items-center gap-2 px-3">
|
||||
{project ? (
|
||||
<>
|
||||
<GitSyncButton
|
||||
@@ -239,6 +252,24 @@ export function ProjectView() {
|
||||
projectName={project.name}
|
||||
disabled={isAnyLoading}
|
||||
/>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
onClick={() => {
|
||||
setIsFloatingChatEnabled(true);
|
||||
setIsFloatingChatMinimized(false);
|
||||
}}
|
||||
aria-label="Floating chat"
|
||||
aria-pressed={isFloatingChatEnabled}
|
||||
>
|
||||
<MessageSquare className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Floating chat</TooltipContent>
|
||||
</Tooltip>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@@ -389,6 +420,23 @@ export function ProjectView() {
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Floating Chat Widget - Mobile */}
|
||||
{isFloatingChatEnabled && project && (
|
||||
<FloatingChatWidget
|
||||
projectId={project.id}
|
||||
isMinimized={isFloatingChatMinimized}
|
||||
onToggleMinimize={() => setIsFloatingChatMinimized(!isFloatingChatMinimized)}
|
||||
onClose={() => setIsFloatingChatEnabled(false)}
|
||||
onNewChat={handleNewChat}
|
||||
onFirstInteraction={handleFirstInteraction}
|
||||
onLoadingChange={handleAILoadingChange}
|
||||
isLoading={isAILoading}
|
||||
isBuildLoading={build.isPending}
|
||||
consoleError={consoleError}
|
||||
onDismissConsoleError={handleDismissConsoleError}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -415,123 +463,175 @@ export function ProjectView() {
|
||||
{/* Main Content Area */}
|
||||
<div className="flex-1 flex flex-col overflow-hidden bg-background">
|
||||
<div className="flex-1 overflow-hidden">
|
||||
<ResizablePanelGroup direction="horizontal" className="h-full">
|
||||
{/* Chat Panel */}
|
||||
<ResizablePanel defaultSize={35} minSize={25}>
|
||||
<div className="h-full flex flex-col">
|
||||
{/* Chat Header */}
|
||||
<div className="h-12 px-4 border-b flex-shrink-0">
|
||||
<div className="flex items-center justify-between h-12">
|
||||
{/* Left side - Sidebar toggle (when collapsed) */}
|
||||
<div className="flex items-center gap-3 overflow-hidden">
|
||||
{!isSidebarVisible && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setIsSidebarVisible(true)}
|
||||
className="h-8 w-8 p-0"
|
||||
aria-label="Open sidebar"
|
||||
>
|
||||
<Menu className="h-4 w-4" />
|
||||
</Button>
|
||||
)}
|
||||
{isFloatingChatEnabled ? (
|
||||
// Full-width preview/code when floating chat is enabled
|
||||
<div className="h-full">
|
||||
{project ? (
|
||||
<PreviewPane
|
||||
projectId={project.id}
|
||||
activeTab={isPreviewable ? activeTab : 'code'}
|
||||
onToggleView={isPreviewable ? () => setActiveTab(activeTab === 'preview' ? 'code' : 'preview') : undefined}
|
||||
isPreviewable={isPreviewable}
|
||||
/>
|
||||
) : (
|
||||
<div className="h-full p-4 space-y-4">
|
||||
<Skeleton className="h-8 w-32" />
|
||||
<Skeleton className="h-full w-full" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
// Original resizable panel layout
|
||||
<ResizablePanelGroup direction="horizontal" className="h-full">
|
||||
{/* Chat Panel */}
|
||||
<ResizablePanel defaultSize={35} minSize={25}>
|
||||
<div className="h-full flex flex-col">
|
||||
{/* Chat Header */}
|
||||
<div className="h-12 px-4 border-b flex-shrink-0">
|
||||
<div className="flex items-center justify-between h-12">
|
||||
{/* Left side - Sidebar toggle (when collapsed) */}
|
||||
<div className="flex items-center gap-3 overflow-hidden">
|
||||
{!isSidebarVisible && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setIsSidebarVisible(true)}
|
||||
className="h-8 w-8 p-0"
|
||||
aria-label="Open sidebar"
|
||||
>
|
||||
<Menu className="h-4 w-4" />
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{/* Project title */}
|
||||
<div className="flex flex-1 min-w-0 truncate">
|
||||
{/* Project title */}
|
||||
<div className="flex flex-1 min-w-0 truncate">
|
||||
{project ? (
|
||||
<ProjectTitleMenu
|
||||
projectId={project.id}
|
||||
projectName={project.name}
|
||||
onNewChat={handleNewChat}
|
||||
onGitHistory={() => setGitHistoryOpen(true)}
|
||||
onDuplicate={() => setDuplicateDialogOpen(true)}
|
||||
onDelete={() => setDeleteDialogOpen(true)}
|
||||
onProjectDetails={() => setIsProjectDetailsOpen(true)}
|
||||
isAILoading={isAILoading}
|
||||
isAnyLoading={isAnyLoading || isDeleting}
|
||||
className="text-lg"
|
||||
/>
|
||||
) : (
|
||||
<Skeleton className="h-6 w-40" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Right side - Deploy and Sync buttons */}
|
||||
<div className="flex items-center gap-2">
|
||||
{project ? (
|
||||
<ProjectTitleMenu
|
||||
projectId={project.id}
|
||||
projectName={project.name}
|
||||
onNewChat={handleNewChat}
|
||||
onGitHistory={() => setGitHistoryOpen(true)}
|
||||
onDuplicate={() => setDuplicateDialogOpen(true)}
|
||||
onDelete={() => setDeleteDialogOpen(true)}
|
||||
onProjectDetails={() => setIsProjectDetailsOpen(true)}
|
||||
isAILoading={isAILoading}
|
||||
isAnyLoading={isAnyLoading || isDeleting}
|
||||
className="text-lg"
|
||||
/>
|
||||
<>
|
||||
<GitSyncButton
|
||||
projectId={project.id}
|
||||
className="h-8 w-8"
|
||||
/>
|
||||
<DeployButton
|
||||
projectId={project.id}
|
||||
projectName={project.name}
|
||||
disabled={isAnyLoading}
|
||||
/>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
onClick={() => setIsFloatingChatEnabled(true)}
|
||||
aria-label="Floating chat"
|
||||
aria-pressed={isFloatingChatEnabled}
|
||||
>
|
||||
<MessageSquare className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Floating chat</TooltipContent>
|
||||
</Tooltip>
|
||||
</>
|
||||
) : (
|
||||
<Skeleton className="h-6 w-40" />
|
||||
<>
|
||||
<Skeleton className="h-8 w-8 rounded" />
|
||||
<Skeleton className="h-8 w-8 rounded" />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Right side - Deploy and Sync buttons */}
|
||||
<div className="flex items-center gap-2">
|
||||
{project ? (
|
||||
<>
|
||||
<GitSyncButton
|
||||
projectId={project.id}
|
||||
className="h-8 w-8"
|
||||
/>
|
||||
<DeployButton
|
||||
projectId={project.id}
|
||||
projectName={project.name}
|
||||
disabled={isAnyLoading}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Skeleton className="h-8 w-8 rounded" />
|
||||
<Skeleton className="h-8 w-8 rounded" />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{/* Chat Content */}
|
||||
<div className="flex-1 overflow-hidden">
|
||||
{project ? (
|
||||
<ChatPane
|
||||
ref={chatPaneRef}
|
||||
projectId={project.id}
|
||||
onNewChat={handleNewChat}
|
||||
onFirstInteraction={handleFirstInteraction}
|
||||
onLoadingChange={handleAILoadingChange}
|
||||
isLoading={isAILoading}
|
||||
isBuildLoading={build.isPending}
|
||||
consoleError={consoleError}
|
||||
onDismissConsoleError={handleDismissConsoleError}
|
||||
/>
|
||||
) : (
|
||||
<div className="h-full p-4 space-y-4">
|
||||
<Skeleton className="h-12 w-full" />
|
||||
<Skeleton className="h-8 w-3/4" />
|
||||
<Skeleton className="h-8 w-1/2" />
|
||||
<Skeleton className="h-32 w-full" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</ResizablePanel>
|
||||
|
||||
{/* Chat Content */}
|
||||
<div className="flex-1 overflow-hidden">
|
||||
{/* Resizable Handle */}
|
||||
<ResizableHandle withHandle />
|
||||
|
||||
{/* Preview/Code Panel */}
|
||||
<ResizablePanel defaultSize={65} minSize={30}>
|
||||
<div className="h-full">
|
||||
{project ? (
|
||||
<ChatPane
|
||||
ref={chatPaneRef}
|
||||
<PreviewPane
|
||||
projectId={project.id}
|
||||
onNewChat={handleNewChat}
|
||||
onFirstInteraction={handleFirstInteraction}
|
||||
onLoadingChange={handleAILoadingChange}
|
||||
isLoading={isAILoading}
|
||||
isBuildLoading={build.isPending}
|
||||
consoleError={consoleError}
|
||||
onDismissConsoleError={handleDismissConsoleError}
|
||||
activeTab={isPreviewable ? activeTab : 'code'}
|
||||
onToggleView={isPreviewable ? () => setActiveTab(activeTab === 'preview' ? 'code' : 'preview') : undefined}
|
||||
isPreviewable={isPreviewable}
|
||||
/>
|
||||
) : (
|
||||
<div className="h-full p-4 space-y-4">
|
||||
<Skeleton className="h-12 w-full" />
|
||||
<Skeleton className="h-8 w-3/4" />
|
||||
<Skeleton className="h-8 w-1/2" />
|
||||
<Skeleton className="h-32 w-full" />
|
||||
<Skeleton className="h-8 w-32" />
|
||||
<Skeleton className="h-full w-full" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</ResizablePanel>
|
||||
|
||||
{/* Resizable Handle */}
|
||||
<ResizableHandle withHandle />
|
||||
|
||||
{/* Preview/Code Panel */}
|
||||
<ResizablePanel defaultSize={65} minSize={30}>
|
||||
<div className="h-full">
|
||||
{project ? (
|
||||
<PreviewPane
|
||||
projectId={project.id}
|
||||
activeTab={isPreviewable ? activeTab : 'code'}
|
||||
onToggleView={isPreviewable ? () => setActiveTab(activeTab === 'preview' ? 'code' : 'preview') : undefined}
|
||||
isPreviewable={isPreviewable}
|
||||
/>
|
||||
) : (
|
||||
<div className="h-full p-4 space-y-4">
|
||||
<Skeleton className="h-8 w-32" />
|
||||
<Skeleton className="h-full w-full" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</ResizablePanel>
|
||||
</ResizablePanelGroup>
|
||||
</ResizablePanel>
|
||||
</ResizablePanelGroup>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Floating Chat Widget - Desktop */}
|
||||
{isFloatingChatEnabled && project && (
|
||||
<FloatingChatWidget
|
||||
projectId={project.id}
|
||||
isMinimized={isFloatingChatMinimized}
|
||||
onToggleMinimize={() => setIsFloatingChatMinimized(!isFloatingChatMinimized)}
|
||||
onClose={() => setIsFloatingChatEnabled(false)}
|
||||
onNewChat={handleNewChat}
|
||||
onFirstInteraction={handleFirstInteraction}
|
||||
onLoadingChange={handleAILoadingChange}
|
||||
isLoading={isAILoading}
|
||||
isBuildLoading={build.isPending}
|
||||
consoleError={consoleError}
|
||||
onDismissConsoleError={handleDismissConsoleError}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Dialogs */}
|
||||
{project && (
|
||||
<>
|
||||
|
||||
@@ -1,254 +0,0 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Wallet, Plus, Trash2, Zap, Globe, WalletMinimal, CheckCircle } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import { useNWC } from '@/hooks/useNWCContext';
|
||||
import { useWallet } from '@/hooks/useWallet';
|
||||
import { useToast } from '@/hooks/useToast';
|
||||
import { SettingsPageLayout } from '@/components/SettingsPageLayout';
|
||||
|
||||
export function WalletSettings() {
|
||||
const { t } = useTranslation();
|
||||
const [addDialogOpen, setAddDialogOpen] = useState(false);
|
||||
const [connectionUri, setConnectionUri] = useState('');
|
||||
const [alias, setAlias] = useState('');
|
||||
const [isConnecting, setIsConnecting] = useState(false);
|
||||
const { toast } = useToast();
|
||||
|
||||
const {
|
||||
connections,
|
||||
activeConnection,
|
||||
connectionInfo,
|
||||
addConnection,
|
||||
removeConnection,
|
||||
setActiveConnection
|
||||
} = useNWC();
|
||||
|
||||
const { webln } = useWallet();
|
||||
|
||||
const hasNWC = connections.length > 0 && connections.some(c => c.isConnected);
|
||||
|
||||
const handleAddConnection = async () => {
|
||||
if (!connectionUri.trim()) {
|
||||
toast({
|
||||
title: t('connectionUriRequired'),
|
||||
description: t('pleaseEnterValidNwcUri'),
|
||||
variant: 'destructive',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
setIsConnecting(true);
|
||||
try {
|
||||
const success = await addConnection(connectionUri.trim(), alias.trim() || undefined);
|
||||
if (success) {
|
||||
setConnectionUri('');
|
||||
setAlias('');
|
||||
setAddDialogOpen(false);
|
||||
}
|
||||
} finally {
|
||||
setIsConnecting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleRemoveConnection = (connectionString: string) => {
|
||||
removeConnection(connectionString);
|
||||
};
|
||||
|
||||
const handleSetActive = (connectionString: string) => {
|
||||
setActiveConnection(connectionString);
|
||||
toast({
|
||||
title: t('activeWalletChanged'),
|
||||
description: t('selectedWalletNowActive'),
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<SettingsPageLayout
|
||||
icon={Wallet}
|
||||
titleKey="walletSettings"
|
||||
descriptionKey="walletSettingsDescription"
|
||||
>
|
||||
{/* Current Status */}
|
||||
<div className="space-y-3">
|
||||
<h3 className="font-medium">{t('currentStatus')}</h3>
|
||||
<div className="grid gap-3">
|
||||
{/* WebLN */}
|
||||
<div className="flex items-center justify-between p-3 border rounded-lg">
|
||||
<div className="flex items-center gap-3">
|
||||
<Globe className="h-4 w-4 text-muted-foreground" />
|
||||
<div>
|
||||
<p className="text-sm font-medium">WebLN</p>
|
||||
<p className="text-xs text-muted-foreground">{t('browserExtension')}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{webln && <CheckCircle className="h-4 w-4 text-green-600" />}
|
||||
<Badge variant={webln ? "default" : "secondary"} className="text-xs">
|
||||
{webln ? t('ready') : t('notFound')}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
{/* NWC */}
|
||||
<div className="flex items-center justify-between p-3 border rounded-lg">
|
||||
<div className="flex items-center gap-3">
|
||||
<WalletMinimal className="h-4 w-4 text-muted-foreground" />
|
||||
<div>
|
||||
<p className="text-sm font-medium">{t('nostrWalletConnect')}</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{connections.length > 0
|
||||
? t('walletsConnected', { count: connections.length })
|
||||
: t('remoteWalletConnection')
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{hasNWC && <CheckCircle className="h-4 w-4 text-green-600" />}
|
||||
<Badge variant={hasNWC ? "default" : "secondary"} className="text-xs">
|
||||
{hasNWC ? t('ready') : t('none')}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Separator />
|
||||
|
||||
{/* NWC Management */}
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<h3 className="font-medium">{t('nostrWalletConnect')}</h3>
|
||||
<Button size="sm" variant="outline" onClick={() => setAddDialogOpen(true)}>
|
||||
<Plus className="h-4 w-4 mr-1" />
|
||||
{t('add')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* Connected Wallets List */}
|
||||
{connections.length === 0 ? (
|
||||
<div className="text-center py-6 text-muted-foreground border border-dashed rounded-lg">
|
||||
<WalletMinimal className="h-8 w-8 mx-auto mb-2 opacity-50" />
|
||||
<p className="text-sm">{t('noWalletsConnected')}</p>
|
||||
<p className="text-xs mt-1">{t('addNwcWalletToGetStarted')}</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-2">
|
||||
{connections.map((connection) => {
|
||||
const info = connectionInfo[connection.connectionString];
|
||||
const isActive = activeConnection === connection.connectionString;
|
||||
return (
|
||||
<div
|
||||
key={connection.connectionString}
|
||||
className={`flex items-center justify-between p-3 border rounded-lg ${isActive ? 'ring-2 ring-primary' : ''}`}
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<WalletMinimal className="h-4 w-4 text-muted-foreground" />
|
||||
<div>
|
||||
<p className="text-sm font-medium">
|
||||
{connection.alias || info?.alias || t('lightningWallet')}
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t('nwcConnection')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{isActive && <CheckCircle className="h-4 w-4 text-green-600" />}
|
||||
{!isActive && (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => handleSetActive(connection.connectionString)}
|
||||
title={t('setAsActive')}
|
||||
>
|
||||
<Zap className="h-3 w-3" />
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => handleRemoveConnection(connection.connectionString)}
|
||||
title={t('remove')}
|
||||
>
|
||||
<Trash2 className="h-3 w-3" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Help */}
|
||||
{!webln && connections.length === 0 && (
|
||||
<>
|
||||
<Separator />
|
||||
<div className="text-center py-4 space-y-2">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('installWeblnOrConnectNwc')}
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Add Wallet Dialog */}
|
||||
<Dialog open={addDialogOpen} onOpenChange={setAddDialogOpen}>
|
||||
<DialogContent className="sm:max-w-[425px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{t('connectNwcWallet')}</DialogTitle>
|
||||
<DialogDescription>
|
||||
{t('enterConnectionStringFromWallet')}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="space-y-4 py-4">
|
||||
<div>
|
||||
<Label htmlFor="alias">{t('walletNameOptional')}</Label>
|
||||
<Input
|
||||
id="alias"
|
||||
placeholder={t('myLightningWallet')}
|
||||
value={alias}
|
||||
onChange={(e) => setAlias(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="connection-uri">{t('connectionUri')}</Label>
|
||||
<Textarea
|
||||
id="connection-uri"
|
||||
placeholder="nostr+walletconnect://..."
|
||||
value={connectionUri}
|
||||
onChange={(e) => setConnectionUri(e.target.value)}
|
||||
rows={3}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button
|
||||
onClick={handleAddConnection}
|
||||
disabled={isConnecting || !connectionUri.trim()}
|
||||
className="w-full"
|
||||
>
|
||||
{isConnecting ? t('connecting') : t('connect')}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</SettingsPageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
export default WalletSettings;
|
||||
Reference in new issue
Block a user