Fix cryptget inner
This commit is contained in:
parent
e38d6d1093
commit
5a055233c0
@ -214,7 +214,7 @@ app.get('/api/config', function(req, res){
|
|||||||
// FIXME don't send websocketURL if websocketPath is provided. deprecated.
|
// FIXME don't send websocketURL if websocketPath is provided. deprecated.
|
||||||
websocketURL:'ws' + ((useSecureWebsockets) ? 's' : '') + '://' + host + ':' +
|
websocketURL:'ws' + ((useSecureWebsockets) ? 's' : '') + '://' + host + ':' +
|
||||||
websocketPort + '/cryptpad_websocket',
|
websocketPort + '/cryptpad_websocket',
|
||||||
httpUnsafeOrigin: config.httpUnsafeOrigin,
|
httpUnsafeOrigin: config.httpUnsafeOrigin.replace(/^ /, ''),
|
||||||
adminEmail: config.adminEmail,
|
adminEmail: config.adminEmail,
|
||||||
adminKeys: admins,
|
adminKeys: admins,
|
||||||
inactiveTime: config.inactiveTime,
|
inactiveTime: config.inactiveTime,
|
||||||
|
|||||||
@ -33,7 +33,7 @@ define([
|
|||||||
var secret = Hash.getSecrets('pad', hash, opt.password);
|
var secret = Hash.getSecrets('pad', hash, opt.password);
|
||||||
if (!secret.keys) { secret.keys = secret.key; } // support old hashses
|
if (!secret.keys) { secret.keys = secret.key; } // support old hashses
|
||||||
var config = {
|
var config = {
|
||||||
websocketURL: NetConfig.getWebsocketURL(),
|
websocketURL: NetConfig.getWebsocketURL(opt.origin),
|
||||||
channel: secret.channel,
|
channel: secret.channel,
|
||||||
validateKey: secret.keys.validateKey || undefined,
|
validateKey: secret.keys.validateKey || undefined,
|
||||||
crypto: Crypto.createEncryptor(secret.keys),
|
crypto: Crypto.createEncryptor(secret.keys),
|
||||||
|
|||||||
@ -43,7 +43,7 @@ var factory = function (Hash, Crypt, Nacl, Scrypt/*, Util, Cred, nThen */) {
|
|||||||
'base64'); // format, could be 'base64'
|
'base64'); // format, could be 'base64'
|
||||||
};
|
};
|
||||||
|
|
||||||
Invite.getPreviewContent = function (seeds, cb) {
|
Invite.getPreviewContent = function (seeds, cryptgetOpts, cb) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
cb(void 0, {
|
cb(void 0, {
|
||||||
author: {
|
author: {
|
||||||
@ -67,7 +67,7 @@ var factory = function (Hash, Crypt, Nacl, Scrypt/*, Util, Cred, nThen */) {
|
|||||||
console.error(e);
|
console.error(e);
|
||||||
cb(e);
|
cb(e);
|
||||||
}
|
}
|
||||||
});
|
}, cryptgetOpts);
|
||||||
// cb("NOT_IMPLEMENTED"); // XXX cryptget
|
// cb("NOT_IMPLEMENTED"); // XXX cryptget
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -3,13 +3,18 @@ define([
|
|||||||
], function (ApiConfig) {
|
], function (ApiConfig) {
|
||||||
var Config = {};
|
var Config = {};
|
||||||
|
|
||||||
Config.getWebsocketURL = function () {
|
Config.getWebsocketURL = function (origin) {
|
||||||
if (!ApiConfig.websocketPath) { return ApiConfig.websocketURL; }
|
if (!ApiConfig.websocketPath) { return ApiConfig.websocketURL; }
|
||||||
var path = ApiConfig.websocketPath;
|
var path = ApiConfig.websocketPath;
|
||||||
if (/^ws{1,2}:\/\//.test(path)) { return path; }
|
if (/^ws{1,2}:\/\//.test(path)) { return path; }
|
||||||
|
|
||||||
var protocol = window.location.protocol.replace(/http/, 'ws');
|
var l = window.location;
|
||||||
var host = window.location.host;
|
if (origin && window && window.document) {
|
||||||
|
var l = document.createElement("a");
|
||||||
|
l.href = origin;
|
||||||
|
}
|
||||||
|
var protocol = l.protocol.replace(/http/, 'ws');
|
||||||
|
var host = l.host;
|
||||||
var url = protocol + '//' + host + path;
|
var url = protocol + '//' + host + path;
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
|
|||||||
@ -1032,7 +1032,8 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
makeBlock('link', function (common, cb) {
|
makeBlock('link', function (common, cb) {
|
||||||
var hash = common.getMetadataMgr().getPrivateData().teamInviteHash;
|
var privateData = common.getMetadataMgr().getPrivateData();
|
||||||
|
var hash = privateData.teamInviteHash;
|
||||||
var hashData = Hash.parseTypeHash('invite', hash);
|
var hashData = Hash.parseTypeHash('invite', hash);
|
||||||
var password = hashData.password;
|
var password = hashData.password;
|
||||||
var seeds = InviteInner.deriveSeeds(hashData.key);
|
var seeds = InviteInner.deriveSeeds(hashData.key);
|
||||||
@ -1083,7 +1084,9 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
nThen(function (waitFor) {
|
nThen(function (waitFor) {
|
||||||
InviteInner.getPreviewContent(seeds, waitFor(function (err, json) {
|
InviteInner.getPreviewContent(seeds, {
|
||||||
|
origin: privateData.origin
|
||||||
|
}, waitFor(function (err, json) {
|
||||||
if (err) {
|
if (err) {
|
||||||
// XXX handle errors
|
// XXX handle errors
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user