summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xclient.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/client.js b/client.js
index 5108a6b..29bc4fe 100755
--- a/client.js
+++ b/client.js
@@ -2,13 +2,13 @@
var fs=require("fs"),
path=require("path"),
- http=require("http"),
+ https=require("https"),
crypto=require("crypto"),
dialog=require("dialog"),
kbd=require("kbd"),
toClipboard=require("to-clipboard");
-var HOSTNAME=process.argv[2]||"tomsmeding.com",HTTPPORT=80;
+var HOSTNAME=process.argv[2]||"tomsmeding.com",HTTPSPORT=443;
console.log("Using server "+HOSTNAME);
@@ -123,9 +123,9 @@ function authhash(challenge,password){
function getchallenge(cb){
console.log("Going to request challenge...");
- var req=http.request({
+ var req=https.request({
hostname:HOSTNAME,
- port:HTTPPORT,
+ port:HTTPSPORT,
path:"/ss/challenge",
method:"GET",
keepAlive:true //speed up the next request
@@ -155,9 +155,9 @@ function sendfile(fname,retries){
if(idx==-1)barefname=fname;
else barefname=fname.slice(idx+1);
getchallenge(function(challenge){
- var req=http.request({
+ var req=https.request({
hostname:HOSTNAME,
- port:HTTPPORT,
+ port:HTTPSPORT,
path:"/ss/image/"+userid+"/"+authhash(challenge,password)+"/"+escape(barefname),
method:"POST",
headers:{
@@ -194,9 +194,9 @@ function sendfile(fname,retries){
function userExists(userid,cb){
- var req=http.request({
+ var req=https.request({
hostname:HOSTNAME,
- port:HTTPPORT,
+ port:HTTPSPORT,
path:"/ss/exists/"+userid,
method:"GET"
},function(res){
@@ -215,9 +215,9 @@ function userExists(userid,cb){
function checkLogin(userid,password,cb,retries){
retries=retries!=null?retries:3;
getchallenge(function(challenge){
- var req=http.request({
+ var req=https.request({
hostname:HOSTNAME,
- port:HTTPPORT,
+ port:HTTPSPORT,
path:"/ss/checklogin/"+userid+"/"+authhash(challenge,password),
method:"GET"
},function(res){
@@ -237,9 +237,9 @@ function checkLogin(userid,password,cb,retries){
}
function registerUser(userid,password){
- var req=http.request({
+ var req=https.request({
hostname:HOSTNAME,
- port:HTTPPORT,
+ port:HTTPSPORT,
path:"/ss/registerx/"+userid,
method:"POST",
headers:{