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
This commit is contained in:
Cory McWilliams 2017-01-03 23:23:50 +00:00
parent 20a81dcbd6
commit a60049b6b5
3 changed files with 10 additions and 4 deletions

View File

@ -286,8 +286,12 @@ function printStructured(container, data) {
node.setAttribute("srcdoc", data.iframe); node.setAttribute("srcdoc", data.iframe);
} }
node.setAttribute("sandbox", "allow-forms allow-scripts allow-top-navigation allow-same-origin"); node.setAttribute("sandbox", "allow-forms allow-scripts allow-top-navigation allow-same-origin");
node.setAttribute("width", data.width || 320); if (data.width !== null) {
node.setAttribute("height", data.height || 240); node.setAttribute("width", data.width || 320);
}
if (data.height !== null) {
node.setAttribute("height", data.height || 240);
}
if (data.name) { if (data.name) {
node.setAttribute("id", "iframe_" + data.name); node.setAttribute("id", "iframe_" + data.name);
} }

View File

@ -267,7 +267,7 @@ function handler(request, response, packageOwner, packageName, uri) {
if (!found) { if (!found) {
var process; var process;
if (uri === "/view") { 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.writeHead(200, {"Content-Type": "text/javascript; charset=utf-8", "Content-Length": data.length});
response.end(data); response.end(data);
} else if (uri == "/save") { } else if (uri == "/save") {

View File

@ -107,6 +107,7 @@ function configureAccount(id, updates) {
} }
return Promise.all(promises).then(function() { return Promise.all(promises).then(function() {
terminal.cork();
terminal.clear(); terminal.clear();
terminal.print(JSON.stringify(account)); terminal.print(JSON.stringify(account));
terminal.print({input: "hidden", value: id, name: "id"}); terminal.print({input: "hidden", value: id, name: "id"});
@ -119,7 +120,7 @@ function configureAccount(id, updates) {
terminal.print("Pick account type:"); terminal.print("Pick account type:");
for (let i in packages) { for (let i in packages) {
let app = packages[i]; 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}); 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.print({input: "submit", value: "Save Account", name: "submit"});
terminal.uncork();
}).then(updateWindows); }).then(updateWindows);
}).catch(function(error) { }).catch(function(error) {
print("whoops", error); print("whoops", error);