You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$%7Bsuccess?q=image&page=6&format=json
For typeahead suggestions, use the /typeahead
endpoint:
https://codesearch.val.run/typeahead?q=image
Returns an array of strings in format "username" or "username/projectName"
Found 6326 results for "image"(1025ms)
4041// Also delete the blob!
42blob.delete("pondiverse_image" + id);
4344return Response.json({ ok: true });
9// - data (string)
10// - type (string)
11// - image (data url string)
12// sanity checks:
13// - title, not toooo long
14// - data, hmm this needs to be long i guess.. maybe some crazy upper limit sanity check though
15// - type, not too long
16// - image, not toooo large a file size
17let body;
18try {
25const data = body.data;
26const type = body.type;
27const image = body.image;
2829// Sanity checks
37}
3839if (image.length > 20 * 1024 * 1024) {
40return Response.json({ ok: false, error: "Thumbnail too large" });
41}
57);
5859// only creates blob if there is indeed an image and updates the image column to represent that
60if (image) {
61const imageName = "pondiverse_image" + id.lastInsertRowid;
62const imageAddr = `${Deno.env.get("PONDIVERSE_STORE_BASE_PATH")}/images&id=${id.lastInsertRowid}`;
63await blob.set(imageName, image);
64await sqlite.execute(
65`UPDATE ${TABLE_NAME} SET image = "${imageAddr}" WHERE id = ${id.lastInsertRowid}`,
66);
67}