forked from cory/tildefriends
Added support for Google Sign-In, optional in every way.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3187 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -15,7 +15,7 @@ if (core.user.credentials.permissions &&
|
||||
],
|
||||
[
|
||||
["set ", {class: "cyan", value: "key value"}],
|
||||
["Set global setting key to value."],
|
||||
["Set global setting key to value. Omit value to unset."],
|
||||
],
|
||||
[
|
||||
"permission list",
|
||||
@ -45,6 +45,7 @@ var kSimpleSettings = [
|
||||
'httpPort',
|
||||
'httpsPort',
|
||||
'index',
|
||||
'google-signin-client_id',
|
||||
];
|
||||
|
||||
function printSettings(settings) {
|
||||
@ -73,12 +74,16 @@ function onInput(input) {
|
||||
terminal.print(" ".repeat(16 - s[i].toString().length), s[i].toString(), " ", i);
|
||||
}
|
||||
});
|
||||
} else if (match = /^\s*set\s+(\w+)\s+(.*)/.exec(input)) {
|
||||
} else if (match = /^\s*set\s+(\S+)(?:\s+(.*))?/.exec(input)) {
|
||||
var key = match[1];
|
||||
var value = match[2];
|
||||
administration.getGlobalSettings().then(function(settings) {
|
||||
if (kSimpleSettings.indexOf(key) != -1) {
|
||||
settings[key] = value;
|
||||
if (value) {
|
||||
settings[key] = value;
|
||||
} else {
|
||||
delete settings[key];
|
||||
}
|
||||
administration.setGlobalSettings(settings).then(function() {
|
||||
administration.getGlobalSettings().then(printSettings);
|
||||
}).catch(function(error) {
|
||||
|
@ -100,7 +100,10 @@ core.register("onInput", function(input) {
|
||||
if (input == "new post") {
|
||||
startNewPost();
|
||||
} else if (input == "submit") {
|
||||
submitNewPost().then(renderBlog);
|
||||
submitNewPost().then(function() {
|
||||
core.unregister("onWindowMessage", onWindowMessage);
|
||||
renderBlog();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -131,18 +134,19 @@ function submitNewPost() {
|
||||
return gBlog.append(gNewPost);
|
||||
}
|
||||
|
||||
function startNewPost() {
|
||||
core.register("onWindowMessage", function(message) {
|
||||
gNewPost = message.message;
|
||||
terminal.cork();
|
||||
terminal.select("right");
|
||||
terminal.clear();
|
||||
terminal.print({style: "font-width: x-large", value: message.message.title});
|
||||
terminal.print(message.message.entry);
|
||||
terminal.print({command: "submit"});
|
||||
terminal.uncork();
|
||||
});
|
||||
function onWindowMessage(message) {
|
||||
gNewPost = message.message;
|
||||
terminal.cork();
|
||||
terminal.select("right");
|
||||
terminal.clear();
|
||||
terminal.print({style: "font-width: x-large", value: message.message.title});
|
||||
terminal.print(message.message.entry);
|
||||
terminal.print({command: "submit"});
|
||||
terminal.uncork();
|
||||
}
|
||||
|
||||
function startNewPost() {
|
||||
core.register("onWindowMessage", onWindowMessage);
|
||||
terminal.split([
|
||||
{
|
||||
type: "horizontal",
|
||||
|
Reference in New Issue
Block a user