From a60049b6b5c405729873a2ad1de89d4cfb7f99ca Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Tue, 3 Jan 2017 23:23:50 +0000 Subject: [PATCH] Allow an unsized iframe, fix a problem with /view, and minor chat fixes. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3374 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- core/client.js | 8 ++++++-- core/terminal.js | 2 +- packages/cory/chat/chat.js | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/client.js b/core/client.js index 9f41448a..8fb32a01 100644 --- a/core/client.js +++ b/core/client.js @@ -286,8 +286,12 @@ function printStructured(container, data) { node.setAttribute("srcdoc", data.iframe); } node.setAttribute("sandbox", "allow-forms allow-scripts allow-top-navigation allow-same-origin"); - node.setAttribute("width", data.width || 320); - node.setAttribute("height", data.height || 240); + if (data.width !== null) { + node.setAttribute("width", data.width || 320); + } + if (data.height !== null) { + node.setAttribute("height", data.height || 240); + } if (data.name) { node.setAttribute("id", "iframe_" + data.name); } diff --git a/core/terminal.js b/core/terminal.js index 2155c0d5..700f2654 100644 --- a/core/terminal.js +++ b/core/terminal.js @@ -267,7 +267,7 @@ function handler(request, response, packageOwner, packageName, uri) { if (!found) { var process; if (uri === "/view") { - var data = new TextDecode("UTF-8").decode(File.readFile("packages/" + packageOwner + "/" + packageName + "/" + packageName + ".js")); + var data = new TextDecoder("UTF-8").decode(File.readFile("packages/" + packageOwner + "/" + packageName + "/" + packageName + ".js")); response.writeHead(200, {"Content-Type": "text/javascript; charset=utf-8", "Content-Length": data.length}); response.end(data); } else if (uri == "/save") { diff --git a/packages/cory/chat/chat.js b/packages/cory/chat/chat.js index 7d77a3d5..bda0bb3c 100644 --- a/packages/cory/chat/chat.js +++ b/packages/cory/chat/chat.js @@ -107,6 +107,7 @@ function configureAccount(id, updates) { } return Promise.all(promises).then(function() { + terminal.cork(); terminal.clear(); terminal.print(JSON.stringify(account)); terminal.print({input: "hidden", value: id, name: "id"}); @@ -119,7 +120,7 @@ function configureAccount(id, updates) { terminal.print("Pick account type:"); for (let i in packages) { let app = packages[i]; - if (app.manifest && app.manifest.chat) { + if (app.manifest && app.manifest.chat && app.owner == core.user.name) { terminal.print({command: "/command " + JSON.stringify({action: "updateAccount", id: id, type: app.name}), value: app.name}); } } @@ -140,6 +141,7 @@ function configureAccount(id, updates) { } } terminal.print({input: "submit", value: "Save Account", name: "submit"}); + terminal.uncork(); }).then(updateWindows); }).catch(function(error) { print("whoops", error);