mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
717c4cc207 |
No files matched your search
Generated
+11
-31
@@ -195,7 +195,6 @@
|
|||||||
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
|
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.27.1",
|
"@babel/code-frame": "^7.27.1",
|
||||||
"@babel/generator": "^7.28.5",
|
"@babel/generator": "^7.28.5",
|
||||||
@@ -1831,7 +1830,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
@@ -1855,7 +1853,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
@@ -1877,7 +1874,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz",
|
||||||
"integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==",
|
"integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dnd-kit/accessibility": "^3.1.1",
|
"@dnd-kit/accessibility": "^3.1.1",
|
||||||
"@dnd-kit/utilities": "^3.2.2",
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
@@ -5408,7 +5404,8 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz",
|
||||||
"integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==",
|
"integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/cacheable-request": {
|
"node_modules/@types/cacheable-request": {
|
||||||
"version": "6.0.3",
|
"version": "6.0.3",
|
||||||
@@ -5650,7 +5647,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.20.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.20.tgz",
|
||||||
"integrity": "sha512-IPaCZN7PShZK/3t6Q87pfTkRm6oLTd4vztyoj+cbHUF1g3FfVb2tFIL79uCRKEfv16AhqDMBywP2VW3KIZUvcg==",
|
"integrity": "sha512-IPaCZN7PShZK/3t6Q87pfTkRm6oLTd4vztyoj+cbHUF1g3FfVb2tFIL79uCRKEfv16AhqDMBywP2VW3KIZUvcg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/prop-types": "*",
|
"@types/prop-types": "*",
|
||||||
"csstype": "^3.0.2"
|
"csstype": "^3.0.2"
|
||||||
@@ -5662,7 +5658,6 @@
|
|||||||
"integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==",
|
"integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@types/react": "^18.0.0"
|
"@types/react": "^18.0.0"
|
||||||
}
|
}
|
||||||
@@ -5767,7 +5762,6 @@
|
|||||||
"integrity": "sha512-oU/OtYVydhXnumd0BobL9rkJg7wFJ9bFFPmSmB/bf/XWN85hlViji59ko6bSKBXyseT9V8l+CN1nwmlbiN0G7Q==",
|
"integrity": "sha512-oU/OtYVydhXnumd0BobL9rkJg7wFJ9bFFPmSmB/bf/XWN85hlViji59ko6bSKBXyseT9V8l+CN1nwmlbiN0G7Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "8.31.1",
|
"@typescript-eslint/scope-manager": "8.31.1",
|
||||||
"@typescript-eslint/types": "8.31.1",
|
"@typescript-eslint/types": "8.31.1",
|
||||||
@@ -6114,7 +6108,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
|
||||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@@ -6559,7 +6552,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.8.19",
|
"baseline-browser-mapping": "^2.8.19",
|
||||||
"caniuse-lite": "^1.0.30001751",
|
"caniuse-lite": "^1.0.30001751",
|
||||||
@@ -6819,7 +6811,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
|
||||||
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
|
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"anymatch": "~3.1.2",
|
"anymatch": "~3.1.2",
|
||||||
"braces": "~3.0.2",
|
"braces": "~3.0.2",
|
||||||
@@ -7558,7 +7549,8 @@
|
|||||||
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz",
|
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz",
|
||||||
"integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==",
|
"integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/dom-helpers": {
|
"node_modules/dom-helpers": {
|
||||||
"version": "5.2.1",
|
"version": "5.2.1",
|
||||||
@@ -7636,8 +7628,7 @@
|
|||||||
"version": "8.6.0",
|
"version": "8.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/embla-carousel/-/embla-carousel-8.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/embla-carousel/-/embla-carousel-8.6.0.tgz",
|
||||||
"integrity": "sha512-SjWyZBHJPbqxHOzckOfo8lHisEaJWmwd23XppYFYVh10bU66/Pn5tkVkbkCMZVdbUE5eTCI2nD8OyIP4Z+uwkA==",
|
"integrity": "sha512-SjWyZBHJPbqxHOzckOfo8lHisEaJWmwd23XppYFYVh10bU66/Pn5tkVkbkCMZVdbUE5eTCI2nD8OyIP4Z+uwkA==",
|
||||||
"license": "MIT",
|
"license": "MIT"
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/embla-carousel-react": {
|
"node_modules/embla-carousel-react": {
|
||||||
"version": "8.6.0",
|
"version": "8.6.0",
|
||||||
@@ -7936,7 +7927,6 @@
|
|||||||
"integrity": "sha512-QldCVh/ztyKJJZLr4jXNUByx3gR+TDYZCRXEktiZoUR3PGy4qCmSbkxcIle8GEwGpb5JBZazlaJ/CxLidXdEbQ==",
|
"integrity": "sha512-QldCVh/ztyKJJZLr4jXNUByx3gR+TDYZCRXEktiZoUR3PGy4qCmSbkxcIle8GEwGpb5JBZazlaJ/CxLidXdEbQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.12.1",
|
"@eslint-community/regexpp": "^4.12.1",
|
||||||
@@ -9284,7 +9274,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.27.6"
|
"@babel/runtime": "^7.27.6"
|
||||||
},
|
},
|
||||||
@@ -10054,7 +10043,6 @@
|
|||||||
"integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==",
|
"integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cssstyle": "^4.2.1",
|
"cssstyle": "^4.2.1",
|
||||||
"data-urls": "^5.0.0",
|
"data-urls": "^5.0.0",
|
||||||
@@ -10451,6 +10439,7 @@
|
|||||||
"integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==",
|
"integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"lz-string": "bin/bin.js"
|
"lz-string": "bin/bin.js"
|
||||||
}
|
}
|
||||||
@@ -12154,7 +12143,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.8",
|
"nanoid": "^3.3.8",
|
||||||
"picocolors": "^1.1.1",
|
"picocolors": "^1.1.1",
|
||||||
@@ -12322,6 +12310,7 @@
|
|||||||
"integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==",
|
"integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-regex": "^5.0.1",
|
"ansi-regex": "^5.0.1",
|
||||||
"ansi-styles": "^5.0.0",
|
"ansi-styles": "^5.0.0",
|
||||||
@@ -12337,6 +12326,7 @@
|
|||||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
@@ -12347,6 +12337,7 @@
|
|||||||
"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
|
"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
},
|
},
|
||||||
@@ -12359,7 +12350,8 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
|
||||||
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/prismjs": {
|
"node_modules/prismjs": {
|
||||||
"version": "1.30.0",
|
"version": "1.30.0",
|
||||||
@@ -12499,7 +12491,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
||||||
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
|
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"loose-envify": "^1.1.0"
|
"loose-envify": "^1.1.0"
|
||||||
},
|
},
|
||||||
@@ -12526,7 +12517,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
|
||||||
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
|
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"loose-envify": "^1.1.0",
|
"loose-envify": "^1.1.0",
|
||||||
"scheduler": "^0.23.2"
|
"scheduler": "^0.23.2"
|
||||||
@@ -12552,7 +12542,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.56.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.56.1.tgz",
|
||||||
"integrity": "sha512-qWAVokhSpshhcEuQDSANHx3jiAEFzu2HAaaQIzi/r9FNPm1ioAvuJSD4EuZzWd7Al7nTRKcKPnBKO7sRn+zavQ==",
|
"integrity": "sha512-qWAVokhSpshhcEuQDSANHx3jiAEFzu2HAaaQIzi/r9FNPm1ioAvuJSD4EuZzWd7Al7nTRKcKPnBKO7sRn+zavQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0"
|
"node": ">=18.0.0"
|
||||||
},
|
},
|
||||||
@@ -12601,7 +12590,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz",
|
||||||
"integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==",
|
"integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/hast": "^3.0.0",
|
"@types/hast": "^3.0.0",
|
||||||
"@types/mdast": "^4.0.0",
|
"@types/mdast": "^4.0.0",
|
||||||
@@ -13184,7 +13172,6 @@
|
|||||||
"integrity": "sha512-C5VvvgCCyfyotVITIAv+4efVytl5F7wt+/I2i9q9GZcEXW9BP52YYOXC58igUi+LFZVHukErIIqQSWwv/M3WRw==",
|
"integrity": "sha512-C5VvvgCCyfyotVITIAv+4efVytl5F7wt+/I2i9q9GZcEXW9BP52YYOXC58igUi+LFZVHukErIIqQSWwv/M3WRw==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/estree": "1.0.7"
|
"@types/estree": "1.0.7"
|
||||||
},
|
},
|
||||||
@@ -14236,7 +14223,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.17.tgz",
|
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.17.tgz",
|
||||||
"integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==",
|
"integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alloc/quick-lru": "^5.2.0",
|
"@alloc/quick-lru": "^5.2.0",
|
||||||
"arg": "^5.0.2",
|
"arg": "^5.0.2",
|
||||||
@@ -14440,7 +14426,6 @@
|
|||||||
"integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
|
"integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -14713,7 +14698,6 @@
|
|||||||
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
@@ -15223,7 +15207,6 @@
|
|||||||
"integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==",
|
"integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.25.0",
|
"esbuild": "^0.25.0",
|
||||||
"fdir": "^6.4.4",
|
"fdir": "^6.4.4",
|
||||||
@@ -15368,7 +15351,6 @@
|
|||||||
"integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
|
"integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -15839,7 +15821,6 @@
|
|||||||
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
|
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
"fast-uri": "^3.0.1",
|
"fast-uri": "^3.0.1",
|
||||||
@@ -15916,7 +15897,6 @@
|
|||||||
"integrity": "sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==",
|
"integrity": "sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"rollup": "dist/bin/rollup"
|
"rollup": "dist/bin/rollup"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,13 +27,14 @@ import { useFS } from '@/hooks/useFS';
|
|||||||
import { useFSPaths } from '@/hooks/useFSPaths';
|
import { useFSPaths } from '@/hooks/useFSPaths';
|
||||||
import { useAppContext } from '@/hooks/useAppContext';
|
import { useAppContext } from '@/hooks/useAppContext';
|
||||||
import { useNostr } from '@nostrify/react';
|
import { useNostr } from '@nostrify/react';
|
||||||
import { ShakespeareAdapter, NetlifyAdapter, VercelAdapter, NsiteAdapter, DeployAdapter } from '@/lib/deploy';
|
import { ShakespeareAdapter, NetlifyAdapter, VercelAdapter, NsiteAdapter, CloudflareAdapter, DeployAdapter } from '@/lib/deploy';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import type { DeployProvider, ShakespeareDeployProvider, NetlifyProvider, VercelProvider } from '@/contexts/DeploySettingsContext';
|
import type { DeployProvider, ShakespeareDeployProvider, NetlifyProvider, VercelProvider, CloudflareProvider } from '@/contexts/DeploySettingsContext';
|
||||||
import { ShakespeareDeployForm } from '@/components/deploy/ShakespeareDeployForm';
|
import { ShakespeareDeployForm } from '@/components/deploy/ShakespeareDeployForm';
|
||||||
import { NetlifyDeployForm } from '@/components/deploy/NetlifyDeployForm';
|
import { NetlifyDeployForm } from '@/components/deploy/NetlifyDeployForm';
|
||||||
import { VercelDeployForm } from '@/components/deploy/VercelDeployForm';
|
import { VercelDeployForm } from '@/components/deploy/VercelDeployForm';
|
||||||
import { NsiteDeployForm } from '@/components/deploy/NsiteDeployForm';
|
import { NsiteDeployForm } from '@/components/deploy/NsiteDeployForm';
|
||||||
|
import { CloudflareDeployForm } from '@/components/deploy/CloudflareDeployForm';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to get provider URL for favicon
|
* Helper function to get provider URL for favicon
|
||||||
@@ -58,6 +59,12 @@ function getProviderUrl(provider: DeployProvider): string | null {
|
|||||||
}
|
}
|
||||||
return 'https://vercel.com';
|
return 'https://vercel.com';
|
||||||
|
|
||||||
|
case 'cloudflare':
|
||||||
|
if (provider.baseURL) {
|
||||||
|
return provider.baseURL;
|
||||||
|
}
|
||||||
|
return 'https://cloudflare.com';
|
||||||
|
|
||||||
case 'nsite':
|
case 'nsite':
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -110,6 +117,11 @@ interface VercelFormData {
|
|||||||
teamId: string;
|
teamId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface CloudflareFormData {
|
||||||
|
projectName: string;
|
||||||
|
branch: string;
|
||||||
|
}
|
||||||
|
|
||||||
export function DeployDialog({ projectId, projectName, open, onOpenChange }: DeployDialogProps) {
|
export function DeployDialog({ projectId, projectName, open, onOpenChange }: DeployDialogProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { settings } = useDeploySettings();
|
const { settings } = useDeploySettings();
|
||||||
@@ -141,6 +153,10 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep
|
|||||||
projectName: projectName || projectId,
|
projectName: projectName || projectId,
|
||||||
teamId: '',
|
teamId: '',
|
||||||
});
|
});
|
||||||
|
const [cloudflareForm, setCloudflareForm] = useState<CloudflareFormData>({
|
||||||
|
projectName: projectName || projectId,
|
||||||
|
branch: 'main',
|
||||||
|
});
|
||||||
|
|
||||||
// Load project settings when dialog opens
|
// Load project settings when dialog opens
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -230,6 +246,24 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep
|
|||||||
projectName: vercelForm.projectName || undefined,
|
projectName: vercelForm.projectName || undefined,
|
||||||
corsProxy: vercelProvider.proxy ? config.corsProxy : undefined,
|
corsProxy: vercelProvider.proxy ? config.corsProxy : undefined,
|
||||||
});
|
});
|
||||||
|
} else if (selectedProvider.type === 'cloudflare') {
|
||||||
|
const cloudflareProvider = selectedProvider as CloudflareProvider;
|
||||||
|
if (!cloudflareProvider.apiToken) {
|
||||||
|
throw new Error('Cloudflare API token is required');
|
||||||
|
}
|
||||||
|
if (!cloudflareProvider.accountId) {
|
||||||
|
throw new Error('Cloudflare Account ID is required');
|
||||||
|
}
|
||||||
|
|
||||||
|
adapter = new CloudflareAdapter({
|
||||||
|
fs,
|
||||||
|
apiToken: cloudflareProvider.apiToken,
|
||||||
|
accountId: cloudflareProvider.accountId,
|
||||||
|
baseURL: cloudflareProvider.baseURL,
|
||||||
|
projectName: cloudflareForm.projectName || undefined,
|
||||||
|
branch: cloudflareForm.branch || undefined,
|
||||||
|
corsProxy: cloudflareProvider.proxy ? config.corsProxy : undefined,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Unknown provider type');
|
throw new Error('Unknown provider type');
|
||||||
}
|
}
|
||||||
@@ -269,6 +303,15 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep
|
|||||||
projectId: vercelForm.projectName || undefined,
|
projectId: vercelForm.projectName || undefined,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
} else if (selectedProvider.type === 'cloudflare') {
|
||||||
|
await updateProjectSettings(selectedProviderId, {
|
||||||
|
type: 'cloudflare',
|
||||||
|
data: {
|
||||||
|
projectName: cloudflareForm.projectName || undefined,
|
||||||
|
branch: cloudflareForm.branch || undefined,
|
||||||
|
projectId: result.metadata?.projectId as string | undefined,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setDeployResult(result);
|
setDeployResult(result);
|
||||||
@@ -288,6 +331,7 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep
|
|||||||
setNsiteForm({ nsec: '' });
|
setNsiteForm({ nsec: '' });
|
||||||
setNetlifyForm({ siteId: '', siteName: '' });
|
setNetlifyForm({ siteId: '', siteName: '' });
|
||||||
setVercelForm({ projectName: projectName || projectId, teamId: '' });
|
setVercelForm({ projectName: projectName || projectId, teamId: '' });
|
||||||
|
setCloudflareForm({ projectName: projectName || projectId, branch: 'main' });
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -311,6 +355,10 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep
|
|||||||
setVercelForm({ projectName, teamId });
|
setVercelForm({ projectName, teamId });
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const handleCloudflareConfigChange = useCallback((projectName: string, branch: string) => {
|
||||||
|
setCloudflareForm({ projectName, branch });
|
||||||
|
}, []);
|
||||||
|
|
||||||
const renderProviderFields = () => {
|
const renderProviderFields = () => {
|
||||||
if (!selectedProvider) return null;
|
if (!selectedProvider) return null;
|
||||||
|
|
||||||
@@ -373,6 +421,22 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selectedProvider.type === 'cloudflare') {
|
||||||
|
const savedConfig = projectSettings.providers[selectedProviderId];
|
||||||
|
const savedProjectName = savedConfig?.type === 'cloudflare' ? savedConfig.data.projectName : undefined;
|
||||||
|
const savedBranch = savedConfig?.type === 'cloudflare' ? savedConfig.data.branch : undefined;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<CloudflareDeployForm
|
||||||
|
projectId={projectId}
|
||||||
|
projectName={projectName}
|
||||||
|
savedProjectName={savedProjectName}
|
||||||
|
savedBranch={savedBranch}
|
||||||
|
onConfigChange={handleCloudflareConfigChange}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { encodeBase64 } from '@std/encoding/base64';
|
import { encodeBase64 } from '@std/encoding/base64';
|
||||||
import { useState, useEffect, useCallback, useRef, useMemo, memo } from 'react';
|
import { useState, useEffect, useCallback, useRef } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
||||||
import { useFS } from '@/hooks/useFS';
|
import { useFS } from '@/hooks/useFS';
|
||||||
import { useFSPaths } from '@/hooks/useFSPaths';
|
import { useFSPaths } from '@/hooks/useFSPaths';
|
||||||
import { addConsoleMessage, getConsoleMessages, addConsoleMessageListener, removeConsoleMessageListener, type ConsoleMessage } from '@/lib/consoleMessages';
|
import { addConsoleMessage, getConsoleMessages, type ConsoleMessage } from '@/lib/consoleMessages';
|
||||||
import { useConsoleError } from '@/hooks/useConsoleError';
|
import { useConsoleError } from '@/hooks/useConsoleError';
|
||||||
import { useBuildProject } from '@/hooks/useBuildProject';
|
import { useBuildProject } from '@/hooks/useBuildProject';
|
||||||
import { Tabs, TabsContent } from '@/components/ui/tabs';
|
import { Tabs, TabsContent } from '@/components/ui/tabs';
|
||||||
import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area';
|
import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { FolderOpen, ArrowLeft, Bug, Copy, Check, Play, Loader2, MenuIcon, Code, Rocket, Terminal, Trash2, ChevronRight } from 'lucide-react';
|
import { FolderOpen, ArrowLeft, Bug, Copy, Check, Play, Loader2, MenuIcon, Code, Rocket, X, Terminal } from 'lucide-react';
|
||||||
import { useIsMobile } from '@/hooks/useIsMobile';
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
||||||
import { GitStatusIndicator } from '@/components/GitStatusIndicator';
|
import { GitStatusIndicator } from '@/components/GitStatusIndicator';
|
||||||
import { BrowserAddressBar } from '@/components/ui/browser-address-bar';
|
import { BrowserAddressBar } from '@/components/ui/browser-address-bar';
|
||||||
@@ -20,6 +20,11 @@ import {
|
|||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from '@/components/ui/dropdown-menu';
|
} from '@/components/ui/dropdown-menu';
|
||||||
|
import {
|
||||||
|
Popover,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverTrigger,
|
||||||
|
} from '@/components/ui/popover';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { FileTree } from './FileTree';
|
import { FileTree } from './FileTree';
|
||||||
import { FileEditor } from './FileEditor';
|
import { FileEditor } from './FileEditor';
|
||||||
@@ -83,7 +88,6 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
|||||||
const [historyIndex, setHistoryIndex] = useState(0);
|
const [historyIndex, setHistoryIndex] = useState(0);
|
||||||
|
|
||||||
const [deployDialogOpen, setDeployDialogOpen] = useState(false);
|
const [deployDialogOpen, setDeployDialogOpen] = useState(false);
|
||||||
const [showConsoleView, setShowConsoleView] = useState(false);
|
|
||||||
const iframeRef = useRef<HTMLIFrameElement>(null);
|
const iframeRef = useRef<HTMLIFrameElement>(null);
|
||||||
const { fs } = useFS();
|
const { fs } = useFS();
|
||||||
const { projectsPath } = useFSPaths();
|
const { projectsPath } = useFSPaths();
|
||||||
@@ -461,7 +465,6 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
|||||||
setFileContent('');
|
setFileContent('');
|
||||||
setMobileCodeView('explorer');
|
setMobileCodeView('explorer');
|
||||||
setDesktopCodeView('files');
|
setDesktopCodeView('files');
|
||||||
setShowConsoleView(false);
|
|
||||||
|
|
||||||
// Reset navigation history and state
|
// Reset navigation history and state
|
||||||
setCurrentPath('/');
|
setCurrentPath('/');
|
||||||
@@ -518,282 +521,102 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constants
|
const ConsoleDropdown = () => {
|
||||||
const CONSOLE_SORT_ORDER_KEY = 'consoleSortOrder';
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const COPY_FEEDBACK_DURATION = 2000;
|
|
||||||
const MAX_CONSOLE_MESSAGES = 500; // Limit displayed messages for performance
|
|
||||||
|
|
||||||
// Helper function to get message level color
|
|
||||||
const getMessageLevelColor = (level: ConsoleMessage['level']): string => {
|
|
||||||
switch (level) {
|
|
||||||
case 'error': return 'text-destructive';
|
|
||||||
case 'warn': return 'text-warning';
|
|
||||||
case 'info': return 'text-primary';
|
|
||||||
default: return 'text-muted-foreground';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const ConsoleToggleButton = () => {
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
variant={showConsoleView ? "secondary" : "ghost"}
|
|
||||||
size="sm"
|
|
||||||
className="h-8 w-8 p-0 relative"
|
|
||||||
onClick={() => setShowConsoleView(!showConsoleView)}
|
|
||||||
title={showConsoleView ? "Show preview" : "Show console"}
|
|
||||||
>
|
|
||||||
<Bug className="h-4 w-4" />
|
|
||||||
{hasConsoleErrors && (
|
|
||||||
<span className="absolute -top-1 -right-1 h-3 w-3 rounded-full border-2 border-background bg-red-500" />
|
|
||||||
)}
|
|
||||||
</Button>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Individual console message component - memoized for performance
|
|
||||||
const ConsoleMessage = memo(({ msg, index, copiedMessageIndex, onCopy }: {
|
|
||||||
msg: ConsoleMessage;
|
|
||||||
index: number;
|
|
||||||
copiedMessageIndex: number | null;
|
|
||||||
onCopy: (msg: ConsoleMessage, index: number) => void;
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className="group relative py-0.5 px-1 hover:bg-muted/50 transition-colors duration-150 rounded cursor-pointer"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
onCopy(msg, index);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className={cn(
|
|
||||||
"text-xs font-mono leading-tight whitespace-pre-wrap break-words",
|
|
||||||
getMessageLevelColor(msg.level)
|
|
||||||
)}>
|
|
||||||
{msg.message}
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
onCopy(msg, index);
|
|
||||||
}}
|
|
||||||
className="h-3 w-3 p-0 opacity-0 group-hover:opacity-100 transition-all duration-200 absolute right-1 top-1 hover:bg-muted/70 text-muted-foreground hover:text-foreground bg-background/80 rounded border"
|
|
||||||
>
|
|
||||||
{copiedMessageIndex === index ? (
|
|
||||||
<Check className="h-2 w-2 text-success" />
|
|
||||||
) : (
|
|
||||||
<Copy className="h-2 w-2" />
|
|
||||||
)}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
ConsoleMessage.displayName = 'ConsoleMessage';
|
|
||||||
|
|
||||||
const ConsoleView = () => {
|
|
||||||
const [copiedMessageIndex, setCopiedMessageIndex] = useState<number | null>(null);
|
const [copiedMessageIndex, setCopiedMessageIndex] = useState<number | null>(null);
|
||||||
const [isInitialLoad, setIsInitialLoad] = useState(true);
|
|
||||||
const [rawMessages, setRawMessages] = useState<ConsoleMessage[]>([]);
|
|
||||||
const [totalMessageCount, setTotalMessageCount] = useState(0);
|
|
||||||
|
|
||||||
// Load sort order from localStorage, default to 'newest-first'
|
|
||||||
const [sortOrder, setSortOrder] = useState<'newest-first' | 'oldest-first'>(() => {
|
|
||||||
const saved = localStorage.getItem(CONSOLE_SORT_ORDER_KEY);
|
|
||||||
return (saved === 'oldest-first' || saved === 'newest-first') ? saved : 'newest-first';
|
|
||||||
});
|
|
||||||
|
|
||||||
// Save sort order to localStorage whenever it changes
|
const messages = isOpen ? getConsoleMessages() : [];
|
||||||
useEffect(() => {
|
|
||||||
localStorage.setItem(CONSOLE_SORT_ORDER_KEY, sortOrder);
|
|
||||||
}, [sortOrder]);
|
|
||||||
|
|
||||||
// Track rapid message bursts for intelligent batching
|
|
||||||
const lastMessageTimeRef = useRef<number>(0);
|
|
||||||
const pendingUpdateRef = useRef<number>();
|
|
||||||
const messageCountSinceUpdateRef = useRef<number>(0);
|
|
||||||
|
|
||||||
// Update messages from the global store - optimized for immediate updates
|
|
||||||
const updateMessages = useCallback(() => {
|
|
||||||
const allMessages = getConsoleMessages();
|
|
||||||
setTotalMessageCount(allMessages.length);
|
|
||||||
|
|
||||||
// Limit messages for performance (keep most recent)
|
|
||||||
const limitedMessages = allMessages.length > MAX_CONSOLE_MESSAGES
|
|
||||||
? allMessages.slice(-MAX_CONSOLE_MESSAGES)
|
|
||||||
: allMessages;
|
|
||||||
|
|
||||||
setRawMessages(limitedMessages);
|
|
||||||
setIsInitialLoad(false);
|
|
||||||
messageCountSinceUpdateRef.current = 0;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
// Smart update handler: immediate for single messages, batched for rapid bursts
|
|
||||||
const handleMessageUpdate = useCallback(() => {
|
|
||||||
const now = Date.now();
|
|
||||||
const timeSinceLastMessage = now - lastMessageTimeRef.current;
|
|
||||||
lastMessageTimeRef.current = now;
|
|
||||||
messageCountSinceUpdateRef.current += 1;
|
|
||||||
|
|
||||||
// Detect rapid bursts: if we get more than 3 messages within 50ms, batch them
|
|
||||||
const isRapidBurst = messageCountSinceUpdateRef.current > 3 && timeSinceLastMessage < 50;
|
|
||||||
|
|
||||||
// Clear any pending update
|
|
||||||
if (pendingUpdateRef.current) {
|
|
||||||
cancelAnimationFrame(pendingUpdateRef.current);
|
|
||||||
pendingUpdateRef.current = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isRapidBurst) {
|
|
||||||
// Batch rapid updates using requestAnimationFrame for smooth rendering
|
|
||||||
// This prevents UI blocking during loops that log many messages
|
|
||||||
pendingUpdateRef.current = requestAnimationFrame(() => {
|
|
||||||
updateMessages();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Immediate update for normal console.log calls (like browser console)
|
|
||||||
// Single messages appear instantly, just like native browser console
|
|
||||||
updateMessages();
|
|
||||||
}
|
|
||||||
}, [updateMessages]);
|
|
||||||
|
|
||||||
// Initial load and listener setup
|
|
||||||
useEffect(() => {
|
|
||||||
// Initial load - check if we have many messages
|
|
||||||
const allMessages = getConsoleMessages();
|
|
||||||
if (allMessages.length > 500) {
|
|
||||||
setIsInitialLoad(true);
|
|
||||||
// Use requestIdleCallback for non-blocking initial render, fallback to setTimeout
|
|
||||||
const scheduleUpdate = () => {
|
|
||||||
if ('requestIdleCallback' in window) {
|
|
||||||
requestIdleCallback(() => {
|
|
||||||
updateMessages();
|
|
||||||
}, { timeout: 100 });
|
|
||||||
} else {
|
|
||||||
setTimeout(() => {
|
|
||||||
updateMessages();
|
|
||||||
}, 0);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
scheduleUpdate();
|
|
||||||
} else {
|
|
||||||
updateMessages();
|
|
||||||
}
|
|
||||||
|
|
||||||
addConsoleMessageListener(handleMessageUpdate);
|
|
||||||
return () => {
|
|
||||||
removeConsoleMessageListener(handleMessageUpdate);
|
|
||||||
if (pendingUpdateRef.current) {
|
|
||||||
cancelAnimationFrame(pendingUpdateRef.current);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}, [handleMessageUpdate, updateMessages]);
|
|
||||||
|
|
||||||
// Memoize sorted messages to avoid recalculation on every render
|
|
||||||
const messages = useMemo(() => {
|
|
||||||
if (sortOrder === 'newest-first') {
|
|
||||||
// For newest-first, reverse the array (messages are stored oldest-first)
|
|
||||||
return [...rawMessages].reverse();
|
|
||||||
}
|
|
||||||
return rawMessages;
|
|
||||||
}, [rawMessages, sortOrder]);
|
|
||||||
|
|
||||||
const copyMessageToClipboard = async (msg: ConsoleMessage, index: number) => {
|
const copyMessageToClipboard = async (msg: ConsoleMessage, index: number) => {
|
||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(msg.message);
|
await navigator.clipboard.writeText(msg.message);
|
||||||
setCopiedMessageIndex(index);
|
setCopiedMessageIndex(index);
|
||||||
setTimeout(() => setCopiedMessageIndex(null), COPY_FEEDBACK_DURATION);
|
setTimeout(() => setCopiedMessageIndex(null), 2000);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to copy message to clipboard:', error);
|
console.error('Failed to copy message to clipboard:', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClearMessages = () => {
|
|
||||||
clearErrors();
|
|
||||||
setCopiedMessageIndex(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
const messageCount = messages.length;
|
const messageCount = messages.length;
|
||||||
const hasMoreMessages = rawMessages.length >= MAX_CONSOLE_MESSAGES;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-full w-full flex flex-col bg-background">
|
<Popover open={isOpen} onOpenChange={setIsOpen}>
|
||||||
{/* Header */}
|
<PopoverTrigger asChild>
|
||||||
<div className="h-12 flex-shrink-0 flex items-center justify-between px-4 border-b">
|
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => setShowConsoleView(false)}
|
className="h-8 w-8 p-0 relative"
|
||||||
className="h-8 gap-2 text-muted-foreground hover:text-foreground"
|
|
||||||
>
|
>
|
||||||
<ArrowLeft className="h-4 w-4" />
|
<Bug className="h-4 w-4" />
|
||||||
Back
|
{hasConsoleErrors && (
|
||||||
</Button>
|
<span className="absolute -top-1 -right-1 h-3 w-3 rounded-full border-2 border-background bg-red-500" />
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
{messageCount > 0 && (
|
|
||||||
<>
|
|
||||||
{hasMoreMessages && (
|
|
||||||
<span className="text-xs text-muted-foreground">
|
|
||||||
Showing last {MAX_CONSOLE_MESSAGES.toLocaleString()} of {totalMessageCount.toLocaleString()}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => setSortOrder(sortOrder === 'newest-first' ? 'oldest-first' : 'newest-first')}
|
|
||||||
className="h-8 text-muted-foreground hover:text-foreground"
|
|
||||||
>
|
|
||||||
{sortOrder === 'newest-first' ? t('latestFirst') : t('oldestFirst')}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={handleClearMessages}
|
|
||||||
className="h-8 w-8 p-0 text-destructive/80 hover:text-destructive"
|
|
||||||
>
|
|
||||||
<Trash2 className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</Button>
|
||||||
</div>
|
</PopoverTrigger>
|
||||||
|
<PopoverContent
|
||||||
|
align="end"
|
||||||
|
className="w-[calc(100vw-1rem)] max-w-[480px] max-h-[512px] overflow-hidden shadow-lg border rounded-lg bg-background p-0"
|
||||||
|
sideOffset={4}
|
||||||
|
>
|
||||||
|
|
||||||
{/* Messages */}
|
{/* Messages */}
|
||||||
<div className="flex-1 min-h-0 overflow-y-auto overflow-x-hidden [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] bg-background text-foreground font-mono text-xs relative">
|
<div className="h-[60vh] max-h-[512px] w-full bg-background text-foreground font-mono text-xs relative overflow-y-auto overflow-x-hidden [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]">
|
||||||
{isInitialLoad ? (
|
|
||||||
<div className="absolute inset-0 flex items-center justify-center z-10 bg-background">
|
|
||||||
<div className="flex flex-col items-center gap-2">
|
|
||||||
<Loader2 className="h-5 w-5 animate-spin text-primary" />
|
|
||||||
<span className="text-sm text-muted-foreground">Loading console messages...</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="py-2 px-1 space-y-0">
|
<div className="py-2 px-1 space-y-0">
|
||||||
{/* Console prompt indicator - at top for newest-first, bottom for oldest-first */}
|
{messageCount === 0 ? (
|
||||||
{sortOrder === 'newest-first' && (
|
<div className="flex flex-col items-center justify-center py-12 text-center">
|
||||||
<div className="py-0.5 px-1 flex items-center">
|
<p className="text-sm text-muted-foreground font-medium">No console messages</p>
|
||||||
<ChevronRight className="h-3 w-3 text-muted-foreground" />
|
<p className="text-xs text-muted-foreground mt-1">Messages from your project will appear here</p>
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{messages.map((msg, index) => (
|
|
||||||
<ConsoleMessage
|
|
||||||
key={`${index}-${msg.message.slice(0, 20)}`}
|
|
||||||
msg={msg}
|
|
||||||
index={index}
|
|
||||||
copiedMessageIndex={copiedMessageIndex}
|
|
||||||
onCopy={copyMessageToClipboard}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
{sortOrder === 'oldest-first' && (
|
|
||||||
<div className="py-0.5 px-1 flex items-center">
|
|
||||||
<ChevronRight className="h-3 w-3 text-muted-foreground" />
|
|
||||||
</div>
|
</div>
|
||||||
|
) : (
|
||||||
|
messages.map((msg, index) => (
|
||||||
|
<div
|
||||||
|
key={index}
|
||||||
|
className="group relative py-0.5 px-1 hover:bg-muted/50 transition-colors duration-150 rounded cursor-pointer"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
copyMessageToClipboard(msg, index);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className={cn(
|
||||||
|
"text-xs font-mono leading-tight whitespace-pre-wrap break-words",
|
||||||
|
msg.level === 'error' ? "text-destructive" :
|
||||||
|
msg.level === 'warn' ? "text-warning" :
|
||||||
|
msg.level === 'info' ? "text-primary" :
|
||||||
|
"text-muted-foreground"
|
||||||
|
)}>
|
||||||
|
{msg.message}
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
copyMessageToClipboard(msg, index);
|
||||||
|
}}
|
||||||
|
className="h-3 w-3 p-0 opacity-0 group-hover:opacity-100 transition-all duration-200 absolute right-1 top-1 hover:bg-muted/70 text-muted-foreground hover:text-foreground bg-background/80 rounded border"
|
||||||
|
>
|
||||||
|
{copiedMessageIndex === index ? (
|
||||||
|
<Check className="h-2 w-2 text-success" />
|
||||||
|
) : (
|
||||||
|
<Copy className="h-2 w-2" />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
{/* Close button */}
|
||||||
|
<button
|
||||||
|
onClick={() => setIsOpen(false)}
|
||||||
|
className="absolute top-2 right-2 h-8 w-8 p-0 bg-muted/50 hover:bg-muted/70 rounded-md z-10 flex items-center justify-center border"
|
||||||
|
>
|
||||||
|
<X className="h-5 w-5 text-muted-foreground" />
|
||||||
|
</button>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -866,7 +689,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
|||||||
<Code className="h-4 w-4" />
|
<Code className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<ConsoleToggleButton />
|
<ConsoleDropdown />
|
||||||
<Menu />
|
<Menu />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -874,25 +697,16 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Content area */}
|
{/* Content area */}
|
||||||
<div className="flex-1 min-h-0 relative">
|
<div className="flex-1">
|
||||||
{/* Console View */}
|
{hasBuiltProject ? (
|
||||||
<div className={cn("absolute inset-0", showConsoleView ? "block" : "hidden")}>
|
|
||||||
<ConsoleView />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Preview iframe */}
|
|
||||||
{hasBuiltProject && (
|
|
||||||
<iframe
|
<iframe
|
||||||
ref={iframeRef}
|
ref={iframeRef}
|
||||||
src={`https://${projectId}.${previewDomain}/`}
|
src={`https://${projectId}.${previewDomain}/`}
|
||||||
className={cn("w-full h-full border-0", showConsoleView ? "hidden" : "block")}
|
className="w-full h-full border-0"
|
||||||
title="Project Preview"
|
title="Project Preview"
|
||||||
sandbox="allow-scripts allow-same-origin"
|
sandbox="allow-scripts allow-same-origin"
|
||||||
/>
|
/>
|
||||||
)}
|
) : (
|
||||||
|
|
||||||
{/* Build prompt */}
|
|
||||||
{!hasBuiltProject && !showConsoleView && (
|
|
||||||
<div className="h-full flex items-center justify-center bg-muted">
|
<div className="h-full flex items-center justify-center bg-muted">
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<h3 className="text-lg font-semibold mb-2">{t('projectPreview')}</h3>
|
<h3 className="text-lg font-semibold mb-2">{t('projectPreview')}</h3>
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import { useState, useEffect } from 'react';
|
||||||
|
import { Label } from '@/components/ui/label';
|
||||||
|
import { Input } from '@/components/ui/input';
|
||||||
|
|
||||||
|
interface CloudflareDeployFormProps {
|
||||||
|
projectId: string;
|
||||||
|
projectName?: string;
|
||||||
|
savedProjectName?: string;
|
||||||
|
savedBranch?: string;
|
||||||
|
onConfigChange: (projectName: string, branch: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CloudflareDeployForm({
|
||||||
|
projectId,
|
||||||
|
projectName: initialProjectName,
|
||||||
|
savedProjectName,
|
||||||
|
savedBranch,
|
||||||
|
onConfigChange,
|
||||||
|
}: CloudflareDeployFormProps) {
|
||||||
|
const [projectName, setProjectName] = useState(savedProjectName || initialProjectName || projectId);
|
||||||
|
const [branch, setBranch] = useState(savedBranch || 'main');
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
onConfigChange(projectName, branch);
|
||||||
|
}, [projectName, branch, onConfigChange]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<div className="space-y-2">
|
||||||
|
<Label htmlFor="cloudflare-project-name">Project Name</Label>
|
||||||
|
<Input
|
||||||
|
id="cloudflare-project-name"
|
||||||
|
value={projectName}
|
||||||
|
onChange={(e) => setProjectName(e.target.value)}
|
||||||
|
placeholder={initialProjectName || projectId}
|
||||||
|
/>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
URL: <span className="font-mono">{projectName || projectId}.pages.dev</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-2">
|
||||||
|
<Label htmlFor="cloudflare-branch">Branch Name</Label>
|
||||||
|
<Input
|
||||||
|
id="cloudflare-branch"
|
||||||
|
value={branch}
|
||||||
|
onChange={(e) => setBranch(e.target.value)}
|
||||||
|
placeholder="main"
|
||||||
|
/>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
Production branch for your Cloudflare Pages project
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -32,7 +32,15 @@ export interface NsiteProvider extends BaseDeployProvider {
|
|||||||
blossomServers: string[];
|
blossomServers: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export type DeployProvider = ShakespeareDeployProvider | NetlifyProvider | VercelProvider | NsiteProvider;
|
export interface CloudflareProvider extends BaseDeployProvider {
|
||||||
|
type: 'cloudflare';
|
||||||
|
apiToken: string;
|
||||||
|
accountId: string;
|
||||||
|
baseURL?: string;
|
||||||
|
proxy?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DeployProvider = ShakespeareDeployProvider | NetlifyProvider | VercelProvider | NsiteProvider | CloudflareProvider;
|
||||||
|
|
||||||
export interface DeploySettings {
|
export interface DeploySettings {
|
||||||
providers: DeployProvider[];
|
providers: DeployProvider[];
|
||||||
|
|||||||
@@ -49,7 +49,10 @@ export function useOAuth(config: OAuthConfig) {
|
|||||||
const { corsProxy } = appConfig;
|
const { corsProxy } = appConfig;
|
||||||
|
|
||||||
// Check if OAuth is configured
|
// Check if OAuth is configured
|
||||||
const isOAuthConfigured = !!(config.clientId && config.clientSecret);
|
// For PKCE flows (like Cloudflare), we only need clientId
|
||||||
|
const isOAuthConfigured = config.usePKCE
|
||||||
|
? !!config.clientId
|
||||||
|
: !!(config.clientId && config.clientSecret);
|
||||||
|
|
||||||
// Generate a cryptographically secure random string for PKCE code verifier
|
// Generate a cryptographically secure random string for PKCE code verifier
|
||||||
const generateCodeVerifier = (): string => {
|
const generateCodeVerifier = (): string => {
|
||||||
|
|||||||
@@ -31,7 +31,16 @@ export interface VercelProjectConfig {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ProjectProviderConfig = ShakespeareProjectConfig | NsiteProjectConfig | NetlifyProjectConfig | VercelProjectConfig;
|
export interface CloudflareProjectConfig {
|
||||||
|
type: 'cloudflare';
|
||||||
|
data: {
|
||||||
|
projectName?: string;
|
||||||
|
branch?: string;
|
||||||
|
projectId?: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ProjectProviderConfig = ShakespeareProjectConfig | NsiteProjectConfig | NetlifyProjectConfig | VercelProjectConfig | CloudflareProjectConfig;
|
||||||
|
|
||||||
export interface ProjectDeploySettings {
|
export interface ProjectDeploySettings {
|
||||||
providers: Record<string, ProjectProviderConfig>;
|
providers: Record<string, ProjectProviderConfig>;
|
||||||
|
|||||||
@@ -0,0 +1,321 @@
|
|||||||
|
import type { JSRuntimeFS } from '../JSRuntime';
|
||||||
|
import type { DeployAdapter, DeployOptions, DeployResult, CloudflareDeployConfig } from './types';
|
||||||
|
import { proxyUrl } from '../proxyUrl';
|
||||||
|
|
||||||
|
interface CloudflareFile {
|
||||||
|
key: string;
|
||||||
|
value: string;
|
||||||
|
metadata: {
|
||||||
|
contentType: string;
|
||||||
|
};
|
||||||
|
base64: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CloudflareDeployment {
|
||||||
|
id: string;
|
||||||
|
url: string;
|
||||||
|
environment: string;
|
||||||
|
deployment_trigger: {
|
||||||
|
type: string;
|
||||||
|
};
|
||||||
|
stages: Array<{
|
||||||
|
name: string;
|
||||||
|
status: string;
|
||||||
|
}>;
|
||||||
|
project_name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CloudflareProject {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
subdomain: string;
|
||||||
|
domains: string[];
|
||||||
|
created_on: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cloudflare Pages Deploy Adapter
|
||||||
|
* Uses Cloudflare Pages Direct Upload API with API token
|
||||||
|
*
|
||||||
|
* Mimics the behavior of "wrangler pages deploy dist"
|
||||||
|
*/
|
||||||
|
export class CloudflareAdapter implements DeployAdapter {
|
||||||
|
private fs: JSRuntimeFS;
|
||||||
|
private apiToken: string;
|
||||||
|
private accountId: string;
|
||||||
|
private baseURL: string;
|
||||||
|
private projectName?: string;
|
||||||
|
private branch?: string;
|
||||||
|
private corsProxy?: string;
|
||||||
|
|
||||||
|
constructor(config: CloudflareDeployConfig) {
|
||||||
|
this.fs = config.fs;
|
||||||
|
this.apiToken = config.apiToken;
|
||||||
|
this.accountId = config.accountId;
|
||||||
|
this.baseURL = config.baseURL || 'https://api.cloudflare.com/client/v4';
|
||||||
|
this.projectName = config.projectName;
|
||||||
|
this.branch = config.branch || 'main';
|
||||||
|
this.corsProxy = config.corsProxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
async deploy(options: DeployOptions): Promise<DeployResult> {
|
||||||
|
const { projectId, projectPath } = options;
|
||||||
|
|
||||||
|
// Check if dist directory exists and contains index.html
|
||||||
|
const distPath = `${projectPath}/dist`;
|
||||||
|
try {
|
||||||
|
await this.fs.readFile(`${distPath}/index.html`, 'utf8');
|
||||||
|
} catch {
|
||||||
|
throw new Error('No index.html found in dist directory. Please build the project first.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine project name
|
||||||
|
const cfProjectName = this.projectName || projectId;
|
||||||
|
|
||||||
|
// Ensure project exists or create it
|
||||||
|
let project: CloudflareProject;
|
||||||
|
try {
|
||||||
|
project = await this.getProject(cfProjectName);
|
||||||
|
} catch {
|
||||||
|
// Project doesn't exist, create it
|
||||||
|
project = await this.createProject(cfProjectName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect all files from dist directory
|
||||||
|
const manifest: Record<string, string> = {};
|
||||||
|
const files: CloudflareFile[] = [];
|
||||||
|
await this.collectFiles(distPath, '', files, manifest);
|
||||||
|
|
||||||
|
// Create deployment using Direct Upload API
|
||||||
|
const deployment = await this.createDeployment(cfProjectName, files, manifest);
|
||||||
|
|
||||||
|
// Construct the deployment URL
|
||||||
|
const deploymentUrl = deployment.url || `https://${deployment.id}.${project.subdomain}.pages.dev`;
|
||||||
|
|
||||||
|
return {
|
||||||
|
url: deploymentUrl,
|
||||||
|
metadata: {
|
||||||
|
deploymentId: deployment.id,
|
||||||
|
projectId: project.id,
|
||||||
|
projectName: project.name,
|
||||||
|
provider: 'cloudflare',
|
||||||
|
environment: deployment.environment,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private async getProject(projectName: string): Promise<CloudflareProject> {
|
||||||
|
const url = `${this.baseURL}/accounts/${this.accountId}/pages/projects/${projectName}`;
|
||||||
|
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||||
|
|
||||||
|
const response = await fetch(targetUrl, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Authorization': `Bearer ${this.apiToken}`,
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorText = await response.text().catch(() => 'Unknown error');
|
||||||
|
throw new Error(`Failed to get Cloudflare Pages project: ${response.status} ${response.statusText}. ${errorText}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
return data.result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async createProject(projectName: string): Promise<CloudflareProject> {
|
||||||
|
const url = `${this.baseURL}/accounts/${this.accountId}/pages/projects`;
|
||||||
|
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||||
|
|
||||||
|
const response = await fetch(targetUrl, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Authorization': `Bearer ${this.apiToken}`,
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
name: projectName,
|
||||||
|
production_branch: this.branch,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorText = await response.text().catch(() => 'Unknown error');
|
||||||
|
throw new Error(`Failed to create Cloudflare Pages project: ${response.status} ${response.statusText}. ${errorText}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
return data.result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async createDeployment(
|
||||||
|
projectName: string,
|
||||||
|
files: CloudflareFile[],
|
||||||
|
manifest: Record<string, string>
|
||||||
|
): Promise<CloudflareDeployment> {
|
||||||
|
const url = `${this.baseURL}/accounts/${this.accountId}/pages/projects/${projectName}/deployments`;
|
||||||
|
const targetUrl = this.corsProxy ? proxyUrl(this.corsProxy, url) : url;
|
||||||
|
|
||||||
|
// Create form data for multipart upload
|
||||||
|
const formData = new FormData();
|
||||||
|
|
||||||
|
// Add manifest
|
||||||
|
formData.append('manifest', JSON.stringify(manifest));
|
||||||
|
|
||||||
|
// Add each file
|
||||||
|
for (const file of files) {
|
||||||
|
const blob = new Blob([file.value], { type: file.metadata.contentType });
|
||||||
|
formData.append(file.key, blob);
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await fetch(targetUrl, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Authorization': `Bearer ${this.apiToken}`,
|
||||||
|
// Don't set Content-Type - browser will set it with boundary for multipart/form-data
|
||||||
|
},
|
||||||
|
body: formData,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorText = await response.text().catch(() => 'Unknown error');
|
||||||
|
throw new Error(`Failed to create Cloudflare Pages deployment: ${response.status} ${response.statusText}. ${errorText}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
return data.result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async collectFiles(
|
||||||
|
dirPath: string,
|
||||||
|
relativePath: string,
|
||||||
|
files: CloudflareFile[],
|
||||||
|
manifest: Record<string, string>
|
||||||
|
): Promise<void> {
|
||||||
|
try {
|
||||||
|
const entries = await this.fs.readdir(dirPath, { withFileTypes: true });
|
||||||
|
|
||||||
|
for (const entry of entries) {
|
||||||
|
const fullPath = `${dirPath}/${entry.name}`;
|
||||||
|
const entryRelativePath = relativePath ? `${relativePath}/${entry.name}` : entry.name;
|
||||||
|
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
// Recursively collect files from subdirectories
|
||||||
|
await this.collectFiles(fullPath, entryRelativePath, files, manifest);
|
||||||
|
} else if (entry.isFile()) {
|
||||||
|
try {
|
||||||
|
// Read file content
|
||||||
|
const fileContent = await this.fs.readFile(fullPath);
|
||||||
|
|
||||||
|
// Determine content type based on file extension
|
||||||
|
const contentType = this.getContentType(entry.name);
|
||||||
|
|
||||||
|
// Convert to base64 for binary files, or keep as string for text files
|
||||||
|
let base64Content: string;
|
||||||
|
let isBase64 = false;
|
||||||
|
|
||||||
|
if (this.isBinaryFile(entry.name)) {
|
||||||
|
// Handle binary files (images, fonts, etc.)
|
||||||
|
if (typeof fileContent === 'string') {
|
||||||
|
base64Content = btoa(fileContent);
|
||||||
|
} else {
|
||||||
|
// Handle Uint8Array
|
||||||
|
const binary = Array.from(fileContent)
|
||||||
|
.map(byte => String.fromCharCode(byte))
|
||||||
|
.join('');
|
||||||
|
base64Content = btoa(binary);
|
||||||
|
}
|
||||||
|
isBase64 = true;
|
||||||
|
} else {
|
||||||
|
// Handle text files (HTML, CSS, JS, etc.)
|
||||||
|
if (typeof fileContent === 'string') {
|
||||||
|
base64Content = fileContent;
|
||||||
|
} else {
|
||||||
|
// Decode Uint8Array to string
|
||||||
|
const decoder = new TextDecoder();
|
||||||
|
base64Content = decoder.decode(fileContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to files array
|
||||||
|
files.push({
|
||||||
|
key: entryRelativePath,
|
||||||
|
value: base64Content,
|
||||||
|
metadata: {
|
||||||
|
contentType,
|
||||||
|
},
|
||||||
|
base64: isBase64,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add to manifest (hash placeholder - Cloudflare will compute actual hash)
|
||||||
|
manifest[entryRelativePath] = '';
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(`Failed to read file ${fullPath}:`, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(`Failed to read directory ${dirPath}:`, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get MIME type based on file extension
|
||||||
|
*/
|
||||||
|
private getContentType(filename: string): string {
|
||||||
|
const ext = filename.split('.').pop()?.toLowerCase();
|
||||||
|
|
||||||
|
const mimeTypes: Record<string, string> = {
|
||||||
|
// Text
|
||||||
|
'html': 'text/html',
|
||||||
|
'htm': 'text/html',
|
||||||
|
'css': 'text/css',
|
||||||
|
'js': 'application/javascript',
|
||||||
|
'mjs': 'application/javascript',
|
||||||
|
'json': 'application/json',
|
||||||
|
'xml': 'application/xml',
|
||||||
|
'txt': 'text/plain',
|
||||||
|
'md': 'text/markdown',
|
||||||
|
|
||||||
|
// Images
|
||||||
|
'png': 'image/png',
|
||||||
|
'jpg': 'image/jpeg',
|
||||||
|
'jpeg': 'image/jpeg',
|
||||||
|
'gif': 'image/gif',
|
||||||
|
'svg': 'image/svg+xml',
|
||||||
|
'webp': 'image/webp',
|
||||||
|
'ico': 'image/x-icon',
|
||||||
|
|
||||||
|
// Fonts
|
||||||
|
'woff': 'font/woff',
|
||||||
|
'woff2': 'font/woff2',
|
||||||
|
'ttf': 'font/ttf',
|
||||||
|
'otf': 'font/otf',
|
||||||
|
'eot': 'application/vnd.ms-fontobject',
|
||||||
|
|
||||||
|
// Other
|
||||||
|
'pdf': 'application/pdf',
|
||||||
|
'zip': 'application/zip',
|
||||||
|
'wasm': 'application/wasm',
|
||||||
|
};
|
||||||
|
|
||||||
|
return mimeTypes[ext || ''] || 'application/octet-stream';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a file should be treated as binary
|
||||||
|
*/
|
||||||
|
private isBinaryFile(filename: string): boolean {
|
||||||
|
const ext = filename.split('.').pop()?.toLowerCase();
|
||||||
|
|
||||||
|
const binaryExtensions = [
|
||||||
|
'png', 'jpg', 'jpeg', 'gif', 'webp', 'ico',
|
||||||
|
'woff', 'woff2', 'ttf', 'otf', 'eot',
|
||||||
|
'pdf', 'zip', 'wasm',
|
||||||
|
];
|
||||||
|
|
||||||
|
return binaryExtensions.includes(ext || '');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,3 +3,4 @@ export * from './ShakespeareAdapter';
|
|||||||
export * from './NetlifyAdapter';
|
export * from './NetlifyAdapter';
|
||||||
export * from './VercelAdapter';
|
export * from './VercelAdapter';
|
||||||
export * from './NsiteAdapter';
|
export * from './NsiteAdapter';
|
||||||
|
export * from './CloudflareAdapter';
|
||||||
@@ -54,3 +54,13 @@ export interface NsiteDeployConfig {
|
|||||||
relayUrls: string[];
|
relayUrls: string[];
|
||||||
blossomServers: string[];
|
blossomServers: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CloudflareDeployConfig {
|
||||||
|
fs: JSRuntimeFS;
|
||||||
|
apiToken: string;
|
||||||
|
accountId: string;
|
||||||
|
baseURL?: string;
|
||||||
|
projectName?: string;
|
||||||
|
branch?: string;
|
||||||
|
corsProxy?: string;
|
||||||
|
}
|
||||||
@@ -87,8 +87,6 @@
|
|||||||
"add": "Add",
|
"add": "Add",
|
||||||
"remove": "Remove",
|
"remove": "Remove",
|
||||||
"retry": "Retry",
|
"retry": "Retry",
|
||||||
"latestFirst": "Latest First",
|
|
||||||
"oldestFirst": "Oldest First",
|
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
"buildNostrApps": "Build apps with AI",
|
"buildNostrApps": "Build apps with AI",
|
||||||
|
|||||||
@@ -83,8 +83,6 @@
|
|||||||
"add": "Ƙara",
|
"add": "Ƙara",
|
||||||
"remove": "Cire",
|
"remove": "Cire",
|
||||||
"retry": "Sake gwadawa",
|
"retry": "Sake gwadawa",
|
||||||
"latestFirst": "Na Baya-bayan nan Da farko",
|
|
||||||
"oldestFirst": "Na Dā Da farko",
|
|
||||||
"name": "Suna",
|
"name": "Suna",
|
||||||
"email": "Imel",
|
"email": "Imel",
|
||||||
"buildNostrApps": "Gina aikace-aikace da AI",
|
"buildNostrApps": "Gina aikace-aikace da AI",
|
||||||
|
|||||||
@@ -83,8 +83,6 @@
|
|||||||
"add": "Tinye",
|
"add": "Tinye",
|
||||||
"remove": "Wepụ",
|
"remove": "Wepụ",
|
||||||
"retry": "Nwaa ọzọ",
|
"retry": "Nwaa ọzọ",
|
||||||
"latestFirst": "Nke Ọhụrụ Mbụ",
|
|
||||||
"oldestFirst": "Nke Ochie Mbụ",
|
|
||||||
"name": "Aha",
|
"name": "Aha",
|
||||||
"email": "Ozi-eletrọniki",
|
"email": "Ozi-eletrọniki",
|
||||||
"buildNostrApps": "Wuo ngwa na AI",
|
"buildNostrApps": "Wuo ngwa na AI",
|
||||||
|
|||||||
@@ -83,8 +83,6 @@
|
|||||||
"add": "Adicionar",
|
"add": "Adicionar",
|
||||||
"remove": "Remover",
|
"remove": "Remover",
|
||||||
"retry": "Tentar novamente",
|
"retry": "Tentar novamente",
|
||||||
"latestFirst": "Mais Recentes Primeiro",
|
|
||||||
"oldestFirst": "Mais Antigos Primeiro",
|
|
||||||
"name": "Nome",
|
"name": "Nome",
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
"buildNostrApps": "Construa aplicativos com IA",
|
"buildNostrApps": "Construa aplicativos com IA",
|
||||||
|
|||||||
@@ -83,8 +83,6 @@
|
|||||||
"add": "Fi kun",
|
"add": "Fi kun",
|
||||||
"remove": "Yọ kuro",
|
"remove": "Yọ kuro",
|
||||||
"retry": "Tun gbiyanju",
|
"retry": "Tun gbiyanju",
|
||||||
"latestFirst": "Tuntun Akọkọ",
|
|
||||||
"oldestFirst": "Atijọ Akọkọ",
|
|
||||||
"name": "Orukọ",
|
"name": "Orukọ",
|
||||||
"email": "Imeeli",
|
"email": "Imeeli",
|
||||||
"buildNostrApps": "Kọ awọn ohun elo pẹlu AI",
|
"buildNostrApps": "Kọ awọn ohun elo pẹlu AI",
|
||||||
|
|||||||
@@ -83,8 +83,6 @@
|
|||||||
"add": "添加",
|
"add": "添加",
|
||||||
"remove": "移除",
|
"remove": "移除",
|
||||||
"retry": "重试",
|
"retry": "重试",
|
||||||
"latestFirst": "最新优先",
|
|
||||||
"oldestFirst": "最旧优先",
|
|
||||||
"name": "名称",
|
"name": "名称",
|
||||||
"email": "邮箱",
|
"email": "邮箱",
|
||||||
"buildNostrApps": "使用AI构建应用",
|
"buildNostrApps": "使用AI构建应用",
|
||||||
|
|||||||
+161
-26
@@ -45,12 +45,14 @@ import { normalizeUrl } from '@/lib/faviconUrl';
|
|||||||
|
|
||||||
interface PresetProvider {
|
interface PresetProvider {
|
||||||
id: string;
|
id: string;
|
||||||
type: 'shakespeare' | 'netlify' | 'vercel' | 'nsite';
|
type: 'shakespeare' | 'netlify' | 'vercel' | 'nsite' | 'cloudflare';
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
requiresNostr?: boolean;
|
requiresNostr?: boolean;
|
||||||
apiKeyLabel?: string;
|
apiKeyLabel?: string;
|
||||||
apiKeyURL?: string;
|
apiKeyURL?: string;
|
||||||
|
accountIdLabel?: string;
|
||||||
|
accountIdURL?: string;
|
||||||
proxy?: boolean;
|
proxy?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,29 +188,54 @@ function SortableProviderItem({ provider, index, preset, onRemove, onUpdate, sho
|
|||||||
<PasswordInput
|
<PasswordInput
|
||||||
id={`provider-${index}-apiKey`}
|
id={`provider-${index}-apiKey`}
|
||||||
placeholder={t('enterApiKey')}
|
placeholder={t('enterApiKey')}
|
||||||
value={provider.apiKey}
|
value={
|
||||||
|
provider.type === 'cloudflare' ? provider.apiToken :
|
||||||
|
provider.type === 'netlify' ? provider.apiKey :
|
||||||
|
provider.type === 'vercel' ? provider.apiKey : ''
|
||||||
|
}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
if (provider.type === 'netlify') {
|
if (provider.type === 'netlify') {
|
||||||
onUpdate(index, { ...provider, apiKey: e.target.value });
|
onUpdate(index, { ...provider, apiKey: e.target.value });
|
||||||
} else if (provider.type === 'vercel') {
|
} else if (provider.type === 'vercel') {
|
||||||
onUpdate(index, { ...provider, apiKey: e.target.value });
|
onUpdate(index, { ...provider, apiKey: e.target.value });
|
||||||
|
} else if (provider.type === 'cloudflare') {
|
||||||
|
onUpdate(index, { ...provider, apiToken: e.target.value });
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{provider.type === 'cloudflare' && (
|
||||||
|
<div className="grid gap-2">
|
||||||
|
<Label htmlFor={`provider-${index}-accountId`}>
|
||||||
|
Account ID
|
||||||
|
</Label>
|
||||||
|
<Input
|
||||||
|
id={`provider-${index}-accountId`}
|
||||||
|
placeholder="Enter your Cloudflare Account ID"
|
||||||
|
value={provider.accountId || ''}
|
||||||
|
onChange={(e) => onUpdate(index, { ...provider, accountId: e.target.value })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor={`provider-${index}-baseURL`}>
|
<Label htmlFor={`provider-${index}-baseURL`}>
|
||||||
Base URL (Optional)
|
Base URL (Optional)
|
||||||
</Label>
|
</Label>
|
||||||
<Input
|
<Input
|
||||||
id={`provider-${index}-baseURL`}
|
id={`provider-${index}-baseURL`}
|
||||||
placeholder={provider.type === 'netlify' ? 'https://api.netlify.com/api/v1' : 'https://api.vercel.com'}
|
placeholder={
|
||||||
|
provider.type === 'netlify' ? 'https://api.netlify.com/api/v1' :
|
||||||
|
provider.type === 'cloudflare' ? 'https://api.cloudflare.com/client/v4' :
|
||||||
|
'https://api.vercel.com'
|
||||||
|
}
|
||||||
value={provider.baseURL || ''}
|
value={provider.baseURL || ''}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
if (provider.type === 'netlify') {
|
if (provider.type === 'netlify') {
|
||||||
onUpdate(index, { ...provider, baseURL: e.target.value });
|
onUpdate(index, { ...provider, baseURL: e.target.value });
|
||||||
} else if (provider.type === 'vercel') {
|
} else if (provider.type === 'vercel') {
|
||||||
onUpdate(index, { ...provider, baseURL: e.target.value });
|
onUpdate(index, { ...provider, baseURL: e.target.value });
|
||||||
|
} else if (provider.type === 'cloudflare') {
|
||||||
|
onUpdate(index, { ...provider, baseURL: e.target.value });
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -256,6 +283,17 @@ const PRESET_PROVIDERS: PresetProvider[] = [
|
|||||||
name: 'nsite',
|
name: 'nsite',
|
||||||
description: 'Deploy to Nostr as a static website',
|
description: 'Deploy to Nostr as a static website',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'cloudflare',
|
||||||
|
type: 'cloudflare',
|
||||||
|
name: 'Cloudflare Pages',
|
||||||
|
description: 'Deploy to Cloudflare Pages',
|
||||||
|
apiKeyLabel: 'API Token',
|
||||||
|
apiKeyURL: 'https://dash.cloudflare.com/profile/api-tokens',
|
||||||
|
accountIdLabel: 'Account ID',
|
||||||
|
accountIdURL: 'https://dash.cloudflare.com/',
|
||||||
|
proxy: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'netlify',
|
id: 'netlify',
|
||||||
type: 'netlify',
|
type: 'netlify',
|
||||||
@@ -306,6 +344,13 @@ function getProviderUrl(provider: DeployProvider | PresetProvider): string | nul
|
|||||||
}
|
}
|
||||||
return 'https://vercel.com';
|
return 'https://vercel.com';
|
||||||
|
|
||||||
|
case 'cloudflare':
|
||||||
|
// For Cloudflare providers, check for custom baseURL first, then use default
|
||||||
|
if ('baseURL' in provider && provider.baseURL) {
|
||||||
|
return provider.baseURL;
|
||||||
|
}
|
||||||
|
return 'https://cloudflare.com';
|
||||||
|
|
||||||
case 'nsite':
|
case 'nsite':
|
||||||
// nsite uses Rocket icon fallback
|
// nsite uses Rocket icon fallback
|
||||||
return null;
|
return null;
|
||||||
@@ -327,12 +372,14 @@ export function DeploySettings() {
|
|||||||
const vercelOAuth = useVercelOAuth();
|
const vercelOAuth = useVercelOAuth();
|
||||||
|
|
||||||
const [presetApiKeys, setPresetApiKeys] = useState<Record<string, string>>({});
|
const [presetApiKeys, setPresetApiKeys] = useState<Record<string, string>>({});
|
||||||
|
const [presetAccountIds, setPresetAccountIds] = useState<Record<string, string>>({});
|
||||||
const [forceManualEntry, setForceManualEntry] = useState<Record<string, boolean>>({});
|
const [forceManualEntry, setForceManualEntry] = useState<Record<string, boolean>>({});
|
||||||
|
|
||||||
// Custom provider form state
|
// Custom provider form state
|
||||||
const [customProviderType, setCustomProviderType] = useState<'shakespeare' | 'netlify' | 'vercel' | 'nsite' | ''>('');
|
const [customProviderType, setCustomProviderType] = useState<'shakespeare' | 'netlify' | 'vercel' | 'nsite' | 'cloudflare' | ''>('');
|
||||||
const [customName, setCustomName] = useState('');
|
const [customName, setCustomName] = useState('');
|
||||||
const [customApiKey, setCustomApiKey] = useState('');
|
const [customApiKey, setCustomApiKey] = useState('');
|
||||||
|
const [customAccountId, setCustomAccountId] = useState('');
|
||||||
const [customBaseURL, setCustomBaseURL] = useState('');
|
const [customBaseURL, setCustomBaseURL] = useState('');
|
||||||
const [customHost, setCustomHost] = useState('');
|
const [customHost, setCustomHost] = useState('');
|
||||||
const [customProxy, setCustomProxy] = useState(false);
|
const [customProxy, setCustomProxy] = useState(false);
|
||||||
@@ -366,12 +413,18 @@ export function DeploySettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const apiKey = presetApiKeys[preset.id];
|
const apiKey = presetApiKeys[preset.id];
|
||||||
|
const accountId = presetAccountIds[preset.id];
|
||||||
|
|
||||||
// For non-Shakespeare/non-nsite providers, require API key
|
// For non-Shakespeare/non-nsite providers, require API key
|
||||||
if (!preset.requiresNostr && preset.type !== 'nsite' && !apiKey?.trim()) {
|
if (!preset.requiresNostr && preset.type !== 'nsite' && !apiKey?.trim()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For Cloudflare, also require account ID
|
||||||
|
if (preset.type === 'cloudflare' && !accountId?.trim()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let newProvider: DeployProvider;
|
let newProvider: DeployProvider;
|
||||||
|
|
||||||
if (preset.type === 'shakespeare') {
|
if (preset.type === 'shakespeare') {
|
||||||
@@ -400,6 +453,15 @@ export function DeploySettings() {
|
|||||||
'https://cdn.sovbit.host',
|
'https://cdn.sovbit.host',
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
} else if (preset.type === 'cloudflare') {
|
||||||
|
newProvider = {
|
||||||
|
id: preset.id, // Use preset ID for presets
|
||||||
|
name: preset.name,
|
||||||
|
type: 'cloudflare',
|
||||||
|
apiToken: apiKey.trim(),
|
||||||
|
accountId: accountId.trim(),
|
||||||
|
...(preset.proxy && { proxy: true }),
|
||||||
|
};
|
||||||
} else if (preset.type === 'netlify') {
|
} else if (preset.type === 'netlify') {
|
||||||
newProvider = {
|
newProvider = {
|
||||||
id: preset.id, // Use preset ID for presets
|
id: preset.id, // Use preset ID for presets
|
||||||
@@ -422,6 +484,7 @@ export function DeploySettings() {
|
|||||||
|
|
||||||
// Clear inputs
|
// Clear inputs
|
||||||
setPresetApiKeys(prev => ({ ...prev, [preset.id]: '' }));
|
setPresetApiKeys(prev => ({ ...prev, [preset.id]: '' }));
|
||||||
|
setPresetAccountIds(prev => ({ ...prev, [preset.id]: '' }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddCustomProvider = () => {
|
const handleAddCustomProvider = () => {
|
||||||
@@ -454,6 +517,17 @@ export function DeploySettings() {
|
|||||||
relayUrls,
|
relayUrls,
|
||||||
blossomServers,
|
blossomServers,
|
||||||
};
|
};
|
||||||
|
} else if (customProviderType === 'cloudflare') {
|
||||||
|
if (!customApiKey.trim() || !customAccountId.trim()) return;
|
||||||
|
newProvider = {
|
||||||
|
id: generateCustomProviderId(customProviderType), // Generate custom ID
|
||||||
|
name: customName.trim(),
|
||||||
|
type: 'cloudflare',
|
||||||
|
apiToken: customApiKey.trim(),
|
||||||
|
accountId: customAccountId.trim(),
|
||||||
|
...(customBaseURL?.trim() && { baseURL: customBaseURL.trim() }),
|
||||||
|
...(customProxy && { proxy: true }),
|
||||||
|
};
|
||||||
} else if (customProviderType === 'netlify') {
|
} else if (customProviderType === 'netlify') {
|
||||||
if (!customApiKey.trim()) return;
|
if (!customApiKey.trim()) return;
|
||||||
newProvider = {
|
newProvider = {
|
||||||
@@ -482,6 +556,7 @@ export function DeploySettings() {
|
|||||||
setCustomProviderType('');
|
setCustomProviderType('');
|
||||||
setCustomName('');
|
setCustomName('');
|
||||||
setCustomApiKey('');
|
setCustomApiKey('');
|
||||||
|
setCustomAccountId('');
|
||||||
setCustomBaseURL('');
|
setCustomBaseURL('');
|
||||||
setCustomHost('');
|
setCustomHost('');
|
||||||
setCustomProxy(false);
|
setCustomProxy(false);
|
||||||
@@ -694,34 +769,77 @@ export function DeploySettings() {
|
|||||||
) : (
|
) : (
|
||||||
// Show manual token input
|
// Show manual token input
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div className="flex gap-2">
|
{preset.type === 'cloudflare' ? (
|
||||||
{!preset.requiresNostr && preset.type !== 'nsite' && (
|
// Cloudflare needs both API token and Account ID
|
||||||
|
<>
|
||||||
<PasswordInput
|
<PasswordInput
|
||||||
placeholder={preset.apiKeyLabel || t('enterApiKey')}
|
placeholder={preset.apiKeyLabel || t('enterApiKey')}
|
||||||
className="flex-1"
|
|
||||||
value={presetApiKeys[preset.id] || ''}
|
value={presetApiKeys[preset.id] || ''}
|
||||||
onChange={(e) => setPresetApiKeys(prev => ({
|
onChange={(e) => setPresetApiKeys(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
[preset.id]: e.target.value,
|
[preset.id]: e.target.value,
|
||||||
}))}
|
}))}
|
||||||
|
/>
|
||||||
|
<Input
|
||||||
|
placeholder={preset.accountIdLabel || 'Account ID'}
|
||||||
|
value={presetAccountIds[preset.id] || ''}
|
||||||
|
onChange={(e) => setPresetAccountIds(prev => ({
|
||||||
|
...prev,
|
||||||
|
[preset.id]: e.target.value,
|
||||||
|
}))}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === 'Enter' && presetApiKeys[preset.id]?.trim()) {
|
if (e.key === 'Enter' && presetApiKeys[preset.id]?.trim() && presetAccountIds[preset.id]?.trim()) {
|
||||||
handleAddPresetProvider(preset);
|
handleAddPresetProvider(preset);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
{preset.accountIdURL && (
|
||||||
<Button
|
<button
|
||||||
onClick={() => handleAddPresetProvider(preset)}
|
type="button"
|
||||||
disabled={
|
className="text-xs text-muted-foreground underline hover:text-foreground"
|
||||||
(preset.requiresNostr && !isLoggedIntoNostr) ||
|
onClick={() => window.open(preset.accountIdURL, '_blank')}
|
||||||
(!preset.requiresNostr && preset.type !== 'nsite' && !presetApiKeys[preset.id]?.trim())
|
>
|
||||||
}
|
Find your Account ID
|
||||||
className={(preset.requiresNostr || preset.type === 'nsite') ? "w-full" : "h-10 px-4 ml-auto"}
|
</button>
|
||||||
>
|
)}
|
||||||
{t('add')}
|
<Button
|
||||||
</Button>
|
onClick={() => handleAddPresetProvider(preset)}
|
||||||
</div>
|
disabled={!presetApiKeys[preset.id]?.trim() || !presetAccountIds[preset.id]?.trim()}
|
||||||
|
className="w-full"
|
||||||
|
>
|
||||||
|
{t('add')}
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<div className="flex gap-2">
|
||||||
|
{!preset.requiresNostr && preset.type !== 'nsite' && (
|
||||||
|
<PasswordInput
|
||||||
|
placeholder={preset.apiKeyLabel || t('enterApiKey')}
|
||||||
|
className="flex-1"
|
||||||
|
value={presetApiKeys[preset.id] || ''}
|
||||||
|
onChange={(e) => setPresetApiKeys(prev => ({
|
||||||
|
...prev,
|
||||||
|
[preset.id]: e.target.value,
|
||||||
|
}))}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === 'Enter' && presetApiKeys[preset.id]?.trim()) {
|
||||||
|
handleAddPresetProvider(preset);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<Button
|
||||||
|
onClick={() => handleAddPresetProvider(preset)}
|
||||||
|
disabled={
|
||||||
|
(preset.requiresNostr && !isLoggedIntoNostr) ||
|
||||||
|
(!preset.requiresNostr && preset.type !== 'nsite' && !presetApiKeys[preset.id]?.trim())
|
||||||
|
}
|
||||||
|
className={(preset.requiresNostr || preset.type === 'nsite') ? "w-full" : "h-10 px-4 ml-auto"}
|
||||||
|
>
|
||||||
|
{t('add')}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -744,10 +862,11 @@ export function DeploySettings() {
|
|||||||
<Label htmlFor="custom-provider-type">{t('providerType')}</Label>
|
<Label htmlFor="custom-provider-type">{t('providerType')}</Label>
|
||||||
<Select
|
<Select
|
||||||
value={customProviderType}
|
value={customProviderType}
|
||||||
onValueChange={(value: 'shakespeare' | 'netlify' | 'vercel' | 'nsite') => {
|
onValueChange={(value: 'shakespeare' | 'netlify' | 'vercel' | 'nsite' | 'cloudflare') => {
|
||||||
setCustomProviderType(value);
|
setCustomProviderType(value);
|
||||||
// Reset form when provider type changes
|
// Reset form when provider type changes
|
||||||
setCustomApiKey('');
|
setCustomApiKey('');
|
||||||
|
setCustomAccountId('');
|
||||||
setCustomBaseURL('');
|
setCustomBaseURL('');
|
||||||
setCustomHost('');
|
setCustomHost('');
|
||||||
setCustomProxy(false);
|
setCustomProxy(false);
|
||||||
@@ -762,6 +881,7 @@ export function DeploySettings() {
|
|||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="shakespeare">Shakespeare Deploy</SelectItem>
|
<SelectItem value="shakespeare">Shakespeare Deploy</SelectItem>
|
||||||
<SelectItem value="nsite">nsite</SelectItem>
|
<SelectItem value="nsite">nsite</SelectItem>
|
||||||
|
<SelectItem value="cloudflare">Cloudflare Pages</SelectItem>
|
||||||
<SelectItem value="netlify">Netlify</SelectItem>
|
<SelectItem value="netlify">Netlify</SelectItem>
|
||||||
<SelectItem value="vercel">Vercel</SelectItem>
|
<SelectItem value="vercel">Vercel</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
@@ -832,7 +952,8 @@ export function DeploySettings() {
|
|||||||
<>
|
<>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="custom-apikey">
|
<Label htmlFor="custom-apikey">
|
||||||
{customProviderType === 'netlify' ? 'Personal Access Token' : 'Access Token'}
|
{customProviderType === 'cloudflare' ? 'API Token' :
|
||||||
|
customProviderType === 'netlify' ? 'Personal Access Token' : 'Access Token'}
|
||||||
</Label>
|
</Label>
|
||||||
<PasswordInput
|
<PasswordInput
|
||||||
id="custom-apikey"
|
id="custom-apikey"
|
||||||
@@ -841,14 +962,27 @@ export function DeploySettings() {
|
|||||||
onChange={(e) => setCustomApiKey(e.target.value)}
|
onChange={(e) => setCustomApiKey(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{customProviderType === 'cloudflare' && (
|
||||||
|
<div className="grid gap-2">
|
||||||
|
<Label htmlFor="custom-accountid">Account ID</Label>
|
||||||
|
<Input
|
||||||
|
id="custom-accountid"
|
||||||
|
placeholder="Enter your Cloudflare Account ID"
|
||||||
|
value={customAccountId}
|
||||||
|
onChange={(e) => setCustomAccountId(e.target.value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="custom-baseurl">Base URL (Optional)</Label>
|
<Label htmlFor="custom-baseurl">Base URL (Optional)</Label>
|
||||||
<Input
|
<Input
|
||||||
id="custom-baseurl"
|
id="custom-baseurl"
|
||||||
placeholder={
|
placeholder={
|
||||||
customProviderType === 'netlify'
|
customProviderType === 'cloudflare'
|
||||||
? 'https://api.netlify.com/api/v1'
|
? 'https://api.cloudflare.com/client/v4'
|
||||||
: 'https://api.vercel.com'
|
: customProviderType === 'netlify'
|
||||||
|
? 'https://api.netlify.com/api/v1'
|
||||||
|
: 'https://api.vercel.com'
|
||||||
}
|
}
|
||||||
value={customBaseURL}
|
value={customBaseURL}
|
||||||
onChange={(e) => setCustomBaseURL(e.target.value)}
|
onChange={(e) => setCustomBaseURL(e.target.value)}
|
||||||
@@ -873,7 +1007,8 @@ export function DeploySettings() {
|
|||||||
disabled={
|
disabled={
|
||||||
!customProviderType ||
|
!customProviderType ||
|
||||||
!customName.trim() ||
|
!customName.trim() ||
|
||||||
(customProviderType !== 'shakespeare' && customProviderType !== 'nsite' && !customApiKey.trim())
|
(customProviderType === 'cloudflare' && (!customApiKey.trim() || !customAccountId.trim())) ||
|
||||||
|
(customProviderType !== 'shakespeare' && customProviderType !== 'nsite' && customProviderType !== 'cloudflare' && !customApiKey.trim())
|
||||||
}
|
}
|
||||||
className="gap-2 ml-auto"
|
className="gap-2 ml-auto"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in new issue
Block a user