mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Switch "userName" to "username"
Because the former is naff
This commit is contained in:
parent
822f436534
commit
d14c61ef45
@ -24,24 +24,24 @@ var UploadSaver = function(wiki) {
|
||||
UploadSaver.prototype.save = function(text) {
|
||||
// Get the various parameters we need
|
||||
var backupDir = ".",
|
||||
userName = this.wiki.getTextReference("$:/UploadName"),
|
||||
username = this.wiki.getTextReference("$:/UploadName"),
|
||||
password = $tw.utils.getPassword("upload"),
|
||||
uploadDir = ".",
|
||||
url = this.wiki.getTextReference("$:/UploadURL");
|
||||
// Bail out if we don't have the bits we need
|
||||
if(!userName || userName.toString().trim() === "" || !password || password.toString().trim() === "") {
|
||||
if(!username || username.toString().trim() === "" || !password || password.toString().trim() === "") {
|
||||
return false;
|
||||
}
|
||||
// Construct the url if not provided
|
||||
if(!url) {
|
||||
url = "http://" + userName + ".tiddlyspot.com/store.cgi";
|
||||
url = "http://" + username + ".tiddlyspot.com/store.cgi";
|
||||
}
|
||||
// Assemble the header
|
||||
var boundary = "---------------------------" + "AaB03x";
|
||||
var uploadFormName = "UploadPlugin";
|
||||
var head = [];
|
||||
head.push("--" + boundary + "\r\nContent-disposition: form-data; name=\"UploadPlugin\"\r\n");
|
||||
head.push("backupDir=" + backupDir + ";user=" + userName + ";password=" + password + ";uploaddir=" + uploadDir + ";;");
|
||||
head.push("backupDir=" + backupDir + ";user=" + username + ";password=" + password + ";uploaddir=" + uploadDir + ";;");
|
||||
head.push("\r\n" + "--" + boundary);
|
||||
head.push("Content-disposition: form-data; name=\"userfile\"; filename=\"index.html\"");
|
||||
head.push("Content-Type: text/html;charset=UTF-8");
|
||||
@ -52,7 +52,7 @@ UploadSaver.prototype.save = function(text) {
|
||||
data = head.join("\r\n") + text + tail;
|
||||
// Do the HTTP post
|
||||
var http = new XMLHttpRequest();
|
||||
http.open("POST",url,true,userName,password);
|
||||
http.open("POST",url,true,username,password);
|
||||
http.setRequestHeader("Content-Type","multipart/form-data; ;charset=UTF-8; boundary=" + boundary);
|
||||
http.onreadystatechange = function() {
|
||||
if(http.readyState == 4 && http.status == 200) {
|
||||
|
@ -127,7 +127,7 @@ Syncer.prototype.storeTiddler = function(tiddlerFields) {
|
||||
|
||||
Syncer.prototype.getStatus = function(callback) {
|
||||
var self = this;
|
||||
this.syncadaptor.getStatus(function(err,isLoggedIn,userName) {
|
||||
this.syncadaptor.getStatus(function(err,isLoggedIn,username) {
|
||||
if(err) {
|
||||
self.showError(err);
|
||||
return;
|
||||
@ -135,13 +135,13 @@ Syncer.prototype.getStatus = function(callback) {
|
||||
// Set the various status tiddlers
|
||||
self.wiki.addTiddler({title: self.titleIsLoggedIn,text: isLoggedIn ? "yes" : "no"});
|
||||
if(isLoggedIn) {
|
||||
self.wiki.addTiddler({title: self.titleUserName,text: userName});
|
||||
self.wiki.addTiddler({title: self.titleUserName,text: username});
|
||||
} else {
|
||||
self.wiki.deleteTiddler(self.titleUserName);
|
||||
}
|
||||
// Invoke the callback
|
||||
if(callback) {
|
||||
callback(err,isLoggedIn,userName);
|
||||
callback(err,isLoggedIn,username);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -224,7 +224,7 @@ Dispay a password prompt and allow the user to login
|
||||
*/
|
||||
Syncer.prototype.handleLoginEvent = function() {
|
||||
var self = this;
|
||||
this.getStatus(function(err,isLoggedIn,userName) {
|
||||
this.getStatus(function(err,isLoggedIn,username) {
|
||||
if(!isLoggedIn) {
|
||||
$tw.passwordPrompt.createPrompt({
|
||||
serviceName: "Login to TiddlySpace",
|
||||
@ -252,7 +252,7 @@ Syncer.prototype.login = function(username,password,callback) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
self.getStatus(function(err,isLoggedIn,userName) {
|
||||
self.getStatus(function(err,isLoggedIn,username) {
|
||||
if(callback) {
|
||||
callback(null,isLoggedIn);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ Returns an object storing any additional information required by the adaptor.
|
||||
Retrieves status information from the server.
|
||||
|
||||
|!Parameter |!Description |
|
||||
|callback |Callback function invoked with parameters `err,isLoggedIn,userName` |
|
||||
|callback |Callback function invoked with parameters `err,isLoggedIn,username` |
|
||||
|
||||
!! `login(username,password,callback)`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user