critique 0.0.23 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/cli.tsx +1 -1
- package/src/worker.ts +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# 0.0.25
|
|
2
|
+
|
|
3
|
+
- Change default worker URL to https://critique.work/
|
|
4
|
+
|
|
5
|
+
# 0.0.24
|
|
6
|
+
|
|
7
|
+
- Worker:
|
|
8
|
+
- Increase ID length from 16 to 32 hex chars (128 bits) for better security against guessing
|
|
9
|
+
- Backwards compatible: accepts both old 16-char and new 32-char IDs
|
|
10
|
+
|
|
1
11
|
# 0.0.23
|
|
2
12
|
|
|
3
13
|
- Web preview:
|
package/package.json
CHANGED
package/src/cli.tsx
CHANGED
|
@@ -670,7 +670,7 @@ cli
|
|
|
670
670
|
});
|
|
671
671
|
|
|
672
672
|
// Worker URL for uploading HTML previews
|
|
673
|
-
const WORKER_URL = process.env.CRITIQUE_WORKER_URL || "https://critique
|
|
673
|
+
const WORKER_URL = process.env.CRITIQUE_WORKER_URL || "https://critique.work";
|
|
674
674
|
|
|
675
675
|
cli
|
|
676
676
|
.command("web [ref]", "Generate web preview of diff")
|
package/src/worker.ts
CHANGED
|
@@ -35,8 +35,8 @@ app.post("/upload", async (c) => {
|
|
|
35
35
|
const hashArray = Array.from(new Uint8Array(hashBuffer))
|
|
36
36
|
const hashHex = hashArray.map(b => b.toString(16).padStart(2, "0")).join("")
|
|
37
37
|
|
|
38
|
-
// Use first
|
|
39
|
-
const id = hashHex.slice(0,
|
|
38
|
+
// Use first 32 chars of hash as ID (128 bits, secure against guessing)
|
|
39
|
+
const id = hashHex.slice(0, 32)
|
|
40
40
|
|
|
41
41
|
// Store in KV with 7 day expiration
|
|
42
42
|
await c.env.CRITIQUE_KV.put(id, body.html, {
|
|
@@ -57,7 +57,7 @@ app.post("/upload", async (c) => {
|
|
|
57
57
|
app.get("/view/:id", async (c) => {
|
|
58
58
|
const id = c.req.param("id")
|
|
59
59
|
|
|
60
|
-
if (!id || !/^[a-f0-9]{16}$/.test(id)) {
|
|
60
|
+
if (!id || !/^[a-f0-9]{16,32}$/.test(id)) {
|
|
61
61
|
return c.text("Invalid ID", 400)
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -90,7 +90,7 @@ app.get("/view/:id", async (c) => {
|
|
|
90
90
|
app.get("/raw/:id", async (c) => {
|
|
91
91
|
const id = c.req.param("id")
|
|
92
92
|
|
|
93
|
-
if (!id || !/^[a-f0-9]{16}$/.test(id)) {
|
|
93
|
+
if (!id || !/^[a-f0-9]{16,32}$/.test(id)) {
|
|
94
94
|
return c.json({ error: "Invalid ID" }, 400)
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -110,7 +110,7 @@ app.get("/raw/:id", async (c) => {
|
|
|
110
110
|
app.on("HEAD", "/view/:id", async (c) => {
|
|
111
111
|
const id = c.req.param("id")
|
|
112
112
|
|
|
113
|
-
if (!id || !/^[a-f0-9]{16}$/.test(id)) {
|
|
113
|
+
if (!id || !/^[a-f0-9]{16,32}$/.test(id)) {
|
|
114
114
|
return c.body(null, 400)
|
|
115
115
|
}
|
|
116
116
|
|