At least some feedback if we can't save an app.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4065 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2022-12-01 00:50:06 +00:00
parent cd8b32b3ca
commit 376094452e
2 changed files with 8 additions and 4 deletions

View File

@ -630,10 +630,9 @@ async function blobHandler(request, response, blobId, uri) {
}
}
} else if (uri == "/save") {
let newBlobId = await ssb.blobStore(request.body);
var match;
if (match = /^\/\~(\w+)\/(\w+)$/.exec(blobId)) {
let newBlobId = await ssb.blobStore(request.body);
var user = match[1];
var appName = match[2];
var credentials = auth.query(request.headers);
@ -660,10 +659,14 @@ async function blobHandler(request, response, blobId, uri) {
response.end("401 Unauthorized");
return;
}
response.writeHead(200, {"Content-Type": "text/plain; charset=utf-8"});
response.end("/" + newBlobId);
} else {
response.writeHead(400, {"Content-Type": "text/plain; charset=utf-8"});
response.end('Invalid name.');
}
response.writeHead(200, {"Content-Type": "text/plain; charset=utf-8"});
response.end("/" + newBlobId);
} else if (uri == "/delete") {
let match;
if (match = /^\/\~(\w+)\/(\w+)$/.exec(blobId)) {

View File

@ -94,6 +94,7 @@ function Response(request, client) {
200: 'OK',
303: 'See other',
304: 'Not Modified',
400: 'Bad Request',
403: 'Forbidden',
404: 'File not found',
500: 'Internal server error',